From: Christoph Hellwig <hch@infradead.org>
To: Randy Dunlap <randy.dunlap@oracle.com>
Cc: David Brownell <david-b@pacbell.net>,
toralf.foerster@gmx.de, netdev@vger.kernel.org,
linux-usb-devel@lists.sourceforge.net, link@miggy.org,
greg@kroah.com, akpm@osdl.org, zippel@linux-m68k.org,
torvalds@osdl.org, linux-kernel@vger.kernel.org,
dbrownell@users.sourceforge.net
Subject: Re: [PATCH 2/2] usbnet: use MII hooks only if CONFIG_MII is enabled
Date: Sat, 28 Oct 2006 12:21:22 +0100 [thread overview]
Message-ID: <20061028112122.GA14316@infradead.org> (raw)
In-Reply-To: <20061025165858.b76b4fd8.randy.dunlap@oracle.com>
On Wed, Oct 25, 2006 at 04:58:58PM -0700, Randy Dunlap wrote:
> On Wed, 25 Oct 2006 15:27:09 -0700 David Brownell wrote:
>
> > Instead, "usbnet.c" should #ifdef the relevant ethtool hooks
> > according to CONFIG_MII ... since it's completely legit to
> > use usbnet with peripherals that don't need MII.
>
> ---
> From: Randy Dunlap <randy.dunlap@oracle.com>
>
> usbnet driver should use mii_*() interfaces if they are available
> in the kernel (config enabled) but usbnet does not require or depend
> on these interfaces.
>
> Build tested with CONFIG_MII=y, m, n.
This is really awkward and against what we do in any other driver.
Lots of PCI ethernet drivers use the MII code but have non-MII variants,
and I'd expect usb code to do the same. If you really need to squeeze
the last bytes out of usbnet for some embedded thing add a CONFIG_USB_NET_MII
opention and explain in the help text which devices require it. Otherwise
a normal user has no way to find out why his mii-requiring usb device
randomly stopped working.
>
> Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
> ---
> drivers/usb/net/usbnet.c | 18 ++++++++++++++++++
> 1 file changed, 18 insertions(+)
>
> --- linux-2619-rc3-pv.orig/drivers/usb/net/usbnet.c
> +++ linux-2619-rc3-pv/drivers/usb/net/usbnet.c
> @@ -47,6 +47,12 @@
>
> #define DRIVER_VERSION "22-Aug-2005"
>
> +#if defined(CONFIG_MII) || defined(CONFIG_MII_MODULE)
> +#define HAVE_MII 1
> +#else
> +#define HAVE_MII 0
> +#endif
> +
>
> /*-------------------------------------------------------------------------*/
>
> @@ -676,7 +682,10 @@ int usbnet_get_settings (struct net_devi
> if (!dev->mii.mdio_read)
> return -EOPNOTSUPP;
>
> +#if HAVE_MII
> return mii_ethtool_gset(&dev->mii, cmd);
> +#endif
> + return -EOPNOTSUPP;
> }
> EXPORT_SYMBOL_GPL(usbnet_get_settings);
>
> @@ -688,7 +697,11 @@ int usbnet_set_settings (struct net_devi
> if (!dev->mii.mdio_write)
> return -EOPNOTSUPP;
>
> +#if HAVE_MII
> retval = mii_ethtool_sset(&dev->mii, cmd);
> +#else
> + retval = -EOPNOTSUPP;
> +#endif
>
> /* link speed/duplex might have changed */
> if (dev->driver_info->link_reset)
> @@ -721,9 +734,11 @@ u32 usbnet_get_link (struct net_device *
> if (dev->driver_info->check_connect)
> return dev->driver_info->check_connect (dev) == 0;
>
> +#if HAVE_MII
> /* if the device has mii operations, use those */
> if (dev->mii.mdio_read)
> return mii_link_ok(&dev->mii);
> +#endif
>
> /* Otherwise, say we're up (to avoid breaking scripts) */
> return 1;
> @@ -753,7 +768,10 @@ int usbnet_nway_reset(struct net_device
> if (!dev->mii.mdio_write)
> return -EOPNOTSUPP;
>
> +#if HAVE_MII
> return mii_nway_restart(&dev->mii);
> +#endif
> + return -EOPNOTSUPP;
> }
> EXPORT_SYMBOL_GPL(usbnet_nway_reset);
>
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
---end quoted text---
next prev parent reply other threads:[~2006-10-28 11:21 UTC|newest]
Thread overview: 152+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-10-23 23:22 Linux 2.6.19-rc3 Linus Torvalds
2006-10-24 2:24 ` Gene Heskett
2006-10-24 7:46 ` Muli Ben-Yehuda
2006-10-24 18:07 ` Badari Pulavarty
2006-10-24 20:21 ` 2.6.19-rc3: known unfixed regressions Adrian Bunk
2006-10-24 20:21 ` Adrian Bunk
2006-10-24 20:21 ` Adrian Bunk
2006-10-24 21:44 ` 2.6.19-rc3: known unfixed regressions: confirmations teunis
2006-10-26 15:31 ` Adrian Bunk
2006-10-26 15:54 ` teunis
2006-10-25 1:51 ` 2.6.19-rc3: known regressions with patches Adrian Bunk
2006-10-25 1:51 ` Adrian Bunk
2006-10-25 11:25 ` Linux 2.6.19-rc3 Jean Delvare
2006-10-25 12:01 ` Damien Wyart
2006-10-25 16:25 ` Auke Kok
2006-10-26 7:20 ` Jean Delvare
2006-10-25 20:13 ` Linux 2.6.19-rc3: !CONFIG_NET_ETHERNET unsets CONFIG_PHYLIB, but CONFIG_USB_USBNET also needs CONFIG_PHYLIB Athanasius
2006-10-25 22:17 ` [PATCH] " Randy Dunlap
2006-10-25 22:27 ` David Brownell
2006-10-25 22:27 ` David Brownell
2006-10-25 23:58 ` [PATCH 2/2] usbnet: use MII hooks only if CONFIG_MII is enabled Randy Dunlap
2006-10-26 2:22 ` David Brownell
2006-11-02 7:15 ` Greg KH
2006-11-02 20:29 ` David Brownell
2006-11-03 2:27 ` Adrian Bunk
2006-11-03 2:47 ` David Brownell
2006-11-03 2:58 ` Randy.Dunlap
2006-11-04 2:51 ` [2.6 patch] USB_RTL8150 must select MII Adrian Bunk
2006-10-26 15:46 ` [PATCH 2/2] usbnet: use MII hooks only if CONFIG_MII is enabled Adrian Bunk
2006-10-26 15:51 ` Randy.Dunlap
2006-10-28 11:21 ` Christoph Hellwig [this message]
2006-10-28 21:10 ` David Brownell
2006-10-28 21:13 ` Christoph Hellwig
2006-10-28 22:30 ` David Brownell
2006-10-28 21:39 ` Adrian Bunk
2006-10-31 17:40 ` [linux-usb-devel] " David Brownell
2006-10-31 18:07 ` Adrian Bunk
2006-10-31 19:36 ` David Brownell
2006-11-01 1:23 ` Adrian Bunk
2006-11-02 20:19 ` David Brownell
2006-10-25 23:59 ` [PATCH 1/2] !CONFIG_NET_ETHERNET unsets CONFIG_PHYLIB, but CONFIG_USB_USBNET also needs CONFIG_PHYLIB Randy Dunlap
2006-10-25 23:59 ` Randy Dunlap
2006-10-26 2:24 ` David Brownell
2006-10-26 5:05 ` Randy.Dunlap
2006-10-26 5:24 ` David Brownell
2006-10-26 22:45 ` 2.6.19-rc3: known unfixed regressions (v2) Adrian Bunk
2006-10-26 22:45 ` Adrian Bunk
2006-10-26 22:45 ` Adrian Bunk
2006-10-27 1:02 ` [RFC: 2.6.19 patch] let PCI_MULTITHREAD_PROBE depend on BROKEN Adrian Bunk
2006-10-27 1:20 ` Matthew Wilcox
2006-10-27 1:28 ` Andrew Morton
2006-10-27 2:11 ` Stephen Hemminger
2006-10-27 17:07 ` Greg KH
2006-10-27 17:22 ` Pavel Machek
2006-10-27 18:39 ` Andrew Morton
2006-10-27 18:41 ` vmlinux.lds: consolidate initcall sections Andrew Morton
2006-10-27 18:42 ` [patch] drivers: wait for threaded probes between initcall levels Andrew Morton
2006-10-27 18:47 ` Stephen Hemminger
2006-10-27 20:15 ` Andrew Morton
2006-10-27 20:42 ` Linus Torvalds
2006-10-27 20:48 ` Linus Torvalds
2006-10-28 1:11 ` Greg KH
2006-10-28 1:50 ` Linus Torvalds
2006-10-27 22:59 ` Alan Cox
2006-10-27 23:06 ` Andrew Morton
2006-10-28 5:09 ` Grant Grundler
2006-10-28 5:19 ` Andrew Morton
2006-10-28 5:32 ` Andrew Morton
2006-10-28 6:08 ` Grant Grundler
2006-10-28 20:48 ` Stefan Richter
2006-10-28 23:34 ` Alan Cox
2006-10-29 2:01 ` Randy Dunlap
2006-10-30 9:44 ` Cornelia Huck
2006-10-30 10:48 ` Alan Cox
2006-10-30 12:29 ` Matthew Wilcox
2006-10-27 23:12 ` Olaf Hering
2006-10-27 19:31 ` vmlinux.lds: consolidate initcall sections Haavard Skinnemoen
2006-10-29 10:21 ` Geert Uytterhoeven
2006-10-27 19:44 ` Matthew Wilcox
2006-10-27 20:17 ` Andrew Morton
2006-10-27 20:27 ` Matthew Wilcox
2006-10-27 22:23 ` [RFC: 2.6.19 patch] let PCI_MULTITHREAD_PROBE depend on BROKEN Adrian Bunk
2006-10-27 22:38 ` Andrew Morton
2006-10-28 1:08 ` Greg KH
2006-10-27 23:03 ` Alan Cox
2006-10-27 22:57 ` Alan Cox
2006-10-27 8:27 ` Pavel Machek
2006-10-29 23:13 ` 2.6.19-rc3: known unfixed regressions (v3) Adrian Bunk
2006-10-29 23:13 ` Adrian Bunk
2006-10-30 13:56 ` Michael S. Tsirkin
2006-10-30 13:56 ` Michael S. Tsirkin
2006-10-30 15:27 ` Martin Lorenz
2006-10-30 16:17 ` Jun'ichi Nomura
2006-10-30 16:32 ` Michael S. Tsirkin
2006-10-30 17:20 ` Jun'ichi Nomura
2006-10-30 17:20 ` Jun'ichi Nomura
2006-10-30 17:54 ` Michael S. Tsirkin
2006-10-30 17:54 ` Michael S. Tsirkin
2006-10-30 16:44 ` Linus Torvalds
2006-10-30 17:34 ` Jun'ichi Nomura
2006-10-30 18:16 ` Linus Torvalds
2006-10-30 18:16 ` Linus Torvalds
2006-10-30 18:35 ` Adrian Bunk
2006-10-30 19:00 ` Michael S. Tsirkin
2006-10-30 19:06 ` Hugh Dickins
2006-10-31 12:47 ` Martin Lorenz
2006-10-30 18:58 ` Michael S. Tsirkin
2006-10-31 21:15 ` Michael S. Tsirkin
2006-10-31 21:15 ` Michael S. Tsirkin
2006-11-01 3:01 ` 2.6.19-rc <-> ThinkPads Adrian Bunk
2006-11-01 3:15 ` Len Brown
2006-11-01 3:15 ` Len Brown
2006-11-01 5:11 ` Ernst Herzberg
2006-11-01 5:26 ` Linus Torvalds
2006-11-01 5:26 ` Linus Torvalds
2006-11-01 5:54 ` Michael S. Tsirkin
2006-11-01 5:54 ` Michael S. Tsirkin
2006-11-01 6:16 ` Linus Torvalds
2006-11-01 6:16 ` Linus Torvalds
2006-11-01 17:25 ` Andi Kleen
2006-11-01 18:12 ` Michael S. Tsirkin
2006-11-01 18:12 ` Michael S. Tsirkin
2006-11-01 18:25 ` Linus Torvalds
2006-11-01 18:25 ` Linus Torvalds
2006-11-01 19:33 ` Michael S. Tsirkin
2006-11-01 19:33 ` Michael S. Tsirkin
2006-11-01 19:44 ` Linus Torvalds
2006-11-01 19:44 ` Linus Torvalds
2006-11-01 19:34 ` Andi Kleen
2006-11-01 19:52 ` Linus Torvalds
2006-11-01 19:52 ` Linus Torvalds
2006-11-01 21:15 ` Andi Kleen
2006-11-01 21:15 ` Andi Kleen
2006-11-01 22:35 ` Bill Davidsen
2006-11-01 22:35 ` Bill Davidsen
2006-11-01 6:18 ` Michael S. Tsirkin
2006-11-01 6:18 ` Michael S. Tsirkin
2006-11-01 9:33 ` Pavel Machek
2006-11-01 12:02 ` Michael S. Tsirkin
2006-11-01 12:02 ` Michael S. Tsirkin
2006-11-01 17:17 ` Andi Kleen
2006-11-01 13:50 ` Stefan Seyfried
2006-11-01 13:50 ` Stefan Seyfried
2006-11-01 16:36 ` Hugh Dickins
2006-11-01 16:36 ` Hugh Dickins
2006-11-04 3:49 ` 2.6.19-rc <-> ThinkPads, summary Adrian Bunk
2006-11-04 13:51 ` Hugh Dickins
2006-11-04 14:04 ` Russell King
2006-11-05 6:23 ` Adrian Bunk
2006-11-07 20:06 ` Russell King
2006-11-07 20:19 ` Ernst Herzberg
2006-11-17 1:53 ` 2.6.19-rc <-> ThinkPads, (related Ubuntu bug report) Mark Stosberg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20061028112122.GA14316@infradead.org \
--to=hch@infradead.org \
--cc=akpm@osdl.org \
--cc=david-b@pacbell.net \
--cc=dbrownell@users.sourceforge.net \
--cc=greg@kroah.com \
--cc=link@miggy.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb-devel@lists.sourceforge.net \
--cc=netdev@vger.kernel.org \
--cc=randy.dunlap@oracle.com \
--cc=toralf.foerster@gmx.de \
--cc=torvalds@osdl.org \
--cc=zippel@linux-m68k.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.