* [PATCH] spi: Initialize cs_gpio and cs_gpios with -ENOENT
@ 2013-02-13 13:20 Andreas Larsson
2013-03-02 22:46 ` Grant Likely
0 siblings, 1 reply; 2+ messages in thread
From: Andreas Larsson @ 2013-02-13 13:20 UTC (permalink / raw)
To: Grant Likely
Cc: spi-devel-general, devicetree-discuss, linux-kernel, software
The return value from of_get_named_gpio is -ENOENT when the given index
matches a hole in the "cs-gpios" property phandle list. However, the
default value of cs_gpio in struct spi_device and entries of cs_gpios in
struct spi_master is -EINVAL, which is documented to indicate that a
GPIO line should not be used for the given spi_device.
This sets the default value of cs_gpio in struct spi_device and entries
of cs_gpios in struct spi_master to -ENOENT. Thus, -ENOENT is the only
value used to indicate that no GPIO line should be used.
Signed-off-by: Andreas Larsson <andreas@gaisler.com>
---
To be applied to spi/next
drivers/spi/spi.c | 4 ++--
include/linux/spi/spi.h | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index 4bca50c..b730a50 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)
spi->dev.parent = &master->dev;
spi->dev.bus = &spi_bus_type;
spi->dev.release = spidev_release;
- spi->cs_gpio = -EINVAL;
+ spi->cs_gpio = -ENOENT;
device_initialize(&spi->dev);
return spi;
}
@@ -1083,7 +1083,7 @@ static int of_spi_register_master(struct spi_master *master)
return -ENOMEM;
for (i = 0; i < master->num_chipselect; i++)
- cs[i] = -EINVAL;
+ cs[i] = -ENOENT;
for (i = 0; i < nb; i++)
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 30e9c50..b0ae8b8 100644
--- a/include/linux/spi/spi.h
+++ b/include/linux/spi/spi.h
@@ -57,7 +57,7 @@ extern struct bus_type spi_bus_type;
* @modalias: Name of the driver to use with this device, or an alias
* for that name. This appears in the sysfs "modalias" attribute
* for driver coldplugging, and in uevents used for hotplugging
- * @cs_gpio: gpio number of the chipselect line (optional, -EINVAL when
+ * @cs_gpio: gpio number of the chipselect line (optional, -ENOENT when
* when not using a GPIO line)
*
* 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)
* queue so the subsystem notifies the driver that it may relax the
* hardware by issuing this call
* @cs_gpios: Array of GPIOs to use as chip select lines; one per CS
- * number. Any individual value may be -EINVAL for CS lines that
+ * number. Any individual value may be -ENOENT for CS lines that
* are not GPIOs (driven by the SPI controller itself).
*
* Each SPI master controller can communicate with one or more @spi_device
--
1.7.0.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] spi: Initialize cs_gpio and cs_gpios with -ENOENT
2013-02-13 13:20 [PATCH] spi: Initialize cs_gpio and cs_gpios with -ENOENT Andreas Larsson
@ 2013-03-02 22:46 ` Grant Likely
0 siblings, 0 replies; 2+ messages in thread
From: Grant Likely @ 2013-03-02 22:46 UTC (permalink / raw)
To: Andreas Larsson
Cc: spi-devel-general, devicetree-discuss, linux-kernel, software
On Wed, 13 Feb 2013 14:20:25 +0100, Andreas Larsson <andreas@gaisler.com> wrote:
> The return value from of_get_named_gpio is -ENOENT when the given index
> matches a hole in the "cs-gpios" property phandle list. However, the
> default value of cs_gpio in struct spi_device and entries of cs_gpios in
> struct spi_master is -EINVAL, which is documented to indicate that a
> GPIO line should not be used for the given spi_device.
>
> This sets the default value of cs_gpio in struct spi_device and entries
> of cs_gpios in struct spi_master to -ENOENT. Thus, -ENOENT is the only
> value used to indicate that no GPIO line should be used.
>
> Signed-off-by: Andreas Larsson <andreas@gaisler.com>
Applied, thanks.
g.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-03-03 9:23 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-13 13:20 [PATCH] spi: Initialize cs_gpio and cs_gpios with -ENOENT Andreas Larsson
2013-03-02 22:46 ` Grant Likely
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).