All this USB_USBNET_MII trickery is simply not worth it considering how
few code it saves.
As a side effect, this also fixes the following compile error reported
by Toralf Förster:
<-- snip -->
...
LD .tmp_vmlinux1
drivers/built-in.o: In function `usbnet_set_settings':
(.text+0xf1876): undefined reference to `mii_ethtool_sset'
drivers/built-in.o: In function `usbnet_get_settings':
(.text+0xf1836): undefined reference to `mii_ethtool_gset'
drivers/built-in.o: In function `usbnet_get_link':
(.text+0xf18d6): undefined reference to `mii_link_ok'
drivers/built-in.o: In function `usbnet_nway_reset':
(.text+0xf18f6): undefined reference to `mii_nway_restart'
make: *** [.tmp_vmlinux1] Error 1
<-- snip -->
Signed-off-by: Adrian Bunk <bunk@kernel.org>
---
drivers/net/usb/Kconfig | 9 +--------
drivers/net/usb/usbnet.c | 7 -------
2 files changed, 1 insertion(+), 15 deletions(-)
3b7f6290c639b9042fead1698fdbe1c84132c953
diff --git a/drivers/net/usb/Kconfig b/drivers/net/usb/Kconfig
index 5a96d74..a12c9c4 100644
--- a/drivers/net/usb/Kconfig
+++ b/drivers/net/usb/Kconfig
@@ -93,13 +93,9 @@ config USB_RTL8150
To compile this driver as a module, choose M here: the
module will be called rtl8150.
-config USB_USBNET_MII
- tristate
- default n
-
config USB_USBNET
tristate "Multi-purpose USB Networking Framework"
- select MII if USB_USBNET_MII != n
+ select MII
---help---
This driver supports several kinds of network links over USB,
with "minidrivers" built around a common network driver core
@@ -135,7 +131,6 @@ config USB_NET_AX8817X
tristate "ASIX AX88xxx Based USB 2.0 Ethernet Adapters"
depends on USB_USBNET && NET_ETHERNET
select CRC32
- select USB_USBNET_MII
default y
help
This option adds support for ASIX AX88xxx based USB 2.0
@@ -190,7 +185,6 @@ config USB_NET_DM9601
tristate "Davicom DM9601 based USB 1.1 10/100 ethernet devices"
depends on USB_USBNET
select CRC32
- select USB_USBNET_MII
help
This option adds support for Davicom DM9601 based USB 1.1
10/100 Ethernet adapters.
@@ -225,7 +219,6 @@ config USB_NET_PLUSB
config USB_NET_MCS7830
tristate "MosChip MCS7830 based Ethernet adapters"
depends on USB_USBNET
- select USB_USBNET_MII
help
Choose this option if you're using a 10/100 Ethernet USB2
adapter based on the MosChip 7830 controller. This includes
diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c
index acd5f1c..8ed1fc5 100644
--- a/drivers/net/usb/usbnet.c
+++ b/drivers/net/usb/usbnet.c
@@ -683,9 +683,6 @@ done_nopm:
* they'll probably want to use this base set.
*/
-#if defined(CONFIG_MII) || defined(CONFIG_MII_MODULE)
-#define HAVE_MII
-
int usbnet_get_settings (struct net_device *net, struct ethtool_cmd *cmd)
{
struct usbnet *dev = netdev_priv(net);@@ -744,8 +741,6 @@ int usbnet_nway_reset(struct net_device *net)
}
EXPORT_SYMBOL_GPL(usbnet_nway_reset);
-#endif /* HAVE_MII */
-
void usbnet_get_drvinfo (struct net_device *net, struct ethtool_drvinfo *info)
{
struct usbnet *dev = netdev_priv(net);@@ -776,12 +771,10 @@ EXPORT_SYMBOL_GPL(usbnet_set_msglevel);
/* drivers may override default ethtool_ops in their bind() routine */
static struct ethtool_ops usbnet_ethtool_ops = {
-#ifdef HAVE_MII
.get_settings = usbnet_get_settings,
.set_settings = usbnet_set_settings,
.get_link = usbnet_get_link,
.nway_reset = usbnet_nway_reset,
-#endif
.get_drvinfo = usbnet_get_drvinfo,
.get_msglevel = usbnet_get_msglevel,
.set_msglevel = usbnet_set_msglevel,
On Thursday 01 November 2007, Adrian Bunk wrote:
All this USB_USBNET_MII trickery is simply not worth it considering how
few code it saves.
Depends on what systems you're talking about. Forcing unused
code into the kernel is not free, especially if that's made into
a design policy and applied repeatedly to many subsystems.
As a side effect, this also fixes the following compile error reported
by Toralf Förster:
Why not just fix the thing which changed and broke the build?
Or if reverse dependencies can't be made to work sanely, then
have those Ethernet-adapter minidrivers depend on NET_ETHERNET
and then select MII. (To make the relationships be simple
enough that current Kconfig can handle them.)
I have a fair number of usbnet devices. Not one of them needs
MII or NET_ETHERNET.
- Dave
On Thu, Nov 01, 2007 at 04:52:39PM -0700, David Brownell wrote:
On Thursday 01 November 2007, Adrian Bunk wrote:
quoted
All this USB_USBNET_MII trickery is simply not worth it considering how
few code it saves.
Depends on what systems you're talking about. Forcing unused
code into the kernel is not free, especially if that's made into
a design policy and applied repeatedly to many subsystems.
If it was turned into a design policy...
My impression is that in some parts of the kernel every byte gets
counted, while in other parts noone would notice a few kilobytes more or
less.
quoted
As a side effect, this also fixes the following compile error reported
by Toralf Förster:
Why not just fix the thing which changed and broke the build?
Today it's exactly one year since your commit entered the tree.
Dear bug, happy birthday! ;-)
Or if reverse dependencies can't be made to work sanely, then
have those Ethernet-adapter minidrivers depend on NET_ETHERNET
and then select MII. (To make the relationships be simple
enough that current Kconfig can handle them.)
It's not Kconfig's fault that you test for the wrong variable in
usbnet.c ...
I have a fair number of usbnet devices. Not one of them needs
MII or NET_ETHERNET.
I don't understand why you think this bug was in any way related to
NET_ETHERNET - set NET_ETHERNET=y and the bug is still present.
If you insist on the #ifdef's take the patch below - it even saves a few
additional bytes if you have non-usbnet net drivers requiring MII
enabled statically or as modules in your .config but no usbnet drivers
requiring MII.
- Dave
cu
Adrian
<-- snip -->
This patch fixes the following compile error with CONFIG_MII=m,
CONFIG_USB_USBNET=y, CONFIG_USB_USBNET_MII=n:
<-- snip -->
...
LD .tmp_vmlinux1
drivers/built-in.o: In function `usbnet_set_settings':
(.text+0xf1876): undefined reference to `mii_ethtool_sset'
drivers/built-in.o: In function `usbnet_get_settings':
(.text+0xf1836): undefined reference to `mii_ethtool_gset'
drivers/built-in.o: In function `usbnet_get_link':
(.text+0xf18d6): undefined reference to `mii_link_ok'
drivers/built-in.o: In function `usbnet_nway_reset':
(.text+0xf18f6): undefined reference to `mii_nway_restart'
make: *** [.tmp_vmlinux1] Error 1
<-- snip -->
This bug was introduced by commit 18ee91fa9815fa3bb4e51cdcb8229bd0a0f11a70
and reported by Toralf Förster.
Signed-off-by: Adrian Bunk <bunk@kernel.org>
---
BTW:
The Kconfig part of this patch is not really required, but testing for
#if defined(CONFIG_USB_USBNET_MII) || defined(CONFIG_USB_USBNET_MII_MODULE)
would look needlessly ugly.
drivers/net/usb/Kconfig | 5 ++---
drivers/net/usb/usbnet.c | 7 +++----
2 files changed, 5 insertions(+), 7 deletions(-)
a421e4910eb30b140a315e274632e87c7a218df6
diff --git a/drivers/net/usb/Kconfig b/drivers/net/usb/Kconfig
index 5a96d74..9261371 100644
--- a/drivers/net/usb/Kconfig
+++ b/drivers/net/usb/Kconfig
@@ -94,12 +94,11 @@ config USB_RTL8150
module will be called rtl8150.
config USB_USBNET_MII
- tristate
- default n
+ bool
config USB_USBNET
tristate "Multi-purpose USB Networking Framework"
- select MII if USB_USBNET_MII != n
+ select MII if USB_USBNET_MII
---help---
This driver supports several kinds of network links over USB,
with "minidrivers" built around a common network driver core
diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c
index acd5f1c..7393ab0 100644
--- a/drivers/net/usb/usbnet.c
+++ b/drivers/net/usb/usbnet.c
@@ -683,8 +683,7 @@ done_nopm:
* they'll probably want to use this base set.
*/
-#if defined(CONFIG_MII) || defined(CONFIG_MII_MODULE)
-#define HAVE_MII
+#ifdef CONFIG_USB_USBNET_MII
int usbnet_get_settings (struct net_device *net, struct ethtool_cmd *cmd)
{@@ -744,7 +743,7 @@ int usbnet_nway_reset(struct net_device *net)
}
EXPORT_SYMBOL_GPL(usbnet_nway_reset);
-#endif /* HAVE_MII */
+#endif /* CONFIG_USB_USBNET_MII */
void usbnet_get_drvinfo (struct net_device *net, struct ethtool_drvinfo *info)
{@@ -776,7 +775,7 @@ EXPORT_SYMBOL_GPL(usbnet_set_msglevel);
/* drivers may override default ethtool_ops in their bind() routine */
static struct ethtool_ops usbnet_ethtool_ops = {
-#ifdef HAVE_MII
+#ifdef CONFIG_USB_USBNET_MII
.get_settings = usbnet_get_settings,
.set_settings = usbnet_set_settings,
.get_link = usbnet_get_link,
From: Adrian Bunk <bunk@kernel.org>
Date: Thu, 1 Nov 2007 23:25:24 +0100
All this USB_USBNET_MII trickery is simply not worth it considering how
few code it saves.
As a side effect, this also fixes the following compile error reported
by Toralf Förster:
<-- snip -->
...
LD .tmp_vmlinux1
drivers/built-in.o: In function `usbnet_set_settings':
(.text+0xf1876): undefined reference to `mii_ethtool_sset'
drivers/built-in.o: In function `usbnet_get_settings':
(.text+0xf1836): undefined reference to `mii_ethtool_gset'
drivers/built-in.o: In function `usbnet_get_link':
(.text+0xf18d6): undefined reference to `mii_link_ok'
drivers/built-in.o: In function `usbnet_nway_reset':
(.text+0xf18f6): undefined reference to `mii_nway_restart'
make: *** [.tmp_vmlinux1] Error 1
<-- snip -->
Signed-off-by: Adrian Bunk <bunk@kernel.org>
Applied, thanks Adrian.
On Friday 02 November 2007, Adrian Bunk wrote:
<-- snip -->
This patch fixes the following compile error with CONFIG_MII=m,
CONFIG_USB_USBNET=y, CONFIG_USB_USBNET_MII=n:
This is the patch I liked better, if there was going to be
one going upstream without additional test from me ... sorry,
the patch you appear to have accepted was the worst of the
three patches in flight.
quoted hunk
<-- snip -->
...
LD .tmp_vmlinux1
drivers/built-in.o: In function `usbnet_set_settings':
(.text+0xf1876): undefined reference to `mii_ethtool_sset'
drivers/built-in.o: In function `usbnet_get_settings':
(.text+0xf1836): undefined reference to `mii_ethtool_gset'
drivers/built-in.o: In function `usbnet_get_link':
(.text+0xf18d6): undefined reference to `mii_link_ok'
drivers/built-in.o: In function `usbnet_nway_reset':
(.text+0xf18f6): undefined reference to `mii_nway_restart'
make: *** [.tmp_vmlinux1] Error 1
<-- snip -->
This bug was introduced by commit 18ee91fa9815fa3bb4e51cdcb8229bd0a0f11a70
and reported by Toralf Förster.
Signed-off-by: Adrian Bunk <bunk@kernel.org>
---
BTW:
The Kconfig part of this patch is not really required, but testing for
#if defined(CONFIG_USB_USBNET_MII) || defined(CONFIG_USB_USBNET_MII_MODULE)
would look needlessly ugly.
drivers/net/usb/Kconfig | 5 ++---
drivers/net/usb/usbnet.c | 7 +++----
2 files changed, 5 insertions(+), 7 deletions(-)
a421e4910eb30b140a315e274632e87c7a218df6
diff --git a/drivers/net/usb/Kconfig b/drivers/net/usb/Kconfig
index 5a96d74..9261371 100644
--- a/drivers/net/usb/Kconfig
+++ b/drivers/net/usb/Kconfig
@@ -94,12 +94,11 @@ config USB_RTL8150
module will be called rtl8150.
config USB_USBNET_MII
- tristate
- default n
+ bool
config USB_USBNET
tristate "Multi-purpose USB Networking Framework"
- select MII if USB_USBNET_MII != n
+ select MII if USB_USBNET_MII
---help---
This driver supports several kinds of network links over USB,
with "minidrivers" built around a common network driver core
diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c
index acd5f1c..7393ab0 100644
--- a/drivers/net/usb/usbnet.c
+++ b/drivers/net/usb/usbnet.c
@@ -683,8 +683,7 @@ done_nopm:
* they'll probably want to use this base set.
*/
-#if defined(CONFIG_MII) || defined(CONFIG_MII_MODULE)
-#define HAVE_MII
+#ifdef CONFIG_USB_USBNET_MII
int usbnet_get_settings (struct net_device *net, struct ethtool_cmd *cmd)
{@@ -744,7 +743,7 @@ int usbnet_nway_reset(struct net_device *net)
}
EXPORT_SYMBOL_GPL(usbnet_nway_reset);
-#endif /* HAVE_MII */
+#endif /* CONFIG_USB_USBNET_MII */
void usbnet_get_drvinfo (struct net_device *net, struct ethtool_drvinfo *info)
{@@ -776,7 +775,7 @@ EXPORT_SYMBOL_GPL(usbnet_set_msglevel);
/* drivers may override default ethtool_ops in their bind() routine */
static struct ethtool_ops usbnet_ethtool_ops = {
-#ifdef HAVE_MII
+#ifdef CONFIG_USB_USBNET_MII
.get_settings = usbnet_get_settings,
.set_settings = usbnet_set_settings,
.get_link = usbnet_get_link,