Commit eddbc3ab authored by Ulf Hansson's avatar Ulf Hansson

mmc: slot-gpio: Remove option to explicitly free requested CD/WP GPIOs

The slot-gpio uses the devm*_ managed functions. Still it provide APIs
to explicitly free requested CD/WP GPIOs, but these API isn't being
used.

Therefore let's simplify slot-gpio by removing these unused APIs. If it
later turns out we need some of them, we can always consider to restore
the code.
Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
parent c2f28eec
...@@ -103,11 +103,7 @@ EXPORT_SYMBOL(mmc_gpio_get_cd); ...@@ -103,11 +103,7 @@ EXPORT_SYMBOL(mmc_gpio_get_cd);
* @gpio: gpio number requested * @gpio: gpio number requested
* *
* As devm_* managed functions are used in mmc_gpio_request_ro(), client * As devm_* managed functions are used in mmc_gpio_request_ro(), client
* drivers do not need to explicitly call mmc_gpio_free_ro() for freeing up, * drivers do not need to worry about freeing up memory.
* if the requesting and freeing are only needed at probing and unbinding time
* for once. However, if client drivers do something special like runtime
* switching for write-protection, they are responsible for calling
* mmc_gpio_request_ro() and mmc_gpio_free_ro() as a pair on their own.
* *
* Returns zero on success, else an error. * Returns zero on success, else an error.
*/ */
...@@ -178,11 +174,7 @@ EXPORT_SYMBOL(mmc_gpiod_request_cd_irq); ...@@ -178,11 +174,7 @@ EXPORT_SYMBOL(mmc_gpiod_request_cd_irq);
* @debounce: debounce time in microseconds * @debounce: debounce time in microseconds
* *
* As devm_* managed functions are used in mmc_gpio_request_cd(), client * As devm_* managed functions are used in mmc_gpio_request_cd(), client
* drivers do not need to explicitly call mmc_gpio_free_cd() for freeing up, * drivers do not need to worry about freeing up memory.
* if the requesting and freeing are only needed at probing and unbinding time
* for once. However, if client drivers do something special like runtime
* switching for card-detection, they are responsible for calling
* mmc_gpio_request_cd() and mmc_gpio_free_cd() as a pair on their own.
* *
* If GPIO debouncing is desired, set the debounce parameter to a non-zero * 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 * value. The caller is responsible for ensuring that the GPIO driver associated
...@@ -225,55 +217,6 @@ int mmc_gpio_request_cd(struct mmc_host *host, unsigned int gpio, ...@@ -225,55 +217,6 @@ int mmc_gpio_request_cd(struct mmc_host *host, unsigned int gpio,
} }
EXPORT_SYMBOL(mmc_gpio_request_cd); EXPORT_SYMBOL(mmc_gpio_request_cd);
/**
* mmc_gpio_free_ro - free the write-protection gpio
* @host: mmc host
*
* It's provided only for cases that client drivers need to manually free
* up the write-protection gpio requested by mmc_gpio_request_ro().
*/
void mmc_gpio_free_ro(struct mmc_host *host)
{
struct mmc_gpio *ctx = host->slot.handler_priv;
int gpio;
if (!ctx || !ctx->ro_gpio)
return;
gpio = desc_to_gpio(ctx->ro_gpio);
ctx->ro_gpio = NULL;
devm_gpio_free(&host->class_dev, gpio);
}
EXPORT_SYMBOL(mmc_gpio_free_ro);
/**
* mmc_gpio_free_cd - free the card-detection gpio
* @host: mmc host
*
* It's provided only for cases that client drivers need to manually free
* up the card-detection gpio requested by mmc_gpio_request_cd().
*/
void mmc_gpio_free_cd(struct mmc_host *host)
{
struct mmc_gpio *ctx = host->slot.handler_priv;
int gpio;
if (!ctx || !ctx->cd_gpio)
return;
if (host->slot.cd_irq >= 0) {
devm_free_irq(&host->class_dev, host->slot.cd_irq, host);
host->slot.cd_irq = -EINVAL;
}
gpio = desc_to_gpio(ctx->cd_gpio);
ctx->cd_gpio = NULL;
devm_gpio_free(&host->class_dev, gpio);
}
EXPORT_SYMBOL(mmc_gpio_free_cd);
/** /**
* mmc_gpiod_request_cd - request a gpio descriptor for card-detection * mmc_gpiod_request_cd - request a gpio descriptor for card-detection
* @host: mmc host * @host: mmc host
...@@ -285,8 +228,7 @@ EXPORT_SYMBOL(mmc_gpio_free_cd); ...@@ -285,8 +228,7 @@ EXPORT_SYMBOL(mmc_gpio_free_cd);
* to NULL to ignore * to NULL to ignore
* *
* Use this function in place of mmc_gpio_request_cd() to use the GPIO * Use this function in place of mmc_gpio_request_cd() to use the GPIO
* descriptor API. Note that it is paired with mmc_gpiod_free_cd() not * descriptor API. Note that it must be called prior to mmc_add_host()
* mmc_gpio_free_cd(). Note also that it must be called prior to mmc_add_host()
* otherwise the caller must also call mmc_gpiod_request_cd_irq(). * otherwise the caller must also call mmc_gpiod_request_cd_irq().
* *
* Returns zero on success, else an error. * Returns zero on success, else an error.
...@@ -339,8 +281,7 @@ EXPORT_SYMBOL(mmc_gpiod_request_cd); ...@@ -339,8 +281,7 @@ EXPORT_SYMBOL(mmc_gpiod_request_cd);
* set to NULL to ignore * set to NULL to ignore
* *
* Use this function in place of mmc_gpio_request_ro() to use the GPIO * Use this function in place of mmc_gpio_request_ro() to use the GPIO
* descriptor API. Note that it is paired with mmc_gpiod_free_ro() not * descriptor API.
* mmc_gpio_free_ro().
* *
* Returns zero on success, else an error. * Returns zero on success, else an error.
*/ */
...@@ -380,28 +321,3 @@ int mmc_gpiod_request_ro(struct mmc_host *host, const char *con_id, ...@@ -380,28 +321,3 @@ int mmc_gpiod_request_ro(struct mmc_host *host, const char *con_id,
return 0; return 0;
} }
EXPORT_SYMBOL(mmc_gpiod_request_ro); EXPORT_SYMBOL(mmc_gpiod_request_ro);
/**
* mmc_gpiod_free_cd - free the card-detection gpio descriptor
* @host: mmc host
*
* It's provided only for cases that client drivers need to manually free
* up the card-detection gpio requested by mmc_gpiod_request_cd().
*/
void mmc_gpiod_free_cd(struct mmc_host *host)
{
struct mmc_gpio *ctx = host->slot.handler_priv;
if (!ctx || !ctx->cd_gpio)
return;
if (host->slot.cd_irq >= 0) {
devm_free_irq(&host->class_dev, host->slot.cd_irq, host);
host->slot.cd_irq = -EINVAL;
}
devm_gpiod_put(host->parent, ctx->cd_gpio);
ctx->cd_gpio = NULL;
}
EXPORT_SYMBOL(mmc_gpiod_free_cd);
...@@ -15,12 +15,10 @@ struct mmc_host; ...@@ -15,12 +15,10 @@ struct mmc_host;
int mmc_gpio_get_ro(struct mmc_host *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_request_ro(struct mmc_host *host, unsigned int gpio);
void mmc_gpio_free_ro(struct mmc_host *host);
int mmc_gpio_get_cd(struct mmc_host *host); int mmc_gpio_get_cd(struct mmc_host *host);
int mmc_gpio_request_cd(struct mmc_host *host, unsigned int gpio, int mmc_gpio_request_cd(struct mmc_host *host, unsigned int gpio,
unsigned int debounce); unsigned int debounce);
void mmc_gpio_free_cd(struct mmc_host *host);
int mmc_gpiod_request_cd(struct mmc_host *host, const char *con_id, int mmc_gpiod_request_cd(struct mmc_host *host, const char *con_id,
unsigned int idx, bool override_active_level, unsigned int idx, bool override_active_level,
...@@ -28,7 +26,6 @@ int mmc_gpiod_request_cd(struct mmc_host *host, const char *con_id, ...@@ -28,7 +26,6 @@ int mmc_gpiod_request_cd(struct mmc_host *host, const char *con_id,
int mmc_gpiod_request_ro(struct mmc_host *host, const char *con_id, int mmc_gpiod_request_ro(struct mmc_host *host, const char *con_id,
unsigned int idx, bool override_active_level, unsigned int idx, bool override_active_level,
unsigned int debounce, bool *gpio_invert); unsigned int debounce, bool *gpio_invert);
void mmc_gpiod_free_cd(struct mmc_host *host);
void mmc_gpiod_request_cd_irq(struct mmc_host *host); void mmc_gpiod_request_cd_irq(struct mmc_host *host);
#endif #endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment