ARM: shmobile: rcar-gen2: Use of_machine_compatible_match() helper

Replace sequences of of_machine_is_compatible() calls by single calls to
the of_machine_compatible_match() helper, to simplify the code, and to
reduce code size.

Note that this does have a slight performance impact on matching
platforms: while the C sequences terminated evaluation after a match,
(internal) of_device_compatible_match() calculates a matching score, and
thus always checks against all passed compatible values.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://patch.msgid.link/2230eb28da9b8d8bdee4e4fd7e19dc8f074531bc.1780499233.git.geert+renesas@glider.be
This commit is contained in:
Geert Uytterhoeven
2026-06-03 17:10:14 +02:00
parent dc59e4fea9
commit c902a6887e
2 changed files with 10 additions and 9 deletions

View File

@@ -140,6 +140,10 @@ static struct notifier_block regulator_quirk_nb = {
static int __init rcar_gen2_regulator_quirk(void)
{
static const char *const boards[] __initconst = {
"renesas,koelsch", "renesas,lager", "renesas,porter",
"renesas,stout", "renesas,gose", NULL
};
struct regulator_quirk *quirk, *pos, *tmp;
struct of_phandle_args *args;
const struct of_device_id *id;
@@ -147,11 +151,7 @@ static int __init rcar_gen2_regulator_quirk(void)
u32 mon, addr;
int ret;
if (!of_machine_is_compatible("renesas,koelsch") &&
!of_machine_is_compatible("renesas,lager") &&
!of_machine_is_compatible("renesas,porter") &&
!of_machine_is_compatible("renesas,stout") &&
!of_machine_is_compatible("renesas,gose"))
if (!of_machine_compatible_match(boards))
return -ENODEV;
for_each_matching_node_and_match(np, rcar_gen2_quirk_match, &id) {

View File

@@ -56,6 +56,10 @@ static unsigned int __init get_extal_freq(void)
static void __init rcar_gen2_timer_init(void)
{
static const char *const fixed_freq_socs[] __initconst = {
"renesas,r8a7745", "renesas,r8a77470", "renesas,r8a7792",
"renesas,r8a7794", NULL
};
bool need_update = true;
void __iomem *base;
u32 freq;
@@ -76,10 +80,7 @@ static void __init rcar_gen2_timer_init(void)
secure_cntvoff_init();
if (of_machine_is_compatible("renesas,r8a7745") ||
of_machine_is_compatible("renesas,r8a77470") ||
of_machine_is_compatible("renesas,r8a7792") ||
of_machine_is_compatible("renesas,r8a7794")) {
if (of_machine_compatible_match(fixed_freq_socs)) {
freq = 260000000 / 8; /* ZS / 8 */
} else {
/* At Linux boot time the r8a7790 arch timer comes up