net/usb: remove err() messages in few drivers
Subsystems (4)
PATCH v2 1/1 net/usb: remove err() messages in few drivers
Remove err-messages and place dev_err instead in catc.c, kaweth.c and rtl8150.c.
--
drivers/net/usb/catc.c +8 -8
@@ -339,14 +339,14 @@ static void catc_irq_done(struct urb *urb) }else { catc->rx_urb->dev = catc->usbdev;if ((res =usb_submit_urb (catc->rx_urb,GFP_ATOMIC )) <0 ) { -err ("submit(rx_urb) status %d" , res); +dev_err (&catc->usbdev->dev,"submit(rx_urb) status %d\n" , res); } } } resubmit: res =usb_submit_urb (urb,GFP_ATOMIC );if (res) -err ("can't resubmit intr, %s-%s, status %d" , +dev_err (&catc->usbdev->dev,"can't resubmit intr, %s-%s, status %d\n" , catc->usbdev->bus->bus_name, catc->usbdev->devpath, res); }
@@ -367,7 +367,7 @@ static int catc_tx_run(struct catc *catc) catc->tx_urb->dev = catc->usbdev;if ((status =usb_submit_urb (catc->tx_urb,GFP_ATOMIC )) <0 ) -err ("submit(tx_urb), status %d" , status); +dev_err (&catc->usbdev->dev,"submit(tx_urb), status %d\n" , status); catc->tx_idx = !catc->tx_idx; catc->tx_ptr =0 ;
@@ -496,7 +496,7 @@ static void catc_ctrl_run(struct catc *catc)memcpy (catc->ctrl_buf, q->buf, q->len);if ((status =usb_submit_urb (catc->ctrl_urb,GFP_KERNEL ))) -err ("submit(ctrl_urb) status %d" , status); +dev_err (&usbdev->dev,"submit(ctrl_urb) status %d\n" , status); }static void catc_ctrl_done (struct urb *urb)
@@ -555,7 +555,7 @@ static int catc_ctrl_async(struct catc *catc, u8 dir, u8 request, u16 value, catc->ctrl_head = (catc->ctrl_head +1 ) & (CTRL_QUEUE -1 );if (catc->ctrl_head == catc->ctrl_tail) { -err ("ctrl queue full" ); +dev_err (&catc->usbdev->dev,"ctrl queue full\n" ); catc->ctrl_tail = (catc->ctrl_tail +1 ) & (CTRL_QUEUE -1 ); retval =-1 ; }
@@ -721,7 +721,7 @@ static int catc_open(struct net_device *netdev) catc->irq_urb->dev = catc->usbdev;if ((status =usb_submit_urb (catc->irq_urb,GFP_KERNEL )) <0 ) { -err ("submit(irq_urb) status %d" , status); +dev_err (&netdev->dev,"submit(irq_urb) status %d\n" , status);return -1 ; }
@@ -764,7 +764,7 @@ static int catc_probe(struct usb_interface *intf, const struct usb_device_id *idif (usb_set_interface (usbdev, intf->altsetting->desc.bInterfaceNumber,1 )) { -err ("Can't set altsetting 1." ); +dev_err (&intf->dev,"Can't set altsetting 1.\n" );return -EIO ; }
@@ -799,7 +799,7 @@ static int catc_probe(struct usb_interface *intf, const struct usb_device_id *id catc->irq_urb =usb_alloc_urb (0 ,GFP_KERNEL );if ((!catc->ctrl_urb) || (!catc->tx_urb) || (!catc->rx_urb) || (!catc->irq_urb)) { -err ("No free urbs available." ); +dev_err (&intf->dev,"No free urbs available.\n" );usb_free_urb (catc->ctrl_urb);usb_free_urb (catc->tx_urb);usb_free_urb (catc->rx_urb);
drivers/net/usb/kaweth.c +22 -20
147 lines not on this page · raw message
drivers/net/usb/rtl8150.c +8 -6
@@ -247,7 +247,8 @@ static int async_set_registers(rtl8150_t * dev, u16 indx, u16 size)if ((ret =usb_submit_urb (dev->ctrl_urb,GFP_ATOMIC ))) {if (ret == -ENODEV )netif_device_detach (dev->netdev); -err ("control request submission failed: %d" , ret); +dev_err (&dev->udev->dev, +"control request submission failed: %d\n" , ret); }else set_bit (RX_REG_SET , &dev->flags);
@@ -599,7 +600,8 @@ resubmit:if (res == -ENODEV )netif_device_detach (dev->netdev);else if (res) -err ("can't resubmit intr, %s-%s/input0, status %d" , +dev_err (&dev->udev->dev, +"can't resubmit intr, %s-%s/input0, status %d\n" , dev->udev->bus->bus_name, dev->udev->devpath, res); }
@@ -906,7 +908,7 @@ static int rtl8150_probe(struct usb_interface *intf, netdev =alloc_etherdev (sizeof (rtl8150_t));if (!netdev) { -err ("Out of memory" ); +dev_err (&intf->dev,"Out of memory\n" );return -ENOMEM ; }
@@ -936,11 +938,11 @@ static int rtl8150_probe(struct usb_interface *intf, dev->intr_interval =100 ;/* 100ms */ if (!alloc_all_urbs (dev)) { -err ("out of memory" ); +dev_err (&intf->dev,"out of memory\n" ); goto out; }if (!rtl8150_reset (dev)) { -err ("couldn't reset the device" ); +dev_err (&intf->dev,"couldn't reset the device\n" ); goto out1; }fill_skb_pool (dev);
@@ -949,7 +951,7 @@ static int rtl8150_probe(struct usb_interface *intf,usb_set_intfdata (intf, dev);SET_NETDEV_DEV (netdev, &intf->dev);if (register_netdev (netdev) !=0 ) { -err ("couldn't register the device" ); +dev_err (&intf->dev,"couldn't register the device\n" ); goto out2; }
Signature · 1 line
Best regards, Klimov Alexey
QW0gVHVlc2RheSAxMyBKYW51YXJ5IDIwMDkgMDE6MDg6NDIgc2NocmllYiBBbGV4ZXkgS2xpbW92 Ogo+IEBAIC02NzUsNyArNjc3LDcgQEAgc3RhdGljIGludCBrYXdldGhfb3BlbihzdHJ1Y3QgbmV0 X2RldmljZSAqbmV0KQo+IMKgCj4gwqDCoMKgwqDCoMKgwqDCoHJlcyA9IHVzYl9hdXRvcG1fZ2V0 X2ludGVyZmFjZShrYXdldGgtPmludGYpOwo+IMKgwqDCoMKgwqDCoMKgwqBpZiAocmVzKSB7Cj4g LcKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoGVycigiSW50ZXJmYWNlIGNhbm5vdCBiZSBy ZXN1bWVkLiIpOwo+ICvCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqBkZXZfZXJyKCZuZXQt PmRldiwgIkludGVyZmFjZSBjYW5ub3QgYmUgcmVzdW1lZC5cbiIpOwo+IMKgwqDCoMKgwqDCoMKg wqDCoMKgwqDCoMKgwqDCoMKgcmV0dXJuIC1FSU87Cj4gwqDCoMKgwqDCoMKgwqDCoH0KPiDCoMKg wqDCoMKgwqDCoMKgcmVzID0ga2F3ZXRoX3Jlc3VibWl0X3J4X3VyYihrYXdldGgsIEdGUF9LRVJO RUwpOwo+IEBAIC05MDIsNyArOTA0LD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CoMKgIMKgIMKgIMKgMTAwLAo+IMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDC oMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKg wqDCoCDCoCDCoCDCoDIpKSA8IDApIHsKPiAtwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKg wqDCoMKgwqDCoMKgwqDCoGVycigiRXJyb3IgZG93bmxvYWRpbmcgZmlybXdhcmUgKCVkKSIsIHJl c3VsdCk7Cj4gK8KgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqBk ZXZfZXJyKCZpbnRmLT5kZXYsICJFcnJvciBkb3dubG9hZGluZyBmaXJtd2FyZSAoJWQpXG4iLCBy ZXN1bHQpOwoKSSBoYXZlIHRvIHZldG8gdGhpcy4gWW91IGFyZSB1c2luZyB0aHJlZSBkaWZmZXJl bnQgZGV2aWNlIHN0cnVjdHVyZXMKdG8gcmVmZXIgdG8gdGhlIHNhbWUgZGV2aWNlLiBUaGF0IHdp bGwgbWFrZSBpdCBuZXh0IHRvIGltcG9zc2libGUgdG8KZmluZCBvdXQgd2hpY2ggZGV2aWNlIG9y aWdpbmF0ZWQgYSBtZXNzYWdlLgoKCVJlZ2FyZHMKCQlPbGl2ZXIKCg==
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 30 lines · Oliver Neukum
Am Tuesday 13 January 2009 01:08:42 schrieb Alexey Klimov:
Quoted 19 lines
drivers/net/usb/kaweth.c +2
-2@@ -675,7 +677,7 @@ static int kaweth_open(struct net_device *net) res =usb_autopm_get_interface (kaweth->intf);if (res) { -err ("Interface cannot be resumed." ); +dev_err (&net->dev,"Interface cannot be resumed.\n" );return -EIO ; } res =kaweth_resubmit_rx_urb (kaweth,GFP_KERNEL );@@ -902,7 +904,7 @@ static void kaweth_async_set_rx_mode(struct kaweth_device *kaweth) KAWETH_CONTROL_TIMEOUT);if (result <0 ) { -err ("Failed to set Rx mode: %d" , result); +dev_err (&kaweth->dev->dev,"Failed to set Rx mode: %d\n" , result); }else {dbg ("Set Rx mode to %d" , packet_filter_bitmap);drivers/net/usb/kaweth.c static int kaweth_probe( · line 1043
Quoted 5 lines
drivers/net/usb/kaweth.c +1
-1@@ -1038,7 +1040,7 @@ static int kaweth_probe( "kaweth/new_code.bin", 100, 2)) < 0) { -err ("Error downloading firmware (%d)" , result); +dev_err (&intf->dev,"Error downloading firmware (%d)\n" , result);I have to veto this. You are using three different device structures to refer to the same device. That will make it next to impossible to find out which device originated a message.
Quoted 2 lines
Regards
Oliver
Ok, i'll reformat patch. Is it okay if i use kaweth->dev->dev, kaweth->net->dev and intf->dev ? Or switch to kaweth->net->dev (instead of dev->dev)?
Signature · 1 line
Best regards, Klimov Alexey
Am Tuesday 13 January 2009 09:57:12 schrieb Alexey Klimov:
Quoted 9 lines · Oliver Neukum
Quoted 5 lines
I have to veto this. You are using three different device structures to refer to the same device. That will make it next to impossible to find out which device originated a message.
Ok, i'll reformat patch. Is it okay if i use
kaweth->dev->dev,kaweth->net->devandintf->dev? Or switch tokaweth->net->dev(instead ofdev->dev)?
kaweth in kaweth_disconnect() frees the network device. Therefore you cannot use it. You'd access freed memory. Pick one of the others and stay with it.
Regards
Oliver
Quoted 7 lines · Oliver Neukum
Quoted 3 lines
Ok, i'll reformat patch. Is it okay if i use
kaweth->dev->dev,kaweth->net->devandintf->dev? Or switch tokaweth->net->dev(instead ofdev->dev)?kaweth in
kaweth_disconnect()frees the network device. Therefore you cannot use it. You'd access freed memory. Pick one of the others and stay with it.
intf->dev is going to be "obviously correct", the others aren't. --
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 2 lines · Alexey Klimov
- err("submit(rx_urb) status %d", res);
+ dev_err(&catc->usbdev->dev, "submit(rx_urb)status %d\n", res);
That's the same as urb->dev though.
Use the interface passed into probe(): dev_err(&intf->dev, ...) etc --
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 11 lines · David Brownell
Quoted 7 lines · Oliver Neukum
Quoted 3 lines
Ok, i'll reformat patch. Is it okay if i use
kaweth->dev->dev,kaweth->net->devandintf->dev? Or switch tokaweth->net->dev(instead ofdev->dev)?kaweth in
kaweth_disconnect()frees the network device. Therefore you cannot use it. You'd access freed memory. Pick one of the others and stay with it.
intf->devis going to be "obviously correct", the others aren't.
Is this patch touch kaweth_disconnect() ? I see dev_warn and dev_info there. No dev_err.
Signature · 1 line
Best regards, Klimov Alexey
Am Tuesday 13 January 2009 11:08:27 schrieb Alexey Klimov:
Quoted 10 lines · David Brownell
Quoted 9 lines · Oliver Neukum
Quoted 7 lines
Quoted 3 lines
Ok, i'll reformat patch. Is it okay if i use
kaweth->dev->dev,kaweth->net->devandintf->dev? Or switch tokaweth->net->dev(instead ofdev->dev)?kaweth in
kaweth_disconnect()frees the network device. Therefore you cannot use it. You'd access freed memory. Pick one of the others and stay with it.
Quoted 5 lines
Quoted 2 lines
intf->devis going to be "obviously correct", the others aren't.Is this patch touch
kaweth_disconnect()? I seedev_warnanddev_infothere. Nodev_err.
No, it does not. But you need to make sure that the devices you refer to in debug messages are always valid. Functions that you do touch may run after disconnect() has run. A debug message that oopses does no good. If you cannot make sure you pass a valid device to dev_err/info don't use them. It is as simple as that.
Regards
Oliver
Hello, all
Quoted 14 lines · Oliver Neukum
Am Tuesday 13 January 2009 11:08:27 schrieb Alexey Klimov:
Quoted 13 lines · David Brownell
Quoted 11 lines · Oliver Neukum
Quoted 7 lines
Quoted 3 lines
Ok, i'll reformat patch. Is it okay if i use
kaweth->dev->dev,kaweth->net->devandintf->dev? Or switch tokaweth->net->dev(instead ofdev->dev)?kaweth in
kaweth_disconnect()frees the network device. Therefore you cannot use it. You'd access freed memory. Pick one of the others and stay with it.
intf->devis going to be "obviously correct", the others aren't.
Quoted 8 lines
Quoted 2 lines
Is this patch touch
kaweth_disconnect()? I seedev_warnanddev_infothere. Nodev_err.No, it does not. But you need to make sure that the devices you refer to in debug messages are always valid. Functions that you do touch may run after
disconnect()has run. A debug message that oopses does no good. If you cannot make sure you pass a valid device to dev_err/info don't use them. It is as simple as that.
Yes, that's obviously right. I'll review and check patch again. Thank you for your advices.
Quoted 8 lines · David Brownell
Review
Quoted 2 lines · Alexey Klimov
(quoted diff) +1
-1- err("submit(rx_urb) status %d", res); + dev_err(&catc->usbdev->dev, "submit(rx_urb) status %d\n", res);That's the same as
urb->devthough.Use the interface passed into
probe():dev_err(&intf->dev, ...)etc
Well, in few v4l-dvb drivers successfully used &radio->usbdev->dev in debug messages and that doesn't look wrong.
Hmm, i see that struct usb_interface passed to probe function for example, and here in catc_irq_done struct urb passed, and then we have struct catc. So, messages based on catc->usbdev->dev. I can switch to &catc->netdev->dev when it's safe to do, right?
I didn't see way we can use &intv->dev in such functions. Am i wrong ? In probe functions &intf->dev is right.
Btw, in patch "USB: remove info() macro from usb network drivers"
few messages based on &urb->dev->dev.
Signature · 5 lines
Best regards, Klimov Alexey -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 4 lines · Alexey Klimov
Quoted 1 line
Use the interface passed into
probe(): dev_err(&intf->dev, ...) etcWell, in few v4l-dvb drivers successfully used
&radio->usbdev->devin debug messages and that doesn't look wrong.
Use intf->dev ... always. You may need to save the interface in probe(), but that's easy.
"Doesn't look wrong" is incorrect; it doesn't list the driver which issued it. Which makes it harder to track down exactly what issued the message, and thence what it really means.
- Dave
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Am Wednesday 14 January 2009 01:22:26 schrieb Alexey Klimov:
Quoted 1 line
Quoted 1 line
Use the interface passed into
probe(): dev_err(&intf->dev, ...) etc
A USB driver is fundamentally a driver for a device's interfaces. Therefore the interface's device struct is the obviously correct choice.
Quoted 2 lines
Well, in few v4l-dvb drivers successfully used
&radio->usbdev->devin debug messages and that doesn't look wrong.
That will not allow you to identify which interface caused the message.
Quoted 4 lines
Hmm, i see that struct
usb_interfacepassed to probe function for example, and here incatc_irq_donestruct urb passed, and then we have struct catc. So, messages based oncatc->usbdev->dev. I can switch to&catc->netdev->devwhen it's safe to do, right?
You cannot. The point of passing a device pointer is to identify the device. The device in the network view and the USB view is not identical. You have to pick one choice and stick with it and if for some reason that is not possible you cannot use this debugging functions.
Regards
Oliver
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html