mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 03:27:44 -04:00
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 <[email protected]> Signed-off-by: Grant Likely <[email protected]> Cc: Linus Walleij <[email protected]> Cc: Rob Herring <[email protected]>
This commit is contained in:
parent
bd69f73f2c
commit
e80beb27d2
9 changed files with 41 additions and 71 deletions
|
|
@ -422,7 +422,7 @@ static int gpio_fan_get_of_pdata(struct device *dev,
|
|||
|
||||
/* Fill GPIO pin array */
|
||||
pdata->num_ctrl = of_gpio_count(node);
|
||||
if (!pdata->num_ctrl) {
|
||||
if (pdata->num_ctrl <= 0) {
|
||||
dev_err(dev, "gpios DT property empty / missing");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
|
@ -477,7 +477,7 @@ static int gpio_fan_get_of_pdata(struct device *dev,
|
|||
pdata->speed = speed;
|
||||
|
||||
/* Alarm GPIO if one exists */
|
||||
if (of_gpio_named_count(node, "alarm-gpios")) {
|
||||
if (of_gpio_named_count(node, "alarm-gpios") > 0) {
|
||||
struct gpio_fan_alarm *alarm;
|
||||
int val;
|
||||
enum of_gpio_flags flags;
|
||||
|
|
|
|||
Loading…
Reference in a new issue