aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/keyboard/matrix_keypad.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/input/keyboard/matrix_keypad.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/input/keyboard/matrix_keypad.c')
-rw-r--r--drivers/input/keyboard/matrix_keypad.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/input/keyboard/matrix_keypad.c b/drivers/input/keyboard/matrix_keypad.c
index f4ff0dda7597..71d77192ac1e 100644
--- a/drivers/input/keyboard/matrix_keypad.c
+++ b/drivers/input/keyboard/matrix_keypad.c
@@ -403,7 +403,7 @@ matrix_keypad_parse_dt(struct device *dev)
403 struct matrix_keypad_platform_data *pdata; 403 struct matrix_keypad_platform_data *pdata;
404 struct device_node *np = dev->of_node; 404 struct device_node *np = dev->of_node;
405 unsigned int *gpios; 405 unsigned int *gpios;
406 int i; 406 int i, nrow, ncol;
407 407
408 if (!np) { 408 if (!np) {
409 dev_err(dev, "device lacks DT data\n"); 409 dev_err(dev, "device lacks DT data\n");
@@ -416,9 +416,9 @@ matrix_keypad_parse_dt(struct device *dev)
416 return ERR_PTR(-ENOMEM); 416 return ERR_PTR(-ENOMEM);
417 } 417 }
418 418
419 pdata->num_row_gpios = of_gpio_named_count(np, "row-gpios"); 419 pdata->num_row_gpios = nrow = of_gpio_named_count(np, "row-gpios");
420 pdata->num_col_gpios = of_gpio_named_count(np, "col-gpios"); 420 pdata->num_col_gpios = ncol = of_gpio_named_count(np, "col-gpios");
421 if (!pdata->num_row_gpios || !pdata->num_col_gpios) { 421 if (nrow <= 0 || ncol <= 0) {
422 dev_err(dev, "number of keypad rows/columns not specified\n"); 422 dev_err(dev, "number of keypad rows/columns not specified\n");
423 return ERR_PTR(-EINVAL); 423 return ERR_PTR(-EINVAL);
424 } 424 }