From: Fabio Estevam <festevam@gmail.com>
To: linus.walleij@linaro.org
Cc: sergei.shtylyov@cogentembedded.com, andrew@lunn.ch,
dmitry.torokhov@gmail.com, linux-gpio@vger.kernel.org,
Fabio Estevam <fabio.estevam@nxp.com>
Subject: [RFC] gpio: consumer: Remove WARN_ON(1) when GPIOLIB is disabled
Date: Wed, 19 Jul 2017 19:34:25 -0300 [thread overview]
Message-ID: <1500503665-21278-1-git-send-email-festevam@gmail.com> (raw)
From: Fabio Estevam <fabio.estevam@nxp.com>
gpiod_get_optional() returns NULL when GPIOLIB is disabled since
commit 22c403676dbbb7c6 ("gpio: return NULL from gpiod_get_optional when
GPIOLIB is disabled").
However, many gpiod functions still have WARN_ON(1) in their
GPIOLIB=n stubs, which causes warnings in drivers even if the
GPIO descriptior is requested via gpiod_get_optional().
Remove the WARN_ON(1) so that drivers can silently work fine
without kernel warnings when GPIOLIB is disabled.
Reported-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
---
include/linux/gpio/consumer.h | 59 -------------------------------------------
1 file changed, 59 deletions(-)
diff --git a/include/linux/gpio/consumer.h b/include/linux/gpio/consumer.h
index 8f702fc..40c1be5 100644
--- a/include/linux/gpio/consumer.h
+++ b/include/linux/gpio/consumer.h
@@ -197,17 +197,11 @@ gpiod_get_array_optional(struct device *dev, const char *con_id,
static inline void gpiod_put(struct gpio_desc *desc)
{
might_sleep();
-
- /* GPIO can never have been requested */
- WARN_ON(1);
}
static inline void gpiod_put_array(struct gpio_descs *descs)
{
might_sleep();
-
- /* GPIO can never have been requested */
- WARN_ON(1);
}
static inline struct gpio_desc *__must_check
@@ -254,150 +248,99 @@ devm_gpiod_get_array_optional(struct device *dev, const char *con_id,
{
return NULL;
}
-
static inline void devm_gpiod_put(struct device *dev, struct gpio_desc *desc)
{
might_sleep();
-
- /* GPIO can never have been requested */
- WARN_ON(1);
}
-
static inline void devm_gpiod_put_array(struct device *dev,
struct gpio_descs *descs)
{
might_sleep();
-
- /* GPIO can never have been requested */
- WARN_ON(1);
}
-
-
static inline int gpiod_get_direction(const struct gpio_desc *desc)
{
- /* GPIO can never have been requested */
- WARN_ON(1);
return -ENOSYS;
}
static inline int gpiod_direction_input(struct gpio_desc *desc)
{
- /* GPIO can never have been requested */
- WARN_ON(1);
return -ENOSYS;
}
static inline int gpiod_direction_output(struct gpio_desc *desc, int value)
{
- /* GPIO can never have been requested */
- WARN_ON(1);
return -ENOSYS;
}
static inline int gpiod_direction_output_raw(struct gpio_desc *desc, int value)
{
- /* GPIO can never have been requested */
- WARN_ON(1);
return -ENOSYS;
}
-
static inline int gpiod_get_value(const struct gpio_desc *desc)
{
- /* GPIO can never have been requested */
- WARN_ON(1);
return 0;
}
static inline void gpiod_set_value(struct gpio_desc *desc, int value)
{
- /* GPIO can never have been requested */
- WARN_ON(1);
}
static inline void gpiod_set_array_value(unsigned int array_size,
struct gpio_desc **desc_array,
int *value_array)
{
- /* GPIO can never have been requested */
- WARN_ON(1);
}
static inline int gpiod_get_raw_value(const struct gpio_desc *desc)
{
- /* GPIO can never have been requested */
- WARN_ON(1);
return 0;
}
static inline void gpiod_set_raw_value(struct gpio_desc *desc, int value)
{
- /* GPIO can never have been requested */
- WARN_ON(1);
}
static inline void gpiod_set_raw_array_value(unsigned int array_size,
struct gpio_desc **desc_array,
int *value_array)
{
- /* GPIO can never have been requested */
- WARN_ON(1);
}
static inline int gpiod_get_value_cansleep(const struct gpio_desc *desc)
{
- /* GPIO can never have been requested */
- WARN_ON(1);
return 0;
}
static inline void gpiod_set_value_cansleep(struct gpio_desc *desc, int value)
{
- /* GPIO can never have been requested */
- WARN_ON(1);
}
static inline void gpiod_set_array_value_cansleep(unsigned int array_size,
struct gpio_desc **desc_array,
int *value_array)
{
- /* GPIO can never have been requested */
- WARN_ON(1);
}
static inline int gpiod_get_raw_value_cansleep(const struct gpio_desc *desc)
{
- /* GPIO can never have been requested */
- WARN_ON(1);
return 0;
}
static inline void gpiod_set_raw_value_cansleep(struct gpio_desc *desc,
int value)
{
- /* GPIO can never have been requested */
- WARN_ON(1);
}
static inline void gpiod_set_raw_array_value_cansleep(unsigned int array_size,
struct gpio_desc **desc_array,
int *value_array)
{
- /* GPIO can never have been requested */
- WARN_ON(1);
}
static inline int gpiod_set_debounce(struct gpio_desc *desc, unsigned debounce)
{
- /* GPIO can never have been requested */
- WARN_ON(1);
return -ENOSYS;
}
static inline int gpiod_is_active_low(const struct gpio_desc *desc)
{
- /* GPIO can never have been requested */
- WARN_ON(1);
return 0;
}
static inline int gpiod_cansleep(const struct gpio_desc *desc)
{
- /* GPIO can never have been requested */
- WARN_ON(1);
return 0;
}
static inline int gpiod_to_irq(const struct gpio_desc *desc)
{
- /* GPIO can never have been requested */
- WARN_ON(1);
return -EINVAL;
}
@@ -408,8 +351,6 @@ static inline struct gpio_desc *gpio_to_desc(unsigned gpio)
static inline int desc_to_gpio(const struct gpio_desc *desc)
{
- /* GPIO can never have been requested */
- WARN_ON(1);
return -EINVAL;
}
--
2.7.4
next reply other threads:[~2017-07-19 22:34 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-19 22:34 Fabio Estevam [this message]
2017-07-19 23:08 ` [RFC] gpio: consumer: Remove WARN_ON(1) when GPIOLIB is disabled Dmitry Torokhov
2017-07-27 19:38 ` Fabio Estevam
2017-08-03 13:22 ` Linus Walleij
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1500503665-21278-1-git-send-email-festevam@gmail.com \
--to=festevam@gmail.com \
--cc=andrew@lunn.ch \
--cc=dmitry.torokhov@gmail.com \
--cc=fabio.estevam@nxp.com \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=sergei.shtylyov@cogentembedded.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).