i2c: designware: Remove ->disable() callback
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Thu, 22 Aug 2024 17:58:41 +0000 (20:58 +0300)
committerAndi Shyti <andi.shyti@kernel.org>
Mon, 9 Sep 2024 22:36:42 +0000 (00:36 +0200)
Commit 90312351fd1e ("i2c: designware: MASTER mode as separated driver")
introduced ->disable() callback but there is no real use for it. Both
i2c-designware-master.c and i2c-designware-slave.c set it to the same
i2c_dw_disable() and scope is inside the same kernel module.

That said, replace the callback by explicitly calling the i2c_dw_disable().

Reviewed-by: Andi Shyti <andi.shyti@kernel.org>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
drivers/i2c/busses/i2c-designware-common.c
drivers/i2c/busses/i2c-designware-core.h
drivers/i2c/busses/i2c-designware-master.c
drivers/i2c/busses/i2c-designware-pcidrv.c
drivers/i2c/busses/i2c-designware-platdrv.c
drivers/i2c/busses/i2c-designware-slave.c

index 2601876f76ad35f6d148f9ed5b5d3024b35842be..b60c55587e486edce0acf2d1589c3cd166835fc5 100644 (file)
@@ -734,6 +734,7 @@ void i2c_dw_disable(struct dw_i2c_dev *dev)
 
        i2c_dw_release_lock(dev);
 }
+EXPORT_SYMBOL_GPL(i2c_dw_disable);
 
 MODULE_DESCRIPTION("Synopsys DesignWare I2C bus adapter core");
 MODULE_LICENSE("GPL");
index b9f97f4eedf55b66265b75b20bf1c6d5ea243df4..723d599cca935fe7d99fb2b7815125a49a71fdb5 100644 (file)
@@ -237,7 +237,6 @@ struct reset_control;
  * @semaphore_idx: Index of table with semaphore type attached to the bus. It's
  *     -1 if there is no semaphore.
  * @shared_with_punit: true if this bus is shared with the SoCs PUNIT
- * @disable: function to disable the controller
  * @init: function to initialize the I2C hardware
  * @set_sda_hold_time: callback to retrieve IP specific SDA hold timing
  * @mode: operation mode - DW_IC_MASTER or DW_IC_SLAVE
@@ -295,7 +294,6 @@ struct dw_i2c_dev {
        void                    (*release_lock)(void);
        int                     semaphore_idx;
        bool                    shared_with_punit;
-       void                    (*disable)(struct dw_i2c_dev *dev);
        int                     (*init)(struct dw_i2c_dev *dev);
        int                     (*set_sda_hold_time)(struct dw_i2c_dev *dev);
        int                     mode;
@@ -342,7 +340,6 @@ int i2c_dw_wait_bus_not_busy(struct dw_i2c_dev *dev);
 int i2c_dw_handle_tx_abort(struct dw_i2c_dev *dev);
 int i2c_dw_set_fifo_size(struct dw_i2c_dev *dev);
 u32 i2c_dw_func(struct i2c_adapter *adap);
-void i2c_dw_disable(struct dw_i2c_dev *dev);
 
 static inline void __i2c_dw_enable(struct dw_i2c_dev *dev)
 {
@@ -375,6 +372,7 @@ static inline void __i2c_dw_read_intr_mask(struct dw_i2c_dev *dev,
 }
 
 void __i2c_dw_disable(struct dw_i2c_dev *dev);
+void i2c_dw_disable(struct dw_i2c_dev *dev);
 
 extern void i2c_dw_configure_master(struct dw_i2c_dev *dev);
 extern int i2c_dw_probe_master(struct dw_i2c_dev *dev);
index a890a73e197ea4c36164417303771738df5b739d..e46f1b22c3601aa361e11e532fa0c5dfe72fb03d 100644 (file)
@@ -949,7 +949,6 @@ int i2c_dw_probe_master(struct dw_i2c_dev *dev)
        init_completion(&dev->cmd_complete);
 
        dev->init = i2c_dw_init_master;
-       dev->disable = i2c_dw_disable;
 
        ret = i2c_dw_init_regmap(dev);
        if (ret)
index 2f20857005943315d0dc00f4e4027141e364dfac..dd188ccd961e05f7581c90f84d742358d919639c 100644 (file)
@@ -198,7 +198,7 @@ static int __maybe_unused i2c_dw_pci_runtime_suspend(struct device *dev)
 {
        struct dw_i2c_dev *i_dev = dev_get_drvdata(dev);
 
-       i_dev->disable(i_dev);
+       i2c_dw_disable(i_dev);
        return 0;
 }
 
@@ -339,7 +339,8 @@ static void i2c_dw_pci_remove(struct pci_dev *pdev)
 {
        struct dw_i2c_dev *dev = pci_get_drvdata(pdev);
 
-       dev->disable(dev);
+       i2c_dw_disable(dev);
+
        pm_runtime_forbid(&pdev->dev);
        pm_runtime_get_noresume(&pdev->dev);
 
index 7a3f4e96d59eb7ccdfc8f62051a6bf46d32afa66..e49c68c6e142a9da09489b9cf5cac2c4e639adae 100644 (file)
@@ -328,7 +328,7 @@ static void dw_i2c_plat_remove(struct platform_device *pdev)
 
        i2c_del_adapter(&dev->adapter);
 
-       dev->disable(dev);
+       i2c_dw_disable(dev);
 
        pm_runtime_dont_use_autosuspend(&pdev->dev);
        pm_runtime_put_sync(&pdev->dev);
@@ -357,7 +357,7 @@ static int dw_i2c_plat_runtime_suspend(struct device *dev)
        if (i_dev->shared_with_punit)
                return 0;
 
-       i_dev->disable(i_dev);
+       i2c_dw_disable(i_dev);
        i2c_dw_prepare_clk(i_dev, false);
 
        return 0;
index 5995361b56155b2a5ee0ff095b5b963ef31fc960..7035296aa24ce0a65d99f7da43cb36c71f4e41fb 100644 (file)
@@ -90,7 +90,7 @@ static int i2c_dw_unreg_slave(struct i2c_client *slave)
        struct dw_i2c_dev *dev = i2c_get_adapdata(slave->adapter);
 
        regmap_write(dev->map, DW_IC_INTR_MASK, 0);
-       dev->disable(dev);
+       i2c_dw_disable(dev);
        synchronize_irq(dev->irq);
        dev->slave = NULL;
        pm_runtime_put(dev->dev);
@@ -237,7 +237,6 @@ int i2c_dw_probe_slave(struct dw_i2c_dev *dev)
        int ret;
 
        dev->init = i2c_dw_init_slave;
-       dev->disable = i2c_dw_disable;
 
        ret = i2c_dw_init_regmap(dev);
        if (ret)