[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230725143023.86325-8-andriy.shevchenko@linux.intel.com>
Date: Tue, 25 Jul 2023 17:30:21 +0300
From: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To: Jarkko Nikula <jarkko.nikula@...ux.intel.com>,
Mario Limonciello <mario.limonciello@....com>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Wolfram Sang <wsa@...nel.org>, linux-i2c@...r.kernel.org,
linux-kernel@...r.kernel.org
Cc: Mika Westerberg <mika.westerberg@...ux.intel.com>,
Jan Dabros <jsd@...ihalf.com>,
Andi Shyti <andi.shyti@...nel.org>
Subject: [PATCH v1 7/9] i2c: desingware: Unify firmware type checks
Instead of asymmetrical checks for the firmware use is_*_node()
calls. With that, drop now local wrappers against
Signed-off-by: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
---
drivers/i2c/busses/i2c-designware-common.c | 23 +++++++---------------
1 file changed, 7 insertions(+), 16 deletions(-)
diff --git a/drivers/i2c/busses/i2c-designware-common.c b/drivers/i2c/busses/i2c-designware-common.c
index 443426474cfc..e6df6a484955 100644
--- a/drivers/i2c/busses/i2c-designware-common.c
+++ b/drivers/i2c/busses/i2c-designware-common.c
@@ -241,15 +241,9 @@ static void i2c_dw_of_do_configure(struct dw_i2c_dev *dev, struct device *device
}
}
-static void i2c_dw_of_configure(struct dw_i2c_dev *dev)
-{
- if (dev_of_node(dev->dev))
- i2c_dw_of_do_configure(dev, dev->dev);
-}
-
#else /* CONFIG_OF */
-static inline void i2c_dw_of_configure(struct dw_i2c_dev *dev) { }
+static inline void i2c_dw_of_do_configure(struct dw_i2c_dev *dev, struct device *device) { }
#endif /* CONFIG_OF */
@@ -329,12 +323,6 @@ static void i2c_dw_acpi_do_configure(struct dw_i2c_dev *dev, struct device *devi
}
}
-static void i2c_dw_acpi_configure(struct dw_i2c_dev *dev)
-{
- if (has_acpi_companion(dev->dev))
- i2c_dw_acpi_do_configure(dev, dev->dev);
-}
-
static u32 i2c_dw_acpi_round_bus_speed(struct device *device)
{
u32 acpi_speed;
@@ -355,7 +343,7 @@ static u32 i2c_dw_acpi_round_bus_speed(struct device *device)
#else /* CONFIG_ACPI */
-static inline void i2c_dw_acpi_configure(struct dw_i2c_dev *dev) { }
+static inline void i2c_dw_acpi_do_configure(struct dw_i2c_dev *dev, struct device *device) { }
static inline u32 i2c_dw_acpi_round_bus_speed(struct device *device) { return 0; }
@@ -380,14 +368,17 @@ static void i2c_dw_adjust_bus_speed(struct dw_i2c_dev *dev)
int i2c_dw_fw_parse_and_configure(struct dw_i2c_dev *dev)
{
+ struct fwnode_handle *fwnode = dev_fwnode(dev->dev);
struct i2c_timings *t = &dev->timings;
i2c_parse_fw_timings(dev->dev, t, false);
i2c_dw_adjust_bus_speed(dev);
- i2c_dw_of_configure(dev);
- i2c_dw_acpi_configure(dev);
+ if (is_of_node(fwnode))
+ i2c_dw_of_do_configure(dev, dev->dev);
+ else if (is_acpi_node(fwnode))
+ i2c_dw_acpi_do_configure(dev, dev->dev);
return i2c_dw_validate_speed(dev);
}
--
2.40.0.1.gaa8946217a0b
Powered by blists - more mailing lists