Re: [PATCH] mmc: sdhci: sirf: Use the slot GPIO descriptor

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

 



On 24 September 2018 at 10:02, Linus Walleij <linus.walleij@xxxxxxxxxx> wrote:
> This driver is complicating things for no reason: the "cd"
> GPIO can easily be retrieved from the device tree if present
> using just mmc_gpiod_request_cd(), which will fetch the
> descriptor from the device tree using the standard binding
> just fine.
>
> If the retrieveal is successful, we also request the IRQ.
>
> As a result the private subdriver data can be removed
> entirely.
>
> Cc: Weijun Yang <york.yang@xxxxxxx>
> Cc: Barry Song <baohua@xxxxxxxxxx>
> Cc: Adrian Hunter <adrian.hunter@xxxxxxxxx>
> Signed-off-by: Linus Walleij <linus.walleij@xxxxxxxxxx>

Applied for next, thanks!

Kind regards
Uffe

> ---
>  drivers/mmc/host/sdhci-sirf.c | 28 +++++-----------------------
>  1 file changed, 5 insertions(+), 23 deletions(-)
>
> diff --git a/drivers/mmc/host/sdhci-sirf.c b/drivers/mmc/host/sdhci-sirf.c
> index 391d52b467ca..5eada6f87e60 100644
> --- a/drivers/mmc/host/sdhci-sirf.c
> +++ b/drivers/mmc/host/sdhci-sirf.c
> @@ -11,7 +11,6 @@
>  #include <linux/mmc/host.h>
>  #include <linux/module.h>
>  #include <linux/of.h>
> -#include <linux/of_gpio.h>
>  #include <linux/mmc/slot-gpio.h>
>  #include "sdhci-pltfm.h"
>
> @@ -19,10 +18,6 @@
>  #define SDHCI_SIRF_8BITBUS BIT(3)
>  #define SIRF_TUNING_COUNT 16384
>
> -struct sdhci_sirf_priv {
> -       int gpio_cd;
> -};
> -
>  static void sdhci_sirf_set_bus_width(struct sdhci_host *host, int width)
>  {
>         u8 ctrl;
> @@ -170,9 +165,7 @@ static int sdhci_sirf_probe(struct platform_device *pdev)
>  {
>         struct sdhci_host *host;
>         struct sdhci_pltfm_host *pltfm_host;
> -       struct sdhci_sirf_priv *priv;
>         struct clk *clk;
> -       int gpio_cd;
>         int ret;
>
>         clk = devm_clk_get(&pdev->dev, NULL);
> @@ -181,19 +174,12 @@ static int sdhci_sirf_probe(struct platform_device *pdev)
>                 return PTR_ERR(clk);
>         }
>
> -       if (pdev->dev.of_node)
> -               gpio_cd = of_get_named_gpio(pdev->dev.of_node, "cd-gpios", 0);
> -       else
> -               gpio_cd = -EINVAL;
> -
> -       host = sdhci_pltfm_init(pdev, &sdhci_sirf_pdata, sizeof(struct sdhci_sirf_priv));
> +       host = sdhci_pltfm_init(pdev, &sdhci_sirf_pdata, 0);
>         if (IS_ERR(host))
>                 return PTR_ERR(host);
>
>         pltfm_host = sdhci_priv(host);
>         pltfm_host->clk = clk;
> -       priv = sdhci_pltfm_priv(pltfm_host);
> -       priv->gpio_cd = gpio_cd;
>
>         sdhci_get_of_property(pdev);
>
> @@ -209,15 +195,11 @@ static int sdhci_sirf_probe(struct platform_device *pdev)
>          * We must request the IRQ after sdhci_add_host(), as the tasklet only
>          * gets setup in sdhci_add_host() and we oops.
>          */
> -       if (gpio_is_valid(priv->gpio_cd)) {
> -               ret = mmc_gpio_request_cd(host->mmc, priv->gpio_cd, 0);
> -               if (ret) {
> -                       dev_err(&pdev->dev, "card detect irq request failed: %d\n",
> -                               ret);
> -                       goto err_request_cd;
> -               }
> +       ret = mmc_gpiod_request_cd(host->mmc, "cd", 0, false, 0, NULL);
> +       if (ret == -EPROBE_DEFER)
> +               goto err_request_cd;
> +       if (!ret)
>                 mmc_gpiod_request_cd_irq(host->mmc);
> -       }
>
>         return 0;
>
> --
> 2.17.1
>



[Index of Archives]     [Linux Memonry Technology]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux