diff options
author | Rasmus Villemoes <linux@rasmusvillemoes.dk> | 2014-12-04 05:30:40 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-12-09 13:45:29 -0500 |
commit | 36c71a735ac2c7046ab1c234c734b2dd9035ad4f (patch) | |
tree | 2e8024ac9d451f26377debdd829c90a1a60dda8f /drivers/net/ethernet/dec | |
parent | c8a73a3568ed071a5b99c365f09f4b015238edb2 (diff) |
net: tulip: Remove private "strncmp"
The comment says that the built-in strncmp didn't work. That is not
surprising, as apparently "str" semantics are not really what is
wanted (hint: de4x5_strncmp only stops when two different bytes are
encountered or the end is reached; not if either byte happens to be
0). de4x5_strncmp is actually a memcmp (except for the signature and
that bytes are not necessarily treated as unsigned char); since only
the boolean value of the result is used we can just replace
de4x5_strncmp with memcmp.
Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Acked-by: Grant Grundler <grundler@parisc-linux.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/dec')
-rw-r--r-- | drivers/net/ethernet/dec/tulip/de4x5.c | 20 |
1 files changed, 3 insertions, 17 deletions
diff --git a/drivers/net/ethernet/dec/tulip/de4x5.c b/drivers/net/ethernet/dec/tulip/de4x5.c index cf8b6ff21613..badff181e719 100644 --- a/drivers/net/ethernet/dec/tulip/de4x5.c +++ b/drivers/net/ethernet/dec/tulip/de4x5.c | |||
@@ -995,7 +995,6 @@ static void de4x5_dbg_mii(struct net_device *dev, int k); | |||
995 | static void de4x5_dbg_media(struct net_device *dev); | 995 | static void de4x5_dbg_media(struct net_device *dev); |
996 | static void de4x5_dbg_srom(struct de4x5_srom *p); | 996 | static void de4x5_dbg_srom(struct de4x5_srom *p); |
997 | static void de4x5_dbg_rx(struct sk_buff *skb, int len); | 997 | static void de4x5_dbg_rx(struct sk_buff *skb, int len); |
998 | static int de4x5_strncmp(char *a, char *b, int n); | ||
999 | static int dc21041_infoleaf(struct net_device *dev); | 998 | static int dc21041_infoleaf(struct net_device *dev); |
1000 | static int dc21140_infoleaf(struct net_device *dev); | 999 | static int dc21140_infoleaf(struct net_device *dev); |
1001 | static int dc21142_infoleaf(struct net_device *dev); | 1000 | static int dc21142_infoleaf(struct net_device *dev); |
@@ -4102,8 +4101,7 @@ get_hw_addr(struct net_device *dev) | |||
4102 | } | 4101 | } |
4103 | 4102 | ||
4104 | /* | 4103 | /* |
4105 | ** Test for enet addresses in the first 32 bytes. The built-in strncmp | 4104 | ** Test for enet addresses in the first 32 bytes. |
4106 | ** didn't seem to work here...? | ||
4107 | */ | 4105 | */ |
4108 | static int | 4106 | static int |
4109 | de4x5_bad_srom(struct de4x5_private *lp) | 4107 | de4x5_bad_srom(struct de4x5_private *lp) |
@@ -4111,8 +4109,8 @@ de4x5_bad_srom(struct de4x5_private *lp) | |||
4111 | int i, status = 0; | 4109 | int i, status = 0; |
4112 | 4110 | ||
4113 | for (i = 0; i < ARRAY_SIZE(enet_det); i++) { | 4111 | for (i = 0; i < ARRAY_SIZE(enet_det); i++) { |
4114 | if (!de4x5_strncmp((char *)&lp->srom, (char *)&enet_det[i], 3) && | 4112 | if (!memcmp(&lp->srom, &enet_det[i], 3) && |
4115 | !de4x5_strncmp((char *)&lp->srom+0x10, (char *)&enet_det[i], 3)) { | 4113 | !memcmp((char *)&lp->srom+0x10, &enet_det[i], 3)) { |
4116 | if (i == 0) { | 4114 | if (i == 0) { |
4117 | status = SMC; | 4115 | status = SMC; |
4118 | } else if (i == 1) { | 4116 | } else if (i == 1) { |
@@ -4125,18 +4123,6 @@ de4x5_bad_srom(struct de4x5_private *lp) | |||
4125 | return status; | 4123 | return status; |
4126 | } | 4124 | } |
4127 | 4125 | ||
4128 | static int | ||
4129 | de4x5_strncmp(char *a, char *b, int n) | ||
4130 | { | ||
4131 | int ret=0; | ||
4132 | |||
4133 | for (;n && !ret; n--) { | ||
4134 | ret = *a++ - *b++; | ||
4135 | } | ||
4136 | |||
4137 | return ret; | ||
4138 | } | ||
4139 | |||
4140 | static void | 4126 | static void |
4141 | srom_repair(struct net_device *dev, int card) | 4127 | srom_repair(struct net_device *dev, int card) |
4142 | { | 4128 | { |