From: "Filippo Muscherà" <filippo.muschera@gmail.com>
To: jdelvare@suse.com, andi.shyti@kernel.org
Cc: andriy.shevchenko@intel.com, linux-i2c@vger.kernel.org,
linux-kernel@vger.kernel.org,
"Filippo Muscherà" <filippo.muschera@gmail.com>
Subject: [PATCH] i2c: amd8111: Switch to pcim_enable_device() and pcim_request_region()
Date: Tue, 24 Feb 2026 11:22:16 +0100 [thread overview]
Message-ID: <20260224102216.17606-1-filippo.muschera@gmail.com> (raw)
In-Reply-To: <aZx_Yvo_an2_13Lq@black.igk.intel.com>
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@intel.com>
Signed-off-by: Filippo Muscherà <filippo.muschera@gmail.com>
---
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
next prev parent reply other threads:[~2026-02-24 10:22 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-02 13:13 [PATCH 1/2] i2c: amd8111: Remove spaces in MODULE_* macros Filippo Muscherà
2026-02-02 13:13 ` [PATCH 2/2] i2c: amd8111: switch to devm_ functions Filippo Muscherà
2026-02-05 11:03 ` Andi Shyti
2026-02-05 12:57 ` Filippo Muscherà
2026-02-23 16:25 ` Andy Shevchenko
2026-02-24 10:22 ` Filippo Muscherà [this message]
2026-02-24 10:38 ` [PATCH] i2c: amd8111: Switch to pcim_enable_device() and pcim_request_region() Andy Shevchenko
2026-02-24 14:42 ` Filippo Muscherà
2026-04-14 23:13 ` Andi Shyti
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260224102216.17606-1-filippo.muschera@gmail.com \
--to=filippo.muschera@gmail.com \
--cc=andi.shyti@kernel.org \
--cc=andriy.shevchenko@intel.com \
--cc=jdelvare@suse.com \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®