Loading drivers/gpio/devres.c +8 −2 Original line number Diff line number Diff line Loading @@ -129,13 +129,19 @@ EXPORT_SYMBOL(devm_gpiod_get_index); * @dev: GPIO consumer * @con_id: function within the GPIO consumer * @child: firmware node (child of @dev) * @flags: GPIO initialization flags * * GPIO descriptors returned from this function are automatically disposed on * driver detach. * * On successfull request the GPIO pin is configured in accordance with * provided @flags. */ struct gpio_desc *devm_get_gpiod_from_child(struct device *dev, const char *con_id, struct fwnode_handle *child) struct fwnode_handle *child, enum gpiod_flags flags, const char *label) { char prop_name[32]; /* 32 is max size of property name */ struct gpio_desc **dr; Loading @@ -155,7 +161,7 @@ struct gpio_desc *devm_get_gpiod_from_child(struct device *dev, snprintf(prop_name, sizeof(prop_name), "%s", gpio_suffixes[i]); desc = fwnode_get_named_gpiod(child, prop_name); desc = fwnode_get_named_gpiod(child, prop_name, flags, label); if (!IS_ERR(desc) || (PTR_ERR(desc) != -ENOENT)) break; } Loading drivers/gpio/gpiolib.c +18 −5 Original line number Diff line number Diff line Loading @@ -3301,6 +3301,7 @@ EXPORT_SYMBOL_GPL(gpiod_get_index); * fwnode_get_named_gpiod - obtain a GPIO from firmware node * @fwnode: handle of the firmware node * @propname: name of the firmware property representing the GPIO * @dflags: GPIO initialization flags * * This function can be used for drivers that get their configuration * from firmware. Loading @@ -3309,12 +3310,18 @@ EXPORT_SYMBOL_GPL(gpiod_get_index); * underlying firmware interface and then makes sure that the GPIO * descriptor is requested before it is returned to the caller. * * On successfull request the GPIO pin is configured in accordance with * provided @dflags. * * In case of error an ERR_PTR() is returned. */ struct gpio_desc *fwnode_get_named_gpiod(struct fwnode_handle *fwnode, const char *propname) const char *propname, enum gpiod_flags dflags, const char *label) { struct gpio_desc *desc = ERR_PTR(-ENODEV); unsigned long lflags = 0; bool active_low = false; bool single_ended = false; int ret; Loading Loading @@ -3342,18 +3349,24 @@ struct gpio_desc *fwnode_get_named_gpiod(struct fwnode_handle *fwnode, if (IS_ERR(desc)) return desc; ret = gpiod_request(desc, NULL); ret = gpiod_request(desc, label); if (ret) return ERR_PTR(ret); if (active_low) set_bit(FLAG_ACTIVE_LOW, &desc->flags); lflags |= GPIO_ACTIVE_LOW; if (single_ended) { if (active_low) set_bit(FLAG_OPEN_DRAIN, &desc->flags); lflags |= GPIO_OPEN_DRAIN; else set_bit(FLAG_OPEN_SOURCE, &desc->flags); lflags |= GPIO_OPEN_SOURCE; } ret = gpiod_configure_flags(desc, propname, lflags, dflags); if (ret < 0) { gpiod_put(desc); return ERR_PTR(ret); } return desc; Loading drivers/input/keyboard/gpio_keys.c +2 −8 Original line number Diff line number Diff line Loading @@ -481,7 +481,8 @@ static int gpio_keys_setup_key(struct platform_device *pdev, spin_lock_init(&bdata->lock); if (child) { bdata->gpiod = devm_get_gpiod_from_child(dev, NULL, child); bdata->gpiod = devm_get_gpiod_from_child(dev, NULL, child, GPIOD_IN, desc); if (IS_ERR(bdata->gpiod)) { error = PTR_ERR(bdata->gpiod); if (error == -ENOENT) { Loading @@ -496,13 +497,6 @@ static int gpio_keys_setup_key(struct platform_device *pdev, error); return error; } } else { error = gpiod_direction_input(bdata->gpiod); if (error) { dev_err(dev, "Failed to configure GPIO %d as input: %d\n", desc_to_gpio(bdata->gpiod), error); return error; } } } else if (gpio_is_valid(button->gpio)) { /* Loading drivers/input/keyboard/gpio_keys_polled.c +3 −9 Original line number Diff line number Diff line Loading @@ -304,7 +304,9 @@ static int gpio_keys_polled_probe(struct platform_device *pdev) } bdata->gpiod = devm_get_gpiod_from_child(dev, NULL, child); child, GPIOD_IN, button->desc); if (IS_ERR(bdata->gpiod)) { error = PTR_ERR(bdata->gpiod); if (error != -EPROBE_DEFER) Loading @@ -314,14 +316,6 @@ static int gpio_keys_polled_probe(struct platform_device *pdev) fwnode_handle_put(child); return error; } error = gpiod_direction_input(bdata->gpiod); if (error) { dev_err(dev, "Failed to configure GPIO %d as input: %d\n", desc_to_gpio(bdata->gpiod), error); fwnode_handle_put(child); return error; } } else if (gpio_is_valid(button->gpio)) { /* * Legacy GPIO number so request the GPIO here and Loading drivers/leds/leds-gpio.c +7 −6 Original line number Diff line number Diff line Loading @@ -174,12 +174,6 @@ static struct gpio_leds_priv *gpio_leds_create(struct platform_device *pdev) const char *state = NULL; struct device_node *np = to_of_node(child); led.gpiod = devm_get_gpiod_from_child(dev, NULL, child); if (IS_ERR(led.gpiod)) { fwnode_handle_put(child); return ERR_CAST(led.gpiod); } ret = fwnode_property_read_string(child, "label", &led.name); if (ret && IS_ENABLED(CONFIG_OF) && np) led.name = np->name; Loading @@ -188,6 +182,13 @@ static struct gpio_leds_priv *gpio_leds_create(struct platform_device *pdev) return ERR_PTR(-EINVAL); } led.gpiod = devm_get_gpiod_from_child(dev, NULL, child, GPIOD_ASIS, led.name); if (IS_ERR(led.gpiod)) { fwnode_handle_put(child); return ERR_CAST(led.gpiod); } fwnode_property_read_string(child, "linux,default-trigger", &led.default_trigger); Loading Loading
drivers/gpio/devres.c +8 −2 Original line number Diff line number Diff line Loading @@ -129,13 +129,19 @@ EXPORT_SYMBOL(devm_gpiod_get_index); * @dev: GPIO consumer * @con_id: function within the GPIO consumer * @child: firmware node (child of @dev) * @flags: GPIO initialization flags * * GPIO descriptors returned from this function are automatically disposed on * driver detach. * * On successfull request the GPIO pin is configured in accordance with * provided @flags. */ struct gpio_desc *devm_get_gpiod_from_child(struct device *dev, const char *con_id, struct fwnode_handle *child) struct fwnode_handle *child, enum gpiod_flags flags, const char *label) { char prop_name[32]; /* 32 is max size of property name */ struct gpio_desc **dr; Loading @@ -155,7 +161,7 @@ struct gpio_desc *devm_get_gpiod_from_child(struct device *dev, snprintf(prop_name, sizeof(prop_name), "%s", gpio_suffixes[i]); desc = fwnode_get_named_gpiod(child, prop_name); desc = fwnode_get_named_gpiod(child, prop_name, flags, label); if (!IS_ERR(desc) || (PTR_ERR(desc) != -ENOENT)) break; } Loading
drivers/gpio/gpiolib.c +18 −5 Original line number Diff line number Diff line Loading @@ -3301,6 +3301,7 @@ EXPORT_SYMBOL_GPL(gpiod_get_index); * fwnode_get_named_gpiod - obtain a GPIO from firmware node * @fwnode: handle of the firmware node * @propname: name of the firmware property representing the GPIO * @dflags: GPIO initialization flags * * This function can be used for drivers that get their configuration * from firmware. Loading @@ -3309,12 +3310,18 @@ EXPORT_SYMBOL_GPL(gpiod_get_index); * underlying firmware interface and then makes sure that the GPIO * descriptor is requested before it is returned to the caller. * * On successfull request the GPIO pin is configured in accordance with * provided @dflags. * * In case of error an ERR_PTR() is returned. */ struct gpio_desc *fwnode_get_named_gpiod(struct fwnode_handle *fwnode, const char *propname) const char *propname, enum gpiod_flags dflags, const char *label) { struct gpio_desc *desc = ERR_PTR(-ENODEV); unsigned long lflags = 0; bool active_low = false; bool single_ended = false; int ret; Loading Loading @@ -3342,18 +3349,24 @@ struct gpio_desc *fwnode_get_named_gpiod(struct fwnode_handle *fwnode, if (IS_ERR(desc)) return desc; ret = gpiod_request(desc, NULL); ret = gpiod_request(desc, label); if (ret) return ERR_PTR(ret); if (active_low) set_bit(FLAG_ACTIVE_LOW, &desc->flags); lflags |= GPIO_ACTIVE_LOW; if (single_ended) { if (active_low) set_bit(FLAG_OPEN_DRAIN, &desc->flags); lflags |= GPIO_OPEN_DRAIN; else set_bit(FLAG_OPEN_SOURCE, &desc->flags); lflags |= GPIO_OPEN_SOURCE; } ret = gpiod_configure_flags(desc, propname, lflags, dflags); if (ret < 0) { gpiod_put(desc); return ERR_PTR(ret); } return desc; Loading
drivers/input/keyboard/gpio_keys.c +2 −8 Original line number Diff line number Diff line Loading @@ -481,7 +481,8 @@ static int gpio_keys_setup_key(struct platform_device *pdev, spin_lock_init(&bdata->lock); if (child) { bdata->gpiod = devm_get_gpiod_from_child(dev, NULL, child); bdata->gpiod = devm_get_gpiod_from_child(dev, NULL, child, GPIOD_IN, desc); if (IS_ERR(bdata->gpiod)) { error = PTR_ERR(bdata->gpiod); if (error == -ENOENT) { Loading @@ -496,13 +497,6 @@ static int gpio_keys_setup_key(struct platform_device *pdev, error); return error; } } else { error = gpiod_direction_input(bdata->gpiod); if (error) { dev_err(dev, "Failed to configure GPIO %d as input: %d\n", desc_to_gpio(bdata->gpiod), error); return error; } } } else if (gpio_is_valid(button->gpio)) { /* Loading
drivers/input/keyboard/gpio_keys_polled.c +3 −9 Original line number Diff line number Diff line Loading @@ -304,7 +304,9 @@ static int gpio_keys_polled_probe(struct platform_device *pdev) } bdata->gpiod = devm_get_gpiod_from_child(dev, NULL, child); child, GPIOD_IN, button->desc); if (IS_ERR(bdata->gpiod)) { error = PTR_ERR(bdata->gpiod); if (error != -EPROBE_DEFER) Loading @@ -314,14 +316,6 @@ static int gpio_keys_polled_probe(struct platform_device *pdev) fwnode_handle_put(child); return error; } error = gpiod_direction_input(bdata->gpiod); if (error) { dev_err(dev, "Failed to configure GPIO %d as input: %d\n", desc_to_gpio(bdata->gpiod), error); fwnode_handle_put(child); return error; } } else if (gpio_is_valid(button->gpio)) { /* * Legacy GPIO number so request the GPIO here and Loading
drivers/leds/leds-gpio.c +7 −6 Original line number Diff line number Diff line Loading @@ -174,12 +174,6 @@ static struct gpio_leds_priv *gpio_leds_create(struct platform_device *pdev) const char *state = NULL; struct device_node *np = to_of_node(child); led.gpiod = devm_get_gpiod_from_child(dev, NULL, child); if (IS_ERR(led.gpiod)) { fwnode_handle_put(child); return ERR_CAST(led.gpiod); } ret = fwnode_property_read_string(child, "label", &led.name); if (ret && IS_ENABLED(CONFIG_OF) && np) led.name = np->name; Loading @@ -188,6 +182,13 @@ static struct gpio_leds_priv *gpio_leds_create(struct platform_device *pdev) return ERR_PTR(-EINVAL); } led.gpiod = devm_get_gpiod_from_child(dev, NULL, child, GPIOD_ASIS, led.name); if (IS_ERR(led.gpiod)) { fwnode_handle_put(child); return ERR_CAST(led.gpiod); } fwnode_property_read_string(child, "linux,default-trigger", &led.default_trigger); Loading