diff options
author | Wang Chen <wangchen@cn.fujitsu.com> | 2008-11-13 02:39:10 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-11-13 02:39:10 -0500 |
commit | 524ad0a79126efabf58d0a49eace6155ab5b4549 (patch) | |
tree | 927e79d7d28d2c563c5beba74f06527df564e31c /net/atm/mpc.c | |
parent | 8f15ea42b64941001a401cf855a0869e24f3a845 (diff) |
netdevice: safe convert to netdev_priv() #part-4
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 'net/atm/mpc.c')
-rw-r--r-- | net/atm/mpc.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/net/atm/mpc.c b/net/atm/mpc.c index 010b1d2a5a8..12e9ea371db 100644 --- a/net/atm/mpc.c +++ b/net/atm/mpc.c | |||
@@ -785,7 +785,7 @@ static int atm_mpoa_mpoad_attach (struct atm_vcc *vcc, int arg) | |||
785 | } | 785 | } |
786 | 786 | ||
787 | if (mpc->dev) { /* check if the lec is LANE2 capable */ | 787 | if (mpc->dev) { /* check if the lec is LANE2 capable */ |
788 | priv = (struct lec_priv *)mpc->dev->priv; | 788 | priv = netdev_priv(mpc->dev); |
789 | if (priv->lane_version < 2) { | 789 | if (priv->lane_version < 2) { |
790 | dev_put(mpc->dev); | 790 | dev_put(mpc->dev); |
791 | mpc->dev = NULL; | 791 | mpc->dev = NULL; |
@@ -845,7 +845,7 @@ static void mpoad_close(struct atm_vcc *vcc) | |||
845 | 845 | ||
846 | mpc->mpoad_vcc = NULL; | 846 | mpc->mpoad_vcc = NULL; |
847 | if (mpc->dev) { | 847 | if (mpc->dev) { |
848 | struct lec_priv *priv = (struct lec_priv *)mpc->dev->priv; | 848 | struct lec_priv *priv = netdev_priv(mpc->dev); |
849 | priv->lane2_ops->associate_indicator = NULL; | 849 | priv->lane2_ops->associate_indicator = NULL; |
850 | stop_mpc(mpc); | 850 | stop_mpc(mpc); |
851 | dev_put(mpc->dev); | 851 | dev_put(mpc->dev); |
@@ -976,7 +976,7 @@ static int mpoa_event_listener(struct notifier_block *mpoa_notifier, unsigned lo | |||
976 | 976 | ||
977 | switch (event) { | 977 | switch (event) { |
978 | case NETDEV_REGISTER: /* a new lec device was allocated */ | 978 | case NETDEV_REGISTER: /* a new lec device was allocated */ |
979 | priv = (struct lec_priv *)dev->priv; | 979 | priv = netdev_priv(dev); |
980 | if (priv->lane_version < 2) | 980 | if (priv->lane_version < 2) |
981 | break; | 981 | break; |
982 | priv->lane2_ops->associate_indicator = lane2_assoc_ind; | 982 | priv->lane2_ops->associate_indicator = lane2_assoc_ind; |
@@ -1324,7 +1324,7 @@ static void set_mpc_ctrl_addr_rcvd(struct k_message *mesg, struct mpoa_client *m | |||
1324 | dprintk("\n"); | 1324 | dprintk("\n"); |
1325 | 1325 | ||
1326 | if (mpc->dev) { | 1326 | if (mpc->dev) { |
1327 | priv = (struct lec_priv *)mpc->dev->priv; | 1327 | priv = netdev_priv(mpc->dev); |
1328 | retval = priv->lane2_ops->associate_req(mpc->dev, mpc->dev->dev_addr, tlv, sizeof(tlv)); | 1328 | retval = priv->lane2_ops->associate_req(mpc->dev, mpc->dev->dev_addr, tlv, sizeof(tlv)); |
1329 | if (retval == 0) | 1329 | if (retval == 0) |
1330 | printk("mpoa: (%s) MPOA device type TLV association failed\n", mpc->dev->name); | 1330 | printk("mpoa: (%s) MPOA device type TLV association failed\n", mpc->dev->name); |
@@ -1474,7 +1474,7 @@ static void __exit atm_mpoa_cleanup(void) | |||
1474 | tmp = mpc->next; | 1474 | tmp = mpc->next; |
1475 | if (mpc->dev != NULL) { | 1475 | if (mpc->dev != NULL) { |
1476 | stop_mpc(mpc); | 1476 | stop_mpc(mpc); |
1477 | priv = (struct lec_priv *)mpc->dev->priv; | 1477 | priv = netdev_priv(mpc->dev); |
1478 | if (priv->lane2_ops != NULL) | 1478 | if (priv->lane2_ops != NULL) |
1479 | priv->lane2_ops->associate_indicator = NULL; | 1479 | priv->lane2_ops->associate_indicator = NULL; |
1480 | } | 1480 | } |