diff options
Diffstat (limited to 'drivers/net/hp100.c')
-rw-r--r-- | drivers/net/hp100.c | 44 |
1 files changed, 17 insertions, 27 deletions
diff --git a/drivers/net/hp100.c b/drivers/net/hp100.c index b3a898c5a585..cf0ac6fda1a1 100644 --- a/drivers/net/hp100.c +++ b/drivers/net/hp100.c | |||
@@ -106,6 +106,7 @@ | |||
106 | #include <linux/interrupt.h> | 106 | #include <linux/interrupt.h> |
107 | #include <linux/eisa.h> | 107 | #include <linux/eisa.h> |
108 | #include <linux/pci.h> | 108 | #include <linux/pci.h> |
109 | #include <linux/dma-mapping.h> | ||
109 | #include <linux/spinlock.h> | 110 | #include <linux/spinlock.h> |
110 | #include <linux/netdevice.h> | 111 | #include <linux/netdevice.h> |
111 | #include <linux/etherdevice.h> | 112 | #include <linux/etherdevice.h> |
@@ -417,12 +418,7 @@ struct net_device * __init hp100_probe(int unit) | |||
417 | if (err) | 418 | if (err) |
418 | goto out; | 419 | goto out; |
419 | 420 | ||
420 | err = register_netdev(dev); | ||
421 | if (err) | ||
422 | goto out1; | ||
423 | return dev; | 421 | return dev; |
424 | out1: | ||
425 | release_region(dev->base_addr, HP100_REGION_SIZE); | ||
426 | out: | 422 | out: |
427 | free_netdev(dev); | 423 | free_netdev(dev); |
428 | return ERR_PTR(err); | 424 | return ERR_PTR(err); |
@@ -562,7 +558,7 @@ static int __devinit hp100_probe1(struct net_device *dev, int ioaddr, | |||
562 | * Also, we can have EISA Busmaster cards (not tested), | 558 | * Also, we can have EISA Busmaster cards (not tested), |
563 | * so beware !!! - Jean II */ | 559 | * so beware !!! - Jean II */ |
564 | if((bus == HP100_BUS_PCI) && | 560 | if((bus == HP100_BUS_PCI) && |
565 | (pci_set_dma_mask(pci_dev, 0xffffffff))) { | 561 | (pci_set_dma_mask(pci_dev, DMA_32BIT_MASK))) { |
566 | /* Gracefully fallback to shared memory */ | 562 | /* Gracefully fallback to shared memory */ |
567 | goto busmasterfail; | 563 | goto busmasterfail; |
568 | } | 564 | } |
@@ -776,11 +772,22 @@ static int __devinit hp100_probe1(struct net_device *dev, int ioaddr, | |||
776 | printk("Warning! Link down.\n"); | 772 | printk("Warning! Link down.\n"); |
777 | } | 773 | } |
778 | 774 | ||
775 | err = register_netdev(dev); | ||
776 | if (err) | ||
777 | goto out3; | ||
778 | |||
779 | return 0; | 779 | return 0; |
780 | out3: | ||
781 | if (local_mode == 1) | ||
782 | pci_free_consistent(lp->pci_dev, MAX_RINGSIZE + 0x0f, | ||
783 | lp->page_vaddr_algn, | ||
784 | virt_to_whatever(dev, lp->page_vaddr_algn)); | ||
785 | if (mem_ptr_virt) | ||
786 | iounmap(mem_ptr_virt); | ||
780 | out2: | 787 | out2: |
781 | release_region(ioaddr, HP100_REGION_SIZE); | 788 | release_region(ioaddr, HP100_REGION_SIZE); |
782 | out1: | 789 | out1: |
783 | return -ENODEV; | 790 | return err; |
784 | } | 791 | } |
785 | 792 | ||
786 | /* This procedure puts the card into a stable init state */ | 793 | /* This procedure puts the card into a stable init state */ |
@@ -2875,18 +2882,12 @@ static int __init hp100_eisa_probe (struct device *gendev) | |||
2875 | if (err) | 2882 | if (err) |
2876 | goto out1; | 2883 | goto out1; |
2877 | 2884 | ||
2878 | err = register_netdev(dev); | ||
2879 | if (err) | ||
2880 | goto out2; | ||
2881 | |||
2882 | #ifdef HP100_DEBUG | 2885 | #ifdef HP100_DEBUG |
2883 | printk("hp100: %s: EISA adapter found at 0x%x\n", dev->name, | 2886 | printk("hp100: %s: EISA adapter found at 0x%x\n", dev->name, |
2884 | dev->base_addr); | 2887 | dev->base_addr); |
2885 | #endif | 2888 | #endif |
2886 | gendev->driver_data = dev; | 2889 | gendev->driver_data = dev; |
2887 | return 0; | 2890 | return 0; |
2888 | out2: | ||
2889 | release_region(dev->base_addr, HP100_REGION_SIZE); | ||
2890 | out1: | 2891 | out1: |
2891 | free_netdev(dev); | 2892 | free_netdev(dev); |
2892 | return err; | 2893 | return err; |
@@ -2951,17 +2952,12 @@ static int __devinit hp100_pci_probe (struct pci_dev *pdev, | |||
2951 | err = hp100_probe1(dev, ioaddr, HP100_BUS_PCI, pdev); | 2952 | err = hp100_probe1(dev, ioaddr, HP100_BUS_PCI, pdev); |
2952 | if (err) | 2953 | if (err) |
2953 | goto out1; | 2954 | goto out1; |
2954 | err = register_netdev(dev); | ||
2955 | if (err) | ||
2956 | goto out2; | ||
2957 | 2955 | ||
2958 | #ifdef HP100_DEBUG | 2956 | #ifdef HP100_DEBUG |
2959 | printk("hp100: %s: PCI adapter found at 0x%x\n", dev->name, ioaddr); | 2957 | printk("hp100: %s: PCI adapter found at 0x%x\n", dev->name, ioaddr); |
2960 | #endif | 2958 | #endif |
2961 | pci_set_drvdata(pdev, dev); | 2959 | pci_set_drvdata(pdev, dev); |
2962 | return 0; | 2960 | return 0; |
2963 | out2: | ||
2964 | release_region(dev->base_addr, HP100_REGION_SIZE); | ||
2965 | out1: | 2961 | out1: |
2966 | free_netdev(dev); | 2962 | free_netdev(dev); |
2967 | out0: | 2963 | out0: |
@@ -3032,15 +3028,9 @@ static int __init hp100_isa_init(void) | |||
3032 | SET_MODULE_OWNER(dev); | 3028 | SET_MODULE_OWNER(dev); |
3033 | 3029 | ||
3034 | err = hp100_isa_probe(dev, hp100_port[i]); | 3030 | err = hp100_isa_probe(dev, hp100_port[i]); |
3035 | if (!err) { | 3031 | if (!err) |
3036 | err = register_netdev(dev); | 3032 | hp100_devlist[cards++] = dev; |
3037 | if (!err) | 3033 | else |
3038 | hp100_devlist[cards++] = dev; | ||
3039 | else | ||
3040 | release_region(dev->base_addr, HP100_REGION_SIZE); | ||
3041 | } | ||
3042 | |||
3043 | if (err) | ||
3044 | free_netdev(dev); | 3034 | free_netdev(dev); |
3045 | } | 3035 | } |
3046 | 3036 | ||