diff mbox series

[v1,2/9] i2c: designware: Change i2c_dw_acpi_configure() prototype

Message ID 20230725143023.86325-3-andriy.shevchenko@linux.intel.com
State Changes Requested
Delegated to: Andi Shyti
Headers show
Series i2c: designware: code consolidation & cleanups | expand

Commit Message

Andy Shevchenko July 25, 2023, 2:30 p.m. UTC
There is no point to have it being int and at the same time
it may take struct dw_i2c_dev pointer instead of plain device.

Change the prototype and implementation accordingly.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/i2c/busses/i2c-designware-common.c  | 10 +++-------
 drivers/i2c/busses/i2c-designware-core.h    |  4 ++--
 drivers/i2c/busses/i2c-designware-pcidrv.c  |  2 +-
 drivers/i2c/busses/i2c-designware-platdrv.c |  2 +-
 4 files changed, 7 insertions(+), 11 deletions(-)

Comments

Andi Shyti July 25, 2023, 9:45 p.m. UTC | #1
Hi Andy,

On Tue, Jul 25, 2023 at 05:30:16PM +0300, Andy Shevchenko wrote:
> There is no point to have it being int and at the same time
> it may take struct dw_i2c_dev pointer instead of plain device.
> 
> Change the prototype and implementation accordingly.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Reviewed-by: Andi Shyti <andi.shyti@kernel.org> 

Andi
diff mbox series

Patch

diff --git a/drivers/i2c/busses/i2c-designware-common.c b/drivers/i2c/busses/i2c-designware-common.c
index 683f7a9beb46..222b530c0441 100644
--- a/drivers/i2c/busses/i2c-designware-common.c
+++ b/drivers/i2c/busses/i2c-designware-common.c
@@ -286,14 +286,10 @@  static void i2c_dw_acpi_do_configure(struct dw_i2c_dev *dev, struct device *devi
 	}
 }
 
-int i2c_dw_acpi_configure(struct device *device)
+void i2c_dw_acpi_configure(struct dw_i2c_dev *dev)
 {
-	struct dw_i2c_dev *dev = dev_get_drvdata(device);
-
-	if (has_acpi_companion(device))
-		i2c_dw_acpi_do_configure(dev, device);
-
-	return 0;
+	if (has_acpi_companion(dev->dev))
+		i2c_dw_acpi_do_configure(dev, dev->dev);
 }
 EXPORT_SYMBOL_GPL(i2c_dw_acpi_configure);
 
diff --git a/drivers/i2c/busses/i2c-designware-core.h b/drivers/i2c/busses/i2c-designware-core.h
index cf4f684f5356..03f4d44ae94c 100644
--- a/drivers/i2c/busses/i2c-designware-core.h
+++ b/drivers/i2c/busses/i2c-designware-core.h
@@ -394,7 +394,7 @@  int i2c_dw_validate_speed(struct dw_i2c_dev *dev);
 void i2c_dw_adjust_bus_speed(struct dw_i2c_dev *dev);
 
 #if IS_ENABLED(CONFIG_ACPI)
-int i2c_dw_acpi_configure(struct device *device);
+void i2c_dw_acpi_configure(struct dw_i2c_dev *dev);
 #else
-static inline int i2c_dw_acpi_configure(struct device *device) { return -ENODEV; }
+static inline void i2c_dw_acpi_configure(struct dw_i2c_dev *dev) { }
 #endif
diff --git a/drivers/i2c/busses/i2c-designware-pcidrv.c b/drivers/i2c/busses/i2c-designware-pcidrv.c
index d9d80650fbdc..7f5a04538c71 100644
--- a/drivers/i2c/busses/i2c-designware-pcidrv.c
+++ b/drivers/i2c/busses/i2c-designware-pcidrv.c
@@ -303,7 +303,7 @@  static int i2c_dw_pci_probe(struct pci_dev *pdev,
 
 	i2c_dw_adjust_bus_speed(dev);
 
-	i2c_dw_acpi_configure(&pdev->dev);
+	i2c_dw_acpi_configure(dev);
 
 	r = i2c_dw_validate_speed(dev);
 	if (r) {
diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/busses/i2c-designware-platdrv.c
index 4eedb0734438..c60e55b8398e 100644
--- a/drivers/i2c/busses/i2c-designware-platdrv.c
+++ b/drivers/i2c/busses/i2c-designware-platdrv.c
@@ -314,7 +314,7 @@  static int dw_i2c_plat_probe(struct platform_device *pdev)
 	if (pdev->dev.of_node)
 		dw_i2c_of_configure(pdev);
 
-	i2c_dw_acpi_configure(&pdev->dev);
+	i2c_dw_acpi_configure(dev);
 
 	ret = i2c_dw_validate_speed(dev);
 	if (ret)