mmc: slot-gpio: Remove override_active_level on WP
authorLinus Walleij <linus.walleij@linaro.org>
Tue, 5 Feb 2019 09:30:22 +0000 (10:30 +0100)
committerUlf Hansson <ulf.hansson@linaro.org>
Mon, 25 Feb 2019 07:40:58 +0000 (08:40 +0100)
The argument "override_active_level" made it possible to
enforce a specific polarity on the write-protect
GPIO line. All callers in the kernel pass "false" to this
call after I have converted all drivers to use GPIO machine
descriptors, so remove the argument and clean out this.

This kind of polarity inversion should be handled by the
GPIO descriptor inside the GPIO library if needed.

This rids us of one instance of the kludgy calls into
the gpiod_get_raw_value() API.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
drivers/mmc/core/host.c
drivers/mmc/core/slot-gpio.c
drivers/mmc/host/davinci_mmc.c
drivers/mmc/host/mmc_spi.c
drivers/mmc/host/mmci.c
drivers/mmc/host/pxamci.c
drivers/mmc/host/s3cmci.c
drivers/mmc/host/sdhci-esdhc-imx.c
include/linux/mmc/slot-gpio.h

index 71fb228ad4478292c7cb1a1573326f64f0f68af1..652ea650233605157e4e76e4ac391d0fc0d77bd5 100644 (file)
@@ -260,7 +260,7 @@ int mmc_of_parse(struct mmc_host *host)
        /* Parse Write Protection */
        ro_cap_invert = device_property_read_bool(dev, "wp-inverted");
 
-       ret = mmc_gpiod_request_ro(host, "wp", 0, false, 0, &ro_gpio_invert);
+       ret = mmc_gpiod_request_ro(host, "wp", 0, 0, &ro_gpio_invert);
        if (!ret)
                dev_info(host->parent, "Got WP GPIO\n");
        else if (ret != -ENOENT && ret != -ENOSYS)
index 319ccd93383d25759d9104d3fd4eaae20745fc67..4afc6b87b4659fbfeca69264ae5b39b8a100fc6f 100644 (file)
@@ -22,7 +22,6 @@
 struct mmc_gpio {
        struct gpio_desc *ro_gpio;
        struct gpio_desc *cd_gpio;
-       bool override_ro_active_level;
        bool override_cd_active_level;
        irqreturn_t (*cd_gpio_isr)(int irq, void *dev_id);
        char *ro_label;
@@ -71,10 +70,6 @@ int mmc_gpio_get_ro(struct mmc_host *host)
        if (!ctx || !ctx->ro_gpio)
                return -ENOSYS;
 
-       if (ctx->override_ro_active_level)
-               return !gpiod_get_raw_value_cansleep(ctx->ro_gpio) ^
-                       !!(host->caps2 & MMC_CAP2_RO_ACTIVE_HIGH);
-
        return gpiod_get_value_cansleep(ctx->ro_gpio);
 }
 EXPORT_SYMBOL(mmc_gpio_get_ro);
@@ -225,7 +220,6 @@ EXPORT_SYMBOL(mmc_can_gpio_cd);
  * @host: mmc host
  * @con_id: function within the GPIO consumer
  * @idx: index of the GPIO to obtain in the consumer
- * @override_active_level: ignore %GPIO_ACTIVE_LOW flag
  * @debounce: debounce time in microseconds
  * @gpio_invert: will return whether the GPIO line is inverted or not,
  * set to NULL to ignore
@@ -233,7 +227,7 @@ EXPORT_SYMBOL(mmc_can_gpio_cd);
  * Returns zero on success, else an error.
  */
 int mmc_gpiod_request_ro(struct mmc_host *host, const char *con_id,
-                        unsigned int idx, bool override_active_level,
+                        unsigned int idx,
                         unsigned int debounce, bool *gpio_invert)
 {
        struct mmc_gpio *ctx = host->slot.handler_priv;
@@ -253,7 +247,6 @@ int mmc_gpiod_request_ro(struct mmc_host *host, const char *con_id,
        if (gpio_invert)
                *gpio_invert = !gpiod_is_active_low(desc);
 
-       ctx->override_ro_active_level = override_active_level;
        ctx->ro_gpio = desc;
 
        return 0;
index 9e68c3645e2270272f3bed4a5035e0dd8cdd2247..49e0daf2ef5e1a99cf13eb1d7b46d71f0195a9c5 100644 (file)
@@ -1193,7 +1193,7 @@ static int mmc_davinci_parse_pdata(struct mmc_host *mmc)
        else if (ret)
                mmc->caps |= MMC_CAP_NEEDS_POLL;
 
-       ret = mmc_gpiod_request_ro(mmc, "wp", 0, false, 0, NULL);
+       ret = mmc_gpiod_request_ro(mmc, "wp", 0, 0, NULL);
        if (ret == -EPROBE_DEFER)
                return ret;
 
index 10ba46b728e82279d66aea48792388145383bbee..d7a5bbeb391bbaee5c3fba7d0d651b556bc08870 100644 (file)
@@ -1452,7 +1452,7 @@ static int mmc_spi_probe(struct spi_device *spi)
        }
 
        /* Index 1 is write protect/read only */
-       status = mmc_gpiod_request_ro(mmc, NULL, 1, false, 0, NULL);
+       status = mmc_gpiod_request_ro(mmc, NULL, 1, 0, NULL);
        if (status == -EPROBE_DEFER)
                goto fail_add_host;
        if (!status)
index e352f5ad58018cebcec91dd87a45e638cb4d8a7c..7dd3ccf5baf00a2af54a2a99009c3c4f462062ee 100644 (file)
@@ -2011,7 +2011,7 @@ static int mmci_probe(struct amba_device *dev,
                if (ret == -EPROBE_DEFER)
                        goto clk_disable;
 
-               ret = mmc_gpiod_request_ro(mmc, "wp", 0, false, 0, NULL);
+               ret = mmc_gpiod_request_ro(mmc, "wp", 0, 0, NULL);
                if (ret == -EPROBE_DEFER)
                        goto clk_disable;
        }
index 8779bbaa6b697441fe50bc2c39d1337cfc0b43bf..c907bf502a123b5b588d8a70e3446fca1da20a66 100644 (file)
@@ -743,7 +743,7 @@ static int pxamci_probe(struct platform_device *pdev)
                        goto out;
                }
 
-               ret = mmc_gpiod_request_ro(mmc, "wp", 0, false, 0, NULL);
+               ret = mmc_gpiod_request_ro(mmc, "wp", 0, 0, NULL);
                if (ret && ret != -ENOENT) {
                        dev_err(dev, "Failed requesting gpio_ro\n");
                        goto out;
index 10f5219b3b408fa3232d31498ce21910071f3503..f31333e831a70963c69b461239e795ab276eebc8 100644 (file)
@@ -1530,7 +1530,7 @@ static int s3cmci_probe_pdata(struct s3cmci_host *host)
                return ret;
        }
 
-       ret = mmc_gpiod_request_ro(host->mmc, "wp", 0, false, 0, NULL);
+       ret = mmc_gpiod_request_ro(host->mmc, "wp", 0, 0, NULL);
        if (ret != -ENOENT) {
                dev_err(&pdev->dev, "error requesting GPIO for WP %d\n",
                        ret);
index fad600739d0e51123d85ef77792cee088e193363..32ca3703b432a5a5b46bb416b3129c30732f781b 100644 (file)
@@ -1351,7 +1351,7 @@ static int sdhci_esdhc_imx_probe_nondt(struct platform_device *pdev,
                                host->mmc->parent->platform_data);
        /* write_protect */
        if (boarddata->wp_type == ESDHC_WP_GPIO) {
-               err = mmc_gpiod_request_ro(host->mmc, "wp", 0, false, 0, NULL);
+               err = mmc_gpiod_request_ro(host->mmc, "wp", 0, 0, NULL);
                if (err) {
                        dev_err(mmc_dev(host->mmc),
                                "failed to request write-protect gpio!\n");
index feebd7aa6f5c16abdd81548bd6502dc5d9c04794..9fd3ce64a885c84bb2afc0aa7b04d12f46c1dd4f 100644 (file)
@@ -22,7 +22,7 @@ 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);
 int mmc_gpiod_request_ro(struct mmc_host *host, const char *con_id,
-                        unsigned int idx, bool override_active_level,
+                        unsigned int idx,
                         unsigned int debounce, bool *gpio_invert);
 void mmc_gpio_set_cd_isr(struct mmc_host *host,
                         irqreturn_t (*isr)(int irq, void *dev_id));