Skip to content

Commit a622bb0

Browse files
linuswstorulf
authored andcommitted
mmc: slot-gpio: Delete legacy GPIO handling
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 <linus.walleij@linaro.org> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
1 parent f54005b commit a622bb0

File tree

2 files changed

+1
-85
lines changed

2 files changed

+1
-85
lines changed

drivers/mmc/core/slot-gpio.c

Lines changed: 1 addition & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
*/
1010

1111
#include <linux/err.h>
12-
#include <linux/gpio.h>
1312
#include <linux/gpio/consumer.h>
1413
#include <linux/interrupt.h>
1514
#include <linux/jiffies.h>
@@ -102,36 +101,6 @@ int mmc_gpio_get_cd(struct mmc_host *host)
102101
}
103102
EXPORT_SYMBOL(mmc_gpio_get_cd);
104103

105-
/**
106-
* mmc_gpio_request_ro - request a gpio for write-protection
107-
* @host: mmc host
108-
* @gpio: gpio number requested
109-
*
110-
* As devm_* managed functions are used in mmc_gpio_request_ro(), client
111-
* drivers do not need to worry about freeing up memory.
112-
*
113-
* Returns zero on success, else an error.
114-
*/
115-
int mmc_gpio_request_ro(struct mmc_host *host, unsigned int gpio)
116-
{
117-
struct mmc_gpio *ctx = host->slot.handler_priv;
118-
int ret;
119-
120-
if (!gpio_is_valid(gpio))
121-
return -EINVAL;
122-
123-
ret = devm_gpio_request_one(host->parent, gpio, GPIOF_DIR_IN,
124-
ctx->ro_label);
125-
if (ret < 0)
126-
return ret;
127-
128-
ctx->override_ro_active_level = true;
129-
ctx->ro_gpio = gpio_to_desc(gpio);
130-
131-
return 0;
132-
}
133-
EXPORT_SYMBOL(mmc_gpio_request_ro);
134-
135104
void mmc_gpiod_request_cd_irq(struct mmc_host *host)
136105
{
137106
struct mmc_gpio *ctx = host->slot.handler_priv;
@@ -200,50 +169,6 @@ void mmc_gpio_set_cd_isr(struct mmc_host *host,
200169
}
201170
EXPORT_SYMBOL(mmc_gpio_set_cd_isr);
202171

203-
/**
204-
* mmc_gpio_request_cd - request a gpio for card-detection
205-
* @host: mmc host
206-
* @gpio: gpio number requested
207-
* @debounce: debounce time in microseconds
208-
*
209-
* As devm_* managed functions are used in mmc_gpio_request_cd(), client
210-
* drivers do not need to worry about freeing up memory.
211-
*
212-
* If GPIO debouncing is desired, set the debounce parameter to a non-zero
213-
* value. The caller is responsible for ensuring that the GPIO driver associated
214-
* with the GPIO supports debouncing, otherwise an error will be returned.
215-
*
216-
* Returns zero on success, else an error.
217-
*/
218-
int mmc_gpio_request_cd(struct mmc_host *host, unsigned int gpio,
219-
unsigned int debounce)
220-
{
221-
struct mmc_gpio *ctx = host->slot.handler_priv;
222-
int ret;
223-
224-
ret = devm_gpio_request_one(host->parent, gpio, GPIOF_DIR_IN,
225-
ctx->cd_label);
226-
if (ret < 0)
227-
/*
228-
* don't bother freeing memory. It might still get used by other
229-
* slot functions, in any case it will be freed, when the device
230-
* is destroyed.
231-
*/
232-
return ret;
233-
234-
if (debounce) {
235-
ret = gpio_set_debounce(gpio, debounce);
236-
if (ret < 0)
237-
return ret;
238-
}
239-
240-
ctx->override_cd_active_level = true;
241-
ctx->cd_gpio = gpio_to_desc(gpio);
242-
243-
return 0;
244-
}
245-
EXPORT_SYMBOL(mmc_gpio_request_cd);
246-
247172
/**
248173
* mmc_gpiod_request_cd - request a gpio descriptor for card-detection
249174
* @host: mmc host
@@ -254,8 +179,7 @@ EXPORT_SYMBOL(mmc_gpio_request_cd);
254179
* @gpio_invert: will return whether the GPIO line is inverted or not, set
255180
* to NULL to ignore
256181
*
257-
* Use this function in place of mmc_gpio_request_cd() to use the GPIO
258-
* descriptor API. Note that it must be called prior to mmc_add_host()
182+
* Note that this must be called prior to mmc_add_host()
259183
* otherwise the caller must also call mmc_gpiod_request_cd_irq().
260184
*
261185
* Returns zero on success, else an error.
@@ -306,9 +230,6 @@ EXPORT_SYMBOL(mmc_can_gpio_cd);
306230
* @gpio_invert: will return whether the GPIO line is inverted or not,
307231
* set to NULL to ignore
308232
*
309-
* Use this function in place of mmc_gpio_request_ro() to use the GPIO
310-
* descriptor API.
311-
*
312233
* Returns zero on success, else an error.
313234
*/
314235
int mmc_gpiod_request_ro(struct mmc_host *host, const char *con_id,

include/linux/mmc/slot-gpio.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,7 @@
1717
struct mmc_host;
1818

1919
int mmc_gpio_get_ro(struct mmc_host *host);
20-
int mmc_gpio_request_ro(struct mmc_host *host, unsigned int gpio);
21-
2220
int mmc_gpio_get_cd(struct mmc_host *host);
23-
int mmc_gpio_request_cd(struct mmc_host *host, unsigned int gpio,
24-
unsigned int debounce);
25-
2621
int mmc_gpiod_request_cd(struct mmc_host *host, const char *con_id,
2722
unsigned int idx, bool override_active_level,
2823
unsigned int debounce, bool *gpio_invert);

0 commit comments

Comments
 (0)