Message ID | 20240201155532.49707-2-brgl@bgdev.pl (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | power: sequencing: implement the subsystem and add first users | expand |
On Thu, Feb 1, 2024 at 9:55 AM Bartosz Golaszewski <brgl@bgdev.pl> wrote: > > From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org> > > Allow to use __free() to automatically put references to OF nodes. Jonathan has already been working on this[1]. Rob [1] https://lore.kernel.org/all/20240128160542.178315-1-jic23@kernel.org/
On Thu, Feb 1, 2024 at 11:18 PM Rob Herring <robh@kernel.org> wrote: > > On Thu, Feb 1, 2024 at 9:55 AM Bartosz Golaszewski <brgl@bgdev.pl> wrote: > > > > From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org> > > > > Allow to use __free() to automatically put references to OF nodes. > > Jonathan has already been working on this[1]. > > Rob > > [1] https://lore.kernel.org/all/20240128160542.178315-1-jic23@kernel.org/ Thanks, I will watch this but for now I'll have to stick to carrying it in my series until it gets upstream. Bart
diff --git a/include/linux/of.h b/include/linux/of.h index 331e05918f11..5462ed47f25b 100644 --- a/include/linux/of.h +++ b/include/linux/of.h @@ -11,6 +11,8 @@ * Updates for SPARC64 by David S. Miller * Derived from PowerPC and Sparc prom.h files by Stephen Rothwell, IBM Corp. */ + +#include <linux/cleanup.h> #include <linux/types.h> #include <linux/bitops.h> #include <linux/errno.h> @@ -887,6 +889,8 @@ static inline const void *of_device_get_match_data(const struct device *dev) #define of_match_node(_matches, _node) NULL #endif /* CONFIG_OF */ +DEFINE_FREE(of_node, struct device_node *, if (_T) of_node_put(_T)) + /* Default string compare functions, Allow arch asm/prom.h to override */ #if !defined(of_compat_cmp) #define of_compat_cmp(s1, s2, l) strcasecmp((s1), (s2))