aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/firewire/nosy.c
diff options
context:
space:
mode:
authorStefan Richter <stefanr@s5r6.in-berlin.de>2010-07-22 05:56:38 -0400
committerStefan Richter <stefanr@s5r6.in-berlin.de>2010-07-27 05:04:11 -0400
commit7429b17d30a19fd52a0c07de9d3959746d321e15 (patch)
tree2dc1e07547893ed804fd06b84eb24a86a38cc571 /drivers/firewire/nosy.c
parentfd8c8d46ca9402c15383d2cf0bc3ee7740de3b62 (diff)
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 <stefanr@s5r6.in-berlin.de>
Diffstat (limited to 'drivers/firewire/nosy.c')
-rw-r--r--drivers/firewire/nosy.c33
1 files changed, 16 insertions, 17 deletions
diff --git a/drivers/firewire/nosy.c b/drivers/firewire/nosy.c
index 225e64956823..8528b10763ed 100644
--- a/drivers/firewire/nosy.c
+++ b/drivers/firewire/nosy.c
@@ -17,6 +17,7 @@
17 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 */ 18 */
19 19
20#include <linux/device.h>
20#include <linux/errno.h> 21#include <linux/errno.h>
21#include <linux/fs.h> 22#include <linux/fs.h>
22#include <linux/init.h> 23#include <linux/init.h>
@@ -45,10 +46,6 @@
45#define TCODE_PHY_PACKET 0x10 46#define TCODE_PHY_PACKET 0x10
46#define PCI_DEVICE_ID_TI_PCILYNX 0x8000 47#define PCI_DEVICE_ID_TI_PCILYNX 0x8000
47 48
48#define notify(s, args...) printk(KERN_NOTICE s, ## args)
49#define error(s, args...) printk(KERN_ERR s, ## args)
50#define debug(s, args...) printk(KERN_DEBUG s, ## args)
51
52static char driver_name[] = KBUILD_MODNAME; 49static char driver_name[] = KBUILD_MODNAME;
53 50
54/* this is the physical layout of a PCL, its size is 128 bytes */ 51/* this is the physical layout of a PCL, its size is 128 bytes */
@@ -260,15 +257,15 @@ static int
260set_phy_reg(struct pcilynx *lynx, int addr, int val) 257set_phy_reg(struct pcilynx *lynx, int addr, int val)
261{ 258{
262 if (addr > 15) { 259 if (addr > 15) {
263 debug("PHY register address %d out of range\n", addr); 260 dev_err(&lynx->pci_device->dev,
261 "PHY register address %d out of range\n", addr);
264 return -1; 262 return -1;
265 } 263 }
266
267 if (val > 0xff) { 264 if (val > 0xff) {
268 debug("PHY register value %d out of range\n", val); 265 dev_err(&lynx->pci_device->dev,
266 "PHY register value %d out of range\n", val);
269 return -1; 267 return -1;
270 } 268 }
271
272 reg_write(lynx, LINK_PHY, LINK_PHY_WRITE | 269 reg_write(lynx, LINK_PHY, LINK_PHY_WRITE |
273 LINK_PHY_ADDR(addr) | LINK_PHY_WDATA(val)); 270 LINK_PHY_ADDR(addr) | LINK_PHY_WDATA(val));
274 271
@@ -540,19 +537,19 @@ add_card(struct pci_dev *dev, const struct pci_device_id *unused)
540 int ret, i; 537 int ret, i;
541 538
542 if (pci_set_dma_mask(dev, 0xffffffff)) { 539 if (pci_set_dma_mask(dev, 0xffffffff)) {
543 error("DMA address limits not supported " 540 dev_err(&dev->dev,
544 "for PCILynx hardware\n"); 541 "DMA address limits not supported for PCILynx hardware\n");
545 return -ENXIO; 542 return -ENXIO;
546 } 543 }
547 if (pci_enable_device(dev)) { 544 if (pci_enable_device(dev)) {
548 error("Failed to enable PCILynx hardware\n"); 545 dev_err(&dev->dev, "Failed to enable PCILynx hardware\n");
549 return -ENXIO; 546 return -ENXIO;
550 } 547 }
551 pci_set_master(dev); 548 pci_set_master(dev);
552 549
553 lynx = kzalloc(sizeof *lynx, GFP_KERNEL); 550 lynx = kzalloc(sizeof *lynx, GFP_KERNEL);
554 if (lynx == NULL) { 551 if (lynx == NULL) {
555 error("Failed to allocate control structure memory\n"); 552 dev_err(&dev->dev, "Failed to allocate control structure\n");
556 ret = -ENOMEM; 553 ret = -ENOMEM;
557 goto fail_disable; 554 goto fail_disable;
558 } 555 }
@@ -575,7 +572,7 @@ add_card(struct pci_dev *dev, const struct pci_device_id *unused)
575 if (lynx->rcv_start_pcl == NULL || 572 if (lynx->rcv_start_pcl == NULL ||
576 lynx->rcv_pcl == NULL || 573 lynx->rcv_pcl == NULL ||
577 lynx->rcv_buffer == NULL) { 574 lynx->rcv_buffer == NULL) {
578 error("Failed to allocate receive buffer\n"); 575 dev_err(&dev->dev, "Failed to allocate receive buffer\n");
579 ret = -ENOMEM; 576 ret = -ENOMEM;
580 goto fail_deallocate; 577 goto fail_deallocate;
581 } 578 }
@@ -637,7 +634,8 @@ add_card(struct pci_dev *dev, const struct pci_device_id *unused)
637 634
638 if (request_irq(dev->irq, irq_handler, IRQF_SHARED, 635 if (request_irq(dev->irq, irq_handler, IRQF_SHARED,
639 driver_name, lynx)) { 636 driver_name, lynx)) {
640 error("Failed to allocate shared interrupt %d\n", dev->irq); 637 dev_err(&dev->dev,
638 "Failed to allocate shared interrupt %d\n", dev->irq);
641 ret = -EIO; 639 ret = -EIO;
642 goto fail_deallocate; 640 goto fail_deallocate;
643 } 641 }
@@ -650,14 +648,15 @@ add_card(struct pci_dev *dev, const struct pci_device_id *unused)
650 mutex_lock(&card_mutex); 648 mutex_lock(&card_mutex);
651 ret = misc_register(&lynx->misc); 649 ret = misc_register(&lynx->misc);
652 if (ret) { 650 if (ret) {
653 error("Failed to register misc char device\n"); 651 dev_err(&dev->dev, "Failed to register misc char device\n");
654 mutex_unlock(&card_mutex); 652 mutex_unlock(&card_mutex);
655 goto fail_free_irq; 653 goto fail_free_irq;
656 } 654 }
657 list_add_tail(&lynx->link, &card_list); 655 list_add_tail(&lynx->link, &card_list);
658 mutex_unlock(&card_mutex); 656 mutex_unlock(&card_mutex);
659 657
660 notify("Initialized PCILynx IEEE1394 card, irq=%d\n", dev->irq); 658 dev_info(&dev->dev,
659 "Initialized PCILynx IEEE1394 card, irq=%d\n", dev->irq);
661 660
662 return 0; 661 return 0;
663 662
@@ -715,7 +714,7 @@ static void __exit nosy_cleanup(void)
715{ 714{
716 pci_unregister_driver(&lynx_pci_driver); 715 pci_unregister_driver(&lynx_pci_driver);
717 716
718 notify("Unloaded %s.\n", driver_name); 717 pr_info("Unloaded %s\n", driver_name);
719} 718}
720 719
721module_init(nosy_init); 720module_init(nosy_init);