Re: [PATCH v1 2/2] pinctrl: intel: Try to retrieve driver data for pure platform drivers
From: Mika Westerberg
Date: Tue Sep 01 2026 - 07:10:24 EST
On Mon, Aug 31, 2026 at 04:25:47PM +0200, Andy Shevchenko wrote:
> The Denverton pinctrl device can be instantiated by the Intel LPC
> driver as an MFD platform device named "denverton-pinctrl".
>
> On affected systems the platform device does not carry the INTC3000
> ACPI match data itself. As a result, intel_pinctrl_probe_by_hid()
> fails to obtain the SoC data using device_get_match_data() and
> returns -ENODATA.
>
> This might be also true for other platforms that can be enumerated
> by ACPI _HID. Fix the above by trying the pure platform driver data
> in case the firmware node is not set or doesn't carry the necessary
> information.
>
> Reported-by: Radek Válko <rvalko@xxxxxxxxxx>
> Closes: https://lore.kernel.org/r/20260827184259.32386-1-rvalko@xxxxxxxxxx
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
> ---
> drivers/pinctrl/intel/pinctrl-intel.c | 25 ++++++++++++++++++++++---
> 1 file changed, 22 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/pinctrl/intel/pinctrl-intel.c b/drivers/pinctrl/intel/pinctrl-intel.c
> index 7aa7f81ac405..50ffad6a7610 100644
> --- a/drivers/pinctrl/intel/pinctrl-intel.c
> +++ b/drivers/pinctrl/intel/pinctrl-intel.c
> @@ -1716,13 +1716,32 @@ int intel_pinctrl_probe(struct platform_device *pdev,
> }
> EXPORT_SYMBOL_NS_GPL(intel_pinctrl_probe, "PINCTRL_INTEL");
>
> +static const struct intel_pinctrl_soc_data *
> +intel_pinctrl_get_soc_data_by_hid(struct platform_device *pdev)
pdev can be const, no?
> +{
> + const struct intel_pinctrl_soc_data *data;
> + const struct platform_device_id *id;
> + struct device *dev = &pdev->dev;
> +
> + data = device_get_match_data(dev);
> + if (data)
> + return data;
> +
> + id = platform_get_device_id(pdev);
> + if (!id)
> + return ERR_PTR(-ENODEV);
> +
> + data = (const struct intel_pinctrl_soc_data *)id->driver_data;
> + return data ?: ERR_PTR(-ENODATA);
> +}
> +
> int intel_pinctrl_probe_by_hid(struct platform_device *pdev)
> {
> const struct intel_pinctrl_soc_data *data;
>
> - data = device_get_match_data(&pdev->dev);
> - if (!data)
> - return -ENODATA;
> + data = intel_pinctrl_get_soc_data_by_hid(pdev);
> + if (IS_ERR(data))
> + return PTR_ERR(data);
>
> return intel_pinctrl_probe(pdev, data);
> }
> --
> 2.50.1