From patchwork Sun Nov 25 22:52:17 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 151942 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp4909082ljp; Sun, 25 Nov 2018 14:55:09 -0800 (PST) X-Google-Smtp-Source: AFSGD/U8zqWBb1MIp+HSLEgz3/SuwNZb4itbkTbM4+lBEJF2DUH793MYuDvMcDeqfPSNwSrnSSty X-Received: by 2002:a17:902:1008:: with SMTP id b8mr15283384pla.252.1543186509094; Sun, 25 Nov 2018 14:55:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543186509; cv=none; d=google.com; s=arc-20160816; b=rDHFDd082Lji6oQGkmvNWx3yk/6rYGoUB1vH9CIMbL92MTOcJgEj/8Qd+1rYhxGa+w amHPzi2mPbZpffor7PSEn4Jg1K23szsr/5+DwCwzrnkBkd5ySuzxw7snaiwDXVlpJtmT mNU3ZwIM/eXHrPOBijOal6PUAYGNsn/WlNyPRhzOigp6eWUZSY9S0Orpcc57aoP2MzJX BhT0POiZtAoG6uoY1fOnVpOulpxjyfWTcahQwVZj9bN2Zm8uXk8qUxY0iTjwYfTmIDEw +ERmRl92Hdar5SNgsriwGM7iSBN4OuiGtvA8RqUoLKBVRwt7IM04uv2bW7LOoxVyXw7/ C77Q== 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=8rF8J9vbeqwwaJpabCc+Gb4QLMG6Cw/NOF+19tR6eqw=; b=mOsQ50miIJayT5c4TYyR09pTcPGA9VM0T5g91KzS0PTk0YfpeLbue7VfgUb0Fa5D1S rNzLIceSUmaYgN7y9lRZLDAnE1+QM0kQmbLqD9d0FjrIdWzTF3sQuLgXWAX++XLkHt3L fiWVOFeQ/KvmF64p1C8mc8IesC0Iy2AL1JAlsdR9OfcryqYz0o9Z2s4lY/XhQ4QuEeVL O1nW8aP5/BZA3gdjJVn3LGXKLP99kEIMojsHTQ2dyaSOTEnrNcK6EDyLbFbP80UHjv1c IjjPdV4OuGokps8gyDlMtRM+lR/oTAtrFCiiFqi18OFELw698pw/O56iBBFRgxt2gLEd hhuA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=M6nNxe9B; 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 m75si39838955pga.432.2018.11.25.14.55.08; Sun, 25 Nov 2018 14:55:09 -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=M6nNxe9B; 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 S1726124AbeKZJrT (ORCPT + 5 others); Mon, 26 Nov 2018 04:47:19 -0500 Received: from mail-lj1-f196.google.com ([209.85.208.196]:34865 "EHLO mail-lj1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726135AbeKZJrT (ORCPT ); Mon, 26 Nov 2018 04:47:19 -0500 Received: by mail-lj1-f196.google.com with SMTP id x85-v6so14850052ljb.2 for ; Sun, 25 Nov 2018 14:55:06 -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=8rF8J9vbeqwwaJpabCc+Gb4QLMG6Cw/NOF+19tR6eqw=; b=M6nNxe9BraI3tDrOADsE58RhxpJqAOtNLslJn6axoHrcyOWG9O4d2YZ1GT6P7qfkOE PiYVCaPpufCxpSEkrpK8sX3qv8yBkM0VLYo9MyeUaexl/CI+ZuPubks0+rgKU35cOeM7 5m3sKGBVMnBiz9yC/0JYLG0cd/lFUtFAlBgw4= 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=8rF8J9vbeqwwaJpabCc+Gb4QLMG6Cw/NOF+19tR6eqw=; b=cvwvjQE6DtmJD/hPaN1bJcbFgpV1ruRSUsKFChwzfXYinxElL06QyouK4DSCZJ2FI2 Q1WTA48qIyK4v7C7oAt6xxzMjkmBODywXgn+E1wdZ5GjFRuRHi8DtShxNrjE9MnyUi+O rqj1t9KgBM6DAuyXjES/EQUTFzJkBvsj2sy+lW8R+n8mBeYnip/GKT9a2bRdiIKqa80Z tz7uEWibbCnzEXVDtLBt+oEJwx0NhQb3t9NJN3tIoT+pX9k1dcYuuPsK9GlSxuNidDjl yE1Hi08SMq8hdYlX8mrQPW0aOzMUMmCAKD6TltrM+obV5bhZ4XeaZSPeLqAzXx0YMmPU Uxjw== X-Gm-Message-State: AA+aEWaSlSLwKWR23LVXgj0i6NCOfcXynSP/kMEq3viLX0J6bhsI3Kh9 QSnWRkoBZE/R5T71NUTGWoUcdsNwT+CsiQ== X-Received: by 2002:a2e:94ce:: with SMTP id r14-v6mr15217333ljh.34.1543186504930; Sun, 25 Nov 2018 14:55:04 -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 c19sm9047235lfg.86.2018.11.25.14.54.57 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 25 Nov 2018 14:54:57 -0800 (PST) From: Linus Walleij To: linux-mmc@vger.kernel.org, Ulf Hansson Cc: Linus Walleij Subject: [PATCH 11/11 v3] mmc: slot-gpio: Delete legacy GPIO handling Date: Sun, 25 Nov 2018 23:52:17 +0100 Message-Id: <20181125225217.23201-12-linus.walleij@linaro.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181125225217.23201-1-linus.walleij@linaro.org> References: <20181125225217.23201-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 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);