Commit 8a4adcf6 authored by Linus Walleij's avatar Linus Walleij Committed by Bartosz Golaszewski

gpio: gpiolib: Simplify gpiochip_add_data_with_key() fwnode

The code defaulting to the parents fwnode if no fwnode was assigned
is unnecessarily convoluted, probably due to refactoring. Simplify
it and make it more human-readable.
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
Reviewed-by: default avatarAnders Roxell <anders.roxell@linaro.org>
Reviewed-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: default avatarBartosz Golaszewski <bartosz.golaszewski@linaro.org>
parent f0967377
...@@ -702,7 +702,6 @@ int gpiochip_add_data_with_key(struct gpio_chip *gc, void *data, ...@@ -702,7 +702,6 @@ int gpiochip_add_data_with_key(struct gpio_chip *gc, void *data,
struct lock_class_key *lock_key, struct lock_class_key *lock_key,
struct lock_class_key *request_key) struct lock_class_key *request_key)
{ {
struct fwnode_handle *fwnode = NULL;
struct gpio_device *gdev; struct gpio_device *gdev;
unsigned long flags; unsigned long flags;
unsigned int i; unsigned int i;
...@@ -710,12 +709,12 @@ int gpiochip_add_data_with_key(struct gpio_chip *gc, void *data, ...@@ -710,12 +709,12 @@ int gpiochip_add_data_with_key(struct gpio_chip *gc, void *data,
int base = 0; int base = 0;
int ret = 0; int ret = 0;
/* If the calling driver did not initialize firmware node, do it here */ /*
if (gc->fwnode) * If the calling driver did not initialize firmware node, do it here
fwnode = gc->fwnode; * using the parent device, if any.
else if (gc->parent) */
fwnode = dev_fwnode(gc->parent); if (!gc->fwnode && gc->parent)
gc->fwnode = fwnode; gc->fwnode = dev_fwnode(gc->parent);
/* /*
* First: allocate and populate the internal stat container, and * First: allocate and populate the internal stat container, and
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment