Commit a2262d5b authored by Philippe Gerum's avatar Philippe Gerum

drivers/gpio: core: add OF-based scanner searching for multiple compat strings

parent e34036b3
......@@ -65,6 +65,10 @@ int rtdm_gpiochip_post_event(struct rtdm_gpio_chip *rgc,
int rtdm_gpiochip_scan_of(struct device_node *from,
const char *compat, int type);
int rtdm_gpiochip_scan_array_of(struct device_node *from,
const char *compat[],
int nentries, int type);
void rtdm_gpiochip_remove_of(int type);
#endif
......
......@@ -571,6 +571,25 @@ int rtdm_gpiochip_scan_of(struct device_node *from, const char *compat,
}
EXPORT_SYMBOL_GPL(rtdm_gpiochip_scan_of);
int rtdm_gpiochip_scan_array_of(struct device_node *from,
const char *compat[],
int nentries, int type)
{
int ret = -ENODEV, _ret, n;
for (n = 0; n < nentries; n++) {
_ret = rtdm_gpiochip_scan_of(from, compat[n], type);
if (_ret) {
if (_ret != -ENODEV)
return _ret;
} else
ret = 0;
}
return ret;
}
EXPORT_SYMBOL_GPL(rtdm_gpiochip_scan_array_of);
void rtdm_gpiochip_remove_of(int type)
{
struct rtdm_gpio_chip *rgc, *n;
......
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