[U-Boot] [PATCH v2 08/17] dm: i2c: Add a uclass for I2C
Masahiro Yamada
yamada.m at jp.panasonic.com
Wed Nov 19 10:02:12 CET 2014
Hi Simon,
Let me correct my question.
(I should have read my mail three times before sending.)
On Wed, 19 Nov 2014 17:56:34 +0900
Masahiro Yamada <yamada.m at jp.panasonic.com> wrote:
>
>
> > +
> > +int i2c_get_chip(struct udevice *bus, uint chip_addr, struct udevice **devp)
> > +{
> > + struct udevice *dev;
> > +
> > + debug("%s: Searching bus '%s' for address %02x: ", __func__,
> > + bus->name, chip_addr);
> > + for (device_find_first_child(bus, &dev); dev;
> > + device_find_next_child(&dev)) {
> > + struct dm_i2c_chip store;
> > + struct dm_i2c_chip *chip = dev_get_parentdata(dev);
> > + int ret;
> > +
> > + if (!chip) {
> > + chip = &store;
> > + i2c_chip_ofdata_to_platdata(gd->fdt_blob,
> > + dev->of_offset, chip);
> > + }
> > + if (chip->chip_addr == chip_addr) {
> > + ret = device_probe(dev);
> > + debug("found, ret=%d\n", ret);
> > + if (ret)
> > + return ret;
> > + *devp = dev;
> > + return 0;
> > + }
>
>
> If "chip" is "NULL", i2c_chip_ofdata_to_platdata() is called to create
> struct dm_i2c_chip, but it is not thrown away soon. It is not efficient.
I mean:
but it *is* thrown away soon.
Best Regards
Masahiro Yamada
More information about the U-Boot
mailing list