Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mmc: slot-gpio: Remove override_active_level on WP

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>

authored by

Linus Walleij and committed by
Ulf Hansson
a2b760a6 9cda3e7c

+9 -16
+1 -1
drivers/mmc/core/host.c
··· 260 260 /* Parse Write Protection */ 261 261 ro_cap_invert = device_property_read_bool(dev, "wp-inverted"); 262 262 263 - ret = mmc_gpiod_request_ro(host, "wp", 0, false, 0, &ro_gpio_invert); 263 + ret = mmc_gpiod_request_ro(host, "wp", 0, 0, &ro_gpio_invert); 264 264 if (!ret) 265 265 dev_info(host->parent, "Got WP GPIO\n"); 266 266 else if (ret != -ENOENT && ret != -ENOSYS)
+1 -8
drivers/mmc/core/slot-gpio.c
··· 22 22 struct mmc_gpio { 23 23 struct gpio_desc *ro_gpio; 24 24 struct gpio_desc *cd_gpio; 25 - bool override_ro_active_level; 26 25 bool override_cd_active_level; 27 26 irqreturn_t (*cd_gpio_isr)(int irq, void *dev_id); 28 27 char *ro_label; ··· 69 70 70 71 if (!ctx || !ctx->ro_gpio) 71 72 return -ENOSYS; 72 - 73 - if (ctx->override_ro_active_level) 74 - return !gpiod_get_raw_value_cansleep(ctx->ro_gpio) ^ 75 - !!(host->caps2 & MMC_CAP2_RO_ACTIVE_HIGH); 76 73 77 74 return gpiod_get_value_cansleep(ctx->ro_gpio); 78 75 } ··· 220 225 * @host: mmc host 221 226 * @con_id: function within the GPIO consumer 222 227 * @idx: index of the GPIO to obtain in the consumer 223 - * @override_active_level: ignore %GPIO_ACTIVE_LOW flag 224 228 * @debounce: debounce time in microseconds 225 229 * @gpio_invert: will return whether the GPIO line is inverted or not, 226 230 * set to NULL to ignore ··· 227 233 * Returns zero on success, else an error. 228 234 */ 229 235 int mmc_gpiod_request_ro(struct mmc_host *host, const char *con_id, 230 - unsigned int idx, bool override_active_level, 236 + unsigned int idx, 231 237 unsigned int debounce, bool *gpio_invert) 232 238 { 233 239 struct mmc_gpio *ctx = host->slot.handler_priv; ··· 247 253 if (gpio_invert) 248 254 *gpio_invert = !gpiod_is_active_low(desc); 249 255 250 - ctx->override_ro_active_level = override_active_level; 251 256 ctx->ro_gpio = desc; 252 257 253 258 return 0;
+1 -1
drivers/mmc/host/davinci_mmc.c
··· 1193 1193 else if (ret) 1194 1194 mmc->caps |= MMC_CAP_NEEDS_POLL; 1195 1195 1196 - ret = mmc_gpiod_request_ro(mmc, "wp", 0, false, 0, NULL); 1196 + ret = mmc_gpiod_request_ro(mmc, "wp", 0, 0, NULL); 1197 1197 if (ret == -EPROBE_DEFER) 1198 1198 return ret; 1199 1199
+1 -1
drivers/mmc/host/mmc_spi.c
··· 1452 1452 } 1453 1453 1454 1454 /* Index 1 is write protect/read only */ 1455 - status = mmc_gpiod_request_ro(mmc, NULL, 1, false, 0, NULL); 1455 + status = mmc_gpiod_request_ro(mmc, NULL, 1, 0, NULL); 1456 1456 if (status == -EPROBE_DEFER) 1457 1457 goto fail_add_host; 1458 1458 if (!status)
+1 -1
drivers/mmc/host/mmci.c
··· 2011 2011 if (ret == -EPROBE_DEFER) 2012 2012 goto clk_disable; 2013 2013 2014 - ret = mmc_gpiod_request_ro(mmc, "wp", 0, false, 0, NULL); 2014 + ret = mmc_gpiod_request_ro(mmc, "wp", 0, 0, NULL); 2015 2015 if (ret == -EPROBE_DEFER) 2016 2016 goto clk_disable; 2017 2017 }
+1 -1
drivers/mmc/host/pxamci.c
··· 743 743 goto out; 744 744 } 745 745 746 - ret = mmc_gpiod_request_ro(mmc, "wp", 0, false, 0, NULL); 746 + ret = mmc_gpiod_request_ro(mmc, "wp", 0, 0, NULL); 747 747 if (ret && ret != -ENOENT) { 748 748 dev_err(dev, "Failed requesting gpio_ro\n"); 749 749 goto out;
+1 -1
drivers/mmc/host/s3cmci.c
··· 1530 1530 return ret; 1531 1531 } 1532 1532 1533 - ret = mmc_gpiod_request_ro(host->mmc, "wp", 0, false, 0, NULL); 1533 + ret = mmc_gpiod_request_ro(host->mmc, "wp", 0, 0, NULL); 1534 1534 if (ret != -ENOENT) { 1535 1535 dev_err(&pdev->dev, "error requesting GPIO for WP %d\n", 1536 1536 ret);
+1 -1
drivers/mmc/host/sdhci-esdhc-imx.c
··· 1351 1351 host->mmc->parent->platform_data); 1352 1352 /* write_protect */ 1353 1353 if (boarddata->wp_type == ESDHC_WP_GPIO) { 1354 - err = mmc_gpiod_request_ro(host->mmc, "wp", 0, false, 0, NULL); 1354 + err = mmc_gpiod_request_ro(host->mmc, "wp", 0, 0, NULL); 1355 1355 if (err) { 1356 1356 dev_err(mmc_dev(host->mmc), 1357 1357 "failed to request write-protect gpio!\n");
+1 -1
include/linux/mmc/slot-gpio.h
··· 22 22 unsigned int idx, bool override_active_level, 23 23 unsigned int debounce, bool *gpio_invert); 24 24 int mmc_gpiod_request_ro(struct mmc_host *host, const char *con_id, 25 - unsigned int idx, bool override_active_level, 25 + unsigned int idx, 26 26 unsigned int debounce, bool *gpio_invert); 27 27 void mmc_gpio_set_cd_isr(struct mmc_host *host, 28 28 irqreturn_t (*isr)(int irq, void *dev_id));