Message ID | 20230725231322.1375303-1-judge.packham@gmail.com |
---|---|
State | Accepted |
Commit | 414236b887a2270d714edf3654eaa0def6315ec6 |
Delegated to: | Stefan Roese |
Headers | show |
Series | [v2,1/2] i2c: i2c-gpio: Correctly handle new {sda, scl}-gpios bindings | expand |
On 7/26/23 01:13, Chris Packham wrote: > gpio_request_list_by_name() returns the number of gpios requested. > Notably it swallows the underlying -ENOENT when the "gpios" property > does not exist. > > Update the i2c-gpio driver to check for ret == 0 before trying the new > sda-gpios/scl-gpios properties. > > Signed-off-by: Chris Packham <judge.packham@gmail.com> Applied to u-boot-marvell/master Thanks, Stefan > --- > This was originally sent as a single patch[1]. I've rolled it into this > series as the board change is dependent on it. > > [1] - https://lore.kernel.org/u-boot/20230720023107.1184147-1-judge.packham@gmail.com/ > > (no changes since v1) > > drivers/i2c/i2c-gpio.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/i2c/i2c-gpio.c b/drivers/i2c/i2c-gpio.c > index 4ed9e9e7cddd..c1fc290bd253 100644 > --- a/drivers/i2c/i2c-gpio.c > +++ b/drivers/i2c/i2c-gpio.c > @@ -339,7 +339,7 @@ static int i2c_gpio_of_to_plat(struct udevice *dev) > /* "gpios" is deprecated and replaced by "sda-gpios" + "scl-gpios". */ > ret = gpio_request_list_by_name(dev, "gpios", bus->gpios, > ARRAY_SIZE(bus->gpios), 0); > - if (ret == -ENOENT) { > + if (ret == 0) { > ret = gpio_request_by_name(dev, "sda-gpios", 0, > &bus->gpios[PIN_SDA], 0); > if (ret < 0) Viele Grüße, Stefan Roese
Hello Chris, On 26.07.23 01:13, Chris Packham wrote: > gpio_request_list_by_name() returns the number of gpios requested. > Notably it swallows the underlying -ENOENT when the "gpios" property > does not exist. > > Update the i2c-gpio driver to check for ret == 0 before trying the new > sda-gpios/scl-gpios properties. > > Signed-off-by: Chris Packham <judge.packham@gmail.com> > --- > This was originally sent as a single patch[1]. I've rolled it into this > series as the board change is dependent on it. > > [1] - https://lore.kernel.org/u-boot/20230720023107.1184147-1-judge.packham@gmail.com/ > > (no changes since v1) > > drivers/i2c/i2c-gpio.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) Reviewed-by: Heiko Schocher <hs@denx.de> bye, Heiko
diff --git a/drivers/i2c/i2c-gpio.c b/drivers/i2c/i2c-gpio.c index 4ed9e9e7cddd..c1fc290bd253 100644 --- a/drivers/i2c/i2c-gpio.c +++ b/drivers/i2c/i2c-gpio.c @@ -339,7 +339,7 @@ static int i2c_gpio_of_to_plat(struct udevice *dev) /* "gpios" is deprecated and replaced by "sda-gpios" + "scl-gpios". */ ret = gpio_request_list_by_name(dev, "gpios", bus->gpios, ARRAY_SIZE(bus->gpios), 0); - if (ret == -ENOENT) { + if (ret == 0) { ret = gpio_request_by_name(dev, "sda-gpios", 0, &bus->gpios[PIN_SDA], 0); if (ret < 0)
gpio_request_list_by_name() returns the number of gpios requested. Notably it swallows the underlying -ENOENT when the "gpios" property does not exist. Update the i2c-gpio driver to check for ret == 0 before trying the new sda-gpios/scl-gpios properties. Signed-off-by: Chris Packham <judge.packham@gmail.com> --- This was originally sent as a single patch[1]. I've rolled it into this series as the board change is dependent on it. [1] - https://lore.kernel.org/u-boot/20230720023107.1184147-1-judge.packham@gmail.com/ (no changes since v1) drivers/i2c/i2c-gpio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)