From patchwork Sun Dec 2 08:43:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 152658 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp5558418ljp; Sun, 2 Dec 2018 00:47:03 -0800 (PST) X-Google-Smtp-Source: AFSGD/XlyMT26iUL6iWC/tl9fyH95cyEl0ukICcYqNbhZZlXTXzrdLXzOy6BjQB5jW6UkOjiaNv2 X-Received: by 2002:a63:9b11:: with SMTP id r17mr9858068pgd.416.1543740423212; Sun, 02 Dec 2018 00:47:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543740423; cv=none; d=google.com; s=arc-20160816; b=zWMt8aPm91mWtj0vGOTBMaYGOnG5PiM6lZfc2lPNj9Rhym+gj09eaD2oXSvOuiE7Ec /oL6R3tH2FPtosfDMidee29txORoNAUTSZueXVjjBQ/XGGz+mkfkuzJ9bfrQPUsrCWPu QFjUNSl2jzCECU+HTLGHIFDZBKeD1phLxSY3Pimic0RQ95PsiAv8sWqxuEcFPRtB8+jZ hC6HkzdcTmyBBWo75kiMJSJXsAL8xcnT+K2QlOU6yaOXRfIU7FMJcwl5NWKKqGcBwcu/ arhvU+EiQ3lf3+eU7bnEij71N7LGvKc+hVGfm6PkGsUii0R9Tbz8m+nn2bmwyzPx/ibG rtxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=q/rT7+2FCp1RDVpT25OyfYRQesH/D1W2I75rJ4YOPGs=; b=tvSzkOf5BQbz4Wyq1OsdO5iZCHI9ap0CFAnqdzKAMZaXX/7/kjlH27coq66cx9tYBs N9ZS+mUPwNVaiycQQ/YMTxGJziEbVaugGeRGjUQo9FYsmPYGHHyYychnWUTfGbT+dEgT HuOLq/B0t1iAOrY+ultkL6QTuNF226egZBeKTks5O+X065pyhort9uZXZWIjihnDWng3 k/fELnEcg838eFiwK/LDRSt9C4aW3LHnVMiYzBHn59w+oD6YBXCBNPYs6ZZITH8yGAy3 /MsXylR9aZjcSt3zG3dqdR6FSrN1KbN3zz4weM6xXJGM1DNukuOavWzX5L9RuShFmMmq on7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TbeCQjwT; 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 28si9351748pgz.593.2018.12.02.00.47.03; Sun, 02 Dec 2018 00:47:03 -0800 (PST) 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=TbeCQjwT; 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 S1725772AbeLBIrE (ORCPT + 5 others); Sun, 2 Dec 2018 03:47:04 -0500 Received: from mail-lj1-f196.google.com ([209.85.208.196]:36855 "EHLO mail-lj1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725812AbeLBIrE (ORCPT ); Sun, 2 Dec 2018 03:47:04 -0500 Received: by mail-lj1-f196.google.com with SMTP id g11-v6so8607766ljk.3 for ; Sun, 02 Dec 2018 00:47:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=q/rT7+2FCp1RDVpT25OyfYRQesH/D1W2I75rJ4YOPGs=; b=TbeCQjwTb8e7TT4/zW1WcUOsJ3ullOzoGyqVb4t/s/bItLfx4z+IzPx5UThz7XFTm2 X2FlZicc3e1kJJOqajUWj/Ts7iqZEO88PZT8uOPO9RfwjyaFkBWjrp7APWUeQYzELPKu ZPFutT5T1YleHRucnt+GYhuZNQZFI7vVql7O0= 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=q/rT7+2FCp1RDVpT25OyfYRQesH/D1W2I75rJ4YOPGs=; b=gnKHq1+pSDBJnGxnq+MrGRhW8a1/oV4Moyce+zxTLHnaSzoYPxeaLaqpS6kJUg2wzb WfXVI8l/1i5ewz3hcuG6LPsO6bgNh3A6rmR8yThUed2PFT1VWw9+zpsIxVkui2UQMXa+ HdgpyEsdn5ZSxdeJjFgXcmJYfGmbct/UTlURHgMNgd1ST9/J3uV53P/BiMRbAFHCDdKr ffbM0D2/WiYKBOZ/KNmZ5VEXr9LH5vK6oyDfObQHeeNHKHL75382QXNMgmDvXGUG068Z R9Pd5gpcgWI7hxwzjeV8z7ocYgrI8RVXrk6DYHx6qKeqCkvY/DMPS+BW1SGizLLTtXSX yYvA== X-Gm-Message-State: AA+aEWb4+fw/IntoLyaVKFf9I4XB05fjd7PBW5Oh7av4sHKKDWFPyTO0 J8vVESXY5ON4kNfPBITcw40O0YThcMrTWA== X-Received: by 2002:a2e:2019:: with SMTP id g25-v6mr7098369ljg.20.1543740415222; Sun, 02 Dec 2018 00:46:55 -0800 (PST) Received: from localhost.localdomain (c-ae7b71d5.014-348-6c756e10.bbcust.telenor.se. [213.113.123.174]) by smtp.gmail.com with ESMTPSA id z7-v6sm1772719lji.42.2018.12.02.00.46.53 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 02 Dec 2018 00:46:54 -0800 (PST) From: Linus Walleij To: linux-mmc@vger.kernel.org, Ulf Hansson Cc: Linus Walleij Subject: [PATCH 11/11 v4] mmc: slot-gpio: Delete legacy GPIO handling Date: Sun, 2 Dec 2018 09:43:28 +0100 Message-Id: <20181202084328.25546-12-linus.walleij@linaro.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181202084328.25546-1-linus.walleij@linaro.org> References: <20181202084328.25546-1-linus.walleij@linaro.org> MIME-Version: 1.0 Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org All host drivers are converted to look up GPIO descriptors from device tree, ACPI or machine descriptor tables, so now we can delete the legacy GPIO handling using hardcoded GPIO numbers from the kernel. Signed-off-by: Linus Walleij --- ChangeLog v3->v4: - Resending. ChangeLog v1->v3: - Resending. --- drivers/mmc/core/slot-gpio.c | 81 +---------------------------------- include/linux/mmc/slot-gpio.h | 5 --- 2 files changed, 1 insertion(+), 85 deletions(-) -- 2.19.1 diff --git a/drivers/mmc/core/slot-gpio.c b/drivers/mmc/core/slot-gpio.c index e5bb86b02373..319ccd93383d 100644 --- a/drivers/mmc/core/slot-gpio.c +++ b/drivers/mmc/core/slot-gpio.c @@ -9,7 +9,6 @@ */ #include -#include #include #include #include @@ -102,36 +101,6 @@ int mmc_gpio_get_cd(struct mmc_host *host) } EXPORT_SYMBOL(mmc_gpio_get_cd); -/** - * mmc_gpio_request_ro - request a gpio for write-protection - * @host: mmc host - * @gpio: gpio number requested - * - * As devm_* managed functions are used in mmc_gpio_request_ro(), client - * drivers do not need to worry about freeing up memory. - * - * Returns zero on success, else an error. - */ -int mmc_gpio_request_ro(struct mmc_host *host, unsigned int gpio) -{ - struct mmc_gpio *ctx = host->slot.handler_priv; - int ret; - - if (!gpio_is_valid(gpio)) - return -EINVAL; - - ret = devm_gpio_request_one(host->parent, gpio, GPIOF_DIR_IN, - ctx->ro_label); - if (ret < 0) - return ret; - - ctx->override_ro_active_level = true; - ctx->ro_gpio = gpio_to_desc(gpio); - - return 0; -} -EXPORT_SYMBOL(mmc_gpio_request_ro); - void mmc_gpiod_request_cd_irq(struct mmc_host *host) { struct mmc_gpio *ctx = host->slot.handler_priv; @@ -200,50 +169,6 @@ void mmc_gpio_set_cd_isr(struct mmc_host *host, } EXPORT_SYMBOL(mmc_gpio_set_cd_isr); -/** - * mmc_gpio_request_cd - request a gpio for card-detection - * @host: mmc host - * @gpio: gpio number requested - * @debounce: debounce time in microseconds - * - * As devm_* managed functions are used in mmc_gpio_request_cd(), client - * drivers do not need to worry about freeing up memory. - * - * If GPIO debouncing is desired, set the debounce parameter to a non-zero - * value. The caller is responsible for ensuring that the GPIO driver associated - * with the GPIO supports debouncing, otherwise an error will be returned. - * - * Returns zero on success, else an error. - */ -int mmc_gpio_request_cd(struct mmc_host *host, unsigned int gpio, - unsigned int debounce) -{ - struct mmc_gpio *ctx = host->slot.handler_priv; - int ret; - - ret = devm_gpio_request_one(host->parent, gpio, GPIOF_DIR_IN, - ctx->cd_label); - if (ret < 0) - /* - * don't bother freeing memory. It might still get used by other - * slot functions, in any case it will be freed, when the device - * is destroyed. - */ - return ret; - - if (debounce) { - ret = gpio_set_debounce(gpio, debounce); - if (ret < 0) - return ret; - } - - ctx->override_cd_active_level = true; - ctx->cd_gpio = gpio_to_desc(gpio); - - return 0; -} -EXPORT_SYMBOL(mmc_gpio_request_cd); - /** * mmc_gpiod_request_cd - request a gpio descriptor for card-detection * @host: mmc host @@ -254,8 +179,7 @@ EXPORT_SYMBOL(mmc_gpio_request_cd); * @gpio_invert: will return whether the GPIO line is inverted or not, set * to NULL to ignore * - * Use this function in place of mmc_gpio_request_cd() to use the GPIO - * descriptor API. Note that it must be called prior to mmc_add_host() + * Note that this must be called prior to mmc_add_host() * otherwise the caller must also call mmc_gpiod_request_cd_irq(). * * Returns zero on success, else an error. @@ -306,9 +230,6 @@ EXPORT_SYMBOL(mmc_can_gpio_cd); * @gpio_invert: will return whether the GPIO line is inverted or not, * set to NULL to ignore * - * Use this function in place of mmc_gpio_request_ro() to use the GPIO - * descriptor API. - * * Returns zero on success, else an error. */ int mmc_gpiod_request_ro(struct mmc_host *host, const char *con_id, diff --git a/include/linux/mmc/slot-gpio.h b/include/linux/mmc/slot-gpio.h index 06607c59c4d0..feebd7aa6f5c 100644 --- a/include/linux/mmc/slot-gpio.h +++ b/include/linux/mmc/slot-gpio.h @@ -17,12 +17,7 @@ struct mmc_host; int mmc_gpio_get_ro(struct mmc_host *host); -int mmc_gpio_request_ro(struct mmc_host *host, unsigned int gpio); - int mmc_gpio_get_cd(struct mmc_host *host); -int mmc_gpio_request_cd(struct mmc_host *host, unsigned int gpio, - unsigned int debounce); - int mmc_gpiod_request_cd(struct mmc_host *host, const char *con_id, unsigned int idx, bool override_active_level, unsigned int debounce, bool *gpio_invert);