lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ede25e03-7a14-4787-ae1b-4fc9290add5a@web.de>
Date: Fri, 11 Oct 2024 18:18:42 +0200
From: Markus Elfring <Markus.Elfring@....de>
To: 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: [PATCH] powermac: Use of_property_match_string() in
 pmac_has_backlight_type()

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://lore.kernel.org/linuxppc-dev/d9bdc1b6-ea7e-47aa-80aa-02ae649abf72@csgroup.eu/
Suggested-by: Michael Ellerman <mpe@...erman.id.au>
Link: https://lore.kernel.org/linuxppc-dev/87cyk97ufp.fsf@mail.lhotse/
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;
 }

 static void pmac_backlight_key_worker(struct work_struct *work)
--
2.46.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ