Skip to content

Commit a2b760a

Browse files
Linus Walleijstorulf
authored andcommitted
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 <[email protected]> Signed-off-by: Ulf Hansson <[email protected]>
1 parent 9cda3e7 commit a2b760a

File tree

9 files changed

+9
-16
lines changed

9 files changed

+9
-16
lines changed

drivers/mmc/core/host.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ int mmc_of_parse(struct mmc_host *host)
260260
/* Parse Write Protection */
261261
ro_cap_invert = device_property_read_bool(dev, "wp-inverted");
262262

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);
264264
if (!ret)
265265
dev_info(host->parent, "Got WP GPIO\n");
266266
else if (ret != -ENOENT && ret != -ENOSYS)

drivers/mmc/core/slot-gpio.c

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
struct mmc_gpio {
2323
struct gpio_desc *ro_gpio;
2424
struct gpio_desc *cd_gpio;
25-
bool override_ro_active_level;
2625
bool override_cd_active_level;
2726
irqreturn_t (*cd_gpio_isr)(int irq, void *dev_id);
2827
char *ro_label;
@@ -71,10 +70,6 @@ int mmc_gpio_get_ro(struct mmc_host *host)
7170
if (!ctx || !ctx->ro_gpio)
7271
return -ENOSYS;
7372

74-
if (ctx->override_ro_active_level)
75-
return !gpiod_get_raw_value_cansleep(ctx->ro_gpio) ^
76-
!!(host->caps2 & MMC_CAP2_RO_ACTIVE_HIGH);
77-
7873
return gpiod_get_value_cansleep(ctx->ro_gpio);
7974
}
8075
EXPORT_SYMBOL(mmc_gpio_get_ro);
@@ -225,15 +220,14 @@ EXPORT_SYMBOL(mmc_can_gpio_cd);
225220
* @host: mmc host
226221
* @con_id: function within the GPIO consumer
227222
* @idx: index of the GPIO to obtain in the consumer
228-
* @override_active_level: ignore %GPIO_ACTIVE_LOW flag
229223
* @debounce: debounce time in microseconds
230224
* @gpio_invert: will return whether the GPIO line is inverted or not,
231225
* set to NULL to ignore
232226
*
233227
* Returns zero on success, else an error.
234228
*/
235229
int mmc_gpiod_request_ro(struct mmc_host *host, const char *con_id,
236-
unsigned int idx, bool override_active_level,
230+
unsigned int idx,
237231
unsigned int debounce, bool *gpio_invert)
238232
{
239233
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,
253247
if (gpio_invert)
254248
*gpio_invert = !gpiod_is_active_low(desc);
255249

256-
ctx->override_ro_active_level = override_active_level;
257250
ctx->ro_gpio = desc;
258251

259252
return 0;

drivers/mmc/host/davinci_mmc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1193,7 +1193,7 @@ static int mmc_davinci_parse_pdata(struct mmc_host *mmc)
11931193
else if (ret)
11941194
mmc->caps |= MMC_CAP_NEEDS_POLL;
11951195

1196-
ret = mmc_gpiod_request_ro(mmc, "wp", 0, false, 0, NULL);
1196+
ret = mmc_gpiod_request_ro(mmc, "wp", 0, 0, NULL);
11971197
if (ret == -EPROBE_DEFER)
11981198
return ret;
11991199

drivers/mmc/host/mmc_spi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1452,7 +1452,7 @@ static int mmc_spi_probe(struct spi_device *spi)
14521452
}
14531453

14541454
/* 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);
14561456
if (status == -EPROBE_DEFER)
14571457
goto fail_add_host;
14581458
if (!status)

drivers/mmc/host/mmci.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2011,7 +2011,7 @@ static int mmci_probe(struct amba_device *dev,
20112011
if (ret == -EPROBE_DEFER)
20122012
goto clk_disable;
20132013

2014-
ret = mmc_gpiod_request_ro(mmc, "wp", 0, false, 0, NULL);
2014+
ret = mmc_gpiod_request_ro(mmc, "wp", 0, 0, NULL);
20152015
if (ret == -EPROBE_DEFER)
20162016
goto clk_disable;
20172017
}

drivers/mmc/host/pxamci.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -743,7 +743,7 @@ static int pxamci_probe(struct platform_device *pdev)
743743
goto out;
744744
}
745745

746-
ret = mmc_gpiod_request_ro(mmc, "wp", 0, false, 0, NULL);
746+
ret = mmc_gpiod_request_ro(mmc, "wp", 0, 0, NULL);
747747
if (ret && ret != -ENOENT) {
748748
dev_err(dev, "Failed requesting gpio_ro\n");
749749
goto out;

drivers/mmc/host/s3cmci.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1530,7 +1530,7 @@ static int s3cmci_probe_pdata(struct s3cmci_host *host)
15301530
return ret;
15311531
}
15321532

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);
15341534
if (ret != -ENOENT) {
15351535
dev_err(&pdev->dev, "error requesting GPIO for WP %d\n",
15361536
ret);

drivers/mmc/host/sdhci-esdhc-imx.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1351,7 +1351,7 @@ static int sdhci_esdhc_imx_probe_nondt(struct platform_device *pdev,
13511351
host->mmc->parent->platform_data);
13521352
/* write_protect */
13531353
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);
13551355
if (err) {
13561356
dev_err(mmc_dev(host->mmc),
13571357
"failed to request write-protect gpio!\n");

include/linux/mmc/slot-gpio.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ int mmc_gpiod_request_cd(struct mmc_host *host, const char *con_id,
2222
unsigned int idx, bool override_active_level,
2323
unsigned int debounce, bool *gpio_invert);
2424
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,
2626
unsigned int debounce, bool *gpio_invert);
2727
void mmc_gpio_set_cd_isr(struct mmc_host *host,
2828
irqreturn_t (*isr)(int irq, void *dev_id));

0 commit comments

Comments
 (0)