dm: spi: Return 0 if driver does not implement ops->cs_info

If an SPI controller driver does not implement ops->cs_info, that
probably means any chip select number could be valid, hence let's
return 0 for spi_cs_info().

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Jagan Teki <jagan@amarulasolutions.com> # SoPine
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
This commit is contained in:
Bin Meng
2019-09-09 06:00:00 -07:00
committed by Jagan Teki
parent 0c8e605670
commit 4dd520b36b
2 changed files with 5 additions and 6 deletions

View File

@@ -261,11 +261,10 @@ int spi_cs_info(struct udevice *bus, uint cs, struct spi_cs_info *info)
return ops->cs_info(bus, cs, info);
/*
* We could assume there is at least one valid chip select, but best
* to be sure and return an error in this case. The driver didn't
* care enough to tell us.
* We could assume there is at least one valid chip select.
* The driver didn't care enough to tell us.
*/
return -ENODEV;
return 0;
}
int spi_find_bus_and_cs(int busnum, int cs, struct udevice **busp,