Re: [PATCH] i2c: amd8111: Switch to pcim_enable_device() and pcim_request_region()

From: Andy Shevchenko

Date: Tue Feb 24 2026 - 05:40:05 EST


On Tue, Feb 24, 2026 at 11:22:16AM +0100, Filippo Muscherà wrote:
> 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.

Looking at the code now I see the difference this patch may bring.
I was under impression that there is pci_enable_device() already in
the code. But it is not the case, which makes quite a different
enumeration flow (it will write CMD register and touch some bits
that might be sensitive). While the code looks okay and I can even
Acked-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxx>
the change needs to be tested on real hardware before going in.

...

> if (!(pci_resource_flags(dev, 0) & IORESOURCE_IO))
> return -ENODEV;

While it seems now being unneeded, I would leave this check in place until
somebody who knows the platform better can come up with a clear justification
for its removal. It also sounds aligned with the above remark. It might be
we can not do this patch at all.

--
With Best Regards,
Andy Shevchenko