aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ni52.c
diff options
context:
space:
mode:
authorWang Chen <wangchen@cn.fujitsu.com>2008-11-13 02:38:14 -0500
committerDavid S. Miller <davem@davemloft.net>2008-11-13 02:38:14 -0500
commit4cf1653aa90c6320dc8032443b5e322820aa28b1 (patch)
tree7920008d3f953defdcda8c81d39da963290d93ad /drivers/net/ni52.c
parent454d7c9b14e20fd1949e2686e9de4a2926e01476 (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/ni52.c')
-rw-r--r--drivers/net/ni52.c36
1 files changed, 18 insertions, 18 deletions
diff --git a/drivers/net/ni52.c b/drivers/net/ni52.c
index 6d7cf3c90fbd..10cfd0f91fc0 100644
--- a/drivers/net/ni52.c
+++ b/drivers/net/ni52.c
@@ -214,7 +214,7 @@ struct priv {
214/* wait for command with timeout: */ 214/* wait for command with timeout: */
215static void wait_for_scb_cmd(struct net_device *dev) 215static void wait_for_scb_cmd(struct net_device *dev)
216{ 216{
217 struct priv *p = dev->priv; 217 struct priv *p = netdev_priv(dev);
218 int i; 218 int i;
219 for (i = 0; i < 16384; i++) { 219 for (i = 0; i < 16384; i++) {
220 if (readb(&p->scb->cmd_cuc) == 0) 220 if (readb(&p->scb->cmd_cuc) == 0)
@@ -233,7 +233,7 @@ static void wait_for_scb_cmd(struct net_device *dev)
233 233
234static void wait_for_scb_cmd_ruc(struct net_device *dev) 234static void wait_for_scb_cmd_ruc(struct net_device *dev)
235{ 235{
236 struct priv *p = dev->priv; 236 struct priv *p = netdev_priv(dev);
237 int i; 237 int i;
238 for (i = 0; i < 16384; i++) { 238 for (i = 0; i < 16384; i++) {
239 if (readb(&p->scb->cmd_ruc) == 0) 239 if (readb(&p->scb->cmd_ruc) == 0)
@@ -298,7 +298,7 @@ static int ni52_open(struct net_device *dev)
298static int check_iscp(struct net_device *dev, void __iomem *addr) 298static int check_iscp(struct net_device *dev, void __iomem *addr)
299{ 299{
300 struct iscp_struct __iomem *iscp = addr; 300 struct iscp_struct __iomem *iscp = addr;
301 struct priv *p = dev->priv; 301 struct priv *p = netdev_priv(dev);
302 memset_io(iscp, 0, sizeof(struct iscp_struct)); 302 memset_io(iscp, 0, sizeof(struct iscp_struct));
303 303
304 writel(make24(iscp), &p->scp->iscp); 304 writel(make24(iscp), &p->scp->iscp);
@@ -318,7 +318,7 @@ static int check_iscp(struct net_device *dev, void __iomem *addr)
318 */ 318 */
319static int check586(struct net_device *dev, unsigned size) 319static int check586(struct net_device *dev, unsigned size)
320{ 320{
321 struct priv *p = dev->priv; 321 struct priv *p = netdev_priv(dev);
322 int i; 322 int i;
323 323
324 p->mapped = ioremap(dev->mem_start, size); 324 p->mapped = ioremap(dev->mem_start, size);
@@ -354,7 +354,7 @@ Enodev:
354 */ 354 */
355static void alloc586(struct net_device *dev) 355static void alloc586(struct net_device *dev)
356{ 356{
357 struct priv *p = (struct priv *) dev->priv; 357 struct priv *p = netdev_priv(dev);
358 358
359 ni_reset586(); 359 ni_reset586();
360 mdelay(32); 360 mdelay(32);
@@ -400,7 +400,7 @@ struct net_device * __init ni52_probe(int unit)
400 if (!dev) 400 if (!dev)
401 return ERR_PTR(-ENOMEM); 401 return ERR_PTR(-ENOMEM);
402 402
403 p = dev->priv; 403 p = netdev_priv(dev);
404 404
405 if (unit >= 0) { 405 if (unit >= 0) {
406 sprintf(dev->name, "eth%d", unit); 406 sprintf(dev->name, "eth%d", unit);
@@ -446,7 +446,7 @@ out:
446static int __init ni52_probe1(struct net_device *dev, int ioaddr) 446static int __init ni52_probe1(struct net_device *dev, int ioaddr)
447{ 447{
448 int i, size, retval; 448 int i, size, retval;
449 struct priv *priv = dev->priv; 449 struct priv *priv = netdev_priv(dev);
450 450
451 dev->base_addr = ioaddr; 451 dev->base_addr = ioaddr;
452 dev->irq = irq; 452 dev->irq = irq;
@@ -588,7 +588,7 @@ static int init586(struct net_device *dev)
588{ 588{
589 void __iomem *ptr; 589 void __iomem *ptr;
590 int i, result = 0; 590 int i, result = 0;
591 struct priv *p = (struct priv *)dev->priv; 591 struct priv *p = netdev_priv(dev);
592 struct configure_cmd_struct __iomem *cfg_cmd; 592 struct configure_cmd_struct __iomem *cfg_cmd;
593 struct iasetup_cmd_struct __iomem *ias_cmd; 593 struct iasetup_cmd_struct __iomem *ias_cmd;
594 struct tdr_cmd_struct __iomem *tdr_cmd; 594 struct tdr_cmd_struct __iomem *tdr_cmd;
@@ -829,7 +829,7 @@ static void __iomem *alloc_rfa(struct net_device *dev, void __iomem *ptr)
829 struct rfd_struct __iomem *rfd = ptr; 829 struct rfd_struct __iomem *rfd = ptr;
830 struct rbd_struct __iomem *rbd; 830 struct rbd_struct __iomem *rbd;
831 int i; 831 int i;
832 struct priv *p = (struct priv *) dev->priv; 832 struct priv *p = netdev_priv(dev);
833 833
834 memset_io(rfd, 0, 834 memset_io(rfd, 0,
835 sizeof(struct rfd_struct) * (p->num_recv_buffs + rfdadd)); 835 sizeof(struct rfd_struct) * (p->num_recv_buffs + rfdadd));
@@ -878,7 +878,7 @@ static irqreturn_t ni52_interrupt(int irq, void *dev_id)
878 int cnt = 0; 878 int cnt = 0;
879 struct priv *p; 879 struct priv *p;
880 880
881 p = (struct priv *) dev->priv; 881 p = netdev_priv(dev);
882 882
883 if (debuglevel > 1) 883 if (debuglevel > 1)
884 printk("I"); 884 printk("I");
@@ -950,7 +950,7 @@ static void ni52_rcv_int(struct net_device *dev)
950 unsigned short totlen; 950 unsigned short totlen;
951 struct sk_buff *skb; 951 struct sk_buff *skb;
952 struct rbd_struct __iomem *rbd; 952 struct rbd_struct __iomem *rbd;
953 struct priv *p = (struct priv *)dev->priv; 953 struct priv *p = netdev_priv(dev);
954 954
955 if (debuglevel > 0) 955 if (debuglevel > 0)
956 printk("R"); 956 printk("R");
@@ -1039,7 +1039,7 @@ static void ni52_rcv_int(struct net_device *dev)
1039 1039
1040static void ni52_rnr_int(struct net_device *dev) 1040static void ni52_rnr_int(struct net_device *dev)
1041{ 1041{
1042 struct priv *p = (struct priv *) dev->priv; 1042 struct priv *p = netdev_priv(dev);
1043 1043
1044 p->stats.rx_errors++; 1044 p->stats.rx_errors++;
1045 1045
@@ -1064,7 +1064,7 @@ static void ni52_rnr_int(struct net_device *dev)
1064static void ni52_xmt_int(struct net_device *dev) 1064static void ni52_xmt_int(struct net_device *dev)
1065{ 1065{
1066 int status; 1066 int status;
1067 struct priv *p = (struct priv *) dev->priv; 1067 struct priv *p = netdev_priv(dev);
1068 1068
1069 if (debuglevel > 0) 1069 if (debuglevel > 0)
1070 printk("X"); 1070 printk("X");
@@ -1112,7 +1112,7 @@ static void ni52_xmt_int(struct net_device *dev)
1112 1112
1113static void startrecv586(struct net_device *dev) 1113static void startrecv586(struct net_device *dev)
1114{ 1114{
1115 struct priv *p = (struct priv *) dev->priv; 1115 struct priv *p = netdev_priv(dev);
1116 1116
1117 wait_for_scb_cmd(dev); 1117 wait_for_scb_cmd(dev);
1118 wait_for_scb_cmd_ruc(dev); 1118 wait_for_scb_cmd_ruc(dev);
@@ -1125,7 +1125,7 @@ static void startrecv586(struct net_device *dev)
1125 1125
1126static void ni52_timeout(struct net_device *dev) 1126static void ni52_timeout(struct net_device *dev)
1127{ 1127{
1128 struct priv *p = (struct priv *) dev->priv; 1128 struct priv *p = netdev_priv(dev);
1129#ifndef NO_NOPCOMMANDS 1129#ifndef NO_NOPCOMMANDS
1130 if (readb(&p->scb->cus) & CU_ACTIVE) { /* COMMAND-UNIT active? */ 1130 if (readb(&p->scb->cus) & CU_ACTIVE) { /* COMMAND-UNIT active? */
1131 netif_wake_queue(dev); 1131 netif_wake_queue(dev);
@@ -1176,7 +1176,7 @@ static int ni52_send_packet(struct sk_buff *skb, struct net_device *dev)
1176#ifndef NO_NOPCOMMANDS 1176#ifndef NO_NOPCOMMANDS
1177 int next_nop; 1177 int next_nop;
1178#endif 1178#endif
1179 struct priv *p = (struct priv *) dev->priv; 1179 struct priv *p = netdev_priv(dev);
1180 1180
1181 if (skb->len > XMIT_BUFF_SIZE) { 1181 if (skb->len > XMIT_BUFF_SIZE) {
1182 printk(KERN_ERR "%s: Sorry, max. framelength is %d bytes. The length of your frame is %d bytes.\n", dev->name, XMIT_BUFF_SIZE, skb->len); 1182 printk(KERN_ERR "%s: Sorry, max. framelength is %d bytes. The length of your frame is %d bytes.\n", dev->name, XMIT_BUFF_SIZE, skb->len);
@@ -1273,7 +1273,7 @@ static int ni52_send_packet(struct sk_buff *skb, struct net_device *dev)
1273 1273
1274static struct net_device_stats *ni52_get_stats(struct net_device *dev) 1274static struct net_device_stats *ni52_get_stats(struct net_device *dev)
1275{ 1275{
1276 struct priv *p = (struct priv *) dev->priv; 1276 struct priv *p = netdev_priv(dev);
1277 unsigned short crc, aln, rsc, ovrn; 1277 unsigned short crc, aln, rsc, ovrn;
1278 1278
1279 /* Get error-statistics from the ni82586 */ 1279 /* Get error-statistics from the ni82586 */
@@ -1336,7 +1336,7 @@ int __init init_module(void)
1336 1336
1337void __exit cleanup_module(void) 1337void __exit cleanup_module(void)
1338{ 1338{
1339 struct priv *p = dev_ni52->priv; 1339 struct priv *p = netdev_priv(dev_ni52);
1340 unregister_netdev(dev_ni52); 1340 unregister_netdev(dev_ni52);
1341 iounmap(p->mapped); 1341 iounmap(p->mapped);
1342 release_region(dev_ni52->base_addr, NI52_TOTAL_SIZE); 1342 release_region(dev_ni52->base_addr, NI52_TOTAL_SIZE);