Re: [PATCH v3 01/25] i2c: designware: Delete adapter before disabling in i2c_dw_pci_remove()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 11/10/23 20:11, Andy Shevchenko wrote:
Make i2c_dw_pci_remove() to be aligned with dw_i2c_plat_remove() on
the sequence of the ceasing I²C operations.

Fixes: 18dbdda89f5c ("i2c-designware: Add runtime power management support")

I think this is wrong. Commit 18dbdda89f5c is 12 years ago so is this patch really fixing a real bug that was hiding all these years?

Signed-off-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
---
  drivers/i2c/busses/i2c-designware-pcidrv.c | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/i2c/busses/i2c-designware-pcidrv.c b/drivers/i2c/busses/i2c-designware-pcidrv.c
index 61d7a27aa070..35d35d7c8e23 100644
--- a/drivers/i2c/busses/i2c-designware-pcidrv.c
+++ b/drivers/i2c/busses/i2c-designware-pcidrv.c
@@ -354,11 +354,13 @@ static void i2c_dw_pci_remove(struct pci_dev *pdev)
  {
  	struct dw_i2c_dev *dev = pci_get_drvdata(pdev);
+ i2c_del_adapter(&dev->adapter);
+
  	dev->disable(dev);
+
  	pm_runtime_forbid(&pdev->dev);
  	pm_runtime_get_noresume(&pdev->dev);
- i2c_del_adapter(&dev->adapter);
  	devm_free_irq(&pdev->dev, dev->irq, dev);
  	pci_free_irq_vectors(pdev);
  }

Then I believe this patch may potentially introduce a bug. As far as I can see nothing wrong regarding adapter deletion after the commit 18dbdda89f5c:

i2c_dw_pci_probe()
{
	...
	i2c_add_numbered_adapter()
	pm_runtime_enable_stuff()
	...
}

i2c_dw_pci_remove()
{
	...
	pm_runtime_disable_stuff()
	i2c_del_adapter()
	...
}

Order is still practically the same in current i2c-designware-pcidrv.c code but after this patch disabling/deletion is not done in reverse order.




[Index of Archives]     [Linux GPIO]     [Linux SPI]     [Linux Hardward Monitoring]     [LM Sensors]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux