The i2c_chip_of_to_plat() is called only from i2c_child_post_bind(), inline i2c_chip_of_to_plat() into i2c_child_post_bind(). Drop the if CONFIG_IS_ENABLED(OF_REAL) and depend on if (!dev_has_ofnode(dev)) which does check CONFIG_IS_ENABLED(OF_REAL) internally too.
Signed-off-by: Marek Vasut <[email protected]> --- Cc: Heiko Schocher <[email protected]> Cc: Tom Rini <[email protected]> Cc: [email protected] --- V2: New patch --- drivers/i2c/i2c-uclass.c | 39 ++++++++++++++------------------------- include/i2c.h | 13 ------------- 2 files changed, 14 insertions(+), 38 deletions(-) diff --git a/drivers/i2c/i2c-uclass.c b/drivers/i2c/i2c-uclass.c index 380a9f8f3ad..97466597d77 100644 --- a/drivers/i2c/i2c-uclass.c +++ b/drivers/i2c/i2c-uclass.c @@ -701,26 +701,6 @@ int i2c_deblock(struct udevice *bus) return ops->deblock(bus); } -#if CONFIG_IS_ENABLED(OF_REAL) -int i2c_chip_of_to_plat(struct udevice *dev, struct dm_i2c_chip *chip) -{ - int addr; - - chip->offset_len = dev_read_u32_default(dev, "u-boot,i2c-offset-len", - 1); - chip->flags = 0; - addr = dev_read_u32_default(dev, "reg", -1); - if (addr == -1) { - debug("%s: I2C Node '%s' has no 'reg' property %s\n", __func__, - dev_read_name(dev), dev->name); - return log_ret(-EINVAL); - } - chip->chip_addr = addr; - - return 0; -} -#endif - static int i2c_pre_probe(struct udevice *dev) { #if CONFIG_IS_ENABLED(OF_REAL) @@ -760,15 +740,24 @@ static int i2c_post_probe(struct udevice *dev) static int i2c_child_post_bind(struct udevice *dev) { -#if CONFIG_IS_ENABLED(OF_REAL) - struct dm_i2c_chip *plat = dev_get_parent_plat(dev); + struct dm_i2c_chip *chip = dev_get_parent_plat(dev); + int addr; if (!dev_has_ofnode(dev)) return 0; - return i2c_chip_of_to_plat(dev, plat); -#else + + chip->offset_len = dev_read_u32_default(dev, "u-boot,i2c-offset-len", + 1); + chip->flags = 0; + addr = dev_read_u32_default(dev, "reg", -1); + if (addr == -1) { + debug("%s: I2C Node '%s' has no 'reg' property %s\n", __func__, + dev_read_name(dev), dev->name); + return log_ret(-EINVAL); + } + chip->chip_addr = addr; + return 0; -#endif } static int i2c_post_bind(struct udevice *dev) diff --git a/include/i2c.h b/include/i2c.h index 91917f54be9..b2572076236 100644 --- a/include/i2c.h +++ b/include/i2c.h @@ -549,19 +549,6 @@ int i2c_get_chip_for_busnum(int busnum, int chip_addr, uint offset_len, int i2c_get_chip_by_phandle(const struct udevice *parent, const char *prop_name, struct udevice **devp); -/** - * i2c_chip_of_to_plat() - Decode standard I2C platform data - * - * This decodes the chip address from a device tree node and puts it into - * its dm_i2c_chip structure. This should be called in your driver's - * of_to_plat() method. - * - * @blob: Device tree blob - * @node: Node offset to read from - * @spi: Place to put the decoded information - */ -int i2c_chip_of_to_plat(struct udevice *dev, struct dm_i2c_chip *chip); - /** * i2c_dump_msgs() - Dump a list of I2C messages * -- 2.51.0

