aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ni52.c
diff options
context:
space:
mode:
authorAl Viro <viro@ftp.linux.org.uk>2008-03-19 05:44:09 -0400
committerJeff Garzik <jeff@garzik.org>2008-03-26 00:18:02 -0400
commit7f8cfd560875fd643024c02ea25d4f3b8f1fd31c (patch)
tree143205269d2f04732a843e5a1de2c7a60d315ea6 /drivers/net/ni52.c
parente06ee2bb03f936c57265e447bc05e8324db61207 (diff)
ni52: clean up initialization of priv
* initialize spinlock once * check586() used to be done before we'd allocated ->priv; these days it's there from the very beginning, so we don't have to play with private copy. Consequently, we don't need to mess with reinitializing ->base, etc. afterwards. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/net/ni52.c')
-rw-r--r--drivers/net/ni52.c21
1 files changed, 7 insertions, 14 deletions
diff --git a/drivers/net/ni52.c b/drivers/net/ni52.c
index 8eac7146a884..3b1c4af615b6 100644
--- a/drivers/net/ni52.c
+++ b/drivers/net/ni52.c
@@ -300,8 +300,7 @@ static int ni52_open(struct net_device *dev)
300static int check586(struct net_device *dev, unsigned size) 300static int check586(struct net_device *dev, unsigned size)
301{ 301{
302 unsigned long where = dev->mem_start; 302 unsigned long where = dev->mem_start;
303 struct priv pb; 303 struct priv *p = dev->priv;
304 struct priv *p = /* (struct priv *) dev->priv*/ &pb;
305 char __iomem *iscp_addrs[2]; 304 char __iomem *iscp_addrs[2];
306 int i; 305 int i;
307 306
@@ -309,6 +308,7 @@ static int check586(struct net_device *dev, unsigned size)
309 p->base = p->mapped + size - 0x01000000; 308 p->base = p->mapped + size - 0x01000000;
310 p->memtop = p->mapped + size; 309 p->memtop = p->mapped + size;
311 p->scp = (struct scp_struct __iomem *)(p->base + SCP_DEFAULT_ADDRESS); 310 p->scp = (struct scp_struct __iomem *)(p->base + SCP_DEFAULT_ADDRESS);
311 p->scb = (struct scb_struct __iomem *) p->mapped;
312 memset_io(p->scp, 0, sizeof(struct scp_struct)); 312 memset_io(p->scp, 0, sizeof(struct scp_struct));
313 for (i = 0; i < sizeof(struct scp_struct); i++) 313 for (i = 0; i < sizeof(struct scp_struct); i++)
314 /* memory was writeable? */ 314 /* memory was writeable? */
@@ -335,6 +335,9 @@ static int check586(struct net_device *dev, unsigned size)
335 if (readb(&p->iscp->busy)) 335 if (readb(&p->iscp->busy))
336 return 0; 336 return 0;
337 } 337 }
338
339 p->iscp = (struct iscp_struct __iomem *)
340 ((char __iomem *)p->scp - sizeof(struct iscp_struct));
338 return 1; 341 return 1;
339} 342}
340 343
@@ -348,13 +351,6 @@ static void alloc586(struct net_device *dev)
348 ni_reset586(); 351 ni_reset586();
349 mdelay(32); 352 mdelay(32);
350 353
351 spin_lock_init(&p->spinlock);
352
353 p->scp = (struct scp_struct __iomem *) (p->base + SCP_DEFAULT_ADDRESS);
354 p->scb = (struct scb_struct __iomem *) isa_bus_to_virt(dev->mem_start);
355 p->iscp = (struct iscp_struct __iomem *)
356 ((char __iomem *)p->scp - sizeof(struct iscp_struct));
357
358 memset_io(p->iscp, 0, sizeof(struct iscp_struct)); 354 memset_io(p->iscp, 0, sizeof(struct iscp_struct));
359 memset_io(p->scp , 0, sizeof(struct scp_struct)); 355 memset_io(p->scp , 0, sizeof(struct scp_struct));
360 356
@@ -445,6 +441,8 @@ static int __init ni52_probe1(struct net_device *dev, int ioaddr)
445 dev->mem_start = memstart; 441 dev->mem_start = memstart;
446 dev->mem_end = memend; 442 dev->mem_end = memend;
447 443
444 spin_lock_init(&priv->spinlock);
445
448 if (!request_region(ioaddr, NI52_TOTAL_SIZE, DRV_NAME)) 446 if (!request_region(ioaddr, NI52_TOTAL_SIZE, DRV_NAME))
449 return -EBUSY; 447 return -EBUSY;
450 448
@@ -520,11 +518,6 @@ static int __init ni52_probe1(struct net_device *dev, int ioaddr)
520 dev->mem_end = dev->mem_start + size; 518 dev->mem_end = dev->mem_start + size;
521#endif 519#endif
522 520
523 memset(priv, 0, sizeof(struct priv));
524
525 priv->mapped = (char __iomem *)isa_bus_to_virt(dev->mem_start);
526 priv->memtop = priv->mapped + size;
527 priv->base = priv->mapped + size - 0x01000000;
528 alloc586(dev); 521 alloc586(dev);
529 522
530 /* set number of receive-buffs according to memsize */ 523 /* set number of receive-buffs according to memsize */