Message ID | 1415727993-22032-7-git-send-email-sjg@chromium.org |
---|---|
State | Accepted |
Delegated to: | Simon Glass |
Headers | show |
On 11 November 2014 23:16, Simon Glass <sjg@chromium.org> wrote: > This code was not updated when the chip select handling was adjusted. Fix > it to call the correct function. > > Signed-off-by: Simon Glass <sjg@chromium.org> > --- > > Changes in v2: None > > drivers/mtd/spi/sandbox.c | 2 +- > drivers/spi/spi-uclass.c | 11 +---------- > include/spi.h | 10 ++++++++++ > 3 files changed, 12 insertions(+), 11 deletions(-) > > diff --git a/drivers/mtd/spi/sandbox.c b/drivers/mtd/spi/sandbox.c > index 1cf2f98..fecf6d4 100644 > --- a/drivers/mtd/spi/sandbox.c > +++ b/drivers/mtd/spi/sandbox.c > @@ -602,7 +602,7 @@ static int sandbox_sf_bind_bus_cs(struct sandbox_state *state, int busnum, > spec, ret); > return ret; > } > - ret = device_find_child_by_seq(bus, cs, true, &slave); > + ret = spi_find_chip_select(bus, cs, &slave); > if (!ret) { > printf("Chip select %d already exists for spec '%s'\n", cs, > spec); > diff --git a/drivers/spi/spi-uclass.c b/drivers/spi/spi-uclass.c > index 13c6b77..6bfc274 100644 > --- a/drivers/spi/spi-uclass.c > +++ b/drivers/spi/spi-uclass.c > @@ -115,16 +115,7 @@ int spi_chip_select(struct udevice *dev) > return slave ? slave->cs : -ENOENT; > } > > -/** > - * spi_find_chip_select() - Find the slave attached to chip select > - * > - * @bus: SPI bus to search > - * @cs: Chip select to look for > - * @devp: Returns the slave device if found > - * @return 0 if found, -ENODEV on error > - */ > -static int spi_find_chip_select(struct udevice *bus, int cs, > - struct udevice **devp) > +int spi_find_chip_select(struct udevice *bus, int cs, struct udevice **devp) > { > struct udevice *dev; > > diff --git a/include/spi.h b/include/spi.h > index aa0a48e..5975cda 100644 > --- a/include/spi.h > +++ b/include/spi.h > @@ -534,6 +534,16 @@ int spi_get_bus_and_cs(int busnum, int cs, int speed, int mode, > int spi_chip_select(struct udevice *slave); > > /** > + * spi_find_chip_select() - Find the slave attached to chip select > + * > + * @bus: SPI bus to search > + * @cs: Chip select to look for > + * @devp: Returns the slave device if found > + * @return 0 if found, -ENODEV on error > + */ > +int spi_find_chip_select(struct udevice *bus, int cs, struct udevice **devp); > + > +/** > * spi_bind_device() - bind a device to a bus's chip select > * > * This binds a new device to an given chip select (which must be unused). > -- > 2.1.0.rc2.206.gedb03e5 > Reviewed-by: Jagannadha Sutradharudu Teki <jagannadh.teki@gmail.com> thanks!
Hello Simon, Am 11.11.2014 18:46, schrieb Simon Glass: > This code was not updated when the chip select handling was adjusted. Fix > it to call the correct function. > > Signed-off-by: Simon Glass <sjg@chromium.org> > --- > > Changes in v2: None > > drivers/mtd/spi/sandbox.c | 2 +- > drivers/spi/spi-uclass.c | 11 +---------- > include/spi.h | 10 ++++++++++ > 3 files changed, 12 insertions(+), 11 deletions(-) Acked-by: Heiko Schocher <hs@denx.de> bye, Heiko
On 17 November 2014 at 07:29, Heiko Schocher <hs@denx.de> wrote: > Hello Simon, > > Am 11.11.2014 18:46, schrieb Simon Glass: >> >> This code was not updated when the chip select handling was adjusted. Fix >> it to call the correct function. >> >> Signed-off-by: Simon Glass <sjg@chromium.org> >> --- >> >> Changes in v2: None >> >> drivers/mtd/spi/sandbox.c | 2 +- >> drivers/spi/spi-uclass.c | 11 +---------- >> include/spi.h | 10 ++++++++++ >> 3 files changed, 12 insertions(+), 11 deletions(-) > > > Acked-by: Heiko Schocher <hs@denx.de> Applied to u-boot-dm.
diff --git a/drivers/mtd/spi/sandbox.c b/drivers/mtd/spi/sandbox.c index 1cf2f98..fecf6d4 100644 --- a/drivers/mtd/spi/sandbox.c +++ b/drivers/mtd/spi/sandbox.c @@ -602,7 +602,7 @@ static int sandbox_sf_bind_bus_cs(struct sandbox_state *state, int busnum, spec, ret); return ret; } - ret = device_find_child_by_seq(bus, cs, true, &slave); + ret = spi_find_chip_select(bus, cs, &slave); if (!ret) { printf("Chip select %d already exists for spec '%s'\n", cs, spec); diff --git a/drivers/spi/spi-uclass.c b/drivers/spi/spi-uclass.c index 13c6b77..6bfc274 100644 --- a/drivers/spi/spi-uclass.c +++ b/drivers/spi/spi-uclass.c @@ -115,16 +115,7 @@ int spi_chip_select(struct udevice *dev) return slave ? slave->cs : -ENOENT; } -/** - * spi_find_chip_select() - Find the slave attached to chip select - * - * @bus: SPI bus to search - * @cs: Chip select to look for - * @devp: Returns the slave device if found - * @return 0 if found, -ENODEV on error - */ -static int spi_find_chip_select(struct udevice *bus, int cs, - struct udevice **devp) +int spi_find_chip_select(struct udevice *bus, int cs, struct udevice **devp) { struct udevice *dev; diff --git a/include/spi.h b/include/spi.h index aa0a48e..5975cda 100644 --- a/include/spi.h +++ b/include/spi.h @@ -534,6 +534,16 @@ int spi_get_bus_and_cs(int busnum, int cs, int speed, int mode, int spi_chip_select(struct udevice *slave); /** + * spi_find_chip_select() - Find the slave attached to chip select + * + * @bus: SPI bus to search + * @cs: Chip select to look for + * @devp: Returns the slave device if found + * @return 0 if found, -ENODEV on error + */ +int spi_find_chip_select(struct udevice *bus, int cs, struct udevice **devp); + +/** * spi_bind_device() - bind a device to a bus's chip select * * This binds a new device to an given chip select (which must be unused).
This code was not updated when the chip select handling was adjusted. Fix it to call the correct function. Signed-off-by: Simon Glass <sjg@chromium.org> --- Changes in v2: None drivers/mtd/spi/sandbox.c | 2 +- drivers/spi/spi-uclass.c | 11 +---------- include/spi.h | 10 ++++++++++ 3 files changed, 12 insertions(+), 11 deletions(-)