Re: [PATCH v2 4/4] driver core: platform: use generic driver_override infrastructure
From: Geert Uytterhoeven
Date: Tue Mar 17 2026 - 04:37:37 EST
Hi Danilo,
On Tue, 17 Mar 2026 at 00:57, Danilo Krummrich <dakr@xxxxxxxxxx> wrote:
> On Tue Mar 3, 2026 at 12:53 PM CET, Danilo Krummrich wrote:
> > diff --git a/arch/sh/drivers/platform_early.c b/arch/sh/drivers/platform_early.c
> > index 143747c45206..3cd17bb0be67 100644
> > --- a/arch/sh/drivers/platform_early.c
> > +++ b/arch/sh/drivers/platform_early.c
> > @@ -25,10 +25,12 @@ static int platform_match(struct device *dev, struct device_driver *drv)
> > {
> > struct platform_device *pdev = to_platform_device(dev);
> > struct platform_driver *pdrv = to_platform_driver(drv);
> > + int ret;
> >
> > /* When driver_override is set, only bind to the matching driver */
> > - if (pdev->driver_override)
> > - return !strcmp(pdev->driver_override, drv->name);
> > + ret = device_match_driver_override(dev, drv);
> > + if (ret >= 0)
> > + return ret;
> >
> > /* Then try to match against the id table */
> > if (pdrv->id_table)
>
> I was just about to pick up this series, but then noticed that checking for
> driver_override in the platform_early case doesn't make sense in the first place
> and was accidentally added when the platform_match() callback was copied over in
> commit 507fd01d5333 ("drivers: move the early platform device support to
> arch/sh").
>
> Thus, I'm going to drop this hunk and add in the following patch; please let me
> know if there are any concerns.
>
> commit 39cae4095efda4b00b436c0fc46f21de84128969
> Author: Danilo Krummrich <dakr@xxxxxxxxxx>
> Date: Tue Mar 17 00:37:15 2026 +0100
>
> sh: platform_early: remove pdev->driver_override check
>
> In commit 507fd01d5333 ("drivers: move the early platform device support to
> arch/sh") platform_match() was copied over to the sh platform_early
> code, accidentally including the driver_override check.
>
> This check does not make sense for platform_early, as sysfs is not even
> available in first place at this point in the boot process, hence remove
> the check.
>
> Fixes: 507fd01d5333 ("drivers: move the early platform device support to arch/sh")
> Signed-off-by: Danilo Krummrich <dakr@xxxxxxxxxx>
>
> diff --git a/arch/sh/drivers/platform_early.c b/arch/sh/drivers/platform_early.c
> index 143747c45206..48ddbc547bd9 100644
> --- a/arch/sh/drivers/platform_early.c
> +++ b/arch/sh/drivers/platform_early.c
> @@ -26,10 +26,6 @@ static int platform_match(struct device *dev, struct device_driver *drv)
> struct platform_device *pdev = to_platform_device(dev);
> struct platform_driver *pdrv = to_platform_driver(drv);
>
> - /* When driver_override is set, only bind to the matching driver */
> - if (pdev->driver_override)
> - return !strcmp(pdev->driver_override, drv->name);
> -
> /* Then try to match against the id table */
> if (pdrv->id_table)
> return platform_match_id(pdrv->id_table, pdev) != NULL;
Nice catch!
Reviewed-by: Geert Uytterhoeven <geert+renesas@xxxxxxxxx>
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds