From patchwork Mon Sep 24 08:02:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 10612005 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0B4D415A6 for ; Mon, 24 Sep 2018 08:02:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0521229BFD for ; Mon, 24 Sep 2018 08:02:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EDC7529C09; Mon, 24 Sep 2018 08:02:43 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 82E6529BFD for ; Mon, 24 Sep 2018 08:02:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727382AbeIXODc (ORCPT ); Mon, 24 Sep 2018 10:03:32 -0400 Received: from mail-lj1-f194.google.com ([209.85.208.194]:43624 "EHLO mail-lj1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727049AbeIXODc (ORCPT ); Mon, 24 Sep 2018 10:03:32 -0400 Received: by mail-lj1-f194.google.com with SMTP id m84-v6so17314689lje.10 for ; Mon, 24 Sep 2018 01:02:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=+GKiUfPONS9Qz28da6RINub7As1Jm4Aa0hYmZl5qviQ=; b=L/rP5zMHY4PWSvsk48bcg1PdXmULW0MNgmtJVmSvOzTn/Df4bp+C1TF/+qg3PQmYi+ I3Xe6nRW+dwhy/EykIceBj9BqD+eVHLHn2R1sEWAyBn+QOvruLCoRL2u91fjBjMMzazq uN9wekyre0SlOWFmneycxI0vFbLPy+pH+UL/k= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=+GKiUfPONS9Qz28da6RINub7As1Jm4Aa0hYmZl5qviQ=; b=iXyYVfW2WDBuvXm5DTzwSd1QPfiLzuNm18EWwsS82HvIpAMZzeIHjGVDgTcPn9fY4Z WdKHBBU4m/nNnUIgOGri6tHMdkqoKmIdb8FxtxUPH6ugFNjaO3CFhTGLaL0GuQvhY0QY j6N18ETHUvF9XJavepeEwN7RwrSZ/PGeLoYQOLKaivVuIz7JTU0T9Sa078SpwhbNZWHJ Yujhe2vAUq6jrA5QpRdwjimzTVkFsjhbLS3aOESD7Thata9OUyl/5wzRH6kqLqQqpDPD RLMiVrVX9XlGNAbHlZw0db0CEb1VVnBCyuLj+7paAX3PKCIXKQcIpWcTmBZE6Dbzukt1 wQ2w== X-Gm-Message-State: APzg51Cw48wpzi5/EzDE5mf0OfNV9NKnfieO82fPOxH5UKm6WaHNgYEi 6a3yZvPg1BEztg2xucwht5BHool9chU= X-Google-Smtp-Source: ACcGV60W00a+8IIpJwtHB/LOqp08Dcq3d9Bs2YLhnXtHJQkcPbuat88sGjXGVqVgpzLADrZnTZE7Iw== X-Received: by 2002:a2e:8513:: with SMTP id j19-v6mr9568632lji.10.1537776159991; Mon, 24 Sep 2018 01:02:39 -0700 (PDT) Received: from genomnajs.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id e5-v6sm1420706ljb.86.2018.09.24.01.02.38 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 24 Sep 2018 01:02:38 -0700 (PDT) From: Linus Walleij To: linux-mmc@vger.kernel.org, Ulf Hansson Cc: Linus Walleij , Weijun Yang , Barry Song , Adrian Hunter Subject: [PATCH] mmc: sdhci: sirf: Use the slot GPIO descriptor Date: Mon, 24 Sep 2018 10:02:33 +0200 Message-Id: <20180924080233.4045-1-linus.walleij@linaro.org> X-Mailer: git-send-email 2.17.1 Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Cc: Barry Song Cc: Adrian Hunter Signed-off-by: Linus Walleij --- 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 #include #include -#include #include #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;