Date: Thu, 22 Jul 2010 11:56:38 +0200 (CEST) From: Stefan Richter Subject: firewire: nosy: use generic printk macros Replace home-grown printk wrapper macros by ones from kernel.h and device.h. Also raise the log level in set_phy_reg() from debug to error because these are really error conditions. Could even be WARN_ON. Lower the log level in the device probe and driver shutdown from notice to info. Signed-off-by: Stefan Richter --- drivers/firewire/nosy.c | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) Index: b/drivers/firewire/nosy.c =================================================================== --- a/drivers/firewire/nosy.c +++ b/drivers/firewire/nosy.c @@ -17,6 +17,7 @@ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#include #include #include #include @@ -44,10 +45,6 @@ #define TCODE_PHY_PACKET 0x10 #define PCI_DEVICE_ID_TI_PCILYNX 0x8000 -#define notify(s, args...) printk(KERN_NOTICE s, ## args) -#define error(s, args...) printk(KERN_ERR s, ## args) -#define debug(s, args...) printk(KERN_DEBUG s, ## args) - static char driver_name[] = KBUILD_MODNAME; /* this is the physical layout of a PCL, its size is 128 bytes */ @@ -259,15 +256,15 @@ static int set_phy_reg(struct pcilynx *lynx, int addr, int val) { if (addr > 15) { - debug("PHY register address %d out of range\n", addr); + dev_err(&lynx->pci_device->dev, + "PHY register address %d out of range\n", addr); return -1; } - if (val > 0xff) { - debug("PHY register value %d out of range\n", val); + dev_err(&lynx->pci_device->dev, + "PHY register value %d out of range\n", val); return -1; } - reg_write(lynx, LINK_PHY, LINK_PHY_WRITE | LINK_PHY_ADDR(addr) | LINK_PHY_WDATA(val)); @@ -539,19 +536,19 @@ add_card(struct pci_dev *dev, const stru int ret, i; if (pci_set_dma_mask(dev, 0xffffffff)) { - error("DMA address limits not supported " - "for PCILynx hardware\n"); + dev_err(&dev->dev, + "DMA address limits not supported for PCILynx hardware\n"); return -ENXIO; } if (pci_enable_device(dev)) { - error("Failed to enable PCILynx hardware\n"); + dev_err(&dev->dev, "Failed to enable PCILynx hardware\n"); return -ENXIO; } pci_set_master(dev); lynx = kzalloc(sizeof *lynx, GFP_KERNEL); if (lynx == NULL) { - error("Failed to allocate control structure memory\n"); + dev_err(&dev->dev, "Failed to allocate control structure\n"); ret = -ENOMEM; goto fail_disable; } @@ -574,7 +571,7 @@ add_card(struct pci_dev *dev, const stru if (lynx->rcv_start_pcl == NULL || lynx->rcv_pcl == NULL || lynx->rcv_buffer == NULL) { - error("Failed to allocate receive buffer\n"); + dev_err(&dev->dev, "Failed to allocate receive buffer\n"); ret = -ENOMEM; goto fail_deallocate; } @@ -636,7 +633,8 @@ add_card(struct pci_dev *dev, const stru if (request_irq(dev->irq, irq_handler, IRQF_SHARED, driver_name, lynx)) { - error("Failed to allocate shared interrupt %d\n", dev->irq); + dev_err(&dev->dev, + "Failed to allocate shared interrupt %d\n", dev->irq); ret = -EIO; goto fail_deallocate; } @@ -649,14 +647,15 @@ add_card(struct pci_dev *dev, const stru mutex_lock(&card_mutex); ret = misc_register(&lynx->misc); if (ret) { - error("Failed to register misc char device\n"); + dev_err(&dev->dev, "Failed to register misc char device\n"); mutex_unlock(&card_mutex); goto fail_free_irq; } list_add_tail(&lynx->link, &card_list); mutex_unlock(&card_mutex); - notify("Initialized PCILynx IEEE1394 card, irq=%d\n", dev->irq); + dev_info(&dev->dev, + "Initialized PCILynx IEEE1394 card, irq=%d\n", dev->irq); return 0; @@ -714,7 +713,7 @@ static void __exit nosy_cleanup(void) { pci_unregister_driver(&lynx_pci_driver); - notify("Unloaded %s.\n", driver_name); + pr_info("Unloaded %s\n", driver_name); } module_init(nosy_init);