Subject: Re: [PATCH] usbnet: Do not implement ethtool get_link() if link state is unknown

From: David Brownell <[email-masked]>
Date: Mon, 2 Nov 2009 23:01:30 -0700

On Monday 02 November 2009, Ben Hutchings wrote:
> @@ -854,7 +854,7 @@ void usbnet_set_msglevel (struct net_device *net, u32 level)
>  EXPORT_SYMBOL_GPL(usbnet_set_msglevel);
>  
>  /* drivers may override default ethtool_ops in their bind() routine */
> -static const struct ethtool_ops usbnet_ethtool_ops = {
> +static const struct ethtool_ops usbnet_get_link_ethtool_ops = {
>         .get_settings           = usbnet_get_settings,
>         .set_settings           = usbnet_set_settings,
>         .get_link               = usbnet_get_link,
> @@ -864,6 +864,15 @@ static const struct ethtool_ops usbnet_ethtool_ops = {
>         .set_msglevel           = usbnet_set_msglevel,
>  };
>  
> +static const struct ethtool_ops usbnet_ethtool_ops = {
> +       .get_settings           = usbnet_get_settings,
> +       .set_settings           = usbnet_set_settings,

Surely there's a code that usbnet_get_link() could return
to say "I can't really tell"?

And if there isn't, there should be one.

Having two tables for this is needlessly ugly.

> +       .nway_reset             = usbnet_nway_reset,
> +       .get_drvinfo            = usbnet_get_drvinfo,
> +       .get_msglevel           = usbnet_get_msglevel,
> +       .set_msglevel           = usbnet_set_msglevel,
> +};
> +
>  /*-------------------------------------------------------------------------*/
>  
>  /* work that cannot be done in interrupt context uses keventd.