aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorJulia Lawall <julia@diku.dk>2010-07-20 08:25:17 -0400
committerDavid S. Miller <davem@davemloft.net>2010-07-21 14:16:09 -0400
commitf25c80a4b2bf93c99820f470573626557db35202 (patch)
treec21faae35b8bd88af75d498760ea48378cc827a3 /arch
parentdf1086fb2e160521eda5b19a37b9e25dbc805c39 (diff)
arch/um/drivers: remove duplicate structure field initialization
There are two initializations of ndo_set_mac_address, one to a local function that is not used otherwise and one to a function that is defined elsewhere. The semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // <smpl> @r@ identifier I, s, fld; position p0,p; expression E; @@ struct I s =@p0 { ... .fld@p = E, ...}; @s@ identifier I, s, r.fld; position r.p0,p; expression E; @@ struct I s =@p0 { ... .fld@p = E, ...}; @script:python@ p0 << r.p0; fld << r.fld; ps << s.p; pr << r.p; @@ if int(ps[0].line)<int(pr[0].line) or int(ps[0].column)<int(pr[0].column): cocci.print_main(fld,p0) // </smpl> akpm: - Use the standard eth_mac_addr() in uml_net_set_mac() - Remove unneeded and racy local set_ether_mac() - Remove duplicated (and incorrect) uml_netdev_ops.ndo_set_mac_address initializer. Fixes 8bb95b39a16ed55226810596f92216c53329d2fe ("uml: convert network device to netdevice ops"). [akpm@linux-foundation.org: rework as above] Signed-off-by: Julia Lawall <julia@diku.dk> Cc: Stephen Hemminger <shemminger@vyatta.com> Cc: "David S. Miller" <davem@davemloft.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch')
-rw-r--r--arch/um/drivers/net_kern.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/arch/um/drivers/net_kern.c b/arch/um/drivers/net_kern.c
index f05372694233..2ab233ba32c1 100644
--- a/arch/um/drivers/net_kern.c
+++ b/arch/um/drivers/net_kern.c
@@ -25,11 +25,6 @@
25#include "net_kern.h" 25#include "net_kern.h"
26#include "net_user.h" 26#include "net_user.h"
27 27
28static inline void set_ether_mac(struct net_device *dev, unsigned char *addr)
29{
30 memcpy(dev->dev_addr, addr, ETH_ALEN);
31}
32
33#define DRIVER_NAME "uml-netdev" 28#define DRIVER_NAME "uml-netdev"
34 29
35static DEFINE_SPINLOCK(opened_lock); 30static DEFINE_SPINLOCK(opened_lock);
@@ -266,7 +261,7 @@ static int uml_net_set_mac(struct net_device *dev, void *addr)
266 struct sockaddr *hwaddr = addr; 261 struct sockaddr *hwaddr = addr;
267 262
268 spin_lock_irq(&lp->lock); 263 spin_lock_irq(&lp->lock);
269 set_ether_mac(dev, hwaddr->sa_data); 264 eth_mac_addr(dev, hwaddr->sa_data);
270 spin_unlock_irq(&lp->lock); 265 spin_unlock_irq(&lp->lock);
271 266
272 return 0; 267 return 0;
@@ -380,7 +375,6 @@ static const struct net_device_ops uml_netdev_ops = {
380 .ndo_tx_timeout = uml_net_tx_timeout, 375 .ndo_tx_timeout = uml_net_tx_timeout,
381 .ndo_set_mac_address = uml_net_set_mac, 376 .ndo_set_mac_address = uml_net_set_mac,
382 .ndo_change_mtu = uml_net_change_mtu, 377 .ndo_change_mtu = uml_net_change_mtu,
383 .ndo_set_mac_address = eth_mac_addr,
384 .ndo_validate_addr = eth_validate_addr, 378 .ndo_validate_addr = eth_validate_addr,
385}; 379};
386 380
@@ -478,7 +472,7 @@ static void eth_configure(int n, void *init, char *mac,
478 ((*transport->user->init)(&lp->user, dev) != 0)) 472 ((*transport->user->init)(&lp->user, dev) != 0))
479 goto out_unregister; 473 goto out_unregister;
480 474
481 set_ether_mac(dev, device->mac); 475 eth_mac_addr(dev, device->mac);
482 dev->mtu = transport->user->mtu; 476 dev->mtu = transport->user->mtu;
483 dev->netdev_ops = &uml_netdev_ops; 477 dev->netdev_ops = &uml_netdev_ops;
484 dev->ethtool_ops = &uml_net_ethtool_ops; 478 dev->ethtool_ops = &uml_net_ethtool_ops;