diff options
author | Jiri Pirko <jpirko@redhat.com> | 2010-02-19 03:48:47 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-02-19 16:15:50 -0500 |
commit | 91fea5858418127ad33e0060f726c62be0047eaf (patch) | |
tree | 3630384b91fe22565ac4eadc7dddd0d7720bf958 /drivers/net/pcmcia/xirc2ps_cs.c | |
parent | 2f1eb65f366b81aa3c22c31e6e8db26168777ec5 (diff) |
net/pcmcia: convert to use netdev_for_each_mc_addr
removed fill_multicast_tbl function in smc91c92_cs and do the work inline
rewritten set_addresses function in xirc2ps_cs. This was kinda headache.
Simulated the original and new functions and they bahave the same.
Signed-off-by: Jiri Pirko <jpirko@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/pcmcia/xirc2ps_cs.c')
-rw-r--r-- | drivers/net/pcmcia/xirc2ps_cs.c | 84 |
1 files changed, 50 insertions, 34 deletions
diff --git a/drivers/net/pcmcia/xirc2ps_cs.c b/drivers/net/pcmcia/xirc2ps_cs.c index 4ace18a71152..4d1802e457be 100644 --- a/drivers/net/pcmcia/xirc2ps_cs.c +++ b/drivers/net/pcmcia/xirc2ps_cs.c | |||
@@ -1364,47 +1364,63 @@ do_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1364 | return NETDEV_TX_OK; | 1364 | return NETDEV_TX_OK; |
1365 | } | 1365 | } |
1366 | 1366 | ||
1367 | struct set_address_info { | ||
1368 | int reg_nr; | ||
1369 | int page_nr; | ||
1370 | int mohawk; | ||
1371 | unsigned int ioaddr; | ||
1372 | }; | ||
1373 | |||
1374 | static void set_address(struct set_address_info *sa_info, char *addr) | ||
1375 | { | ||
1376 | unsigned int ioaddr = sa_info->ioaddr; | ||
1377 | int i; | ||
1378 | |||
1379 | for (i = 0; i < 6; i++) { | ||
1380 | if (sa_info->reg_nr > 15) { | ||
1381 | sa_info->reg_nr = 8; | ||
1382 | sa_info->page_nr++; | ||
1383 | SelectPage(sa_info->page_nr); | ||
1384 | } | ||
1385 | if (sa_info->mohawk) | ||
1386 | PutByte(sa_info->reg_nr++, addr[5 - i]); | ||
1387 | else | ||
1388 | PutByte(sa_info->reg_nr++, addr[i]); | ||
1389 | } | ||
1390 | } | ||
1391 | |||
1367 | /**************** | 1392 | /**************** |
1368 | * Set all addresses: This first one is the individual address, | 1393 | * Set all addresses: This first one is the individual address, |
1369 | * the next 9 addresses are taken from the multicast list and | 1394 | * the next 9 addresses are taken from the multicast list and |
1370 | * the rest is filled with the individual address. | 1395 | * the rest is filled with the individual address. |
1371 | */ | 1396 | */ |
1372 | static void | 1397 | static void set_addresses(struct net_device *dev) |
1373 | set_addresses(struct net_device *dev) | ||
1374 | { | 1398 | { |
1375 | unsigned int ioaddr = dev->base_addr; | 1399 | unsigned int ioaddr = dev->base_addr; |
1376 | local_info_t *lp = netdev_priv(dev); | 1400 | local_info_t *lp = netdev_priv(dev); |
1377 | struct dev_mc_list *dmi = dev->mc_list; | 1401 | struct dev_mc_list *dmi; |
1378 | unsigned char *addr; | 1402 | struct set_address_info sa_info; |
1379 | int i,j,k,n; | 1403 | int i; |
1380 | |||
1381 | SelectPage(k=0x50); | ||
1382 | for (i=0,j=8,n=0; ; i++, j++) { | ||
1383 | if (i > 5) { | ||
1384 | if (++n > 9) | ||
1385 | break; | ||
1386 | i = 0; | ||
1387 | if (n > 1 && n <= netdev_mc_count(dev) && dmi) { | ||
1388 | dmi = dmi->next; | ||
1389 | } | ||
1390 | } | ||
1391 | if (j > 15) { | ||
1392 | j = 8; | ||
1393 | k++; | ||
1394 | SelectPage(k); | ||
1395 | } | ||
1396 | |||
1397 | if (n && n <= netdev_mc_count(dev) && dmi) | ||
1398 | addr = dmi->dmi_addr; | ||
1399 | else | ||
1400 | addr = dev->dev_addr; | ||
1401 | 1404 | ||
1402 | if (lp->mohawk) | 1405 | /* |
1403 | PutByte(j, addr[5-i]); | 1406 | * Setup the info structure so that by first set_address call it will do |
1404 | else | 1407 | * SelectPage with the right page number. Hence these ones here. |
1405 | PutByte(j, addr[i]); | 1408 | */ |
1406 | } | 1409 | sa_info.reg_nr = 15 + 1; |
1407 | SelectPage(0); | 1410 | sa_info.page_nr = 0x50 - 1; |
1411 | sa_info.mohawk = lp->mohawk; | ||
1412 | sa_info.ioaddr = ioaddr; | ||
1413 | |||
1414 | set_address(&sa_info, dev->dev_addr); | ||
1415 | i = 0; | ||
1416 | netdev_for_each_mc_addr(dmi, dev) { | ||
1417 | if (i++ == 9) | ||
1418 | break; | ||
1419 | set_address(&sa_info, dmi->dmi_addr); | ||
1420 | } | ||
1421 | while (i++ < 9) | ||
1422 | set_address(&sa_info, dev->dev_addr); | ||
1423 | SelectPage(0); | ||
1408 | } | 1424 | } |
1409 | 1425 | ||
1410 | /**************** | 1426 | /**************** |