diff options
Diffstat (limited to 'drivers/watchdog/pcwd_usb.c')
-rw-r--r-- | drivers/watchdog/pcwd_usb.c | 74 |
1 files changed, 35 insertions, 39 deletions
diff --git a/drivers/watchdog/pcwd_usb.c b/drivers/watchdog/pcwd_usb.c index d8de1ddd176a..3e66a6bbfec5 100644 --- a/drivers/watchdog/pcwd_usb.c +++ b/drivers/watchdog/pcwd_usb.c @@ -24,6 +24,8 @@ * http://www.berkprod.com/ or http://www.pcwatchdog.com/ */ +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt + #include <linux/module.h> /* For module specific items */ #include <linux/moduleparam.h> /* For new moduleparam's */ #include <linux/types.h> /* For standard types (like size_t) */ @@ -42,17 +44,23 @@ #include <linux/hid.h> /* For HID_REQ_SET_REPORT & HID_DT_REPORT */ #include <linux/uaccess.h> /* For copy_to_user/put_user/... */ - #ifdef CONFIG_USB_DEBUG - static int debug = 1; +static int debug = 1; #else - static int debug; +static int debug; #endif /* Use our own dbg macro */ + #undef dbg -#define dbg(format, arg...) \ - do { if (debug) printk(KERN_DEBUG PFX format "\n" , ## arg); } while (0) +#ifndef DEBUG +#define DEBUG +#endif +#define dbg(format, ...) \ +do { \ + if (debug) \ + pr_debug(format "\n", ##__VA_ARGS__); \ +} while (0) /* Module and Version Information */ #define DRIVER_VERSION "1.02" @@ -60,7 +68,6 @@ #define DRIVER_DESC "Berkshire USB-PC Watchdog driver" #define DRIVER_LICENSE "GPL" #define DRIVER_NAME "pcwd_usb" -#define PFX DRIVER_NAME ": " MODULE_AUTHOR(DRIVER_AUTHOR); MODULE_DESCRIPTION(DRIVER_DESC); @@ -220,8 +227,8 @@ static void usb_pcwd_intr_done(struct urb *urb) resubmit: retval = usb_submit_urb(urb, GFP_ATOMIC); if (retval) - printk(KERN_ERR PFX "can't resubmit intr, " - "usb_submit_urb failed with result %d\n", retval); + pr_err("can't resubmit intr, usb_submit_urb failed with result %d\n", + retval); } static int usb_pcwd_send_command(struct usb_pcwd_private *usb_pcwd, @@ -284,8 +291,7 @@ static int usb_pcwd_start(struct usb_pcwd_private *usb_pcwd) &msb, &lsb); if ((retval == 0) || (lsb == 0)) { - printk(KERN_ERR PFX - "Card did not acknowledge enable attempt\n"); + pr_err("Card did not acknowledge enable attempt\n"); return -1; } @@ -303,8 +309,7 @@ static int usb_pcwd_stop(struct usb_pcwd_private *usb_pcwd) &msb, &lsb); if ((retval == 0) || (lsb != 0)) { - printk(KERN_ERR PFX - "Card did not acknowledge disable attempt\n"); + pr_err("Card did not acknowledge disable attempt\n"); return -1; } @@ -506,8 +511,7 @@ static int usb_pcwd_release(struct inode *inode, struct file *file) if (expect_release == 42) { usb_pcwd_stop(usb_pcwd_device); } else { - printk(KERN_CRIT PFX - "Unexpected close, not stopping watchdog!\n"); + pr_crit("Unexpected close, not stopping watchdog!\n"); usb_pcwd_keepalive(usb_pcwd_device); } expect_release = 0; @@ -627,7 +631,7 @@ static int usb_pcwd_probe(struct usb_interface *interface, cards_found++; if (cards_found > 1) { - printk(KERN_ERR PFX "This driver only supports 1 device\n"); + pr_err("This driver only supports 1 device\n"); return -ENODEV; } @@ -636,8 +640,7 @@ static int usb_pcwd_probe(struct usb_interface *interface, /* check out that we have a HID device */ if (!(iface_desc->desc.bInterfaceClass == USB_CLASS_HID)) { - printk(KERN_ERR PFX - "The device isn't a Human Interface Device\n"); + pr_err("The device isn't a Human Interface Device\n"); return -ENODEV; } @@ -646,7 +649,7 @@ static int usb_pcwd_probe(struct usb_interface *interface, if (!usb_endpoint_is_int_in(endpoint)) { /* we didn't find a Interrupt endpoint with direction IN */ - printk(KERN_ERR PFX "Couldn't find an INTR & IN endpoint\n"); + pr_err("Couldn't find an INTR & IN endpoint\n"); return -ENODEV; } @@ -657,7 +660,7 @@ static int usb_pcwd_probe(struct usb_interface *interface, /* allocate memory for our device and initialize it */ usb_pcwd = kzalloc(sizeof(struct usb_pcwd_private), GFP_KERNEL); if (usb_pcwd == NULL) { - printk(KERN_ERR PFX "Out of memory\n"); + pr_err("Out of memory\n"); goto error; } @@ -674,14 +677,14 @@ static int usb_pcwd_probe(struct usb_interface *interface, usb_pcwd->intr_buffer = usb_alloc_coherent(udev, usb_pcwd->intr_size, GFP_ATOMIC, &usb_pcwd->intr_dma); if (!usb_pcwd->intr_buffer) { - printk(KERN_ERR PFX "Out of memory\n"); + pr_err("Out of memory\n"); goto error; } /* allocate the urb's */ usb_pcwd->intr_urb = usb_alloc_urb(0, GFP_KERNEL); if (!usb_pcwd->intr_urb) { - printk(KERN_ERR PFX "Out of memory\n"); + pr_err("Out of memory\n"); goto error; } @@ -694,7 +697,7 @@ static int usb_pcwd_probe(struct usb_interface *interface, /* register our interrupt URB with the USB system */ if (usb_submit_urb(usb_pcwd->intr_urb, GFP_KERNEL)) { - printk(KERN_ERR PFX "Problem registering interrupt URB\n"); + pr_err("Problem registering interrupt URB\n"); retval = -EIO; /* failure */ goto error; } @@ -713,15 +716,13 @@ static int usb_pcwd_probe(struct usb_interface *interface, else sprintf(fw_ver_str, "<card no answer>"); - printk(KERN_INFO PFX "Found card (Firmware: %s) with temp option\n", - fw_ver_str); + pr_info("Found card (Firmware: %s) with temp option\n", fw_ver_str); /* Get switch settings */ usb_pcwd_send_command(usb_pcwd, CMD_GET_DIP_SWITCH_SETTINGS, &dummy, &option_switches); - printk(KERN_INFO PFX "Option switches (0x%02x): " - "Temperature Reset Enable=%s, Power On Delay=%s\n", + pr_info("Option switches (0x%02x): Temperature Reset Enable=%s, Power On Delay=%s\n", option_switches, ((option_switches & 0x10) ? "ON" : "OFF"), ((option_switches & 0x08) ? "ON" : "OFF")); @@ -734,39 +735,34 @@ static int usb_pcwd_probe(struct usb_interface *interface, * if not reset to the default */ if (usb_pcwd_set_heartbeat(usb_pcwd, heartbeat)) { usb_pcwd_set_heartbeat(usb_pcwd, WATCHDOG_HEARTBEAT); - printk(KERN_INFO PFX - "heartbeat value must be 0<heartbeat<65536, using %d\n", + pr_info("heartbeat value must be 0<heartbeat<65536, using %d\n", WATCHDOG_HEARTBEAT); } retval = register_reboot_notifier(&usb_pcwd_notifier); if (retval != 0) { - printk(KERN_ERR PFX - "cannot register reboot notifier (err=%d)\n", - retval); + pr_err("cannot register reboot notifier (err=%d)\n", retval); goto error; } retval = misc_register(&usb_pcwd_temperature_miscdev); if (retval != 0) { - printk(KERN_ERR PFX - "cannot register miscdev on minor=%d (err=%d)\n", - TEMP_MINOR, retval); + pr_err("cannot register miscdev on minor=%d (err=%d)\n", + TEMP_MINOR, retval); goto err_out_unregister_reboot; } retval = misc_register(&usb_pcwd_miscdev); if (retval != 0) { - printk(KERN_ERR PFX - "cannot register miscdev on minor=%d (err=%d)\n", - WATCHDOG_MINOR, retval); + pr_err("cannot register miscdev on minor=%d (err=%d)\n", + WATCHDOG_MINOR, retval); goto err_out_misc_deregister; } /* we can register the device now, as it is ready */ usb_set_intfdata(interface, usb_pcwd); - printk(KERN_INFO PFX "initialized. heartbeat=%d sec (nowayout=%d)\n", + pr_info("initialized. heartbeat=%d sec (nowayout=%d)\n", heartbeat, nowayout); return 0; @@ -824,7 +820,7 @@ static void usb_pcwd_disconnect(struct usb_interface *interface) mutex_unlock(&disconnect_mutex); - printk(KERN_INFO PFX "USB PC Watchdog disconnected\n"); + pr_info("USB PC Watchdog disconnected\n"); } module_usb_driver(usb_pcwd_driver); |