On Sun, Sep 26, 2010 at 10:57 PM, zhangfei gao <[email protected]> wrote:
> From af7aa1232efd3bb3bf3eac151b71dba7d4a0c875 Mon Sep 17 00:00:00 2001
> From: Zhangfei Gao <[email protected]>
> Date: Mon, 27 Sep 2010 10:33:38 -0400
> Subject: [PATCH 2/3] dhci-pltfm: add call back get_quirk
>
>        One driver may serve several device, each one may have different
> quirks instead of the initial one.
>
> Signed-off-by: Zhangfei Gao <[email protected]>
> ---
>  drivers/mmc/host/sdhci-pltfm.c |    8 ++++++--
>  include/linux/sdhci-pltfm.h    |    1 +
>  2 files changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/mmc/host/sdhci-pltfm.c b/drivers/mmc/host/sdhci-pltfm.c
> index 82d3d05..5c3c513 100644
> --- a/drivers/mmc/host/sdhci-pltfm.c
> +++ b/drivers/mmc/host/sdhci-pltfm.c
> @@ -91,8 +91,7 @@ static int __devinit sdhci_pltfm_probe(struct
> platform_device *pdev)
>                host->ops = pdata->ops;
>        else
>                host->ops = &sdhci_pltfm_ops;
> -       if (pdata)
> -               host->quirks = pdata->quirks;
> +
>        host->irq = platform_get_irq(pdev, 0);
>
>        if (!request_mem_region(iomem->start, resource_size(iomem),
> @@ -115,6 +114,11 @@ static int __devinit sdhci_pltfm_probe(struct
> platform_device *pdev)
>                        goto err_plat_init;
>        }
>
> +       if (pdata && pdata->get_quirk)
> +               host->quirks = pdata->get_quirk(host);
> +       else if (pdata)
> +               host->quirks = pdata->quirks;
> +
>        ret = sdhci_add_host(host);
>        if (ret)
>                goto err_add_host;
> diff --git a/include/linux/sdhci-pltfm.h b/include/linux/sdhci-pltfm.h
> index 80c415e..0d20cb4 100644
> --- a/include/linux/sdhci-pltfm.h
> +++ b/include/linux/sdhci-pltfm.h
> @@ -30,6 +30,7 @@ struct sdhci_pltfm_data {
>        unsigned int quirks;
>        int (*init)(struct sdhci_host *host, struct sdhci_pltfm_data *pdata,
> void* priv_pdata);
>        void (*exit)(struct sdhci_host *host);
> +       unsigned int  (*get_quirk)(struct sdhci_host *host);
>        struct sdhci_host *(*alloc_host)(struct device *dev);
>  };
>
> --
> 1.7.0.4
>

Any feed back, the different device may require different quirk, so we
can not set the same one set in init.
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to