Skip to content

Commit 14f6ca5

Browse files
committed
firewire: ohci: use devres for PCI-related resources
The PCI framework supports managed device resource to maintain the lifetime of PCI specific resources. This commit allows 1394 OHCI driver to utilize it. Link: https://lore.kernel.org/r/20230604054451.161076-3-o-takashi@sakamocchi.jp Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
1 parent f86319c commit 14f6ca5

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

drivers/firewire/ohci.c

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3588,7 +3588,7 @@ static int pci_probe(struct pci_dev *dev,
35883588
pmac_ohci_on(dev);
35893589
devres_add(&dev->dev, ohci);
35903590

3591-
err = pci_enable_device(dev);
3591+
err = pcim_enable_device(dev);
35923592
if (err) {
35933593
dev_err(&dev->dev, "failed to enable OHCI hardware\n");
35943594
return err;
@@ -3605,14 +3605,13 @@ static int pci_probe(struct pci_dev *dev,
36053605
if (!(pci_resource_flags(dev, 0) & IORESOURCE_MEM) ||
36063606
pci_resource_len(dev, 0) < OHCI1394_REGISTER_SIZE) {
36073607
ohci_err(ohci, "invalid MMIO resource\n");
3608-
err = -ENXIO;
3609-
goto fail_disable;
3608+
return -ENXIO;
36103609
}
36113610

36123611
err = pci_request_region(dev, 0, ohci_driver_name);
36133612
if (err) {
36143613
ohci_err(ohci, "MMIO resource unavailable\n");
3615-
goto fail_disable;
3614+
return err;
36163615
}
36173616

36183617
ohci->registers = pci_iomap(dev, 0, OHCI1394_REGISTER_SIZE);
@@ -3752,8 +3751,6 @@ static int pci_probe(struct pci_dev *dev,
37523751
pci_iounmap(dev, ohci->registers);
37533752
fail_iomem:
37543753
pci_release_region(dev, 0);
3755-
fail_disable:
3756-
pci_disable_device(dev);
37573754

37583755
return err;
37593756
}
@@ -3798,7 +3795,6 @@ static void pci_remove(struct pci_dev *dev)
37983795
pci_disable_msi(dev);
37993796
pci_iounmap(dev, ohci->registers);
38003797
pci_release_region(dev, 0);
3801-
pci_disable_device(dev);
38023798

38033799
dev_notice(&dev->dev, "removing fw-ohci device\n");
38043800
}

0 commit comments

Comments
 (0)