mirror of
https://github.com/torvalds/linux.git
synced 2026-10-07 05:31:08 -04:00
gpiolib: Add support for removing registered consumer lookup table
In case we unload and load a driver module again that is registering a lookup table, without this it will result in multiple entries. Provide an option to remove the lookup table on driver unload Cc: Samuel Ortiz <[email protected]> Cc: Linus Walleij <[email protected]> Cc: Alexandre Courbot <[email protected]> Cc: Thierry Reding <[email protected]> Reviewed-by: Alexandre Courbot <[email protected]> Reviewed-by: Linus Walleij <[email protected]> Tested-by: Ville Syrjälä <[email protected]> Signed-off-by: Shobhit Kumar <[email protected]> Acked-by: Lee Jones <[email protected]> Signed-off-by: Daniel Vetter <[email protected]>
This commit is contained in:
1 parent
52721d9d33
commit
be9015abb8
2 files changed
+14
No files matched your search
@@ -1672,6 +1672,19 @@ void gpiod_add_lookup_table(struct gpiod_lookup_table *table)
|
||||
mutex_unlock(&gpio_lookup_lock);
|
||||
}
|
||||
|
||||
/**
|
||||
* gpiod_remove_lookup_table() - unregister GPIO device consumers
|
||||
* @table: table of consumers to unregister
|
||||
*/
|
||||
void gpiod_remove_lookup_table(struct gpiod_lookup_table *table)
|
||||
{
|
||||
mutex_lock(&gpio_lookup_lock);
|
||||
|
||||
list_del(&table->list);
|
||||
|
||||
mutex_unlock(&gpio_lookup_lock);
|
||||
}
|
||||
|
||||
static struct gpio_desc *of_find_gpio(struct device *dev, const char *con_id,
|
||||
unsigned int idx,
|
||||
enum gpio_lookup_flags *flags)
|
||||
|
||||
@@ -57,5 +57,6 @@ struct gpiod_lookup_table {
|
||||
}
|
||||
|
||||
void gpiod_add_lookup_table(struct gpiod_lookup_table *table);
|
||||
void gpiod_remove_lookup_table(struct gpiod_lookup_table *table);
|
||||
|
||||
#endif /* __LINUX_GPIO_MACHINE_H */
|
||||
Reference in new issue
Block a user