Commit 7429b17d authored by Stefan Richter's avatar Stefan Richter

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: default avatarStefan Richter <stefanr@s5r6.in-berlin.de>
parent fd8c8d46
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/ */
#include <linux/device.h>
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/fs.h> #include <linux/fs.h>
#include <linux/init.h> #include <linux/init.h>
...@@ -45,10 +46,6 @@ ...@@ -45,10 +46,6 @@
#define TCODE_PHY_PACKET 0x10 #define TCODE_PHY_PACKET 0x10
#define PCI_DEVICE_ID_TI_PCILYNX 0x8000 #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; static char driver_name[] = KBUILD_MODNAME;
/* this is the physical layout of a PCL, its size is 128 bytes */ /* this is the physical layout of a PCL, its size is 128 bytes */
...@@ -260,15 +257,15 @@ static int ...@@ -260,15 +257,15 @@ static int
set_phy_reg(struct pcilynx *lynx, int addr, int val) set_phy_reg(struct pcilynx *lynx, int addr, int val)
{ {
if (addr > 15) { 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; return -1;
} }
if (val > 0xff) { 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; return -1;
} }
reg_write(lynx, LINK_PHY, LINK_PHY_WRITE | reg_write(lynx, LINK_PHY, LINK_PHY_WRITE |
LINK_PHY_ADDR(addr) | LINK_PHY_WDATA(val)); LINK_PHY_ADDR(addr) | LINK_PHY_WDATA(val));
...@@ -540,19 +537,19 @@ add_card(struct pci_dev *dev, const struct pci_device_id *unused) ...@@ -540,19 +537,19 @@ add_card(struct pci_dev *dev, const struct pci_device_id *unused)
int ret, i; int ret, i;
if (pci_set_dma_mask(dev, 0xffffffff)) { if (pci_set_dma_mask(dev, 0xffffffff)) {
error("DMA address limits not supported " dev_err(&dev->dev,
"for PCILynx hardware\n"); "DMA address limits not supported for PCILynx hardware\n");
return -ENXIO; return -ENXIO;
} }
if (pci_enable_device(dev)) { if (pci_enable_device(dev)) {
error("Failed to enable PCILynx hardware\n"); dev_err(&dev->dev, "Failed to enable PCILynx hardware\n");
return -ENXIO; return -ENXIO;
} }
pci_set_master(dev); pci_set_master(dev);
lynx = kzalloc(sizeof *lynx, GFP_KERNEL); lynx = kzalloc(sizeof *lynx, GFP_KERNEL);
if (lynx == NULL) { if (lynx == NULL) {
error("Failed to allocate control structure memory\n"); dev_err(&dev->dev, "Failed to allocate control structure\n");
ret = -ENOMEM; ret = -ENOMEM;
goto fail_disable; goto fail_disable;
} }
...@@ -575,7 +572,7 @@ add_card(struct pci_dev *dev, const struct pci_device_id *unused) ...@@ -575,7 +572,7 @@ add_card(struct pci_dev *dev, const struct pci_device_id *unused)
if (lynx->rcv_start_pcl == NULL || if (lynx->rcv_start_pcl == NULL ||
lynx->rcv_pcl == NULL || lynx->rcv_pcl == NULL ||
lynx->rcv_buffer == NULL) { lynx->rcv_buffer == NULL) {
error("Failed to allocate receive buffer\n"); dev_err(&dev->dev, "Failed to allocate receive buffer\n");
ret = -ENOMEM; ret = -ENOMEM;
goto fail_deallocate; goto fail_deallocate;
} }
...@@ -637,7 +634,8 @@ add_card(struct pci_dev *dev, const struct pci_device_id *unused) ...@@ -637,7 +634,8 @@ add_card(struct pci_dev *dev, const struct pci_device_id *unused)
if (request_irq(dev->irq, irq_handler, IRQF_SHARED, if (request_irq(dev->irq, irq_handler, IRQF_SHARED,
driver_name, lynx)) { 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; ret = -EIO;
goto fail_deallocate; goto fail_deallocate;
} }
...@@ -650,14 +648,15 @@ add_card(struct pci_dev *dev, const struct pci_device_id *unused) ...@@ -650,14 +648,15 @@ add_card(struct pci_dev *dev, const struct pci_device_id *unused)
mutex_lock(&card_mutex); mutex_lock(&card_mutex);
ret = misc_register(&lynx->misc); ret = misc_register(&lynx->misc);
if (ret) { 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); mutex_unlock(&card_mutex);
goto fail_free_irq; goto fail_free_irq;
} }
list_add_tail(&lynx->link, &card_list); list_add_tail(&lynx->link, &card_list);
mutex_unlock(&card_mutex); 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; return 0;
...@@ -715,7 +714,7 @@ static void __exit nosy_cleanup(void) ...@@ -715,7 +714,7 @@ static void __exit nosy_cleanup(void)
{ {
pci_unregister_driver(&lynx_pci_driver); pci_unregister_driver(&lynx_pci_driver);
notify("Unloaded %s.\n", driver_name); pr_info("Unloaded %s\n", driver_name);
} }
module_init(nosy_init); module_init(nosy_init);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment