@@ -632,7 +632,6 @@ struct vortex_private {
632632 pm_state_valid :1 , /* pci_dev->saved_config_space has sane contents */
633633 open :1 ,
634634 medialock :1 ,
635- must_free_region :1 , /* Flag: if zero, Cardbus owns the I/O region */
636635 large_frames :1 , /* accept large frames */
637636 handling_irq :1 ; /* private in_irq indicator */
638637 /* {get|set}_wol operations are already serialized by rtnl.
@@ -1012,6 +1011,12 @@ static int vortex_init_one(struct pci_dev *pdev,
10121011 if (rc < 0 )
10131012 goto out ;
10141013
1014+ rc = pci_request_regions (pdev , DRV_NAME );
1015+ if (rc < 0 ) {
1016+ pci_disable_device (pdev );
1017+ goto out ;
1018+ }
1019+
10151020 unit = vortex_cards_found ;
10161021
10171022 if (global_use_mmio < 0 && (unit >= MAX_UNITS || use_mmio [unit ] < 0 )) {
@@ -1027,6 +1032,7 @@ static int vortex_init_one(struct pci_dev *pdev,
10271032 if (!ioaddr ) /* If mapping fails, fall-back to BAR 0... */
10281033 ioaddr = pci_iomap (pdev , 0 , 0 );
10291034 if (!ioaddr ) {
1035+ pci_release_regions (pdev );
10301036 pci_disable_device (pdev );
10311037 rc = - ENOMEM ;
10321038 goto out ;
@@ -1036,6 +1042,7 @@ static int vortex_init_one(struct pci_dev *pdev,
10361042 ent -> driver_data , unit );
10371043 if (rc < 0 ) {
10381044 pci_iounmap (pdev , ioaddr );
1045+ pci_release_regions (pdev );
10391046 pci_disable_device (pdev );
10401047 goto out ;
10411048 }
@@ -1178,11 +1185,6 @@ static int vortex_probe1(struct device *gendev, void __iomem *ioaddr, int irq,
11781185
11791186 /* PCI-only startup logic */
11801187 if (pdev ) {
1181- /* EISA resources already marked, so only PCI needs to do this here */
1182- /* Ignore return value, because Cardbus drivers already allocate for us */
1183- if (request_region (dev -> base_addr , vci -> io_size , print_name ) != NULL )
1184- vp -> must_free_region = 1 ;
1185-
11861188 /* enable bus-mastering if necessary */
11871189 if (vci -> flags & PCI_USES_MASTER )
11881190 pci_set_master (pdev );
@@ -1220,7 +1222,7 @@ static int vortex_probe1(struct device *gendev, void __iomem *ioaddr, int irq,
12201222 & vp -> rx_ring_dma );
12211223 retval = - ENOMEM ;
12221224 if (!vp -> rx_ring )
1223- goto free_region ;
1225+ goto free_device ;
12241226
12251227 vp -> tx_ring = (struct boom_tx_desc * )(vp -> rx_ring + RX_RING_SIZE );
12261228 vp -> tx_ring_dma = vp -> rx_ring_dma + sizeof (struct boom_rx_desc ) * RX_RING_SIZE ;
@@ -1484,9 +1486,7 @@ static int vortex_probe1(struct device *gendev, void __iomem *ioaddr, int irq,
14841486 + sizeof (struct boom_tx_desc ) * TX_RING_SIZE ,
14851487 vp -> rx_ring ,
14861488 vp -> rx_ring_dma );
1487- free_region :
1488- if (vp -> must_free_region )
1489- release_region (dev -> base_addr , vci -> io_size );
1489+ free_device :
14901490 free_netdev (dev );
14911491 pr_err (PFX "vortex_probe1 fails. Returns %d\n" , retval );
14921492out :
@@ -3254,8 +3254,9 @@ static void vortex_remove_one(struct pci_dev *pdev)
32543254 + sizeof (struct boom_tx_desc ) * TX_RING_SIZE ,
32553255 vp -> rx_ring ,
32563256 vp -> rx_ring_dma );
3257- if (vp -> must_free_region )
3258- release_region (dev -> base_addr , vp -> io_size );
3257+
3258+ pci_release_regions (pdev );
3259+
32593260 free_netdev (dev );
32603261}
32613262
0 commit comments