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: 147340 Delivered-To: patch@linaro.org Received: by 2002:a2e:8595:0:0:0:0:0 with SMTP id b21-v6csp423859lji; Mon, 24 Sep 2018 01:02:43 -0700 (PDT) X-Google-Smtp-Source: ACcGV60qOa4E/5VNoq6Nwf7u77cNSc2P4Z8WE8LDOV06IPA09wTeHPCX8DNMHSSCYaCW+aHDfswT X-Received: by 2002:a63:c20:: with SMTP id b32-v6mr8430504pgl.400.1537776163604; Mon, 24 Sep 2018 01:02:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537776163; cv=none; d=google.com; s=arc-20160816; b=px9REA6TeCHx+RJBk9blgOwcv5q3CEtFPmbBk4jiHWkqSsVEbiUG5MHjMjXYGSutqI dF6/ta1UXiwIPMrootis4tUY0uyJeozq77R4Lwhn82cVT4tmBx1hadx5yE2Rj6vuYadx 9dX536+XmY2FPafJmuDuDwezJJTAc0TXoLI7+40Mo/g9Si01O4FnS7zy8D8VsMdBLhcY 2+PO1KossVRqcx+bVbTLF0/OxbNhh+SDHwYG2lrIyPBGZZaBhMvjCb6vLT60Q2KfYB+O zSU0sjEFR8O3Pgajoe9jfbpLhIQxFZqXR1qlLsyxLHeWB9NvNCCZHuOk4FzFLovHcT63 1ZGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=+GKiUfPONS9Qz28da6RINub7As1Jm4Aa0hYmZl5qviQ=; b=LTLzCtJX3k1CEO9Myd6R4TrqyhumVJOk+i8+tNI+7Zuv6sIhBjgXtEwhVpqhk9LhlC o913e2Z8yZW72wgtAJ9dOaY27VGBhI/yyOhpytkuww+mvArQPX5S1nayWbBgzvOTUc0f x6Y9NUbeHcA7YpIU5pQvoURZ/XiKXE2nhvkjQgdCXxIUTN5NeXAqGgI3cVhvhR9JBGfI /uLkhX6FGIagwQz6trKvIKoPbvM7STpZnV3e82lvywsNFQTOrYxEDDFTl8wPnVSdIFAz TI4fa66zW7tPa6zcWMrhsmifU2VAKnXhWZ+ZisWOGiuWPJO70Imll1DRcum5w7/ciCs2 mWEg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="L/rP5zMH"; spf=pass (google.com: best guess record for domain of linux-mmc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-mmc-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i135-v6si34358137pgc.154.2018.09.24.01.02.43; Mon, 24 Sep 2018 01:02:43 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-mmc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="L/rP5zMH"; spf=pass (google.com: best guess record for domain of linux-mmc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-mmc-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727382AbeIXODc (ORCPT + 5 others); 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-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 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(-) -- 2.17.1 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;