[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <c629e544-f768-4063-bd2c-f72382bdf69b@csgroup.eu>
Date: Fri, 11 Oct 2024 18:25:45 +0200
From: Christophe Leroy <christophe.leroy@...roup.eu>
To: Markus Elfring <Markus.Elfring@....de>,
Christophe Leroy <christophe.leroy@...roup.eu>,
linuxppc-dev@...ts.ozlabs.org, Jani Nikula <jani.nikula@...el.com>,
Madhavan Srinivasan <maddy@...ux.ibm.com>,
Michael Ellerman <mpe@...erman.id.au>, Naveen N Rao <naveen@...nel.org>,
Nicholas Piggin <npiggin@...il.com>, Paul Mackerras <paulus@...ba.org>,
Stephen Rothwell <sfr@...b.auug.org.au>,
Thomas Zimmermann <tzimmermann@...e.de>
Cc: LKML <linux-kernel@...r.kernel.org>, kernel-janitors@...r.kernel.org,
Krzysztof Kozlowski <krzysztof.kozlowski@...aro.org>
Subject: Re: [PATCH] powermac: Use of_property_match_string() in
pmac_has_backlight_type()
Le 11/10/2024 à 18:18, Markus Elfring a écrit :
> From: Markus Elfring <elfring@...rs.sourceforge.net>
> Date: Fri, 11 Oct 2024 18:10:06 +0200
>
> Replace an of_get_property() call by of_property_match_string()
> so that this function implementation can be simplified.
>
> Suggested-by: Christophe Leroy <christophe.leroy@...roup.eu>
> Link: https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flore.kernel.org%2Flinuxppc-dev%2Fd9bdc1b6-ea7e-47aa-80aa-02ae649abf72%40csgroup.eu%2F&data=05%7C02%7Cchristophe.leroy%40csgroup.eu%7Cf278e44683c04b931b9c08dcea106447%7C8b87af7d86474dc78df45f69a2011bb5%7C0%7C0%7C638642603333398766%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=6byvgvuGiBSVu8F6kLA2OozUuHZunJRH%2BU%2Bq9q7osmM%3D&reserved=0
> Suggested-by: Michael Ellerman <mpe@...erman.id.au>
> Link: https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flore.kernel.org%2Flinuxppc-dev%2F87cyk97ufp.fsf%40mail.lhotse%2F&data=05%7C02%7Cchristophe.leroy%40csgroup.eu%7Cf278e44683c04b931b9c08dcea106447%7C8b87af7d86474dc78df45f69a2011bb5%7C0%7C0%7C638642603333422636%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=IDuYfe3UoaIEmedJ07H67zvzrPnzbQ2g8EeTtbJ%2BbZ8%3D&reserved=0
> Signed-off-by: Markus Elfring <elfring@...rs.sourceforge.net>
> ---
> arch/powerpc/platforms/powermac/backlight.c | 14 +++-----------
> 1 file changed, 3 insertions(+), 11 deletions(-)
>
> diff --git a/arch/powerpc/platforms/powermac/backlight.c b/arch/powerpc/platforms/powermac/backlight.c
> index 12bc01353bd3..79741370c40c 100644
> --- a/arch/powerpc/platforms/powermac/backlight.c
> +++ b/arch/powerpc/platforms/powermac/backlight.c
> @@ -57,18 +57,10 @@ struct backlight_device *pmac_backlight;
> int pmac_has_backlight_type(const char *type)
> {
> struct device_node* bk_node = of_find_node_by_name(NULL, "backlight");
> + int i = of_property_match_string(bk_node, "backlight-control", type);
>
> - if (bk_node) {
> - const char *prop = of_get_property(bk_node,
> - "backlight-control", NULL);
> - if (prop && strncmp(prop, type, strlen(type)) == 0) {
> - of_node_put(bk_node);
> - return 1;
> - }
> - of_node_put(bk_node);
> - }
> -
> - return 0;
> + of_node_put(bk_node);
> + return i >= 0;
Could have been:
return !IS_ERR_VALUE(i);
Never mind,
Reviewed-by: Christophe Leroy <christophe.leroy@...roup.eu>
> }
>
> static void pmac_backlight_key_worker(struct work_struct *work)
> --
> 2.46.1
>
Powered by blists - more mailing lists