Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

powerpc/powermac: Use of_property_match_string() in pmac_has_backlight_type()

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@csgroup.eu>
Link: https://lore.kernel.org/linuxppc-dev/d9bdc1b6-ea7e-47aa-80aa-02ae649abf72@csgroup.eu/
Suggested-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/linuxppc-dev/87cyk97ufp.fsf@mail.lhotse/
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Reviewed-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://patch.msgid.link/ede25e03-7a14-4787-ae1b-4fc9290add5a@web.de

authored by

Markus Elfring and committed by
Michael Ellerman
2e716f5c f20b0a03

+3 -11
+3 -11
arch/powerpc/platforms/powermac/backlight.c
··· 57 57 int pmac_has_backlight_type(const char *type) 58 58 { 59 59 struct device_node* bk_node = of_find_node_by_name(NULL, "backlight"); 60 + int i = of_property_match_string(bk_node, "backlight-control", type); 60 61 61 - if (bk_node) { 62 - const char *prop = of_get_property(bk_node, 63 - "backlight-control", NULL); 64 - if (prop && strncmp(prop, type, strlen(type)) == 0) { 65 - of_node_put(bk_node); 66 - return 1; 67 - } 68 - of_node_put(bk_node); 69 - } 70 - 71 - return 0; 62 + of_node_put(bk_node); 63 + return i >= 0; 72 64 } 73 65 74 66 static void pmac_backlight_key_worker(struct work_struct *work)