[PATCH 1/2] of: have of_property_match_string accept pointer to const device_node

Sascha Hauer sha at pengutronix.de
Tue Dec 6 22:58:09 PST 2022


On Mon, Dec 05, 2022 at 02:32:26PM +0100, Ahmad Fatoum wrote:
> This function need not have mutable access to the device node, so make
> the parameter const to allow calling it from more places without
> sacrificing cost safety.
> 
> Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
> ---
>  drivers/of/base.c | 2 +-
>  include/of.h      | 4 ++--
>  2 files changed, 3 insertions(+), 3 deletions(-)

Applied, thanks

Sascha

> 
> diff --git a/drivers/of/base.c b/drivers/of/base.c
> index 2eee1279a98d..221050a19715 100644
> --- a/drivers/of/base.c
> +++ b/drivers/of/base.c
> @@ -1049,7 +1049,7 @@ EXPORT_SYMBOL_GPL(of_property_read_string);
>   * This function searches a string list property and returns the index
>   * of a specific string value.
>   */
> -int of_property_match_string(struct device_node *np, const char *propname,
> +int of_property_match_string(const struct device_node *np, const char *propname,
>  			     const char *string)
>  {
>  	struct property *prop = of_find_property(np, propname, NULL);
> diff --git a/include/of.h b/include/of.h
> index 052d5fcad84c..c19a17584e47 100644
> --- a/include/of.h
> +++ b/include/of.h
> @@ -229,7 +229,7 @@ extern int of_property_read_variable_u64_array(const struct device_node *np,
>  extern int of_property_read_string(struct device_node *np,
>  				   const char *propname,
>  				   const char **out_string);
> -extern int of_property_match_string(struct device_node *np,
> +extern int of_property_match_string(const struct device_node *np,
>  				    const char *propname,
>  				    const char *string);
>  extern int of_property_read_string_helper(const struct device_node *np,
> @@ -616,7 +616,7 @@ static inline int of_property_read_string(struct device_node *np,
>  	return -ENOSYS;
>  }
>  
> -static inline int of_property_match_string(struct device_node *np,
> +static inline int of_property_match_string(const struct device_node *np,
>  				const char *propname, const char *string)
>  {
>  	return -ENOSYS;
> -- 
> 2.30.2
> 
> 
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the barebox mailing list