Skip to content

Commit 3b6004f

Browse files
committed
USB: remove warn() macro from usb drivers
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>
1 parent 4dc8994 commit 3b6004f

9 files changed

Lines changed: 32 additions & 19 deletions

File tree

‎drivers/usb/atm/usbatm.c‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ static void usbatm_extract_one_cell(struct usbatm_data *instance, unsigned char
344344
__func__, sarb->len, vcc);
345345
/* discard cells already received */
346346
skb_trim(sarb, 0);
347-
UDSL_ASSERT(sarb->tail + ATM_CELL_PAYLOAD <= sarb->end);
347+
UDSL_ASSERT(instance, sarb->tail + ATM_CELL_PAYLOAD <= sarb->end);
348348
}
349349

350350
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,
432432
unsigned char *cell_buf = instance->cell_buf;
433433
unsigned int space_left = stride - buf_usage;
434434

435-
UDSL_ASSERT(buf_usage <= stride);
435+
UDSL_ASSERT(instance, buf_usage <= stride);
436436

437437
if (avail_data >= space_left) {
438438
/* add new data and process cell */
@@ -475,7 +475,7 @@ static unsigned int usbatm_write_cells(struct usbatm_data *instance,
475475
unsigned int stride = instance->tx_channel.stride;
476476

477477
vdbg("%s: skb->len=%d, avail_space=%u", __func__, skb->len, avail_space);
478-
UDSL_ASSERT(!(avail_space % stride));
478+
UDSL_ASSERT(instance, !(avail_space % stride));
479479

480480
for (bytes_written = 0; bytes_written < avail_space && ctrl->len;
481481
bytes_written += stride, target += stride) {
@@ -547,7 +547,7 @@ static void usbatm_rx_process(unsigned long data)
547547
if (!urb->iso_frame_desc[i].status) {
548548
unsigned int actual_length = urb->iso_frame_desc[i].actual_length;
549549

550-
UDSL_ASSERT(actual_length <= packet_size);
550+
UDSL_ASSERT(instance, actual_length <= packet_size);
551551

552552
if (!merge_length)
553553
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,
11881188
struct urb *urb;
11891189
unsigned int iso_packets = usb_pipeisoc(channel->endpoint) ? channel->buf_size / channel->packet_size : 0;
11901190

1191-
UDSL_ASSERT(!usb_pipeisoc(channel->endpoint) || usb_pipein(channel->endpoint));
1191+
UDSL_ASSERT(instance, !usb_pipeisoc(channel->endpoint) || usb_pipein(channel->endpoint));
11921192

11931193
urb = usb_alloc_urb(iso_packets, GFP_KERNEL);
11941194
if (!urb) {

‎drivers/usb/atm/usbatm.h‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,15 @@
4040
*/
4141

4242
#ifdef DEBUG
43-
#define UDSL_ASSERT(x) BUG_ON(!(x))
43+
#define UDSL_ASSERT(instance, x) BUG_ON(!(x))
4444
#else
45-
#define UDSL_ASSERT(x) do { if (!(x)) warn("failed assertion '%s' at line %d", __stringify(x), __LINE__); } while(0)
45+
#define UDSL_ASSERT(instance, x) \
46+
do { \
47+
if (!(x)) \
48+
dev_warn(&(instance)->usb_intf->dev, \
49+
"failed assertion '%s' at line %d", \
50+
__stringify(x), __LINE__); \
51+
} while(0)
4652
#endif
4753

4854
#define usb_err(instance, format, arg...) \

‎drivers/usb/atm/xusbatm.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ static int __init xusbatm_init(void)
193193
num_vendor != num_product ||
194194
num_vendor != num_rx_endpoint ||
195195
num_vendor != num_tx_endpoint) {
196-
warn("malformed module parameters");
196+
printk(KERN_WARNING "xusbatm: malformed module parameters\n");
197197
return -EINVAL;
198198
}
199199

‎drivers/usb/core/devio.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,8 @@ static void driver_disconnect(struct usb_interface *intf)
413413
if (likely(ifnum < 8*sizeof(ps->ifclaimed)))
414414
clear_bit(ifnum, &ps->ifclaimed);
415415
else
416-
warn("interface number %u out of range", ifnum);
416+
dev_warn(&intf->dev, "interface number %u out of range\n",
417+
ifnum);
417418

418419
usb_set_intfdata(intf, NULL);
419420

‎drivers/usb/core/inode.c‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,9 @@ static void update_sb(struct super_block *sb)
240240
update_special(bus);
241241
break;
242242
default:
243-
warn("Unknown node %s mode %x found on remount!\n",bus->d_name.name,bus->d_inode->i_mode);
243+
printk(KERN_WARNING "usbfs: Unknown node %s "
244+
"mode %x found on remount!\n",
245+
bus->d_name.name, bus->d_inode->i_mode);
244246
break;
245247
}
246248
}
@@ -259,7 +261,7 @@ static int remount(struct super_block *sb, int *flags, char *data)
259261
return 0;
260262

261263
if (parse_options(sb, data)) {
262-
warn("usbfs: mount parameter error:");
264+
printk(KERN_WARNING "usbfs: mount parameter error.\n");
263265
return -EINVAL;
264266
}
265267

‎drivers/usb/core/message.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1204,7 +1204,8 @@ int usb_set_interface(struct usb_device *dev, int interface, int alternate)
12041204

12051205
alt = usb_altnum_to_altsetting(iface, alternate);
12061206
if (!alt) {
1207-
warn("selecting invalid altsetting %d", alternate);
1207+
dev_warn(&dev->dev, "selecting invalid altsetting %d",
1208+
alternate);
12081209
return -EINVAL;
12091210
}
12101211

‎drivers/usb/image/mdc800.c‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,8 @@ static int mdc800_usb_waitForIRQ (int mode, int msec)
361361

362362
if (mdc800->state == NOT_CONNECTED)
363363
{
364-
warn ("Camera gets disconnected during waiting for irq.");
364+
printk(KERN_WARNING "mdc800: Camera gets disconnected "
365+
"during waiting for irq.\n");
365366
mdc800->camera_request_ready=0;
366367
return -2;
367368
}
@@ -443,7 +444,7 @@ static int mdc800_usb_probe (struct usb_interface *intf,
443444

444445
if (mdc800->dev != NULL)
445446
{
446-
warn ("only one Mustek MDC800 is supported.");
447+
dev_warn(&intf->dev, "only one Mustek MDC800 is supported.\n");
447448
return -ENODEV;
448449
}
449450

@@ -701,7 +702,8 @@ static ssize_t mdc800_device_read (struct file *file, char __user *buf, size_t l
701702
}
702703
if (mdc800->state == WORKING)
703704
{
704-
warn ("Illegal State \"working\" reached during read ?!");
705+
printk(KERN_WARNING "mdc800: Illegal State \"working\""
706+
"reached during read ?!\n");
705707
mutex_unlock(&mdc800->io_lock);
706708
return -EBUSY;
707709
}

‎drivers/usb/misc/usblcd.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ static int lcd_probe(struct usb_interface *interface, const struct usb_device_id
311311
dev->interface = interface;
312312

313313
if (le16_to_cpu(dev->udev->descriptor.idProduct) != 0x0001) {
314-
warn(KERN_INFO "USBLCD model not supported.");
314+
dev_warn(&interface->dev, "USBLCD model not supported.\n");
315315
return -ENODEV;
316316
}
317317

‎drivers/usb/misc/uss720.c‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -228,11 +228,12 @@ static int get_1284_register(struct parport *pp, unsigned char reg, unsigned cha
228228
ret = rq->urb->status;
229229
*val = priv->reg[(reg >= 9) ? 0 : regindex[reg]];
230230
if (ret)
231-
warn("get_1284_register: usb error %d", ret);
231+
printk(KERN_WARNING "get_1284_register: "
232+
"usb error %d\n", ret);
232233
kref_put(&rq->ref_count, destroy_async);
233234
return ret;
234235
}
235-
warn("get_1284_register timeout");
236+
printk(KERN_WARNING "get_1284_register timeout\n");
236237
kill_all_async_requests_priv(priv);
237238
return -EIO;
238239
}
@@ -716,7 +717,7 @@ static int uss720_probe(struct usb_interface *intf,
716717
spin_lock_init(&priv->asynclock);
717718
INIT_LIST_HEAD(&priv->asynclist);
718719
if (!(pp = parport_register_port(0, PARPORT_IRQ_NONE, PARPORT_DMA_NONE, &parport_uss720_ops))) {
719-
warn("could not register parport");
720+
printk(KERN_WARNING "uss720: could not register parport\n");
720721
goto probe_abort;
721722
}
722723

0 commit comments

Comments
 (0)