diff options
author | Simon Glass <sjg@chromium.org> | 2020-02-06 09:54:52 -0700 |
---|---|---|
committer | Bin Meng <bmeng.cn@gmail.com> | 2020-02-07 22:41:24 +0800 |
commit | fdec36f248c0508ab5d001ad65c38f413638b4a2 (patch) | |
tree | bcae159e88ac7faafba16bb886de3d72e5d321e7 /drivers/i2c | |
parent | ae44cafcb3f1287f618693bab865fcdbe4abb90f (diff) | |
download | u-boot-fdec36f248c0508ab5d001ad65c38f413638b4a2.zip u-boot-fdec36f248c0508ab5d001ad65c38f413638b4a2.tar.gz u-boot-fdec36f248c0508ab5d001ad65c38f413638b4a2.tar.bz2 |
tegra: i2c: Change driver to use helper function
Now that we have uclass_first_device_drvdata(), use it from the I2C driver
to reduce code duplication.
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Diffstat (limited to 'drivers/i2c')
-rw-r--r-- | drivers/i2c/tegra_i2c.c | 13 |
1 files changed, 1 insertions, 12 deletions
diff --git a/drivers/i2c/tegra_i2c.c b/drivers/i2c/tegra_i2c.c index 4be41dd..142463e 100644 --- a/drivers/i2c/tegra_i2c.c +++ b/drivers/i2c/tegra_i2c.c @@ -499,18 +499,7 @@ static int tegra_i2c_xfer(struct udevice *bus, struct i2c_msg *msg, int tegra_i2c_get_dvc_bus(struct udevice **busp) { - struct udevice *bus; - - for (uclass_first_device(UCLASS_I2C, &bus); - bus; - uclass_next_device(&bus)) { - if (dev_get_driver_data(bus) == TYPE_DVC) { - *busp = bus; - return 0; - } - } - - return -ENODEV; + return uclass_first_device_drvdata(UCLASS_I2C, TYPE_DVC, busp); } static const struct dm_i2c_ops tegra_i2c_ops = { |