Skip to content

Commit d784bba

Browse files
committed
ARM: shmobile: rcar-gen2: Use of_phandle_args_equal() helper
Use the existing of_phandle_args_equal() helper instead of open-coding the same operation. Signed-off-by: Geert Uytterhoeven <[email protected]> Link: https://patch.msgid.link/d8338ff1fd795912b466ccf55b49dcd6885b6925.1773241833.git.geert+renesas@glider.be
1 parent 6de23f8 commit d784bba

1 file changed

Lines changed: 4 additions & 12 deletions

File tree

arch/arm/mach-shmobile/regulator-quirk-rcar-gen2.c

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ static struct notifier_block regulator_quirk_nb = {
141141
static int __init rcar_gen2_regulator_quirk(void)
142142
{
143143
struct regulator_quirk *quirk, *pos, *tmp;
144-
struct of_phandle_args *argsa, *argsb;
144+
struct of_phandle_args *args;
145145
const struct of_device_id *id;
146146
struct device_node *np;
147147
u32 mon, addr;
@@ -171,30 +171,22 @@ static int __init rcar_gen2_regulator_quirk(void)
171171
goto err_mem;
172172
}
173173

174-
argsa = &quirk->irq_args;
174+
args = &quirk->irq_args;
175175
memcpy(&quirk->i2c_msg, id->data, sizeof(quirk->i2c_msg));
176176

177177
quirk->id = id;
178178
quirk->np = of_node_get(np);
179179
quirk->i2c_msg.addr = addr;
180180

181-
ret = of_irq_parse_one(np, 0, argsa);
181+
ret = of_irq_parse_one(np, 0, args);
182182
if (ret) { /* Skip invalid entry and continue */
183183
of_node_put(np);
184184
kfree(quirk);
185185
continue;
186186
}
187187

188188
list_for_each_entry(pos, &quirk_list, list) {
189-
argsb = &pos->irq_args;
190-
191-
if (argsa->args_count != argsb->args_count)
192-
continue;
193-
194-
ret = memcmp(argsa->args, argsb->args,
195-
argsa->args_count *
196-
sizeof(argsa->args[0]));
197-
if (!ret) {
189+
if (of_phandle_args_equal(args, &pos->irq_args)) {
198190
pos->shared = true;
199191
quirk->shared = true;
200192
}

0 commit comments

Comments
 (0)