aboutsummaryrefslogtreecommitdiff
path: root/drivers/spi/spi.c
diff options
context:
space:
mode:
authorGrant Likely <grant.likely@secretlab.ca>2013-02-12 17:48:37 +0000
committerGrant Likely <grant.likely@secretlab.ca>2013-02-13 10:11:53 +0000
commite80beb27d2f81a1c3c8887e0e0a82d77bb392d28 (patch)
tree1f81c7ffb20b23d5f7a157e996fbb176779af88a /drivers/spi/spi.c
parentbd69f73f2c81eed9a398708b8c4bb3409ba1b0f9 (diff)
gpio: Make of_count_named_gpios() use new of_count_phandle_with_args()
This patch replaces the horribly coded of_count_named_gpios() with a call to of_count_phandle_with_args() which is far more efficient. This also changes the return value of of_gpio_count() & of_gpio_named_count() from 'unsigned int' to 'int' so that it can return an error code. All the users of that function are fixed up to correctly handle a negative return value. v2: Split GPIO portion into a separate patch Tested-by: Andreas Larsson <andreas@gaisler.com> Signed-off-by: Grant Likely <grant.likely@secretlab.ca> Cc: Linus Walleij <linus.walleij@linaro.org> Cc: Rob Herring <rob.herring@calxeda.com>
Diffstat (limited to 'drivers/spi/spi.c')
-rw-r--r--drivers/spi/spi.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index 19ee901577d..21c47482d9f 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -1059,15 +1059,14 @@ EXPORT_SYMBOL_GPL(spi_alloc_master);
#ifdef CONFIG_OF
static int of_spi_register_master(struct spi_master *master)
{
- u16 nb;
- int i, *cs;
+ int nb, i, *cs;
struct device_node *np = master->dev.of_node;
if (!np)
return 0;
nb = of_gpio_named_count(np, "cs-gpios");
- master->num_chipselect = max(nb, master->num_chipselect);
+ master->num_chipselect = max(nb, (int)master->num_chipselect);
if (nb < 1)
return 0;