From 27c766aaacb265d625dc634bf7903f7f9fd0c697 Mon Sep 17 00:00:00 2001 From: Joe Perches Date: Wed, 15 Feb 2012 15:06:19 -0800 Subject: watchdog: Use pr_ and pr_ Use the current logging styles. Make sure all output has a prefix. Add missing newlines. Remove now unnecessary PFX, NAME, and miscellaneous other #defines. Coalesce formats. Signed-off-by: Joe Perches Signed-off-by: Wim Van Sebroeck --- drivers/watchdog/pcwd_usb.c | 74 +++++++++++++++++++++------------------------ 1 file changed, 35 insertions(+), 39 deletions(-) (limited to 'drivers/watchdog/pcwd_usb.c') 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 /* For module specific items */ #include /* For new moduleparam's */ #include /* For standard types (like size_t) */ @@ -42,17 +44,23 @@ #include /* For HID_REQ_SET_REPORT & HID_DT_REPORT */ #include /* 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, ""); - 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