i2c: i801: Remove unnecessary PCI function call
authorPhilipp Stanner <pstanner@redhat.com>
Thu, 21 Nov 2024 19:56:25 +0000 (20:56 +0100)
committerAndi Shyti <andi.shyti@kernel.org>
Thu, 9 Jan 2025 15:40:10 +0000 (16:40 +0100)
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>
Link: https://lore.kernel.org/r/20241121195624.144839-2-pstanner@redhat.com
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
drivers/i2c/busses/i2c-i801.c

index 75dab01d43a750ccdd98b5dafccc5e2475a01fe0..d9d354ce231d6ff5031313b3ed0e0595d73e62d4 100644 (file)
@@ -1682,13 +1682,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);