diff options
-rw-r--r-- | drivers/spi/spi-atmel.c | 4 | ||||
-rw-r--r-- | drivers/spi/spi-davinci.c | 2 | ||||
-rw-r--r-- | drivers/spi/spi.c | 9 | ||||
-rw-r--r-- | include/linux/spi/spi.h | 4 |
4 files changed, 11 insertions, 8 deletions
diff --git a/drivers/spi/spi-atmel.c b/drivers/spi/spi-atmel.c index 656d137db253..80f5867c088b 100644 --- a/drivers/spi/spi-atmel.c +++ b/drivers/spi/spi-atmel.c | |||
@@ -847,8 +847,8 @@ static int atmel_spi_transfer(struct spi_device *spi, struct spi_message *msg) | |||
847 | } | 847 | } |
848 | 848 | ||
849 | /* FIXME implement these protocol options!! */ | 849 | /* FIXME implement these protocol options!! */ |
850 | if (xfer->speed_hz) { | 850 | if (xfer->speed_hz < spi->max_speed_hz) { |
851 | dev_dbg(&spi->dev, "no protocol options yet\n"); | 851 | dev_dbg(&spi->dev, "can't change speed in transfer\n"); |
852 | return -ENOPROTOOPT; | 852 | return -ENOPROTOOPT; |
853 | } | 853 | } |
854 | 854 | ||
diff --git a/drivers/spi/spi-davinci.c b/drivers/spi/spi-davinci.c index 8234d2259722..6287c8315d0d 100644 --- a/drivers/spi/spi-davinci.c +++ b/drivers/spi/spi-davinci.c | |||
@@ -784,7 +784,7 @@ static const struct of_device_id davinci_spi_of_match[] = { | |||
784 | }, | 784 | }, |
785 | { }, | 785 | { }, |
786 | }; | 786 | }; |
787 | MODULE_DEVICE_TABLE(of, davini_spi_of_match); | 787 | MODULE_DEVICE_TABLE(of, davinci_spi_of_match); |
788 | 788 | ||
789 | /** | 789 | /** |
790 | * spi_davinci_get_pdata - Get platform data from DTS binding | 790 | * spi_davinci_get_pdata - Get platform data from DTS binding |
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index 004b10f184d4..3738e7cbff33 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c | |||
@@ -334,7 +334,7 @@ struct spi_device *spi_alloc_device(struct spi_master *master) | |||
334 | spi->dev.parent = &master->dev; | 334 | spi->dev.parent = &master->dev; |
335 | spi->dev.bus = &spi_bus_type; | 335 | spi->dev.bus = &spi_bus_type; |
336 | spi->dev.release = spidev_release; | 336 | spi->dev.release = spidev_release; |
337 | spi->cs_gpio = -EINVAL; | 337 | spi->cs_gpio = -ENOENT; |
338 | device_initialize(&spi->dev); | 338 | device_initialize(&spi->dev); |
339 | return spi; | 339 | return spi; |
340 | } | 340 | } |
@@ -1067,8 +1067,11 @@ static int of_spi_register_master(struct spi_master *master) | |||
1067 | nb = of_gpio_named_count(np, "cs-gpios"); | 1067 | nb = of_gpio_named_count(np, "cs-gpios"); |
1068 | master->num_chipselect = max(nb, (int)master->num_chipselect); | 1068 | master->num_chipselect = max(nb, (int)master->num_chipselect); |
1069 | 1069 | ||
1070 | if (nb < 1) | 1070 | /* Return error only for an incorrectly formed cs-gpios property */ |
1071 | if (nb == 0 || nb == -ENOENT) | ||
1071 | return 0; | 1072 | return 0; |
1073 | else if (nb < 0) | ||
1074 | return nb; | ||
1072 | 1075 | ||
1073 | cs = devm_kzalloc(&master->dev, | 1076 | cs = devm_kzalloc(&master->dev, |
1074 | sizeof(int) * master->num_chipselect, | 1077 | sizeof(int) * master->num_chipselect, |
@@ -1079,7 +1082,7 @@ static int of_spi_register_master(struct spi_master *master) | |||
1079 | return -ENOMEM; | 1082 | return -ENOMEM; |
1080 | 1083 | ||
1081 | for (i = 0; i < master->num_chipselect; i++) | 1084 | for (i = 0; i < master->num_chipselect; i++) |
1082 | cs[i] = -EINVAL; | 1085 | cs[i] = -ENOENT; |
1083 | 1086 | ||
1084 | for (i = 0; i < nb; i++) | 1087 | for (i = 0; i < nb; i++) |
1085 | cs[i] = of_get_named_gpio(np, "cs-gpios", i); | 1088 | cs[i] = of_get_named_gpio(np, "cs-gpios", i); |
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h index 38c2b925923d..c395f32b53b3 100644 --- a/include/linux/spi/spi.h +++ b/include/linux/spi/spi.h | |||
@@ -57,7 +57,7 @@ extern struct bus_type spi_bus_type; | |||
57 | * @modalias: Name of the driver to use with this device, or an alias | 57 | * @modalias: Name of the driver to use with this device, or an alias |
58 | * for that name. This appears in the sysfs "modalias" attribute | 58 | * for that name. This appears in the sysfs "modalias" attribute |
59 | * for driver coldplugging, and in uevents used for hotplugging | 59 | * for driver coldplugging, and in uevents used for hotplugging |
60 | * @cs_gpio: gpio number of the chipselect line (optional, -EINVAL when | 60 | * @cs_gpio: gpio number of the chipselect line (optional, -ENOENT when |
61 | * when not using a GPIO line) | 61 | * when not using a GPIO line) |
62 | * | 62 | * |
63 | * A @spi_device is used to interchange data between an SPI slave | 63 | * A @spi_device is used to interchange data between an SPI slave |
@@ -261,7 +261,7 @@ static inline void spi_unregister_driver(struct spi_driver *sdrv) | |||
261 | * queue so the subsystem notifies the driver that it may relax the | 261 | * queue so the subsystem notifies the driver that it may relax the |
262 | * hardware by issuing this call | 262 | * hardware by issuing this call |
263 | * @cs_gpios: Array of GPIOs to use as chip select lines; one per CS | 263 | * @cs_gpios: Array of GPIOs to use as chip select lines; one per CS |
264 | * number. Any individual value may be -EINVAL for CS lines that | 264 | * number. Any individual value may be -ENOENT for CS lines that |
265 | * are not GPIOs (driven by the SPI controller itself). | 265 | * are not GPIOs (driven by the SPI controller itself). |
266 | * | 266 | * |
267 | * Each SPI master controller can communicate with one or more @spi_device | 267 | * Each SPI master controller can communicate with one or more @spi_device |