aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/via-velocity.h
diff options
context:
space:
mode:
authorEric Dumazet <eric.dumazet@gmail.com>2010-09-15 00:04:31 -0400
committerDavid S. Miller <davem@davemloft.net>2010-09-16 01:06:05 -0400
commit95ae6b228f814fc0528d0506ee9f18ac333d6851 (patch)
treed5287f3dee478e1bd5fa79e63192447c5bc91e92 /drivers/net/via-velocity.h
parent9e0064a5456fd75fd7c70f6f3692c7f732f91a65 (diff)
ipv4: ip_ptr cleanups
dev->ip_ptr is protected by rtnl and rcu. Yet some places dont use appropriate primitives and/or locking rules. Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/via-velocity.h')
-rw-r--r--drivers/net/via-velocity.h11
1 files changed, 7 insertions, 4 deletions
diff --git a/drivers/net/via-velocity.h b/drivers/net/via-velocity.h
index f7b33ae7a703..b5e120b0074b 100644
--- a/drivers/net/via-velocity.h
+++ b/drivers/net/via-velocity.h
@@ -1504,22 +1504,25 @@ struct velocity_info {
1504 * addresses on this chain then we use the first - multi-IP WOL is not 1504 * addresses on this chain then we use the first - multi-IP WOL is not
1505 * supported. 1505 * supported.
1506 * 1506 *
1507 * CHECK ME: locking
1508 */ 1507 */
1509 1508
1510static inline int velocity_get_ip(struct velocity_info *vptr) 1509static inline int velocity_get_ip(struct velocity_info *vptr)
1511{ 1510{
1512 struct in_device *in_dev = (struct in_device *) vptr->dev->ip_ptr; 1511 struct in_device *in_dev;
1513 struct in_ifaddr *ifa; 1512 struct in_ifaddr *ifa;
1513 int res = -ENOENT;
1514 1514
1515 rcu_read_lock();
1516 in_dev = __in_dev_get_rcu(vptr->dev);
1515 if (in_dev != NULL) { 1517 if (in_dev != NULL) {
1516 ifa = (struct in_ifaddr *) in_dev->ifa_list; 1518 ifa = (struct in_ifaddr *) in_dev->ifa_list;
1517 if (ifa != NULL) { 1519 if (ifa != NULL) {
1518 memcpy(vptr->ip_addr, &ifa->ifa_address, 4); 1520 memcpy(vptr->ip_addr, &ifa->ifa_address, 4);
1519 return 0; 1521 res = 0;
1520 } 1522 }
1521 } 1523 }
1522 return -ENOENT; 1524 rcu_read_unlock();
1525 return res;
1523} 1526}
1524 1527
1525/** 1528/**