File tree Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -1145,6 +1145,26 @@ struct gpio_device *gpio_device_find_by_label(const char *label)
1145
1145
}
1146
1146
EXPORT_SYMBOL_GPL (gpio_device_find_by_label );
1147
1147
1148
+ static int gpio_chip_match_by_fwnode (struct gpio_chip * gc , void * fwnode )
1149
+ {
1150
+ return device_match_fwnode (& gc -> gpiodev -> dev , fwnode );
1151
+ }
1152
+
1153
+ /**
1154
+ * gpio_device_find_by_fwnode() - wrapper around gpio_device_find() finding
1155
+ * the GPIO device by its fwnode
1156
+ * @fwnode: Firmware node to lookup
1157
+ *
1158
+ * Returns:
1159
+ * Reference to the GPIO device or NULL. Reference must be released with
1160
+ * gpio_device_put().
1161
+ */
1162
+ struct gpio_device * gpio_device_find_by_fwnode (const struct fwnode_handle * fwnode )
1163
+ {
1164
+ return gpio_device_find ((void * )fwnode , gpio_chip_match_by_fwnode );
1165
+ }
1166
+ EXPORT_SYMBOL_GPL (gpio_device_find_by_fwnode );
1167
+
1148
1168
/**
1149
1169
* gpio_device_get() - Increase the reference count of this GPIO device
1150
1170
* @gdev: GPIO device to increase the refcount for
Original file line number Diff line number Diff line change @@ -611,6 +611,7 @@ struct gpio_chip *gpiochip_find(void *data,
611
611
struct gpio_device * gpio_device_find (void * data ,
612
612
int (* match )(struct gpio_chip * gc , void * data ));
613
613
struct gpio_device * gpio_device_find_by_label (const char * label );
614
+ struct gpio_device * gpio_device_find_by_fwnode (const struct fwnode_handle * fwnode );
614
615
615
616
struct gpio_device * gpio_device_get (struct gpio_device * gdev );
616
617
void gpio_device_put (struct gpio_device * gdev );
You can’t perform that action at this time.
0 commit comments