aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/macmace.c
diff options
context:
space:
mode:
authorAndrea Bastoni <bastoni@cs.unc.edu>2010-05-30 19:16:45 -0400
committerAndrea Bastoni <bastoni@cs.unc.edu>2010-05-30 19:16:45 -0400
commitada47b5fe13d89735805b566185f4885f5a3f750 (patch)
tree644b88f8a71896307d71438e9b3af49126ffb22b /drivers/net/macmace.c
parent43e98717ad40a4ae64545b5ba047c7b86aa44f4f (diff)
parent3280f21d43ee541f97f8cda5792150d2dbec20d5 (diff)
Merge branch 'wip-2.6.34' into old-private-masterarchived-private-master
Diffstat (limited to 'drivers/net/macmace.c')
-rw-r--r--drivers/net/macmace.c46
1 files changed, 11 insertions, 35 deletions
diff --git a/drivers/net/macmace.c b/drivers/net/macmace.c
index 44f3c2896f20..52e9a51c4c4f 100644
--- a/drivers/net/macmace.c
+++ b/drivers/net/macmace.c
@@ -30,6 +30,7 @@
30#include <linux/bitrev.h> 30#include <linux/bitrev.h>
31#include <linux/dma-mapping.h> 31#include <linux/dma-mapping.h>
32#include <linux/platform_device.h> 32#include <linux/platform_device.h>
33#include <linux/gfp.h>
33#include <asm/io.h> 34#include <asm/io.h>
34#include <asm/irq.h> 35#include <asm/irq.h>
35#include <asm/macintosh.h> 36#include <asm/macintosh.h>
@@ -39,7 +40,6 @@
39#include "mace.h" 40#include "mace.h"
40 41
41static char mac_mace_string[] = "macmace"; 42static char mac_mace_string[] = "macmace";
42static struct platform_device *mac_mace_device;
43 43
44#define N_TX_BUFF_ORDER 0 44#define N_TX_BUFF_ORDER 0
45#define N_TX_RING (1 << N_TX_BUFF_ORDER) 45#define N_TX_RING (1 << N_TX_BUFF_ORDER)
@@ -496,7 +496,7 @@ static void mace_set_multicast(struct net_device *dev)
496{ 496{
497 struct mace_data *mp = netdev_priv(dev); 497 struct mace_data *mp = netdev_priv(dev);
498 volatile struct mace *mb = mp->mace; 498 volatile struct mace *mb = mp->mace;
499 int i, j; 499 int i;
500 u32 crc; 500 u32 crc;
501 u8 maccc; 501 u8 maccc;
502 unsigned long flags; 502 unsigned long flags;
@@ -509,7 +509,7 @@ static void mace_set_multicast(struct net_device *dev)
509 mb->maccc |= PROM; 509 mb->maccc |= PROM;
510 } else { 510 } else {
511 unsigned char multicast_filter[8]; 511 unsigned char multicast_filter[8];
512 struct dev_mc_list *dmi = dev->mc_list; 512 struct dev_mc_list *dmi;
513 513
514 if (dev->flags & IFF_ALLMULTI) { 514 if (dev->flags & IFF_ALLMULTI) {
515 for (i = 0; i < 8; i++) { 515 for (i = 0; i < 8; i++) {
@@ -518,11 +518,11 @@ static void mace_set_multicast(struct net_device *dev)
518 } else { 518 } else {
519 for (i = 0; i < 8; i++) 519 for (i = 0; i < 8; i++)
520 multicast_filter[i] = 0; 520 multicast_filter[i] = 0;
521 for (i = 0; i < dev->mc_count; i++) { 521 netdev_for_each_mc_addr(dmi, dev) {
522 crc = ether_crc_le(6, dmi->dmi_addr); 522 crc = ether_crc_le(6, dmi->dmi_addr);
523 j = crc >> 26; /* bit number in multicast_filter */ 523 /* bit number in multicast_filter */
524 multicast_filter[j >> 3] |= 1 << (j & 7); 524 i = crc >> 26;
525 dmi = dmi->next; 525 multicast_filter[i >> 3] |= 1 << (i & 7);
526 } 526 }
527 } 527 }
528 528
@@ -752,6 +752,7 @@ static irqreturn_t mace_dma_intr(int irq, void *dev_id)
752 752
753MODULE_LICENSE("GPL"); 753MODULE_LICENSE("GPL");
754MODULE_DESCRIPTION("Macintosh MACE ethernet driver"); 754MODULE_DESCRIPTION("Macintosh MACE ethernet driver");
755MODULE_ALIAS("platform:macmace");
755 756
756static int __devexit mac_mace_device_remove (struct platform_device *pdev) 757static int __devexit mac_mace_device_remove (struct platform_device *pdev)
757{ 758{
@@ -777,47 +778,22 @@ static struct platform_driver mac_mace_driver = {
777 .probe = mace_probe, 778 .probe = mace_probe,
778 .remove = __devexit_p(mac_mace_device_remove), 779 .remove = __devexit_p(mac_mace_device_remove),
779 .driver = { 780 .driver = {
780 .name = mac_mace_string, 781 .name = mac_mace_string,
782 .owner = THIS_MODULE,
781 }, 783 },
782}; 784};
783 785
784static int __init mac_mace_init_module(void) 786static int __init mac_mace_init_module(void)
785{ 787{
786 int err;
787
788 if (!MACH_IS_MAC) 788 if (!MACH_IS_MAC)
789 return -ENODEV; 789 return -ENODEV;
790 790
791 if ((err = platform_driver_register(&mac_mace_driver))) { 791 return platform_driver_register(&mac_mace_driver);
792 printk(KERN_ERR "Driver registration failed\n");
793 return err;
794 }
795
796 mac_mace_device = platform_device_alloc(mac_mace_string, 0);
797 if (!mac_mace_device)
798 goto out_unregister;
799
800 if (platform_device_add(mac_mace_device)) {
801 platform_device_put(mac_mace_device);
802 mac_mace_device = NULL;
803 }
804
805 return 0;
806
807out_unregister:
808 platform_driver_unregister(&mac_mace_driver);
809
810 return -ENOMEM;
811} 792}
812 793
813static void __exit mac_mace_cleanup_module(void) 794static void __exit mac_mace_cleanup_module(void)
814{ 795{
815 platform_driver_unregister(&mac_mace_driver); 796 platform_driver_unregister(&mac_mace_driver);
816
817 if (mac_mace_device) {
818 platform_device_unregister(mac_mace_device);
819 mac_mace_device = NULL;
820 }
821} 797}
822 798
823module_init(mac_mace_init_module); 799module_init(mac_mace_init_module);