aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2013-05-13 10:27:18 -0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2013-05-13 10:27:18 -0400
commit88b0357dde1c2721a64268e4601d1c2dec1158b0 (patch)
treea86c0af317bbb3f501c4d5b3517b02640a9f69c0
parent0faa3146f17295f612abadafbfe3d4346178f10f (diff)
parent3086c9f6482101b3c06935cdfb4d4b56adb60097 (diff)
Merge remote-tracking branch 'spi/fix/grant' into spi-linus
-rw-r--r--drivers/spi/spi-atmel.c4
-rw-r--r--drivers/spi/spi-davinci.c2
-rw-r--r--drivers/spi/spi.c9
-rw-r--r--include/linux/spi/spi.h4
4 files changed, 11 insertions, 8 deletions
diff --git a/drivers/spi/spi-atmel.c b/drivers/spi/spi-atmel.c
index d8cb7da65efe..380387a47b1d 100644
--- a/drivers/spi/spi-atmel.c
+++ b/drivers/spi/spi-atmel.c
@@ -1408,8 +1408,8 @@ static int atmel_spi_transfer(struct spi_device *spi, struct spi_message *msg)
1408 } 1408 }
1409 1409
1410 /* FIXME implement these protocol options!! */ 1410 /* FIXME implement these protocol options!! */
1411 if (xfer->speed_hz) { 1411 if (xfer->speed_hz < spi->max_speed_hz) {
1412 dev_dbg(&spi->dev, "no protocol options yet\n"); 1412 dev_dbg(&spi->dev, "can't change speed in transfer\n");
1413 return -ENOPROTOOPT; 1413 return -ENOPROTOOPT;
1414 } 1414 }
1415 1415
diff --git a/drivers/spi/spi-davinci.c b/drivers/spi/spi-davinci.c
index 2e8f24a1fb95..50b13c9b1ab6 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};
787MODULE_DEVICE_TABLE(of, davini_spi_of_match); 787MODULE_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 163fd802b7ac..32b7bb111eb6 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 733eb5ee31c5..6ff26c8db7b9 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
@@ -266,7 +266,7 @@ static inline void spi_unregister_driver(struct spi_driver *sdrv)
266 * queue so the subsystem notifies the driver that it may relax the 266 * queue so the subsystem notifies the driver that it may relax the
267 * hardware by issuing this call 267 * hardware by issuing this call
268 * @cs_gpios: Array of GPIOs to use as chip select lines; one per CS 268 * @cs_gpios: Array of GPIOs to use as chip select lines; one per CS
269 * number. Any individual value may be -EINVAL for CS lines that 269 * number. Any individual value may be -ENOENT for CS lines that
270 * are not GPIOs (driven by the SPI controller itself). 270 * are not GPIOs (driven by the SPI controller itself).
271 * 271 *
272 * Each SPI master controller can communicate with one or more @spi_device 272 * Each SPI master controller can communicate with one or more @spi_device