netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch review 1/3] net/usb: catc.c - place dev_err instead of err()
@ 2009-01-11 16:16 Alexey Klimov
       [not found] ` <1231690591.2050.103.camel-XMdqyYT0w3Zyw3qLyVIJKA@public.gmane.org>
  0 siblings, 1 reply; 2+ messages in thread
From: Alexey Klimov @ 2009-01-11 16:16 UTC (permalink / raw)
  To: dbrownell, davem; +Cc: Greg KH, netdev, linux-usb

Hello,

there are 3 patches for usb-network drivers that use err macroses.

Probably, few mistakes exist in this 3 patches and they should be
reformatted. May be they should be joined in one patch. Please, review.

---
Remove err-messages and place dev_err there.

Signed-off-by: Alexey Klimov <klimov.linux@gmail.com>

--
diff --git a/drivers/net/usb/catc.c b/drivers/net/usb/catc.c
index cb7acbb..e23fa80 100644
--- a/drivers/net/usb/catc.c
+++ b/drivers/net/usb/catc.c
@@ -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(&urb->dev->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(&urb->dev->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 *id
 
 	if (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);

-- 
Best regards, Klimov Alexey


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [patch review 1/3] net/usb: catc.c - place dev_err instead of err()
       [not found] ` <1231690591.2050.103.camel-XMdqyYT0w3Zyw3qLyVIJKA@public.gmane.org>
@ 2009-01-11 21:48   ` David Brownell
  0 siblings, 0 replies; 2+ messages in thread
From: David Brownell @ 2009-01-11 21:48 UTC (permalink / raw)
  To: Alexey Klimov
  Cc: davem-fT/PcQaiUtIeIZ0/mPfg9Q, Greg KH,
	netdev-u79uwXL29TY76Z2rM5mHXA, linux-usb-u79uwXL29TY76Z2rM5mHXA

On Sunday 11 January 2009, Alexey Klimov wrote:
> -                               err("submit(rx_urb) status %d", res);
> +                               dev_err(&urb->dev->dev, "submit(rx_urb) status %d\n", res);

You should really find and use the device on the *interface* to which
that driver is bound, rather than the one in the URB.  That's what
gets passed in to probe(); drivers normally remember that until a
remove() callback unbinds the driver from that interface.

A weak analogy is issuing a diagnostic about the PCI bus to which
the PCI device is attached, instead of the PCI device itself.  In
both cases, the diagnostic would point to the wrong thing...

The other two patches got this right in at least some cases, but I
didn't look in any detail.

- Dave

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-01-11 21:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-11 16:16 [patch review 1/3] net/usb: catc.c - place dev_err instead of err() Alexey Klimov
     [not found] ` <1231690591.2050.103.camel-XMdqyYT0w3Zyw3qLyVIJKA@public.gmane.org>
2009-01-11 21:48   ` David Brownell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).