diff options
author | Wang Chen <wangchen@cn.fujitsu.com> | 2008-11-13 02:37:49 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-11-13 02:37:49 -0500 |
commit | 454d7c9b14e20fd1949e2686e9de4a2926e01476 (patch) | |
tree | fae8bd1bfb5fd496977a0639ad71c54a2ee278ae /drivers/net/3c523.c | |
parent | 7a12122c7a00347da9669cfcde82954c9e3d6f5e (diff) |
netdevice: safe convert to netdev_priv() #part-1
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/3c523.c')
-rw-r--r-- | drivers/net/3c523.c | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/drivers/net/3c523.c b/drivers/net/3c523.c index 0885aeeac98a..59ea2910bcac 100644 --- a/drivers/net/3c523.c +++ b/drivers/net/3c523.c | |||
@@ -308,7 +308,7 @@ static int elmc_open(struct net_device *dev) | |||
308 | 308 | ||
309 | static int __init check586(struct net_device *dev, unsigned long where, unsigned size) | 309 | static int __init check586(struct net_device *dev, unsigned long where, unsigned size) |
310 | { | 310 | { |
311 | struct priv *p = (struct priv *) dev->priv; | 311 | struct priv *p = netdev_priv(dev); |
312 | char *iscp_addrs[2]; | 312 | char *iscp_addrs[2]; |
313 | int i = 0; | 313 | int i = 0; |
314 | 314 | ||
@@ -349,7 +349,7 @@ static int __init check586(struct net_device *dev, unsigned long where, unsigned | |||
349 | 349 | ||
350 | void alloc586(struct net_device *dev) | 350 | void alloc586(struct net_device *dev) |
351 | { | 351 | { |
352 | struct priv *p = (struct priv *) dev->priv; | 352 | struct priv *p = netdev_priv(dev); |
353 | 353 | ||
354 | elmc_id_reset586(); | 354 | elmc_id_reset586(); |
355 | DELAY(2); | 355 | DELAY(2); |
@@ -415,7 +415,7 @@ static int __init do_elmc_probe(struct net_device *dev) | |||
415 | int i = 0; | 415 | int i = 0; |
416 | unsigned int size = 0; | 416 | unsigned int size = 0; |
417 | int retval; | 417 | int retval; |
418 | struct priv *pr = dev->priv; | 418 | struct priv *pr = netdev_priv(dev); |
419 | 419 | ||
420 | if (MCA_bus == 0) { | 420 | if (MCA_bus == 0) { |
421 | return -ENODEV; | 421 | return -ENODEV; |
@@ -578,7 +578,8 @@ err_out: | |||
578 | 578 | ||
579 | static void cleanup_card(struct net_device *dev) | 579 | static void cleanup_card(struct net_device *dev) |
580 | { | 580 | { |
581 | mca_set_adapter_procfn(((struct priv *) (dev->priv))->slot, NULL, NULL); | 581 | mca_set_adapter_procfn(((struct priv *)netdev_priv(dev))->slot, |
582 | NULL, NULL); | ||
582 | release_region(dev->base_addr, ELMC_IO_EXTENT); | 583 | release_region(dev->base_addr, ELMC_IO_EXTENT); |
583 | } | 584 | } |
584 | 585 | ||
@@ -614,7 +615,7 @@ static int init586(struct net_device *dev) | |||
614 | void *ptr; | 615 | void *ptr; |
615 | unsigned long s; | 616 | unsigned long s; |
616 | int i, result = 0; | 617 | int i, result = 0; |
617 | struct priv *p = (struct priv *) dev->priv; | 618 | struct priv *p = netdev_priv(dev); |
618 | volatile struct configure_cmd_struct *cfg_cmd; | 619 | volatile struct configure_cmd_struct *cfg_cmd; |
619 | volatile struct iasetup_cmd_struct *ias_cmd; | 620 | volatile struct iasetup_cmd_struct *ias_cmd; |
620 | volatile struct tdr_cmd_struct *tdr_cmd; | 621 | volatile struct tdr_cmd_struct *tdr_cmd; |
@@ -850,7 +851,7 @@ static void *alloc_rfa(struct net_device *dev, void *ptr) | |||
850 | volatile struct rfd_struct *rfd = (struct rfd_struct *) ptr; | 851 | volatile struct rfd_struct *rfd = (struct rfd_struct *) ptr; |
851 | volatile struct rbd_struct *rbd; | 852 | volatile struct rbd_struct *rbd; |
852 | int i; | 853 | int i; |
853 | struct priv *p = (struct priv *) dev->priv; | 854 | struct priv *p = netdev_priv(dev); |
854 | 855 | ||
855 | memset((char *) rfd, 0, sizeof(struct rfd_struct) * p->num_recv_buffs); | 856 | memset((char *) rfd, 0, sizeof(struct rfd_struct) * p->num_recv_buffs); |
856 | p->rfd_first = rfd; | 857 | p->rfd_first = rfd; |
@@ -911,7 +912,7 @@ elmc_interrupt(int irq, void *dev_id) | |||
911 | } | 912 | } |
912 | /* reading ELMC_CTRL also clears the INT bit. */ | 913 | /* reading ELMC_CTRL also clears the INT bit. */ |
913 | 914 | ||
914 | p = (struct priv *) dev->priv; | 915 | p = netdev_priv(dev); |
915 | 916 | ||
916 | while ((stat = p->scb->status & STAT_MASK)) | 917 | while ((stat = p->scb->status & STAT_MASK)) |
917 | { | 918 | { |
@@ -967,7 +968,7 @@ static void elmc_rcv_int(struct net_device *dev) | |||
967 | unsigned short totlen; | 968 | unsigned short totlen; |
968 | struct sk_buff *skb; | 969 | struct sk_buff *skb; |
969 | struct rbd_struct *rbd; | 970 | struct rbd_struct *rbd; |
970 | struct priv *p = (struct priv *) dev->priv; | 971 | struct priv *p = netdev_priv(dev); |
971 | 972 | ||
972 | for (; (status = p->rfd_top->status) & STAT_COMPL;) { | 973 | for (; (status = p->rfd_top->status) & STAT_COMPL;) { |
973 | rbd = (struct rbd_struct *) make32(p->rfd_top->rbd_offset); | 974 | rbd = (struct rbd_struct *) make32(p->rfd_top->rbd_offset); |
@@ -1010,7 +1011,7 @@ static void elmc_rcv_int(struct net_device *dev) | |||
1010 | 1011 | ||
1011 | static void elmc_rnr_int(struct net_device *dev) | 1012 | static void elmc_rnr_int(struct net_device *dev) |
1012 | { | 1013 | { |
1013 | struct priv *p = (struct priv *) dev->priv; | 1014 | struct priv *p = netdev_priv(dev); |
1014 | 1015 | ||
1015 | dev->stats.rx_errors++; | 1016 | dev->stats.rx_errors++; |
1016 | 1017 | ||
@@ -1033,7 +1034,7 @@ static void elmc_rnr_int(struct net_device *dev) | |||
1033 | static void elmc_xmt_int(struct net_device *dev) | 1034 | static void elmc_xmt_int(struct net_device *dev) |
1034 | { | 1035 | { |
1035 | int status; | 1036 | int status; |
1036 | struct priv *p = (struct priv *) dev->priv; | 1037 | struct priv *p = netdev_priv(dev); |
1037 | 1038 | ||
1038 | status = p->xmit_cmds[p->xmit_last]->cmd_status; | 1039 | status = p->xmit_cmds[p->xmit_last]->cmd_status; |
1039 | if (!(status & STAT_COMPL)) { | 1040 | if (!(status & STAT_COMPL)) { |
@@ -1076,7 +1077,7 @@ static void elmc_xmt_int(struct net_device *dev) | |||
1076 | 1077 | ||
1077 | static void startrecv586(struct net_device *dev) | 1078 | static void startrecv586(struct net_device *dev) |
1078 | { | 1079 | { |
1079 | struct priv *p = (struct priv *) dev->priv; | 1080 | struct priv *p = netdev_priv(dev); |
1080 | 1081 | ||
1081 | p->scb->rfa_offset = make16(p->rfd_first); | 1082 | p->scb->rfa_offset = make16(p->rfd_first); |
1082 | p->scb->cmd = RUC_START; | 1083 | p->scb->cmd = RUC_START; |
@@ -1090,7 +1091,7 @@ static void startrecv586(struct net_device *dev) | |||
1090 | 1091 | ||
1091 | static void elmc_timeout(struct net_device *dev) | 1092 | static void elmc_timeout(struct net_device *dev) |
1092 | { | 1093 | { |
1093 | struct priv *p = (struct priv *) dev->priv; | 1094 | struct priv *p = netdev_priv(dev); |
1094 | /* COMMAND-UNIT active? */ | 1095 | /* COMMAND-UNIT active? */ |
1095 | if (p->scb->status & CU_ACTIVE) { | 1096 | if (p->scb->status & CU_ACTIVE) { |
1096 | #ifdef DEBUG | 1097 | #ifdef DEBUG |
@@ -1126,7 +1127,7 @@ static int elmc_send_packet(struct sk_buff *skb, struct net_device *dev) | |||
1126 | #ifndef NO_NOPCOMMANDS | 1127 | #ifndef NO_NOPCOMMANDS |
1127 | int next_nop; | 1128 | int next_nop; |
1128 | #endif | 1129 | #endif |
1129 | struct priv *p = (struct priv *) dev->priv; | 1130 | struct priv *p = netdev_priv(dev); |
1130 | 1131 | ||
1131 | netif_stop_queue(dev); | 1132 | netif_stop_queue(dev); |
1132 | 1133 | ||
@@ -1197,7 +1198,7 @@ static int elmc_send_packet(struct sk_buff *skb, struct net_device *dev) | |||
1197 | 1198 | ||
1198 | static struct net_device_stats *elmc_get_stats(struct net_device *dev) | 1199 | static struct net_device_stats *elmc_get_stats(struct net_device *dev) |
1199 | { | 1200 | { |
1200 | struct priv *p = (struct priv *) dev->priv; | 1201 | struct priv *p = netdev_priv(dev); |
1201 | unsigned short crc, aln, rsc, ovrn; | 1202 | unsigned short crc, aln, rsc, ovrn; |
1202 | 1203 | ||
1203 | crc = p->scb->crc_errs; /* get error-statistic from the ni82586 */ | 1204 | crc = p->scb->crc_errs; /* get error-statistic from the ni82586 */ |