diff mbox

[net-next-2.6] br: remove redundant check and init

Message ID 1314883778-2706-1-git-send-email-jpirko@redhat.com
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

Jiri Pirko Sept. 1, 2011, 1:29 p.m. UTC
Since these checks and initialization are done in
dev_ethtool_get_settings called later on, remove this redundancy.

Signed-off-by: Jiri Pirko <jpirko@redhat.com>
---
 net/bridge/br_if.c |   24 +++++++++++-------------
 1 files changed, 11 insertions(+), 13 deletions(-)

Comments

stephen hemminger Sept. 1, 2011, 4:07 p.m. UTC | #1
On Thu,  1 Sep 2011 15:29:38 +0200
Jiri Pirko <jpirko@redhat.com> wrote:

> Since these checks and initialization are done in
> dev_ethtool_get_settings called later on, remove this redundancy.
> 
> Signed-off-by: Jiri Pirko <jpirko@redhat.com>
> ---
>  net/bridge/br_if.c |   24 +++++++++++-------------
>  1 files changed, 11 insertions(+), 13 deletions(-)
> 
> diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c
> index 2cdf007..b365bba 100644
> --- a/net/bridge/br_if.c
> +++ b/net/bridge/br_if.c
> @@ -33,20 +33,18 @@
>   */
>  static int port_cost(struct net_device *dev)
>  {
> -	if (dev->ethtool_ops && dev->ethtool_ops->get_settings) {
> -		struct ethtool_cmd ecmd = { .cmd = ETHTOOL_GSET, };
> -
> -		if (!dev_ethtool_get_settings(dev, &ecmd)) {
> -			switch (ethtool_cmd_speed(&ecmd)) {
> -			case SPEED_10000:
> -				return 2;
> -			case SPEED_1000:
> -				return 4;
> -			case SPEED_100:
> -				return 19;
> -			case SPEED_10:
> -				return 100;
> -			}
> +	struct ethtool_cmd ecmd;
> +
> +	if (!dev_ethtool_get_settings(dev, &ecmd)) {
> +		switch (ethtool_cmd_speed(&ecmd)) {
> +		case SPEED_10000:
> +			return 2;
> +		case SPEED_1000:
> +			return 4;
> +		case SPEED_100:
> +			return 19;
> +		case SPEED_10:
> +			return 100;
>  		}
>  	}
>  

Yeah, this code predates when ethtool was sane about ops

Acked-by: Stephen Hemminger <shemminger@vyatta.com>
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Miller Sept. 15, 2011, 7:43 p.m. UTC | #2
From: Jiri Pirko <jpirko@redhat.com>
Date: Thu,  1 Sep 2011 15:29:38 +0200

> Since these checks and initialization are done in
> dev_ethtool_get_settings called later on, remove this redundancy.
> 
> Signed-off-by: Jiri Pirko <jpirko@redhat.com>

Applied.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c
index 2cdf007..b365bba 100644
--- a/net/bridge/br_if.c
+++ b/net/bridge/br_if.c
@@ -33,20 +33,18 @@ 
  */
 static int port_cost(struct net_device *dev)
 {
-	if (dev->ethtool_ops && dev->ethtool_ops->get_settings) {
-		struct ethtool_cmd ecmd = { .cmd = ETHTOOL_GSET, };
-
-		if (!dev_ethtool_get_settings(dev, &ecmd)) {
-			switch (ethtool_cmd_speed(&ecmd)) {
-			case SPEED_10000:
-				return 2;
-			case SPEED_1000:
-				return 4;
-			case SPEED_100:
-				return 19;
-			case SPEED_10:
-				return 100;
-			}
+	struct ethtool_cmd ecmd;
+
+	if (!dev_ethtool_get_settings(dev, &ecmd)) {
+		switch (ethtool_cmd_speed(&ecmd)) {
+		case SPEED_10000:
+			return 2;
+		case SPEED_1000:
+			return 4;
+		case SPEED_100:
+			return 19;
+		case SPEED_10:
+			return 100;
 		}
 	}