[PATCH] i2c: amd8111: Switch to pcim_enable_device() and pcim_request_region()
From: Filippo Muscherà
Date: Tue Feb 24 2026 - 05:23:06 EST
Following the conversion to managed devm_* APIs, update the driver to use
the PCI-specific managed APIs.
Use pcim_enable_device() to properly enable the PCI device and
pcim_request_region() to manage the I/O port region.
Switching to pcim_enable_device() also addresses the fact that
pci_disable_device() was missing in the driver lifecycle, as the
managed API now automatically handles the disablement when the driver
unbinds.
Suggested-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxx>
Signed-off-by: Filippo Muscherà <filippo.muschera@xxxxxxxxx>
---
drivers/i2c/busses/i2c-amd8111.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/drivers/i2c/busses/i2c-amd8111.c b/drivers/i2c/busses/i2c-amd8111.c
index dd9ac4bb6704..3e8f7a59df51 100644
--- a/drivers/i2c/busses/i2c-amd8111.c
+++ b/drivers/i2c/busses/i2c-amd8111.c
@@ -427,6 +427,10 @@ static int amd8111_probe(struct pci_dev *dev, const struct pci_device_id *id)
if (!(pci_resource_flags(dev, 0) & IORESOURCE_IO))
return -ENODEV;
+ error = pcim_enable_device(dev);
+ if (error)
+ return error;
+
smbus = devm_kzalloc(&dev->dev, sizeof(struct amd_smbus), GFP_KERNEL);
if (!smbus)
return -ENOMEM;
@@ -439,8 +443,9 @@ static int amd8111_probe(struct pci_dev *dev, const struct pci_device_id *id)
if (error)
return -ENODEV;
- if (!devm_request_region(&dev->dev, smbus->base, smbus->size, amd8111_driver.name))
- return -EBUSY;
+ error = pcim_request_region(dev, 0, amd8111_driver.name);
+ if (error)
+ return error;
smbus->adapter.owner = THIS_MODULE;
snprintf(smbus->adapter.name, sizeof(smbus->adapter.name),
--
2.52.0