Skip to content

Commit 2e716f5

Browse files
elfringmpe
authored andcommitted
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 <[email protected]> Link: https://lore.kernel.org/linuxppc-dev/[email protected]/ Suggested-by: Michael Ellerman <[email protected]> Link: https://lore.kernel.org/linuxppc-dev/[email protected]/ Signed-off-by: Markus Elfring <[email protected]> Reviewed-by: Christophe Leroy <[email protected]> Signed-off-by: Michael Ellerman <[email protected]> Link: https://patch.msgid.link/[email protected]
1 parent f20b0a0 commit 2e716f5

File tree

1 file changed

+3
-11
lines changed

1 file changed

+3
-11
lines changed

arch/powerpc/platforms/powermac/backlight.c

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -57,18 +57,10 @@ struct backlight_device *pmac_backlight;
5757
int pmac_has_backlight_type(const char *type)
5858
{
5959
struct device_node* bk_node = of_find_node_by_name(NULL, "backlight");
60+
int i = of_property_match_string(bk_node, "backlight-control", type);
6061

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;
7264
}
7365

7466
static void pmac_backlight_key_worker(struct work_struct *work)

0 commit comments

Comments
 (0)