Message ID | 20220712163345.445811-3-francesco.dolcini@toradex.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | mfd: stmpe: Probe sub-function by compatible | expand |
On Tue, Jul 12, 2022 at 6:36 PM Francesco Dolcini <francesco.dolcini@toradex.com> wrote: > Use sub-function of_compatible during probe, instead of using the node > name. The code should not rely on the node names during probe, in > addition to that the previously hard-coded node names are not compliant > to the latest naming convention (they are not generic and they use > underscores), and it was broken by mistake already once [1]. > > [1] commit 56086b5e804f ("ARM: dts: imx6qdl-apalis: Avoid underscore in node name") > > Suggested-by: Ahmad Fatoum <a.fatoum@pengutronix.de> > Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com> > --- > v2: > - remove define usage for compatible strings > - moved rotator removal from probe to a separate patch v2 LGTM Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Yours, Linus Walleij
On Tue, 12 Jul 2022, Francesco Dolcini wrote: > Use sub-function of_compatible during probe, instead of using the node > name. The code should not rely on the node names during probe, in > addition to that the previously hard-coded node names are not compliant > to the latest naming convention (they are not generic and they use > underscores), and it was broken by mistake already once [1]. > > [1] commit 56086b5e804f ("ARM: dts: imx6qdl-apalis: Avoid underscore in node name") > > Suggested-by: Ahmad Fatoum <a.fatoum@pengutronix.de> > Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com> > --- > v2: > - remove define usage for compatible strings > - moved rotator removal from probe to a separate patch > --- > drivers/mfd/stmpe.c | 11 +++++------ > 1 file changed, 5 insertions(+), 6 deletions(-) Applied, thanks.
diff --git a/drivers/mfd/stmpe.c b/drivers/mfd/stmpe.c index 4aa4ac2ff406..987e251d90ae 100644 --- a/drivers/mfd/stmpe.c +++ b/drivers/mfd/stmpe.c @@ -1362,17 +1362,16 @@ static void stmpe_of_probe(struct stmpe_platform_data *pdata, pdata->autosleep = (pdata->autosleep_timeout) ? true : false; for_each_available_child_of_node(np, child) { - if (of_node_name_eq(child, "stmpe_gpio")) { + if (of_device_is_compatible(child, stmpe_gpio_cell.of_compatible)) pdata->blocks |= STMPE_BLOCK_GPIO; - } else if (of_node_name_eq(child, "stmpe_keypad")) { + else if (of_device_is_compatible(child, stmpe_keypad_cell.of_compatible)) pdata->blocks |= STMPE_BLOCK_KEYPAD; - } else if (of_node_name_eq(child, "stmpe_touchscreen")) { + else if (of_device_is_compatible(child, stmpe_ts_cell.of_compatible)) pdata->blocks |= STMPE_BLOCK_TOUCHSCREEN; - } else if (of_node_name_eq(child, "stmpe_adc")) { + else if (of_device_is_compatible(child, stmpe_adc_cell.of_compatible)) pdata->blocks |= STMPE_BLOCK_ADC; - } else if (of_node_name_eq(child, "stmpe_pwm")) { + else if (of_device_is_compatible(child, stmpe_pwm_cell.of_compatible)) pdata->blocks |= STMPE_BLOCK_PWM; - } } }
Use sub-function of_compatible during probe, instead of using the node name. The code should not rely on the node names during probe, in addition to that the previously hard-coded node names are not compliant to the latest naming convention (they are not generic and they use underscores), and it was broken by mistake already once [1]. [1] commit 56086b5e804f ("ARM: dts: imx6qdl-apalis: Avoid underscore in node name") Suggested-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com> --- v2: - remove define usage for compatible strings - moved rotator removal from probe to a separate patch --- drivers/mfd/stmpe.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)