Re: [PATCH/RFC] mmc: host: renesas_sdhi: Refactor of_device_id.data

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Shimoda-san,

On Fri, Jun 25, 2021 at 9:56 AM Yoshihiro Shimoda
<yoshihiro.shimoda.uh@xxxxxxxxxxx> wrote:
> Refactor of_device_id.data to avoid increasing numbers of
> sdhi_quirks_match[] entry when we add other stable SoCs like
> r8a779m*.
>
> Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@xxxxxxxxxxx>

Thanks for your patch!

> --- a/drivers/mmc/host/renesas_sdhi_core.c
> +++ b/drivers/mmc/host/renesas_sdhi_core.c
> @@ -941,13 +910,8 @@ static const struct soc_device_attribute sdhi_quirks_match[]  = {
>         { .soc_id = "r8a774a1", .revision = "ES1.[012]", .data = &sdhi_quirks_4tap_nohs400 },
>         { .soc_id = "r8a7795", .revision = "ES1.*", .data = &sdhi_quirks_4tap_nohs400 },
>         { .soc_id = "r8a7795", .revision = "ES2.0", .data = &sdhi_quirks_4tap },
> -       { .soc_id = "r8a7795", .revision = "ES3.*", .data = &sdhi_quirks_bad_taps2367 },
>         { .soc_id = "r8a7796", .revision = "ES1.[012]", .data = &sdhi_quirks_4tap_nohs400 },
>         { .soc_id = "r8a7796", .revision = "ES1.*", .data = &sdhi_quirks_r8a7796_es13 },
> -       { .soc_id = "r8a77961", .data = &sdhi_quirks_bad_taps1357 },
> -       { .soc_id = "r8a77965", .data = &sdhi_quirks_r8a77965 },
> -       { .soc_id = "r8a77980", .data = &sdhi_quirks_nohs400 },
> -       { .soc_id = "r8a77990", .data = &sdhi_quirks_r8a77990 },
>         { /* Sentinel. */ },
>  };
>
> @@ -957,6 +921,7 @@ int renesas_sdhi_probe(struct platform_device *pdev,
>         struct tmio_mmc_data *mmd = pdev->dev.platform_data;
>         const struct renesas_sdhi_quirks *quirks = NULL;
>         const struct renesas_sdhi_of_data *of_data;
> +       const struct renesas_sdhi_of_data_with_quirks *of_data_quirks;
>         const struct soc_device_attribute *attr;
>         struct tmio_mmc_data *mmc_data;
>         struct tmio_mmc_dma *dma_priv;
> @@ -966,11 +931,14 @@ int renesas_sdhi_probe(struct platform_device *pdev,
>         struct resource *res;
>         u16 ver;
>
> -       of_data = of_device_get_match_data(&pdev->dev);
> +       of_data_quirks = of_device_get_match_data(&pdev->dev);
> +       of_data = of_data_quirks->of_data;
>
>         attr = soc_device_match(sdhi_quirks_match);
>         if (attr)
>                 quirks = attr->data;
> +       else
> +               quirks = of_data_quirks->quirks;

Please do not use "else" statements in soc_device_match()-based
quirk handling, as that makes it less trivial to remove the quirk
handling later.

I.e. move "quirks = of_data_quirks->quirks;" up, before the call
to soc_device_match().

>
>         res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>         if (!res)

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



[Index of Archives]     [Linux Samsung SOC]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux