diff options
author | Wang Chen <wangchen@cn.fujitsu.com> | 2008-11-13 02:38:14 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-11-13 02:38:14 -0500 |
commit | 4cf1653aa90c6320dc8032443b5e322820aa28b1 (patch) | |
tree | 7920008d3f953defdcda8c81d39da963290d93ad /drivers/net/rionet.c | |
parent | 454d7c9b14e20fd1949e2686e9de4a2926e01476 (diff) |
netdevice: safe convert to netdev_priv() #part-2
We have some reasons to kill netdev->priv:
1. netdev->priv is equal to netdev_priv().
2. netdev_priv() wraps the calculation of netdev->priv's offset, obviously
netdev_priv() is more flexible than netdev->priv.
But we cann't kill netdev->priv, because so many drivers reference to it
directly.
This patch is a safe convert for netdev->priv to netdev_priv(netdev).
Since all of the netdev->priv is only for read.
But it is too big to be sent in one mail.
I split it to 4 parts and make every part smaller than 100,000 bytes,
which is max size allowed by vger.
Signed-off-by: Wang Chen <wangchen@cn.fujitsu.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/rionet.c')
-rw-r--r-- | drivers/net/rionet.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/drivers/net/rionet.c b/drivers/net/rionet.c index bd4f4ad5d360..a6fd27a2cc3d 100644 --- a/drivers/net/rionet.c +++ b/drivers/net/rionet.c | |||
@@ -94,7 +94,7 @@ static int rionet_rx_clean(struct net_device *ndev) | |||
94 | { | 94 | { |
95 | int i; | 95 | int i; |
96 | int error = 0; | 96 | int error = 0; |
97 | struct rionet_private *rnet = ndev->priv; | 97 | struct rionet_private *rnet = netdev_priv(ndev); |
98 | void *data; | 98 | void *data; |
99 | 99 | ||
100 | i = rnet->rx_slot; | 100 | i = rnet->rx_slot; |
@@ -132,7 +132,7 @@ static int rionet_rx_clean(struct net_device *ndev) | |||
132 | static void rionet_rx_fill(struct net_device *ndev, int end) | 132 | static void rionet_rx_fill(struct net_device *ndev, int end) |
133 | { | 133 | { |
134 | int i; | 134 | int i; |
135 | struct rionet_private *rnet = ndev->priv; | 135 | struct rionet_private *rnet = netdev_priv(ndev); |
136 | 136 | ||
137 | i = rnet->rx_slot; | 137 | i = rnet->rx_slot; |
138 | do { | 138 | do { |
@@ -151,7 +151,7 @@ static void rionet_rx_fill(struct net_device *ndev, int end) | |||
151 | static int rionet_queue_tx_msg(struct sk_buff *skb, struct net_device *ndev, | 151 | static int rionet_queue_tx_msg(struct sk_buff *skb, struct net_device *ndev, |
152 | struct rio_dev *rdev) | 152 | struct rio_dev *rdev) |
153 | { | 153 | { |
154 | struct rionet_private *rnet = ndev->priv; | 154 | struct rionet_private *rnet = netdev_priv(ndev); |
155 | 155 | ||
156 | rio_add_outb_message(rnet->mport, rdev, 0, skb->data, skb->len); | 156 | rio_add_outb_message(rnet->mport, rdev, 0, skb->data, skb->len); |
157 | rnet->tx_skb[rnet->tx_slot] = skb; | 157 | rnet->tx_skb[rnet->tx_slot] = skb; |
@@ -175,7 +175,7 @@ static int rionet_queue_tx_msg(struct sk_buff *skb, struct net_device *ndev, | |||
175 | static int rionet_start_xmit(struct sk_buff *skb, struct net_device *ndev) | 175 | static int rionet_start_xmit(struct sk_buff *skb, struct net_device *ndev) |
176 | { | 176 | { |
177 | int i; | 177 | int i; |
178 | struct rionet_private *rnet = ndev->priv; | 178 | struct rionet_private *rnet = netdev_priv(ndev); |
179 | struct ethhdr *eth = (struct ethhdr *)skb->data; | 179 | struct ethhdr *eth = (struct ethhdr *)skb->data; |
180 | u16 destid; | 180 | u16 destid; |
181 | unsigned long flags; | 181 | unsigned long flags; |
@@ -215,7 +215,7 @@ static void rionet_dbell_event(struct rio_mport *mport, void *dev_id, u16 sid, u | |||
215 | u16 info) | 215 | u16 info) |
216 | { | 216 | { |
217 | struct net_device *ndev = dev_id; | 217 | struct net_device *ndev = dev_id; |
218 | struct rionet_private *rnet = ndev->priv; | 218 | struct rionet_private *rnet = netdev_priv(ndev); |
219 | struct rionet_peer *peer; | 219 | struct rionet_peer *peer; |
220 | 220 | ||
221 | if (netif_msg_intr(rnet)) | 221 | if (netif_msg_intr(rnet)) |
@@ -243,7 +243,7 @@ static void rionet_inb_msg_event(struct rio_mport *mport, void *dev_id, int mbox | |||
243 | { | 243 | { |
244 | int n; | 244 | int n; |
245 | struct net_device *ndev = dev_id; | 245 | struct net_device *ndev = dev_id; |
246 | struct rionet_private *rnet = (struct rionet_private *)ndev->priv; | 246 | struct rionet_private *rnet = netdev_priv(ndev); |
247 | 247 | ||
248 | if (netif_msg_intr(rnet)) | 248 | if (netif_msg_intr(rnet)) |
249 | printk(KERN_INFO "%s: inbound message event, mbox %d slot %d\n", | 249 | printk(KERN_INFO "%s: inbound message event, mbox %d slot %d\n", |
@@ -258,7 +258,7 @@ static void rionet_inb_msg_event(struct rio_mport *mport, void *dev_id, int mbox | |||
258 | static void rionet_outb_msg_event(struct rio_mport *mport, void *dev_id, int mbox, int slot) | 258 | static void rionet_outb_msg_event(struct rio_mport *mport, void *dev_id, int mbox, int slot) |
259 | { | 259 | { |
260 | struct net_device *ndev = dev_id; | 260 | struct net_device *ndev = dev_id; |
261 | struct rionet_private *rnet = ndev->priv; | 261 | struct rionet_private *rnet = netdev_priv(ndev); |
262 | 262 | ||
263 | spin_lock(&rnet->lock); | 263 | spin_lock(&rnet->lock); |
264 | 264 | ||
@@ -287,7 +287,7 @@ static int rionet_open(struct net_device *ndev) | |||
287 | int i, rc = 0; | 287 | int i, rc = 0; |
288 | struct rionet_peer *peer, *tmp; | 288 | struct rionet_peer *peer, *tmp; |
289 | u32 pwdcsr; | 289 | u32 pwdcsr; |
290 | struct rionet_private *rnet = ndev->priv; | 290 | struct rionet_private *rnet = netdev_priv(ndev); |
291 | 291 | ||
292 | if (netif_msg_ifup(rnet)) | 292 | if (netif_msg_ifup(rnet)) |
293 | printk(KERN_INFO "%s: open\n", DRV_NAME); | 293 | printk(KERN_INFO "%s: open\n", DRV_NAME); |
@@ -351,7 +351,7 @@ static int rionet_open(struct net_device *ndev) | |||
351 | 351 | ||
352 | static int rionet_close(struct net_device *ndev) | 352 | static int rionet_close(struct net_device *ndev) |
353 | { | 353 | { |
354 | struct rionet_private *rnet = (struct rionet_private *)ndev->priv; | 354 | struct rionet_private *rnet = netdev_priv(ndev); |
355 | struct rionet_peer *peer, *tmp; | 355 | struct rionet_peer *peer, *tmp; |
356 | int i; | 356 | int i; |
357 | 357 | ||
@@ -400,7 +400,7 @@ static void rionet_remove(struct rio_dev *rdev) | |||
400 | static void rionet_get_drvinfo(struct net_device *ndev, | 400 | static void rionet_get_drvinfo(struct net_device *ndev, |
401 | struct ethtool_drvinfo *info) | 401 | struct ethtool_drvinfo *info) |
402 | { | 402 | { |
403 | struct rionet_private *rnet = ndev->priv; | 403 | struct rionet_private *rnet = netdev_priv(ndev); |
404 | 404 | ||
405 | strcpy(info->driver, DRV_NAME); | 405 | strcpy(info->driver, DRV_NAME); |
406 | strcpy(info->version, DRV_VERSION); | 406 | strcpy(info->version, DRV_VERSION); |
@@ -410,14 +410,14 @@ static void rionet_get_drvinfo(struct net_device *ndev, | |||
410 | 410 | ||
411 | static u32 rionet_get_msglevel(struct net_device *ndev) | 411 | static u32 rionet_get_msglevel(struct net_device *ndev) |
412 | { | 412 | { |
413 | struct rionet_private *rnet = ndev->priv; | 413 | struct rionet_private *rnet = netdev_priv(ndev); |
414 | 414 | ||
415 | return rnet->msg_enable; | 415 | return rnet->msg_enable; |
416 | } | 416 | } |
417 | 417 | ||
418 | static void rionet_set_msglevel(struct net_device *ndev, u32 value) | 418 | static void rionet_set_msglevel(struct net_device *ndev, u32 value) |
419 | { | 419 | { |
420 | struct rionet_private *rnet = ndev->priv; | 420 | struct rionet_private *rnet = netdev_priv(ndev); |
421 | 421 | ||
422 | rnet->msg_enable = value; | 422 | rnet->msg_enable = value; |
423 | } | 423 | } |
@@ -455,7 +455,7 @@ static int rionet_setup_netdev(struct rio_mport *mport) | |||
455 | RIO_MAX_ROUTE_ENTRIES(mport->sys_size)); | 455 | RIO_MAX_ROUTE_ENTRIES(mport->sys_size)); |
456 | 456 | ||
457 | /* Set up private area */ | 457 | /* Set up private area */ |
458 | rnet = (struct rionet_private *)ndev->priv; | 458 | rnet = netdev_priv(ndev); |
459 | rnet->mport = mport; | 459 | rnet->mport = mport; |
460 | 460 | ||
461 | /* Set the default MAC address */ | 461 | /* Set the default MAC address */ |