Commit 2e5fde8c authored by Hongzhan Chen's avatar Hongzhan Chen Committed by Jan Kiszka

drivers/gpio: core: introduce helper to find gpiochip

To find gpiochip for non-OF platforms like x86
Signed-off-by: default avatarHongzhan Chen <>
parent 0bec4bdb
......@@ -61,6 +61,9 @@ int rtdm_gpiochip_add_by_name(struct rtdm_gpio_chip *rgc,
int rtdm_gpiochip_post_event(struct rtdm_gpio_chip *rgc,
unsigned int offset);
int rtdm_gpiochip_find(struct device_node *from,
const char *label, int type);
#ifdef CONFIG_OF
int rtdm_gpiochip_scan_of(struct device_node *from,
......@@ -520,6 +520,29 @@ int rtdm_gpiochip_add_by_name(struct rtdm_gpio_chip *rgc,
int rtdm_gpiochip_find(struct device_node *from, const char *label,
int type)
struct rtdm_gpio_chip *rgc;
struct gpio_chip *chip;
int ret = -ENODEV;
if (!rtdm_available())
return -ENOSYS;
chip = find_chip_by_name(label);
if (chip == NULL)
return ret;
ret = 0;
rgc = rtdm_gpiochip_alloc(chip, type);
if (IS_ERR(rgc))
ret = PTR_ERR(rgc);
return ret;
#ifdef CONFIG_OF
#include <linux/of_platform.h>
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