[PATCH] ARM: shmobile: rcar-gen2: Use of_phandle_args_equal() helper
Geert Uytterhoeven
geert+renesas at glider.be
Wed Mar 11 08:14:14 PDT 2026
Use the existing of_phandle_args_equal() helper instead of open-coding
the same operation.
Signed-off-by: Geert Uytterhoeven <geert+renesas at glider.be>
---
This is an old patch of mine, and originally used of_phandle_args_eq(),
which never made it upstream. Only recently did I notice the existence
of of_phandle_args_equal(), so here we go ;-)
To be queued in renesas-devel for v7.1.
.../mach-shmobile/regulator-quirk-rcar-gen2.c | 16 ++++------------
1 file changed, 4 insertions(+), 12 deletions(-)
diff --git a/arch/arm/mach-shmobile/regulator-quirk-rcar-gen2.c b/arch/arm/mach-shmobile/regulator-quirk-rcar-gen2.c
index 4277ba5b3ae052bb..747a96c58df15075 100644
--- a/arch/arm/mach-shmobile/regulator-quirk-rcar-gen2.c
+++ b/arch/arm/mach-shmobile/regulator-quirk-rcar-gen2.c
@@ -141,7 +141,7 @@ static struct notifier_block regulator_quirk_nb = {
static int __init rcar_gen2_regulator_quirk(void)
{
struct regulator_quirk *quirk, *pos, *tmp;
- struct of_phandle_args *argsa, *argsb;
+ struct of_phandle_args *args;
const struct of_device_id *id;
struct device_node *np;
u32 mon, addr;
@@ -171,14 +171,14 @@ static int __init rcar_gen2_regulator_quirk(void)
goto err_mem;
}
- argsa = &quirk->irq_args;
+ args = &quirk->irq_args;
memcpy(&quirk->i2c_msg, id->data, sizeof(quirk->i2c_msg));
quirk->id = id;
quirk->np = of_node_get(np);
quirk->i2c_msg.addr = addr;
- ret = of_irq_parse_one(np, 0, argsa);
+ ret = of_irq_parse_one(np, 0, args);
if (ret) { /* Skip invalid entry and continue */
of_node_put(np);
kfree(quirk);
@@ -186,15 +186,7 @@ static int __init rcar_gen2_regulator_quirk(void)
}
list_for_each_entry(pos, &quirk_list, list) {
- argsb = &pos->irq_args;
-
- if (argsa->args_count != argsb->args_count)
- continue;
-
- ret = memcmp(argsa->args, argsb->args,
- argsa->args_count *
- sizeof(argsa->args[0]));
- if (!ret) {
+ if (of_phandle_args_equal(args, &pos->irq_args)) {
pos->shared = true;
quirk->shared = true;
}
--
2.43.0
More information about the linux-arm-kernel
mailing list