History

Merge tag 'gpio-fixes-for-v6.17' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux

Pull gpio fixes from Bartosz Golaszewski: - allow looking up GPIOs by the secondary firmware node too - fix memory leak in gpio-regmap * tag 'gpio-fixes-for-v6.17' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux: gpio: regmap: fix memory leak of gpio_regmap structure gpiolib: Extend software-node support to support secondary software-nodes

Linus Torvalds committed 1 year ago

Commit df283702 parents 3a654ee 3bd44ed2 files · +20 −3Browse files

Unified · Split

2 files
  1. drivers/gpio/gpio-regmap.c +1 −1
  2. drivers/gpio/gpiolib.c +19 −2
drivers/gpio/gpio-regmap.c+1−1
@@ -274,7 +274,7 @@ struct gpio_regmap *gpio_regmap_register(const struct gpio_regmap_config *config · 273 unmodified lines
274 if (!chip->ngpio) {274 if (!chip->ngpio) {
275 ret = gpiochip_get_ngpios(chip, chip->parent);275 ret = gpiochip_get_ngpios(chip, chip->parent);
276 if (ret)276 if (ret)
277 return ERR_PTR(ret);277 goto err_free_gpio;
278 }278 }
279 279
280 /* if not set, assume there is only one register */280 /* if not set, assume there is only one register */
drivers/gpio/gpiolib.c+19−2
@@ -4604,6 +4604,23 @@ static struct gpio_desc *gpiod_find_by_fwnode(struct fwnode_handle *fwnode, · 4603 unmodified lines
4604 return desc;4604 return desc;
4605}4605}
4606 4606
4607static struct gpio_desc *gpiod_fwnode_lookup(struct fwnode_handle *fwnode,
4608 struct device *consumer,
4609 const char *con_id,
4610 unsigned int idx,
4611 enum gpiod_flags *flags,
4612 unsigned long *lookupflags)
4613{
4614 struct gpio_desc *desc;
4615
4616 desc = gpiod_find_by_fwnode(fwnode, consumer, con_id, idx, flags, lookupflags);
4617 if (gpiod_not_found(desc) && !IS_ERR_OR_NULL(fwnode))
4618 desc = gpiod_find_by_fwnode(fwnode->secondary, consumer, con_id,
4619 idx, flags, lookupflags);
4620
4621 return desc;
4622}
4623
4607struct gpio_desc *gpiod_find_and_request(struct device *consumer,4624struct gpio_desc *gpiod_find_and_request(struct device *consumer,
4608 struct fwnode_handle *fwnode,4625 struct fwnode_handle *fwnode,
4609 const char *con_id,4626 const char *con_id,
@@ -4622,8 +4639,8 @@ struct gpio_desc *gpiod_find_and_request(struct device *consumer, · 12 unmodified lines
4622 int ret = 0;4639 int ret = 0;
4623 4640
4624 scoped_guard(srcu, &gpio_devices_srcu) {4641 scoped_guard(srcu, &gpio_devices_srcu) {
4625 desc = gpiod_find_by_fwnode(fwnode, consumer, con_id, idx,4642 desc = gpiod_fwnode_lookup(fwnode, consumer, con_id, idx,
4626 &flags, &lookupflags);4643 &flags, &lookupflags);
4627 if (gpiod_not_found(desc) && platform_lookup_allowed) {4644 if (gpiod_not_found(desc) && platform_lookup_allowed) {
4628 /*4645 /*
4629 * Either we are not using DT or ACPI, or their lookup4646 * Either we are not using DT or ACPI, or their lookup