diff options
| author | Jonathan Cameron <[email protected]> | 2024-02-17 16:42:36 +0000 |
|---|---|---|
| committer | Jonathan Cameron <[email protected]> | 2024-03-25 19:50:08 +0000 |
| commit | 59ed5e2d505bf5f9b4af64d0021cd0c96aec1f7c (patch) | |
| tree | 1e907d26e37d893d4a82c97c61a93a9c0fcc729c /include/linux | |
| parent | 77fc5151f9c0e6068f1567b73d33e75a0c35333d (diff) | |
device property: Add cleanup.h based fwnode_handle_put() scope based cleanup.
Useful where the fwnode_handle was obtained from a call such as
fwnode_find_reference() as it will safely do nothing if IS_ERR() is true
and will automatically release the reference on the variable leaving
scope.
Reviewed-by: Andy Shevchenko <[email protected]>
Acked-by: Greg Kroah-Hartman <[email protected]>
Reviewed-by: Sakari Ailus <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Jonathan Cameron <[email protected]>
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/property.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/include/linux/property.h b/include/linux/property.h index 93d992a92f59..1322f0cce77a 100644 --- a/include/linux/property.h +++ b/include/linux/property.h @@ -13,6 +13,7 @@ #include <linux/args.h> #include <linux/array_size.h> #include <linux/bits.h> +#include <linux/cleanup.h> #include <linux/fwnode.h> #include <linux/stddef.h> #include <linux/types.h> @@ -194,6 +195,8 @@ static inline void fwnode_handle_put(struct fwnode_handle *fwnode) fwnode_call_void_op(fwnode, put); } +DEFINE_FREE(fwnode_handle, struct fwnode_handle *, fwnode_handle_put(_T)) + int fwnode_irq_get(const struct fwnode_handle *fwnode, unsigned int index); int fwnode_irq_get_byname(const struct fwnode_handle *fwnode, const char *name); |