dm: spi: Change cs_info op to return -EINVAL for invalid cs num
authorBin Meng <bmeng.cn@gmail.com>
Mon, 9 Sep 2019 13:00:01 +0000 (06:00 -0700)
committerJagan Teki <jagan@amarulasolutions.com>
Thu, 24 Oct 2019 19:18:31 +0000 (00:48 +0530)
commit4b060003957db07fa0e35beafe6559f9cc91954c
treeba4a762a7dbe6ed0c16a2a93e6b8a46c2f74876e
parent4dd520b36bce9b35f7a12f3ffd9a95269d425170
dm: spi: Change cs_info op to return -EINVAL for invalid cs num

We need distinguish the following two situations in various SPI APIs:

- given chip select num is invalid
- given chip select num is valid, but no device is attached

Currently -ENODEV is returned for both cases.

For the first case, it's more reasonable to return -EINVAL instead of
-ENODEV for invalid chip select numbers.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Jagan Teki <jagan@amarulasolutions.com> # SoPine
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
doc/driver-model/spi-howto.rst
drivers/spi/ath79_spi.c
drivers/spi/bcm63xx_hsspi.c
drivers/spi/bcm63xx_spi.c
drivers/spi/sandbox_spi.c
drivers/spi/tegra20_sflash.c
include/spi.h