mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] i2c: i801: Remove unnecessary PCI function call
@ 2024-11-21 19:56 Philipp Stanner
  2025-01-09 15:45 ` Andi Shyti
  0 siblings, 1 reply; 2+ messages in thread
From: Philipp Stanner @ 2024-11-21 19:56 UTC (permalink / raw)
  To: Jean Delvare, Andi Shyti; +Cc: linux-i2c, linux-kernel, Philipp Stanner

Since the changes in

	commit f748a07a0b64 ("PCI: Remove legacy pcim_release()")

all pcim_enable_device() does is set up a callback that disables the
device from being disabled from driver detach. The function
pcim_pin_device() prevents said disabling. pcim_enable_device(),
therefore, sets up an action that is removed immediately afterwards by
pcim_pin_device().

Replace pcim_enable_device() with pci_enable_device() and remove the
unnecessary call to pcim_pin_device().

Signed-off-by: Philipp Stanner <pstanner@redhat.com>
---
 drivers/i2c/busses/i2c-i801.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c
index 299fe9d3afab..514d3f8277cf 100644
--- a/drivers/i2c/busses/i2c-i801.c
+++ b/drivers/i2c/busses/i2c-i801.c
@@ -1676,13 +1676,16 @@ static int i801_probe(struct pci_dev *dev, const struct pci_device_id *id)
 	if (!(priv->features & FEATURE_BLOCK_BUFFER))
 		priv->features &= ~FEATURE_BLOCK_PROC;
 
-	err = pcim_enable_device(dev);
+	/*
+	 * Do not call pcim_enable_device(), because the device has to remain
+	 * enabled on driver detach. See i801_remove() for the reasoning.
+	 */
+	err = pci_enable_device(dev);
 	if (err) {
 		dev_err(&dev->dev, "Failed to enable SMBus PCI device (%d)\n",
 			err);
 		return err;
 	}
-	pcim_pin_device(dev);
 
 	/* Determine the address of the SMBus area */
 	priv->smba = pci_resource_start(dev, SMBBAR);
-- 
2.47.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] i2c: i801: Remove unnecessary PCI function call
  2024-11-21 19:56 [PATCH] i2c: i801: Remove unnecessary PCI function call Philipp Stanner
@ 2025-01-09 15:45 ` Andi Shyti
  0 siblings, 0 replies; 2+ messages in thread
From: Andi Shyti @ 2025-01-09 15:45 UTC (permalink / raw)
  To: Philipp Stanner; +Cc: Jean Delvare, linux-i2c, linux-kernel

Hi Philipp,

On Thu, Nov 21, 2024 at 08:56:25PM +0100, Philipp Stanner wrote:
> Since the changes in
> 
> 	commit f748a07a0b64 ("PCI: Remove legacy pcim_release()")
> 
> all pcim_enable_device() does is set up a callback that disables the
> device from being disabled from driver detach. The function
> pcim_pin_device() prevents said disabling. pcim_enable_device(),
> therefore, sets up an action that is removed immediately afterwards by
> pcim_pin_device().
> 
> Replace pcim_enable_device() with pci_enable_device() and remove the
> unnecessary call to pcim_pin_device().
> 
> Signed-off-by: Philipp Stanner <pstanner@redhat.com>

nice cleanup, merged to i2c/i2c-host.

Thanks,
Andi

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-01-09 15:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-11-21 19:56 [PATCH] i2c: i801: Remove unnecessary PCI function call Philipp Stanner
2025-01-09 15:45 ` Andi Shyti

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®