USB: remove warn() macro from usb drivers
authorGreg Kroah-Hartman <gregkh@suse.de>
Thu, 14 Aug 2008 16:37:34 +0000 (09:37 -0700)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 17 Oct 2008 21:41:09 +0000 (14:41 -0700)
USB should not be having it's own printk macros, so remove warn() and
use the system-wide standard of dev_warn() wherever possible.  In the
few places that will not work out, use a basic printk().

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/atm/usbatm.c
drivers/usb/atm/usbatm.h
drivers/usb/atm/xusbatm.c
drivers/usb/core/devio.c
drivers/usb/core/inode.c
drivers/usb/core/message.c
drivers/usb/image/mdc800.c
drivers/usb/misc/usblcd.c
drivers/usb/misc/uss720.c

index 0da2c25bab3b2396766e36cc41ca0140f98986c3..06dd114910d45ac4cda3a080c375459329cada0d 100644 (file)
@@ -344,7 +344,7 @@ static void usbatm_extract_one_cell(struct usbatm_data *instance, unsigned char
                                __func__, sarb->len, vcc);
                /* discard cells already received */
                skb_trim(sarb, 0);
-               UDSL_ASSERT(sarb->tail + ATM_CELL_PAYLOAD <= sarb->end);
+               UDSL_ASSERT(instance, sarb->tail + ATM_CELL_PAYLOAD <= sarb->end);
        }
 
        memcpy(skb_tail_pointer(sarb), source + ATM_CELL_HEADER, ATM_CELL_PAYLOAD);
@@ -432,7 +432,7 @@ static void usbatm_extract_cells(struct usbatm_data *instance,
                unsigned char *cell_buf = instance->cell_buf;
                unsigned int space_left = stride - buf_usage;
 
-               UDSL_ASSERT(buf_usage <= stride);
+               UDSL_ASSERT(instance, buf_usage <= stride);
 
                if (avail_data >= space_left) {
                        /* add new data and process cell */
@@ -475,7 +475,7 @@ static unsigned int usbatm_write_cells(struct usbatm_data *instance,
        unsigned int stride = instance->tx_channel.stride;
 
        vdbg("%s: skb->len=%d, avail_space=%u", __func__, skb->len, avail_space);
-       UDSL_ASSERT(!(avail_space % stride));
+       UDSL_ASSERT(instance, !(avail_space % stride));
 
        for (bytes_written = 0; bytes_written < avail_space && ctrl->len;
             bytes_written += stride, target += stride) {
@@ -547,7 +547,7 @@ static void usbatm_rx_process(unsigned long data)
                                if (!urb->iso_frame_desc[i].status) {
                                        unsigned int actual_length = urb->iso_frame_desc[i].actual_length;
 
-                                       UDSL_ASSERT(actual_length <= packet_size);
+                                       UDSL_ASSERT(instance, actual_length <= packet_size);
 
                                        if (!merge_length)
                                                merge_start = (unsigned char *)urb->transfer_buffer + urb->iso_frame_desc[i].offset;
@@ -1188,7 +1188,7 @@ int usbatm_usb_probe(struct usb_interface *intf, const struct usb_device_id *id,
                struct urb *urb;
                unsigned int iso_packets = usb_pipeisoc(channel->endpoint) ? channel->buf_size / channel->packet_size : 0;
 
-               UDSL_ASSERT(!usb_pipeisoc(channel->endpoint) || usb_pipein(channel->endpoint));
+               UDSL_ASSERT(instance, !usb_pipeisoc(channel->endpoint) || usb_pipein(channel->endpoint));
 
                urb = usb_alloc_urb(iso_packets, GFP_KERNEL);
                if (!urb) {
index e6887c6cf3cf5a26b7401ca4b7477b001df18b01..f6f4508a9d425a38314e1b7dd64d3eca88fee417 100644 (file)
 */
 
 #ifdef DEBUG
-#define UDSL_ASSERT(x) BUG_ON(!(x))
+#define UDSL_ASSERT(instance, x)       BUG_ON(!(x))
 #else
-#define UDSL_ASSERT(x) do { if (!(x)) warn("failed assertion '%s' at line %d", __stringify(x), __LINE__); } while(0)
+#define UDSL_ASSERT(instance, x)                                       \
+       do {    \
+               if (!(x))                                               \
+                       dev_warn(&(instance)->usb_intf->dev,            \
+                                "failed assertion '%s' at line %d",    \
+                                __stringify(x), __LINE__);             \
+       } while(0)
 #endif
 
 #define usb_err(instance, format, arg...)      \
index 8472543eee81d4f117103836d6636b25abbc98e0..17d167bbd2dc346fefdead23ab4c3ddef68eca25 100644 (file)
@@ -193,7 +193,7 @@ static int __init xusbatm_init(void)
            num_vendor != num_product ||
            num_vendor != num_rx_endpoint ||
            num_vendor != num_tx_endpoint) {
-               warn("malformed module parameters");
+               printk(KERN_WARNING "xusbatm: malformed module parameters\n");
                return -EINVAL;
        }
 
index 528befdcc7813b64e42aa345eb32dcddf4c9108e..7f621149f9f2d93700e8fc46d3d1c38542fcbe85 100644 (file)
@@ -413,7 +413,8 @@ static void driver_disconnect(struct usb_interface *intf)
        if (likely(ifnum < 8*sizeof(ps->ifclaimed)))
                clear_bit(ifnum, &ps->ifclaimed);
        else
-               warn("interface number %u out of range", ifnum);
+               dev_warn(&intf->dev, "interface number %u out of range\n",
+                        ifnum);
 
        usb_set_intfdata(intf, NULL);
 
index 77fa7a0808019f55033d05b03d94f8118a010a0f..2cf2dc8528d88bcb72d3157c2c3f37bd7660b647 100644 (file)
@@ -240,7 +240,9 @@ static void update_sb(struct super_block *sb)
                                update_special(bus);
                                break;
                        default:
-                               warn("Unknown node %s mode %x found on remount!\n",bus->d_name.name,bus->d_inode->i_mode);
+                               printk(KERN_WARNING "usbfs: Unknown node %s "
+                                      "mode %x found on remount!\n",
+                                      bus->d_name.name, bus->d_inode->i_mode);
                                break;
                        }
                }
@@ -259,7 +261,7 @@ static int remount(struct super_block *sb, int *flags, char *data)
                return 0;
 
        if (parse_options(sb, data)) {
-               warn("usbfs: mount parameter error:");
+               printk(KERN_WARNING "usbfs: mount parameter error.\n");
                return -EINVAL;
        }
 
index 286b4431a0974195dc0ceffe74f351d18f1d7c68..887738577b2838df3e02f93c05a9fe32a48b0606 100644 (file)
@@ -1204,7 +1204,8 @@ int usb_set_interface(struct usb_device *dev, int interface, int alternate)
 
        alt = usb_altnum_to_altsetting(iface, alternate);
        if (!alt) {
-               warn("selecting invalid altsetting %d", alternate);
+               dev_warn(&dev->dev, "selecting invalid altsetting %d",
+                        alternate);
                return -EINVAL;
        }
 
index 0fb114ca1eba9d598da09483f7565451b351822a..228552beb534c696b4084fd12ff09793fcfb3671 100644 (file)
@@ -361,7 +361,8 @@ static int mdc800_usb_waitForIRQ (int mode, int msec)
        
        if (mdc800->state == NOT_CONNECTED)
        {
-               warn ("Camera gets disconnected during waiting for irq.");
+               printk(KERN_WARNING "mdc800: Camera gets disconnected "
+                      "during waiting for irq.\n");
                mdc800->camera_request_ready=0;
                return -2;
        }
@@ -443,7 +444,7 @@ static int mdc800_usb_probe (struct usb_interface *intf,
 
        if (mdc800->dev != NULL)
        {
-               warn ("only one Mustek MDC800 is supported.");
+               dev_warn(&intf->dev, "only one Mustek MDC800 is supported.\n");
                return -ENODEV;
        }
 
@@ -701,7 +702,8 @@ static ssize_t mdc800_device_read (struct file *file, char __user *buf, size_t l
        }
        if (mdc800->state == WORKING)
        {
-               warn ("Illegal State \"working\" reached during read ?!");
+               printk(KERN_WARNING "mdc800: Illegal State \"working\""
+                      "reached during read ?!\n");
                mutex_unlock(&mdc800->io_lock);
                return -EBUSY;
        }
index 2db4228fbb016bce9548e899bad64a17dc428f7e..d589324bb0d0e618368498a3081487c6c667cbc0 100644 (file)
@@ -311,7 +311,7 @@ static int lcd_probe(struct usb_interface *interface, const struct usb_device_id
        dev->interface = interface;
 
        if (le16_to_cpu(dev->udev->descriptor.idProduct) != 0x0001) {
-               warn(KERN_INFO "USBLCD model not supported.");
+               dev_warn(&interface->dev, "USBLCD model not supported.\n");
                return -ENODEV;
        }
        
index f1255b0a182d24f4742180c4f47caf5a37b4e259..594f3e4e8c2e628fd1dfcbaf846c5f27fcb986d2 100644 (file)
@@ -228,11 +228,12 @@ static int get_1284_register(struct parport *pp, unsigned char reg, unsigned cha
                ret = rq->urb->status;
                *val = priv->reg[(reg >= 9) ? 0 : regindex[reg]];
                if (ret)
-                       warn("get_1284_register: usb error %d", ret);
+                       printk(KERN_WARNING "get_1284_register: "
+                              "usb error %d\n", ret);
                kref_put(&rq->ref_count, destroy_async);
                return ret;
        }
-       warn("get_1284_register timeout");
+       printk(KERN_WARNING "get_1284_register timeout\n");
        kill_all_async_requests_priv(priv);
        return -EIO;
 }
@@ -716,7 +717,7 @@ static int uss720_probe(struct usb_interface *intf,
        spin_lock_init(&priv->asynclock);
        INIT_LIST_HEAD(&priv->asynclist);
        if (!(pp = parport_register_port(0, PARPORT_IRQ_NONE, PARPORT_DMA_NONE, &parport_uss720_ops))) {
-               warn("could not register parport");
+               printk(KERN_WARNING "uss720: could not register parport\n");
                goto probe_abort;
        }