Message ID | 1415727993-22032-8-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: > The SPI function does the same thing, so we may as well just use the new > generic function. The 'cs' parameter was not actually used, so can be > dropped. > > Signed-off-by: Simon Glass <sjg@chromium.org> > --- > > Changes in v2: > - Add new patches to adjust SPI to use device_bind_driver() > > drivers/mtd/spi/sandbox.c | 2 +- > drivers/spi/spi-uclass.c | 23 +---------------------- > include/spi.h | 14 -------------- > 3 files changed, 2 insertions(+), 37 deletions(-) > > diff --git a/drivers/mtd/spi/sandbox.c b/drivers/mtd/spi/sandbox.c > index fecf6d4..c6a5c4b 100644 > --- a/drivers/mtd/spi/sandbox.c > +++ b/drivers/mtd/spi/sandbox.c > @@ -609,7 +609,7 @@ static int sandbox_sf_bind_bus_cs(struct sandbox_state *state, int busnum, > return -EEXIST; > } > > - ret = spi_bind_device(bus, cs, "spi_flash_std", spec, &slave); > + ret = device_bind_driver(bus, "spi_flash_std", spec, &slave); > if (ret) > return ret; > > diff --git a/drivers/spi/spi-uclass.c b/drivers/spi/spi-uclass.c > index 6bfc274..64eb1f6 100644 > --- a/drivers/spi/spi-uclass.c > +++ b/drivers/spi/spi-uclass.c > @@ -188,27 +188,6 @@ int spi_cs_info(struct udevice *bus, uint cs, struct spi_cs_info *info) > return -ENODEV; > } > > -int spi_bind_device(struct udevice *bus, int cs, const char *drv_name, > - const char *dev_name, struct udevice **devp) > -{ > - struct driver *drv; > - int ret; > - > - drv = lists_driver_lookup_name(drv_name); > - if (!drv) { > - printf("Cannot find driver '%s'\n", drv_name); > - return -ENOENT; > - } > - ret = device_bind(bus, drv, dev_name, NULL, -1, devp); > - if (ret) { > - printf("Cannot create device named '%s' (err=%d)\n", > - dev_name, ret); > - return ret; > - } > - > - return 0; > -} > - > int spi_find_bus_and_cs(int busnum, int cs, struct udevice **busp, > struct udevice **devp) > { > @@ -255,7 +234,7 @@ int spi_get_bus_and_cs(int busnum, int cs, int speed, int mode, > if (ret == -ENODEV && drv_name) { > debug("%s: Binding new device '%s', busnum=%d, cs=%d, driver=%s\n", > __func__, dev_name, busnum, cs, drv_name); > - ret = spi_bind_device(bus, cs, drv_name, dev_name, &dev); > + ret = device_bind_driver(bus, drv_name, dev_name, &dev); > if (ret) > return ret; > created = true; > diff --git a/include/spi.h b/include/spi.h > index 5975cda..5b78271 100644 > --- a/include/spi.h > +++ b/include/spi.h > @@ -544,20 +544,6 @@ int spi_chip_select(struct udevice *slave); > 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). > - * > - * @bus: SPI bus to search > - * @cs: Chip select to attach to > - * @drv_name: Name of driver to attach to this chip select > - * @dev_name: Name of the new device thus created > - * @devp: Returns the newly bound device > - */ > -int spi_bind_device(struct udevice *bus, int cs, const char *drv_name, > - const char *dev_name, struct udevice **devp); > - > -/** > * spi_ofdata_to_platdata() - decode standard SPI platform data > * > * This decodes the speed and mode from a device tree node and puts it into > -- > 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: > The SPI function does the same thing, so we may as well just use the new > generic function. The 'cs' parameter was not actually used, so can be > dropped. > > Signed-off-by: Simon Glass <sjg@chromium.org> > --- > > Changes in v2: > - Add new patches to adjust SPI to use device_bind_driver() > > drivers/mtd/spi/sandbox.c | 2 +- > drivers/spi/spi-uclass.c | 23 +---------------------- > include/spi.h | 14 -------------- > 3 files changed, 2 insertions(+), 37 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: >> >> The SPI function does the same thing, so we may as well just use the new >> generic function. The 'cs' parameter was not actually used, so can be >> dropped. >> >> Signed-off-by: Simon Glass <sjg@chromium.org> >> --- >> >> Changes in v2: >> - Add new patches to adjust SPI to use device_bind_driver() >> >> drivers/mtd/spi/sandbox.c | 2 +- >> drivers/spi/spi-uclass.c | 23 +---------------------- >> include/spi.h | 14 -------------- >> 3 files changed, 2 insertions(+), 37 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 fecf6d4..c6a5c4b 100644 --- a/drivers/mtd/spi/sandbox.c +++ b/drivers/mtd/spi/sandbox.c @@ -609,7 +609,7 @@ static int sandbox_sf_bind_bus_cs(struct sandbox_state *state, int busnum, return -EEXIST; } - ret = spi_bind_device(bus, cs, "spi_flash_std", spec, &slave); + ret = device_bind_driver(bus, "spi_flash_std", spec, &slave); if (ret) return ret; diff --git a/drivers/spi/spi-uclass.c b/drivers/spi/spi-uclass.c index 6bfc274..64eb1f6 100644 --- a/drivers/spi/spi-uclass.c +++ b/drivers/spi/spi-uclass.c @@ -188,27 +188,6 @@ int spi_cs_info(struct udevice *bus, uint cs, struct spi_cs_info *info) return -ENODEV; } -int spi_bind_device(struct udevice *bus, int cs, const char *drv_name, - const char *dev_name, struct udevice **devp) -{ - struct driver *drv; - int ret; - - drv = lists_driver_lookup_name(drv_name); - if (!drv) { - printf("Cannot find driver '%s'\n", drv_name); - return -ENOENT; - } - ret = device_bind(bus, drv, dev_name, NULL, -1, devp); - if (ret) { - printf("Cannot create device named '%s' (err=%d)\n", - dev_name, ret); - return ret; - } - - return 0; -} - int spi_find_bus_and_cs(int busnum, int cs, struct udevice **busp, struct udevice **devp) { @@ -255,7 +234,7 @@ int spi_get_bus_and_cs(int busnum, int cs, int speed, int mode, if (ret == -ENODEV && drv_name) { debug("%s: Binding new device '%s', busnum=%d, cs=%d, driver=%s\n", __func__, dev_name, busnum, cs, drv_name); - ret = spi_bind_device(bus, cs, drv_name, dev_name, &dev); + ret = device_bind_driver(bus, drv_name, dev_name, &dev); if (ret) return ret; created = true; diff --git a/include/spi.h b/include/spi.h index 5975cda..5b78271 100644 --- a/include/spi.h +++ b/include/spi.h @@ -544,20 +544,6 @@ int spi_chip_select(struct udevice *slave); 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). - * - * @bus: SPI bus to search - * @cs: Chip select to attach to - * @drv_name: Name of driver to attach to this chip select - * @dev_name: Name of the new device thus created - * @devp: Returns the newly bound device - */ -int spi_bind_device(struct udevice *bus, int cs, const char *drv_name, - const char *dev_name, struct udevice **devp); - -/** * spi_ofdata_to_platdata() - decode standard SPI platform data * * This decodes the speed and mode from a device tree node and puts it into
The SPI function does the same thing, so we may as well just use the new generic function. The 'cs' parameter was not actually used, so can be dropped. Signed-off-by: Simon Glass <sjg@chromium.org> --- Changes in v2: - Add new patches to adjust SPI to use device_bind_driver() drivers/mtd/spi/sandbox.c | 2 +- drivers/spi/spi-uclass.c | 23 +---------------------- include/spi.h | 14 -------------- 3 files changed, 2 insertions(+), 37 deletions(-)