mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-05 10:31:46 +09:00
device property: Add cleanup.h based fwnode_handle_put() scope based cleanup.
[ Upstream commit 59ed5e2d505bf5f9b4af64d0021cd0c96aec1f7c ] 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 <andriy.shevchenko@linux.intel.com> Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Reviewed-by: Sakari Ailus <sakari.ailus@linux.intel.com> Link: https://lore.kernel.org/r/20240217164249.921878-3-jic23@kernel.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Stable-dep-of: 73b03b27736e ("leds: flash: mt6360: Fix device_for_each_child_node() refcounting in error paths") Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
0ba045ab08
commit
da1097f8d9
@@ -11,6 +11,7 @@
|
|||||||
#define _LINUX_PROPERTY_H_
|
#define _LINUX_PROPERTY_H_
|
||||||
|
|
||||||
#include <linux/bits.h>
|
#include <linux/bits.h>
|
||||||
|
#include <linux/cleanup.h>
|
||||||
#include <linux/fwnode.h>
|
#include <linux/fwnode.h>
|
||||||
#include <linux/types.h>
|
#include <linux/types.h>
|
||||||
|
|
||||||
@@ -129,6 +130,8 @@ struct fwnode_handle *device_get_named_child_node(const struct device *dev,
|
|||||||
struct fwnode_handle *fwnode_handle_get(struct fwnode_handle *fwnode);
|
struct fwnode_handle *fwnode_handle_get(struct fwnode_handle *fwnode);
|
||||||
void fwnode_handle_put(struct fwnode_handle *fwnode);
|
void fwnode_handle_put(struct fwnode_handle *fwnode);
|
||||||
|
|
||||||
|
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(const struct fwnode_handle *fwnode, unsigned int index);
|
||||||
int fwnode_irq_get_byname(const struct fwnode_handle *fwnode, const char *name);
|
int fwnode_irq_get_byname(const struct fwnode_handle *fwnode, const char *name);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user