[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Sun, 06 Jul 2008 20:59:05 -0700 (PDT)
From: David Miller <davem@...emloft.net>
To: wangchen@...fujitsu.com
Cc: arjan@...radead.org, netdev@...r.kernel.org
Subject: Re: Printing the driver name as part of the netdev watchdog message
From: Wang Chen <wangchen@...fujitsu.com>
Date: Mon, 07 Jul 2008 09:51:30 +0800
> Arjan van de Ven said the following on 2008-7-7 7:56:
> > +void netdev_drivername(struct net_device *dev, char *buffer, int len)
> > +{
> > + struct device_driver *driver;
> > + struct device *parent;
> > + struct ethtool_drvinfo info;
> > + const struct ethtool_ops *ops = dev->ethtool_ops;
> > +
> > + if (len <= 0)
> > + return;
> > + buffer[0] = 0;
> > +
> > + if (ops->get_drvinfo) {
>
> if (ops && ops->get_drvinfo)
That's right, ethtool_ops could indeed be NULL. It is not
a mandatory facility.
> > + memset(&info, 0, sizeof(info));
> > + info.cmd = ETHTOOL_GDRVINFO;
> > + ops->get_drvinfo(dev, &info);
> > + strlcpy(buffer, info.driver, len);
> > + if (strlen(info.driver) > 0)
> > + return;
> > + }
>
> seems the logic should be:
> if (strlen(info.driver) > 0) {
> strlcpy(buffer, info.driver, len);
> return;
> }
Also correct.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists