[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1296341043.3477.64.camel@localhost>
Date: Sun, 30 Jan 2011 08:44:03 +1000
From: Ben Hutchings <bhutchings@...arflare.com>
To: Michał Mirosław <mirq-linux@...e.qmqm.pl>
Cc: netdev@...r.kernel.org
Subject: Re: [PATCH v3 3/5] net: use ndo_fix_features for
ethtool_ops->set_flags
On Sat, 2011-01-29 at 19:39 +0100, Michał Mirosław wrote:
> Signed-off-by: Michał Mirosław <mirq-linux@...e.qmqm.pl>
> ---
> net/core/ethtool.c | 22 ++++++++++++++++++++--
> 1 files changed, 20 insertions(+), 2 deletions(-)
>
> diff --git a/net/core/ethtool.c b/net/core/ethtool.c
> index 409aebb..17a689f4 100644
> --- a/net/core/ethtool.c
> +++ b/net/core/ethtool.c
> @@ -240,6 +240,25 @@ static int ethtool_set_features(struct net_device *dev, void __user *useraddr)
> return ret;
> }
>
> +static int __ethtool_set_flags(struct net_device *dev, u32 data)
> +{
> + if (data & ~flags_dup_features)
> + return -EINVAL;
> +
> + if (!(dev->hw_features & flags_dup_features)) {
> + if (!dev->ethtool_ops->set_flags)
> + return -EOPNOTSUPP;
> + return dev->ethtool_ops->set_flags(dev, data);
> + }
> +
> + dev->wanted_features =
> + (dev->wanted_features & ~flags_dup_features) | data;
> +
> + netdev_update_features(dev);
> +
> + return 0;
[...]
I think it would be clearer to write this as:
if (dev->hw_features & flags_dup_features) {
dev->wanted_features =
(dev->wanted_features & ~flags_dup_features) | data;
netdev_update_features(dev);
return 0;
}
if (dev->ethtool_ops->set_flags)
return dev->ethtool_ops->set_flags(dev, data);
return -EOPNOTSUPP;
Ben.
--
Ben Hutchings, Senior Software Engineer, Solarflare Communications
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
--
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