Re: [PATCH v2 3/4] pinctrl: freescale: scmi: Switch to use machine_allowlist

Saravana Kannan
2025-02-13T08:26:10Z

On Sun, Jan 19, 2025 at 11:14 PM Peng Fan (OSS) <peng.fan@oss.nxp.com> wrote:
>
> From: Peng Fan <peng.fan@nxp.com>
>
> With machine_allowlist, only allowed machines have pinctrl imx scmi
> devices created. The fw_devlink will link consumer and supplier
> correctly.
>
> Signed-off-by: Peng Fan <peng.fan@nxp.com>
> ---
> drivers/pinctrl/freescale/pinctrl-imx-scmi.c | 15 ++++++---------
> 1 file changed, 6 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/pinctrl/freescale/pinctrl-imx-scmi.c b/drivers/pinctrl/freescale/pinctrl-imx-scmi.c
> index 8f15c4c4dc4412dddb40505699fc3f459fdc0adc..058b4f0477039d57ddae06f385ad809cbb4784d6 100644
> --- a/drivers/pinctrl/freescale/pinctrl-imx-scmi.c
> +++ b/drivers/pinctrl/freescale/pinctrl-imx-scmi.c
> @@ -287,11 +287,6 @@ scmi_pinctrl_imx_get_pins(struct scmi_pinctrl_imx *pmx, struct pinctrl_desc *des
> return 0;
> }
>
> -static const char * const scmi_pinctrl_imx_allowlist[] = {
> - "fsl,imx95",
> - NULL
> -};
> -
> static int scmi_pinctrl_imx_probe(struct scmi_device *sdev)
> {
> struct device *dev = &sdev->dev;
> @@ -304,9 +299,6 @@ static int scmi_pinctrl_imx_probe(struct scmi_device *sdev)
> if (!handle)
> return -EINVAL;
>
> - if (!of_machine_compatible_match(scmi_pinctrl_imx_allowlist))
> - return -ENODEV;
> -
> pinctrl_ops = handle->devm_protocol_get(sdev, SCMI_PROTOCOL_PINCTRL, &ph);
> if (IS_ERR(pinctrl_ops))
> return PTR_ERR(pinctrl_ops);
> @@ -339,8 +331,13 @@ static int scmi_pinctrl_imx_probe(struct scmi_device *sdev)
> return pinctrl_enable(pmx->pctldev);
> }
>
> +static const char * const scmi_pinctrl_imx_allowlist[] = {
> + "fsl,imx95",
> + NULL
> +};
> +
> static const struct scmi_device_id scmi_id_table[] = {
> - { SCMI_PROTOCOL_PINCTRL, "pinctrl-imx" },
> + { SCMI_PROTOCOL_PINCTRL, "pinctrl-imx", NULL, scmi_pinctrl_imx_allowlist },
> { }
> };
> MODULE_DEVICE_TABLE(scmi, scmi_id_table);
>

Definite NACK to this. Please don't depend on indirect
conditions/flags. There's no guarantee that this check will hold true
in the future.

-Saravana