aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/spi/spi-fsl-spi.c
diff options
context:
space:
mode:
authorGrant Likely <grant.likely@secretlab.ca>2013-02-12 12:48:37 -0500
committerGrant Likely <grant.likely@secretlab.ca>2013-02-13 05:11:53 -0500
commite80beb27d2f81a1c3c8887e0e0a82d77bb392d28 (patch)
tree1f81c7ffb20b23d5f7a157e996fbb176779af88a /drivers/spi/spi-fsl-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-fsl-spi.c')
-rw-r--r--drivers/spi/spi-fsl-spi.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/spi/spi-fsl-spi.c b/drivers/spi/spi-fsl-spi.c
index 1a7f6359d998..086a9eef2e05 100644
--- a/drivers/spi/spi-fsl-spi.c
+++ b/drivers/spi/spi-fsl-spi.c
@@ -947,12 +947,12 @@ static int of_fsl_spi_get_chipselects(struct device *dev)
947 struct device_node *np = dev->of_node; 947 struct device_node *np = dev->of_node;
948 struct fsl_spi_platform_data *pdata = dev->platform_data; 948 struct fsl_spi_platform_data *pdata = dev->platform_data;
949 struct mpc8xxx_spi_probe_info *pinfo = to_of_pinfo(pdata); 949 struct mpc8xxx_spi_probe_info *pinfo = to_of_pinfo(pdata);
950 unsigned int ngpios; 950 int ngpios;
951 int i = 0; 951 int i = 0;
952 int ret; 952 int ret;
953 953
954 ngpios = of_gpio_count(np); 954 ngpios = of_gpio_count(np);
955 if (!ngpios) { 955 if (ngpios <= 0) {
956 /* 956 /*
957 * SPI w/o chip-select line. One SPI device is still permitted 957 * SPI w/o chip-select line. One SPI device is still permitted
958 * though. 958 * though.