Patchwork Broken rndis_host with #define DEBUG (by a475f603d23392f386e45cf377b17c30ed3bbb80)

login
register
mail settings
Submitter Joe Perches
Date June 12, 2010, 9:10 p.m.
Message ID <1276377038.21640.67.camel@Joe-Laptop.home>
Download mbox | patch
Permalink /patch/55399/
State RFC
Delegated to: David Miller
Headers show

Comments

Joe Perches - June 12, 2010, 9:10 p.m.
On Sat, 2010-06-12 at 23:39 +0300, Jussi Kivilinna wrote:
> Commit a475f603d23392f386e45cf377b17c30ed3bbb80 "drivers/net/usb: Use  
> netif_<level> logging facilities" causes problems with rndis_host.
> 
> rndis_host oopses with #define DEBUG, in generic_rndis_bind() when  
> calling netif_dbg(). Problem is that (netdev)->dev.parent is NULL  
> (used in netdev_printk) while generic_rndis_bind is called.

Thanks.

Here's a revert until these macros get converted to functions.

Signed-off-by: Joe Perches <joe@perches.com>
---
 drivers/net/usb/rndis_host.c |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)



--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Brownell - June 13, 2010, 2:49 a.m.
--- On Sat, 6/12/10, Joe Perches <joe@perches.com> wrote:

> > rndis_host oopses with #define DEBUG, in
> generic_rndis_bind() when  
> > calling netif_dbg(). Problem is that
> (netdev)->dev.parent is NULL

> > (used in netdev_printk) while generic_rndis_bind is
> called.Thanks.

Should have been assigned by SET_NETDEV_DEV()
in usbnet_probe() ... before calling the
bind() routine


Maybe just moving that SET_NETDEV_DEV earlier
would suffice.


> 


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Miller - June 17, 2010, 1:11 a.m.
From: David Brownell <david-b@pacbell.net>
Date: Sat, 12 Jun 2010 19:49:27 -0700 (PDT)

> --- On Sat, 6/12/10, Joe Perches <joe@perches.com> wrote:
> 
>> > rndis_host oopses with #define DEBUG, in
>> generic_rndis_bind() when  
>> > calling netif_dbg(). Problem is that
>> (netdev)->dev.parent is NULL
> 
>> > (used in netdev_printk) while generic_rndis_bind is
>> called.Thanks.
> 
> Should have been assigned by SET_NETDEV_DEV()
> in usbnet_probe() ... before calling the
> bind() routine
> 
> Maybe just moving that SET_NETDEV_DEV earlier
> would suffice.

Can someone please submit a patch which does this?

Thanks!
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/drivers/net/usb/rndis_host.c b/drivers/net/usb/rndis_host.c
index 28d3ee1..49c3044 100644
--- a/drivers/net/usb/rndis_host.c
+++ b/drivers/net/usb/rndis_host.c
@@ -342,8 +342,8 @@  generic_rndis_bind(struct usbnet *dev, struct usb_interface *intf, int flags)
 
 	dev->maxpacket = usb_maxpacket(dev->udev, dev->out, 1);
 	if (dev->maxpacket == 0) {
-		netif_dbg(dev, probe, dev->net,
-			  "dev->maxpacket can't be 0\n");
+		if (netif_msg_probe(dev))
+			dev_dbg(&intf->dev, "dev->maxpacket can't be 0\n");
 		retval = -EINVAL;
 		goto fail_and_release;
 	}
@@ -401,15 +401,17 @@  generic_rndis_bind(struct usbnet *dev, struct usb_interface *intf, int flags)
 	}
 	if ((flags & FLAG_RNDIS_PHYM_WIRELESS) &&
 			*phym != RNDIS_PHYSICAL_MEDIUM_WIRELESS_LAN) {
-		netif_dbg(dev, probe, dev->net,
-			  "driver requires wireless physical medium, but device is not\n");
+		if (netif_msg_probe(dev))
+			dev_dbg(&intf->dev, "driver requires wireless "
+				"physical medium, but device is not.\n");
 		retval = -ENODEV;
 		goto halt_fail_and_release;
 	}
 	if ((flags & FLAG_RNDIS_PHYM_NOT_WIRELESS) &&
 			*phym == RNDIS_PHYSICAL_MEDIUM_WIRELESS_LAN) {
-		netif_dbg(dev, probe, dev->net,
-			  "driver requires non-wireless physical medium, but device is wireless.\n");
+		if (netif_msg_probe(dev))
+			dev_dbg(&intf->dev, "driver requires non-wireless "
+				"physical medium, but device is wireless.\n");
 		retval = -ENODEV;
 		goto halt_fail_and_release;
 	}