[PATCH v1 7/9] i2c: desingware: Unify firmware type checks

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

 



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@xxxxxxxxxxxxxxx>
---
 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




[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