* [PATCH v2 0/2] gpiolib: more cleanups to get rid of of_node @ 2022-10-05 15:29 Andy Shevchenko 2022-10-05 15:29 ` [PATCH v2 1/2] device property: Introduce fwnode_device_is_compatible() helper Andy Shevchenko ` (2 more replies) 0 siblings, 3 replies; 7+ messages in thread From: Andy Shevchenko @ 2022-10-05 15:29 UTC (permalink / raw) To: Andy Shevchenko, linuxppc-dev, linux-arm-kernel, linux-kernel, linux-acpi Cc: Qiang Zhao, Li Yang, Daniel Scally, Heikki Krogerus, Sakari Ailus One more user outside of GPIO library and pin control folders needs to be updated to use fwnode instead of of_node. To make this easier introduce a helper in property.h and convert the user. Note, the helper will be useful not only for the current users, but any future ones that want to replace of_device_is_compatible() with analogous fwnode API. Changelog v2: - placed new helper correctly in the property.h Andy Shevchenko (2): device property: Introduce fwnode_device_is_compatible() helper soc: fsl: qe: Switch to use fwnode instead of of_node drivers/soc/fsl/qe/gpio.c | 4 +++- include/linux/property.h | 10 +++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) -- 2.35.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v2 1/2] device property: Introduce fwnode_device_is_compatible() helper 2022-10-05 15:29 [PATCH v2 0/2] gpiolib: more cleanups to get rid of of_node Andy Shevchenko @ 2022-10-05 15:29 ` Andy Shevchenko 2022-10-05 21:05 ` Sakari Ailus 2022-10-05 15:29 ` [PATCH v2 2/2] soc: fsl: qe: Switch to use fwnode instead of of_node Andy Shevchenko 2022-10-21 19:01 ` [PATCH v2 0/2] gpiolib: more cleanups to get rid " Andy Shevchenko 2 siblings, 1 reply; 7+ messages in thread From: Andy Shevchenko @ 2022-10-05 15:29 UTC (permalink / raw) To: Andy Shevchenko, linuxppc-dev, linux-arm-kernel, linux-kernel, linux-acpi Cc: Qiang Zhao, Li Yang, Daniel Scally, Heikki Krogerus, Sakari Ailus The fwnode_device_is_compatible() helper searches for the given string in the "compatible" string array property and, if found, returns true. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> --- include/linux/property.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/include/linux/property.h b/include/linux/property.h index 1c26d263d5e4..701570423943 100644 --- a/include/linux/property.h +++ b/include/linux/property.h @@ -55,7 +55,6 @@ int device_property_read_string(struct device *dev, const char *propname, int device_property_match_string(struct device *dev, const char *propname, const char *string); -bool fwnode_device_is_available(const struct fwnode_handle *fwnode); bool fwnode_property_present(const struct fwnode_handle *fwnode, const char *propname); int fwnode_property_read_u8_array(const struct fwnode_handle *fwnode, @@ -77,6 +76,15 @@ int fwnode_property_read_string(const struct fwnode_handle *fwnode, const char *propname, const char **val); int fwnode_property_match_string(const struct fwnode_handle *fwnode, const char *propname, const char *string); + +bool fwnode_device_is_available(const struct fwnode_handle *fwnode); + +static inline +bool fwnode_device_is_compatible(const struct fwnode_handle *fwnode, const char *compat) +{ + return fwnode_property_match_string(fwnode, "compatible", compat) >= 0; +} + int fwnode_property_get_reference_args(const struct fwnode_handle *fwnode, const char *prop, const char *nargs_prop, unsigned int nargs, unsigned int index, -- 2.35.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH v2 1/2] device property: Introduce fwnode_device_is_compatible() helper 2022-10-05 15:29 ` [PATCH v2 1/2] device property: Introduce fwnode_device_is_compatible() helper Andy Shevchenko @ 2022-10-05 21:05 ` Sakari Ailus 2022-10-06 12:34 ` Andy Shevchenko 0 siblings, 1 reply; 7+ messages in thread From: Sakari Ailus @ 2022-10-05 21:05 UTC (permalink / raw) To: Andy Shevchenko Cc: linuxppc-dev, linux-arm-kernel, linux-kernel, linux-acpi, Qiang Zhao, Li Yang, Daniel Scally, Heikki Krogerus Hi Andy, On Wed, Oct 05, 2022 at 06:29:46PM +0300, Andy Shevchenko wrote: > The fwnode_device_is_compatible() helper searches for the > given string in the "compatible" string array property and, > if found, returns true. > > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> > --- > include/linux/property.h | 10 +++++++++- > 1 file changed, 9 insertions(+), 1 deletion(-) > > diff --git a/include/linux/property.h b/include/linux/property.h > index 1c26d263d5e4..701570423943 100644 > --- a/include/linux/property.h > +++ b/include/linux/property.h > @@ -55,7 +55,6 @@ int device_property_read_string(struct device *dev, const char *propname, > int device_property_match_string(struct device *dev, > const char *propname, const char *string); > > -bool fwnode_device_is_available(const struct fwnode_handle *fwnode); > bool fwnode_property_present(const struct fwnode_handle *fwnode, > const char *propname); > int fwnode_property_read_u8_array(const struct fwnode_handle *fwnode, > @@ -77,6 +76,15 @@ int fwnode_property_read_string(const struct fwnode_handle *fwnode, > const char *propname, const char **val); > int fwnode_property_match_string(const struct fwnode_handle *fwnode, > const char *propname, const char *string); > + > +bool fwnode_device_is_available(const struct fwnode_handle *fwnode); > + > +static inline > +bool fwnode_device_is_compatible(const struct fwnode_handle *fwnode, const char *compat) > +{ > + return fwnode_property_match_string(fwnode, "compatible", compat) >= 0; fwnode_property_match_string() returns zero on success, therefore >= 0 is not needed. I'd just use !fwnode_property_match_string(...). For both patches: Reviewed-by: Sakari Ailus <sakari.ailus@linux.intel.com> > +} > + > int fwnode_property_get_reference_args(const struct fwnode_handle *fwnode, > const char *prop, const char *nargs_prop, > unsigned int nargs, unsigned int index, -- Regards, Sakari Ailus _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2 1/2] device property: Introduce fwnode_device_is_compatible() helper 2022-10-05 21:05 ` Sakari Ailus @ 2022-10-06 12:34 ` Andy Shevchenko 0 siblings, 0 replies; 7+ messages in thread From: Andy Shevchenko @ 2022-10-06 12:34 UTC (permalink / raw) To: Sakari Ailus Cc: linuxppc-dev, linux-arm-kernel, linux-kernel, linux-acpi, Qiang Zhao, Li Yang, Daniel Scally, Heikki Krogerus On Wed, Oct 05, 2022 at 09:05:54PM +0000, Sakari Ailus wrote: > On Wed, Oct 05, 2022 at 06:29:46PM +0300, Andy Shevchenko wrote: ... > fwnode_property_match_string() returns zero on success, therefore >= 0 is > not needed. I'd just use !fwnode_property_match_string(...). No, it's bug in the documentation, thanks to rising an attention, I forgot to send a fix for it earlier. > For both patches: > > Reviewed-by: Sakari Ailus <sakari.ailus@linux.intel.com> Thanks, but as stated above the condition in my patch is correct. It seems due to documentation bug we have some kind of "buggy" code, luckily not too many to fix. That said, I'm not going to resend this until PPC (Freescale) maintainers ask for it. Yang, what's your vision on this series? -- With Best Regards, Andy Shevchenko _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v2 2/2] soc: fsl: qe: Switch to use fwnode instead of of_node 2022-10-05 15:29 [PATCH v2 0/2] gpiolib: more cleanups to get rid of of_node Andy Shevchenko 2022-10-05 15:29 ` [PATCH v2 1/2] device property: Introduce fwnode_device_is_compatible() helper Andy Shevchenko @ 2022-10-05 15:29 ` Andy Shevchenko 2022-10-21 19:01 ` [PATCH v2 0/2] gpiolib: more cleanups to get rid " Andy Shevchenko 2 siblings, 0 replies; 7+ messages in thread From: Andy Shevchenko @ 2022-10-05 15:29 UTC (permalink / raw) To: Andy Shevchenko, linuxppc-dev, linux-arm-kernel, linux-kernel, linux-acpi Cc: Qiang Zhao, Li Yang, Daniel Scally, Heikki Krogerus, Sakari Ailus The OF node in the GPIO library is deprecated and soon will be removed. GPIO library now accepts fwnode as a firmware node, so switch the driver to use it. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> --- drivers/soc/fsl/qe/gpio.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/soc/fsl/qe/gpio.c b/drivers/soc/fsl/qe/gpio.c index 99f7de43c3c6..9abb45ab138b 100644 --- a/drivers/soc/fsl/qe/gpio.c +++ b/drivers/soc/fsl/qe/gpio.c @@ -19,6 +19,8 @@ #include <linux/gpio.h> #include <linux/slab.h> #include <linux/export.h> +#include <linux/property.h> + #include <soc/fsl/qe/qe.h> struct qe_gpio_chip { @@ -179,7 +181,7 @@ struct qe_pin *qe_pin_request(struct device_node *np, int index) goto err0; } - if (!of_device_is_compatible(gc->of_node, "fsl,mpc8323-qe-pario-bank")) { + if (!fwnode_device_is_compatible(gc->fwnode, "fsl,mpc8323-qe-pario-bank")) { pr_debug("%s: tried to get a non-qe pin\n", __func__); err = -EINVAL; goto err0; -- 2.35.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH v2 0/2] gpiolib: more cleanups to get rid of of_node 2022-10-05 15:29 [PATCH v2 0/2] gpiolib: more cleanups to get rid of of_node Andy Shevchenko 2022-10-05 15:29 ` [PATCH v2 1/2] device property: Introduce fwnode_device_is_compatible() helper Andy Shevchenko 2022-10-05 15:29 ` [PATCH v2 2/2] soc: fsl: qe: Switch to use fwnode instead of of_node Andy Shevchenko @ 2022-10-21 19:01 ` Andy Shevchenko 2022-11-02 11:01 ` Andy Shevchenko 2 siblings, 1 reply; 7+ messages in thread From: Andy Shevchenko @ 2022-10-21 19:01 UTC (permalink / raw) To: linuxppc-dev, linux-arm-kernel, linux-kernel, linux-acpi Cc: Qiang Zhao, Li Yang, Daniel Scally, Heikki Krogerus, Sakari Ailus On Wed, Oct 05, 2022 at 06:29:45PM +0300, Andy Shevchenko wrote: > One more user outside of GPIO library and pin control folders needs > to be updated to use fwnode instead of of_node. To make this easier > introduce a helper in property.h and convert the user. > > Note, the helper will be useful not only for the current users, > but any future ones that want to replace of_device_is_compatible() > with analogous fwnode API. > > Changelog v2: > - placed new helper correctly in the property.h Any comments on the series? -- With Best Regards, Andy Shevchenko _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2 0/2] gpiolib: more cleanups to get rid of of_node 2022-10-21 19:01 ` [PATCH v2 0/2] gpiolib: more cleanups to get rid " Andy Shevchenko @ 2022-11-02 11:01 ` Andy Shevchenko 0 siblings, 0 replies; 7+ messages in thread From: Andy Shevchenko @ 2022-11-02 11:01 UTC (permalink / raw) To: linuxppc-dev, linux-arm-kernel, linux-kernel, linux-acpi Cc: Qiang Zhao, Li Yang, Daniel Scally, Heikki Krogerus, Sakari Ailus On Fri, Oct 21, 2022 at 10:01:34PM +0300, Andy Shevchenko wrote: > On Wed, Oct 05, 2022 at 06:29:45PM +0300, Andy Shevchenko wrote: > > One more user outside of GPIO library and pin control folders needs > > to be updated to use fwnode instead of of_node. To make this easier > > introduce a helper in property.h and convert the user. > > > > Note, the helper will be useful not only for the current users, > > but any future ones that want to replace of_device_is_compatible() > > with analogous fwnode API. > > > > Changelog v2: > > - placed new helper correctly in the property.h > > Any comments on the series? I'm going to apply this to my branch with Sakari's tag since there is no answer from PPC maintainers for a month. -- With Best Regards, Andy Shevchenko _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2022-11-02 11:02 UTC | newest] Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2022-10-05 15:29 [PATCH v2 0/2] gpiolib: more cleanups to get rid of of_node Andy Shevchenko 2022-10-05 15:29 ` [PATCH v2 1/2] device property: Introduce fwnode_device_is_compatible() helper Andy Shevchenko 2022-10-05 21:05 ` Sakari Ailus 2022-10-06 12:34 ` Andy Shevchenko 2022-10-05 15:29 ` [PATCH v2 2/2] soc: fsl: qe: Switch to use fwnode instead of of_node Andy Shevchenko 2022-10-21 19:01 ` [PATCH v2 0/2] gpiolib: more cleanups to get rid " Andy Shevchenko 2022-11-02 11:01 ` Andy Shevchenko
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).