mirror of
https://github.com/Fishwaldo/u-boot.git
synced 2025-03-29 02:21:31 +00:00
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>
This commit is contained in:
parent
ae44cafcb3
commit
fdec36f248
1 changed files with 1 additions and 12 deletions
|
@ -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)
|
int tegra_i2c_get_dvc_bus(struct udevice **busp)
|
||||||
{
|
{
|
||||||
struct udevice *bus;
|
return uclass_first_device_drvdata(UCLASS_I2C, TYPE_DVC, busp);
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct dm_i2c_ops tegra_i2c_ops = {
|
static const struct dm_i2c_ops tegra_i2c_ops = {
|
||||||
|
|
Loading…
Add table
Reference in a new issue