Patchwork [net-next-2.6] de2104x: use speed defines instead of number

login
register
mail settings
Submitter Jiri Pirko
Date June 1, 2011, 2:14 p.m.
Message ID <1306937677-11101-1-git-send-email-jpirko@redhat.com>
Download mbox | patch
Permalink /patch/98191/
State Rejected
Delegated to: David Miller
Headers show

Comments

Jiri Pirko - June 1, 2011, 2:14 p.m.
Signed-off-by: Jiri Pirko <jpirko@redhat.com>
---
 drivers/net/tulip/de2104x.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
Ben Hutchings - June 1, 2011, 3:46 p.m.
The speed/speed_hi fields are defined to hold speed in Mbit/s, not only
specific values.  I don't see any reason to use the names any more.

Ben.

On Wed, 2011-06-01 at 16:14 +0200, Jiri Pirko wrote:
> Signed-off-by: Jiri Pirko <jpirko@redhat.com>
> ---
>  drivers/net/tulip/de2104x.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/tulip/de2104x.c b/drivers/net/tulip/de2104x.c
> index e2f6923..1cc426d 100644
> --- a/drivers/net/tulip/de2104x.c
> +++ b/drivers/net/tulip/de2104x.c
> @@ -1507,7 +1507,7 @@ static int __de_get_settings(struct de_private *de, struct ethtool_cmd *ecmd)
>  		break;
>  	}
>  
> -	ethtool_cmd_speed_set(ecmd, 10);
> +	ethtool_cmd_speed_set(ecmd, SPEED_10);
>  
>  	if (dr32(MacMode) & FullDuplex)
>  		ecmd->duplex = DUPLEX_FULL;
> @@ -1529,7 +1529,7 @@ static int __de_set_settings(struct de_private *de, struct ethtool_cmd *ecmd)
>  	u32 new_media;
>  	unsigned int media_lock;
>  
> -	if (ethtool_cmd_speed(ecmd) != 10)
> +	if (ethtool_cmd_speed(ecmd) != SPEED_10)
>  		return -EINVAL;
>  	if (ecmd->duplex != DUPLEX_HALF && ecmd->duplex != DUPLEX_FULL)
>  		return -EINVAL;
Jiri Pirko - June 1, 2011, 4:19 p.m.
Wed, Jun 01, 2011 at 05:46:46PM CEST, bhutchings@solarflare.com wrote:
>The speed/speed_hi fields are defined to hold speed in Mbit/s, not only
>specific values.  I don't see any reason to use the names any more.

Do you mean to remove SPEED_X defines in whole code?

>
>Ben.
>
>On Wed, 2011-06-01 at 16:14 +0200, Jiri Pirko wrote:
>> Signed-off-by: Jiri Pirko <jpirko@redhat.com>
>> ---
>>  drivers/net/tulip/de2104x.c |    4 ++--
>>  1 files changed, 2 insertions(+), 2 deletions(-)
>> 
>> diff --git a/drivers/net/tulip/de2104x.c b/drivers/net/tulip/de2104x.c
>> index e2f6923..1cc426d 100644
>> --- a/drivers/net/tulip/de2104x.c
>> +++ b/drivers/net/tulip/de2104x.c
>> @@ -1507,7 +1507,7 @@ static int __de_get_settings(struct de_private *de, struct ethtool_cmd *ecmd)
>>  		break;
>>  	}
>>  
>> -	ethtool_cmd_speed_set(ecmd, 10);
>> +	ethtool_cmd_speed_set(ecmd, SPEED_10);
>>  
>>  	if (dr32(MacMode) & FullDuplex)
>>  		ecmd->duplex = DUPLEX_FULL;
>> @@ -1529,7 +1529,7 @@ static int __de_set_settings(struct de_private *de, struct ethtool_cmd *ecmd)
>>  	u32 new_media;
>>  	unsigned int media_lock;
>>  
>> -	if (ethtool_cmd_speed(ecmd) != 10)
>> +	if (ethtool_cmd_speed(ecmd) != SPEED_10)
>>  		return -EINVAL;
>>  	if (ecmd->duplex != DUPLEX_HALF && ecmd->duplex != DUPLEX_FULL)
>>  		return -EINVAL;
>
>-- 
>Ben Hutchings, Senior Software Engineer, Solarflare
>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@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Ben Hutchings - June 1, 2011, 5:26 p.m.
On Wed, 2011-06-01 at 18:19 +0200, Jiri Pirko wrote:
> Wed, Jun 01, 2011 at 05:46:46PM CEST, bhutchings@solarflare.com wrote:
> >The speed/speed_hi fields are defined to hold speed in Mbit/s, not only
> >specific values.  I don't see any reason to use the names any more.
> 
> Do you mean to remove SPEED_X defines in whole code?
[...]

I have higher priorities - but I would happy to see someone do that.
The definitions have to stay in <linux/ethtool.h> for user space,
though.

Ben.

Patch

diff --git a/drivers/net/tulip/de2104x.c b/drivers/net/tulip/de2104x.c
index e2f6923..1cc426d 100644
--- a/drivers/net/tulip/de2104x.c
+++ b/drivers/net/tulip/de2104x.c
@@ -1507,7 +1507,7 @@  static int __de_get_settings(struct de_private *de, struct ethtool_cmd *ecmd)
 		break;
 	}
 
-	ethtool_cmd_speed_set(ecmd, 10);
+	ethtool_cmd_speed_set(ecmd, SPEED_10);
 
 	if (dr32(MacMode) & FullDuplex)
 		ecmd->duplex = DUPLEX_FULL;
@@ -1529,7 +1529,7 @@  static int __de_set_settings(struct de_private *de, struct ethtool_cmd *ecmd)
 	u32 new_media;
 	unsigned int media_lock;
 
-	if (ethtool_cmd_speed(ecmd) != 10)
+	if (ethtool_cmd_speed(ecmd) != SPEED_10)
 		return -EINVAL;
 	if (ecmd->duplex != DUPLEX_HALF && ecmd->duplex != DUPLEX_FULL)
 		return -EINVAL;