diff mbox series

gpio: mvebu: Use IS_REACHABLE instead of IS_ENABLED for CONFIG_PWM

Message ID 20230120075333.142223-1-u.kleine-koenig@pengutronix.de
State New
Headers show
Series gpio: mvebu: Use IS_REACHABLE instead of IS_ENABLED for CONFIG_PWM | expand

Commit Message

Uwe Kleine-König Jan. 20, 2023, 7:53 a.m. UTC
To check if a certain function (here e.g. pwmchip_add()) can be called
IS_REACHABLE is the better check. The relevant difference to IS_ENABLED
is that IS_REACHABLE evaluates to 0 if the current code is builtin but the
checked symbol is =m and so must not be used.

Today there is no practical impact as CONFIG_PWM is a bool.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/gpio/gpio-mvebu.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Bartosz Golaszewski Jan. 23, 2023, 3:12 p.m. UTC | #1
On Fri, Jan 20, 2023 at 8:53 AM Uwe Kleine-König
<u.kleine-koenig@pengutronix.de> wrote:
>
> To check if a certain function (here e.g. pwmchip_add()) can be called
> IS_REACHABLE is the better check. The relevant difference to IS_ENABLED
> is that IS_REACHABLE evaluates to 0 if the current code is builtin but the
> checked symbol is =m and so must not be used.
>
> Today there is no practical impact as CONFIG_PWM is a bool.
>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> ---
>  drivers/gpio/gpio-mvebu.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpio/gpio-mvebu.c b/drivers/gpio/gpio-mvebu.c
> index 91a4232ee58c..a68f682aec01 100644
> --- a/drivers/gpio/gpio-mvebu.c
> +++ b/drivers/gpio/gpio-mvebu.c
> @@ -1002,7 +1002,7 @@ static int mvebu_gpio_suspend(struct platform_device *pdev, pm_message_t state)
>                 BUG();
>         }
>
> -       if (IS_ENABLED(CONFIG_PWM))
> +       if (IS_REACHABLE(CONFIG_PWM))
>                 mvebu_pwm_suspend(mvchip);
>
>         return 0;
> @@ -1054,7 +1054,7 @@ static int mvebu_gpio_resume(struct platform_device *pdev)
>                 BUG();
>         }
>
> -       if (IS_ENABLED(CONFIG_PWM))
> +       if (IS_REACHABLE(CONFIG_PWM))
>                 mvebu_pwm_resume(mvchip);
>
>         return 0;
> @@ -1228,7 +1228,7 @@ static int mvebu_gpio_probe(struct platform_device *pdev)
>         devm_gpiochip_add_data(&pdev->dev, &mvchip->chip, mvchip);
>
>         /* Some MVEBU SoCs have simple PWM support for GPIO lines */
> -       if (IS_ENABLED(CONFIG_PWM)) {
> +       if (IS_REACHABLE(CONFIG_PWM)) {
>                 err = mvebu_pwm_probe(pdev, mvchip, id);
>                 if (err)
>                         return err;
> --
> 2.39.0
>

Applied, thanks!

Bart
diff mbox series

Patch

diff --git a/drivers/gpio/gpio-mvebu.c b/drivers/gpio/gpio-mvebu.c
index 91a4232ee58c..a68f682aec01 100644
--- a/drivers/gpio/gpio-mvebu.c
+++ b/drivers/gpio/gpio-mvebu.c
@@ -1002,7 +1002,7 @@  static int mvebu_gpio_suspend(struct platform_device *pdev, pm_message_t state)
 		BUG();
 	}
 
-	if (IS_ENABLED(CONFIG_PWM))
+	if (IS_REACHABLE(CONFIG_PWM))
 		mvebu_pwm_suspend(mvchip);
 
 	return 0;
@@ -1054,7 +1054,7 @@  static int mvebu_gpio_resume(struct platform_device *pdev)
 		BUG();
 	}
 
-	if (IS_ENABLED(CONFIG_PWM))
+	if (IS_REACHABLE(CONFIG_PWM))
 		mvebu_pwm_resume(mvchip);
 
 	return 0;
@@ -1228,7 +1228,7 @@  static int mvebu_gpio_probe(struct platform_device *pdev)
 	devm_gpiochip_add_data(&pdev->dev, &mvchip->chip, mvchip);
 
 	/* Some MVEBU SoCs have simple PWM support for GPIO lines */
-	if (IS_ENABLED(CONFIG_PWM)) {
+	if (IS_REACHABLE(CONFIG_PWM)) {
 		err = mvebu_pwm_probe(pdev, mvchip, id);
 		if (err)
 			return err;