* [PATCH] misc: keba: cp500: use pcim_enable_device()
@ 2026-07-14 2:50 Rosen Penev
0 siblings, 0 replies; only message in thread
From: Rosen Penev @ 2026-07-14 2:50 UTC (permalink / raw)
To: linux-kernel; +Cc: Arnd Bergmann, Greg Kroah-Hartman
Switch from pci_enable_device() to pcim_enable_device() so the PCI device
is automatically disabled on probe error and driver removal. Drop the now
redundant manual pci_disable_device() and pci_clear_master() calls, since
pcim's release path clears bus mastering and disables the device.
Assisted-by: opencode:hy3-free
Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
drivers/misc/keba/cp500.c | 17 ++++-------------
1 file changed, 4 insertions(+), 13 deletions(-)
diff --git a/drivers/misc/keba/cp500.c b/drivers/misc/keba/cp500.c
index 6c65fbf22e75..c2ca63e40814 100644
--- a/drivers/misc/keba/cp500.c
+++ b/drivers/misc/keba/cp500.c
@@ -887,7 +887,7 @@ static int cp500_probe(struct pci_dev *pci_dev, const struct pci_device_id *id)
else
return -ENODEV;
- ret = pci_enable_device(pci_dev);
+ ret = pcim_enable_device(pci_dev);
if (ret)
return ret;
pci_set_master(pci_dev);
@@ -896,18 +896,15 @@ static int cp500_probe(struct pci_dev *pci_dev, const struct pci_device_id *id)
startup.end = startup.start + cp500->devs->startup.size - 1;
cp500->system_startup_addr = devm_ioremap_resource(&pci_dev->dev,
&startup);
- if (IS_ERR(cp500->system_startup_addr)) {
- ret = PTR_ERR(cp500->system_startup_addr);
- goto out_disable;
- }
+ if (IS_ERR(cp500->system_startup_addr))
+ return PTR_ERR(cp500->system_startup_addr);
cp500->msix_num = pci_alloc_irq_vectors(pci_dev, CP500_NUM_MSIX_NO_MMI,
CP500_NUM_MSIX, PCI_IRQ_MSIX);
if (cp500->msix_num < CP500_NUM_MSIX_NO_MMI) {
dev_err(&pci_dev->dev,
"Hardware does not support enough MSI-X interrupts\n");
- ret = -ENODEV;
- goto out_disable;
+ return -ENODEV;
}
cp500_vers = ioread32(cp500->system_startup_addr + CP500_VERSION_REG);
@@ -937,9 +934,6 @@ static int cp500_probe(struct pci_dev *pci_dev, const struct pci_device_id *id)
nvmem_unregister_notifier(&cp500->nvmem_notifier);
out_free_irq:
pci_free_irq_vectors(pci_dev);
-out_disable:
- pci_clear_master(pci_dev);
- pci_disable_device(pci_dev);
return ret;
}
@@ -962,9 +956,6 @@ static void cp500_remove(struct pci_dev *pci_dev)
pci_set_drvdata(pci_dev, 0);
pci_free_irq_vectors(pci_dev);
-
- pci_clear_master(pci_dev);
- pci_disable_device(pci_dev);
}
static struct pci_device_id cp500_ids[] = {
--
2.55.0
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-07-14 2:50 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-07-14 2:50 [PATCH] misc: keba: cp500: use pcim_enable_device() Rosen Penev
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®