Skip to content

Commit 63eb894

Browse files
krishnachaitanya-linuxZiyue Zhang
authored andcommitted
FROMLIST: gpio: Add fwnode_gpiod_get() helper
Add fwnode_gpiod_get() as a convenience wrapper around fwnode_gpiod_get_index() for the common case where only the first GPIO is required. This mirrors existing gpiod_get() and devm_gpiod_get() helpers and avoids open-coding index 0 at call sites. Suggested-by: Manivannan Sadhasivam <mani@kernel.org> Acked-by: Manivannan Sadhasivam <mani@kernel.org> Reviewed-by: Linus Walleij <linusw@kernel.org> Acked-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com> Signed-off-by: Krishna Chaitanya Chundru <krishna.chundru@oss.qualcomm.com> Signed-off-by: Ziyue Zhang <ziyue.zhang@oss.qualcomm.com> Link: https://lore.kernel.org/all/20260511-wakeirq_support-v10-1-c10af9c9eb8c@oss.qualcomm.com/
1 parent bf15344 commit 63eb894

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

include/linux/gpio/consumer.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -585,6 +585,15 @@ static inline int gpiod_disable_hw_timestamp_ns(struct gpio_desc *desc,
585585
}
586586
#endif /* CONFIG_GPIOLIB && CONFIG_HTE */
587587

588+
static inline
589+
struct gpio_desc *fwnode_gpiod_get(struct fwnode_handle *fwnode,
590+
const char *con_id,
591+
enum gpiod_flags flags,
592+
const char *label)
593+
{
594+
return fwnode_gpiod_get_index(fwnode, con_id, 0, flags, label);
595+
}
596+
588597
static inline
589598
struct gpio_desc *devm_fwnode_gpiod_get(struct device *dev,
590599
struct fwnode_handle *fwnode,

0 commit comments

Comments
 (0)