* [PATCH] gpio: tps65219: don't use CONFIG_DEBUG_GPIO
@ 2023-12-21 18:57 Bartosz Golaszewski
2023-12-21 19:06 ` Andy Shevchenko
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Bartosz Golaszewski @ 2023-12-21 18:57 UTC (permalink / raw)
To: Tony Lindgren, Linus Walleij, Andy Shevchenko
Cc: linux-omap, linux-gpio, linux-kernel, Bartosz Golaszewski
From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
CONFIG_DEBUG_GPIO should only be used to enable debug log messages and
for core GPIOLIB debugging. Don't use it to control the execution of
potentially buggy code. Just put it under an always-false #if.
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
---
drivers/gpio/gpio-tps65219.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/drivers/gpio/gpio-tps65219.c b/drivers/gpio/gpio-tps65219.c
index 7b38aa360112..cd1f17041f8c 100644
--- a/drivers/gpio/gpio-tps65219.c
+++ b/drivers/gpio/gpio-tps65219.c
@@ -96,16 +96,16 @@ static int tps65219_gpio_change_direction(struct gpio_chip *gc, unsigned int off
* Below can be used for test purpose only.
*/
- if (IS_ENABLED(CONFIG_DEBUG_GPIO)) {
- int ret = regmap_update_bits(gpio->tps->regmap, TPS65219_REG_MFP_1_CONFIG,
- TPS65219_GPIO0_DIR_MASK, direction);
- if (ret) {
- dev_err(dev,
- "GPIO DEBUG enabled: Fail to change direction to %u for GPIO%d.\n",
- direction, offset);
- return ret;
- }
+#if 0
+ int ret = regmap_update_bits(gpio->tps->regmap, TPS65219_REG_MFP_1_CONFIG,
+ TPS65219_GPIO0_DIR_MASK, direction);
+ if (ret) {
+ dev_err(dev,
+ "GPIO DEBUG enabled: Fail to change direction to %u for GPIO%d.\n",
+ direction, offset);
+ return ret;
}
+#endif
dev_err(dev,
"GPIO%d direction set by NVM, change to %u failed, not allowed by specification\n",
--
2.40.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] gpio: tps65219: don't use CONFIG_DEBUG_GPIO
2023-12-21 18:57 [PATCH] gpio: tps65219: don't use CONFIG_DEBUG_GPIO Bartosz Golaszewski
@ 2023-12-21 19:06 ` Andy Shevchenko
2023-12-22 17:51 ` Linus Walleij
2023-12-27 14:57 ` Bartosz Golaszewski
2 siblings, 0 replies; 4+ messages in thread
From: Andy Shevchenko @ 2023-12-21 19:06 UTC (permalink / raw)
To: Bartosz Golaszewski
Cc: Tony Lindgren, Linus Walleij, Andy Shevchenko, linux-omap,
linux-gpio, linux-kernel, Bartosz Golaszewski
On Thu, Dec 21, 2023 at 8:57 PM Bartosz Golaszewski <brgl@bgdev.pl> wrote:
>
> From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
>
> CONFIG_DEBUG_GPIO should only be used to enable debug log messages and
> for core GPIOLIB debugging. Don't use it to control the execution of
> potentially buggy code. Just put it under an always-false #if.
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] gpio: tps65219: don't use CONFIG_DEBUG_GPIO
2023-12-21 18:57 [PATCH] gpio: tps65219: don't use CONFIG_DEBUG_GPIO Bartosz Golaszewski
2023-12-21 19:06 ` Andy Shevchenko
@ 2023-12-22 17:51 ` Linus Walleij
2023-12-27 14:57 ` Bartosz Golaszewski
2 siblings, 0 replies; 4+ messages in thread
From: Linus Walleij @ 2023-12-22 17:51 UTC (permalink / raw)
To: Bartosz Golaszewski
Cc: Tony Lindgren, Andy Shevchenko, linux-omap, linux-gpio,
linux-kernel, Bartosz Golaszewski
On Thu, Dec 21, 2023 at 7:57 PM Bartosz Golaszewski <brgl@bgdev.pl> wrote:
> From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
>
> CONFIG_DEBUG_GPIO should only be used to enable debug log messages and
> for core GPIOLIB debugging. Don't use it to control the execution of
> potentially buggy code. Just put it under an always-false #if.
>
> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Maybe I would have simply deleted the code, but OK. I bet some static
analyzers will promptly return complaints about "no #if 0 in the kernel" :/
In this case it's an OK compromise.
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] gpio: tps65219: don't use CONFIG_DEBUG_GPIO
2023-12-21 18:57 [PATCH] gpio: tps65219: don't use CONFIG_DEBUG_GPIO Bartosz Golaszewski
2023-12-21 19:06 ` Andy Shevchenko
2023-12-22 17:51 ` Linus Walleij
@ 2023-12-27 14:57 ` Bartosz Golaszewski
2 siblings, 0 replies; 4+ messages in thread
From: Bartosz Golaszewski @ 2023-12-27 14:57 UTC (permalink / raw)
To: Tony Lindgren, Linus Walleij, Andy Shevchenko
Cc: linux-omap, linux-gpio, linux-kernel, Bartosz Golaszewski
On Thu, Dec 21, 2023 at 7:57 PM Bartosz Golaszewski <brgl@bgdev.pl> wrote:
>
> From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
>
> CONFIG_DEBUG_GPIO should only be used to enable debug log messages and
> for core GPIOLIB debugging. Don't use it to control the execution of
> potentially buggy code. Just put it under an always-false #if.
>
> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
> ---
> drivers/gpio/gpio-tps65219.c | 18 +++++++++---------
> 1 file changed, 9 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/gpio/gpio-tps65219.c b/drivers/gpio/gpio-tps65219.c
> index 7b38aa360112..cd1f17041f8c 100644
> --- a/drivers/gpio/gpio-tps65219.c
> +++ b/drivers/gpio/gpio-tps65219.c
> @@ -96,16 +96,16 @@ static int tps65219_gpio_change_direction(struct gpio_chip *gc, unsigned int off
> * Below can be used for test purpose only.
> */
>
> - if (IS_ENABLED(CONFIG_DEBUG_GPIO)) {
> - int ret = regmap_update_bits(gpio->tps->regmap, TPS65219_REG_MFP_1_CONFIG,
> - TPS65219_GPIO0_DIR_MASK, direction);
> - if (ret) {
> - dev_err(dev,
> - "GPIO DEBUG enabled: Fail to change direction to %u for GPIO%d.\n",
> - direction, offset);
> - return ret;
> - }
> +#if 0
> + int ret = regmap_update_bits(gpio->tps->regmap, TPS65219_REG_MFP_1_CONFIG,
> + TPS65219_GPIO0_DIR_MASK, direction);
> + if (ret) {
> + dev_err(dev,
> + "GPIO DEBUG enabled: Fail to change direction to %u for GPIO%d.\n",
> + direction, offset);
> + return ret;
> }
> +#endif
>
> dev_err(dev,
> "GPIO%d direction set by NVM, change to %u failed, not allowed by specification\n",
> --
> 2.40.1
>
Patch applied.
Bart
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-12-27 14:57 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-21 18:57 [PATCH] gpio: tps65219: don't use CONFIG_DEBUG_GPIO Bartosz Golaszewski
2023-12-21 19:06 ` Andy Shevchenko
2023-12-22 17:51 ` Linus Walleij
2023-12-27 14:57 ` Bartosz Golaszewski
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox