drm/bridge: ti-sn65dsi86: Check for CONFIG_PWM using IS_REACHABLE()
authorUwe Kleine-König <u.kleine-koenig@baylibre.com>
Mon, 17 Feb 2025 17:49:36 +0000 (18:49 +0100)
committerDouglas Anderson <dianders@chromium.org>
Tue, 25 Feb 2025 00:23:50 +0000 (16:23 -0800)
Currently CONFIG_PWM is a bool but I intend to change it to tristate. If
CONFIG_PWM=m in the configuration, the cpp symbol CONFIG_PWM isn't
defined and so the PWM code paths in the ti-sn65dsi86 driver are not
used.

The correct way to check for CONFIG_PWM is using IS_REACHABLE which does
the right thing for all cases
CONFIG_DRM_TI_SN65DSI86 ∈ { y, m } x CONFIG_PWM ∈ { y, m, n }.

There is no change until CONFIG_PWM actually becomes tristate.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
Reviewed-by: Louis Chauvet <louis.chauvet@bootlin.com>
Reviewed-by: Robert Foss <rfoss@kernel.org>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
Signed-off-by: Douglas Anderson <dianders@chromium.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20250217174936.758420-2-u.kleine-koenig@baylibre.com
drivers/gpu/drm/bridge/ti-sn65dsi86.c

index ae34585e05b307934d9fbf0dfd7ad159a99d4c17..01d456b955abbb2cca65c222bf7a24d6f1697d02 100644 (file)
@@ -195,7 +195,7 @@ struct ti_sn65dsi86 {
        struct gpio_chip                gchip;
        DECLARE_BITMAP(gchip_output, SN_NUM_GPIOS);
 #endif
-#if defined(CONFIG_PWM)
+#if IS_REACHABLE(CONFIG_PWM)
        struct pwm_chip                 *pchip;
        bool                            pwm_enabled;
        atomic_t                        pwm_pin_busy;
@@ -1362,7 +1362,7 @@ static struct auxiliary_driver ti_sn_bridge_driver = {
 /* -----------------------------------------------------------------------------
  * PWM Controller
  */
-#if defined(CONFIG_PWM)
+#if IS_REACHABLE(CONFIG_PWM)
 static int ti_sn_pwm_pin_request(struct ti_sn65dsi86 *pdata)
 {
        return atomic_xchg(&pdata->pwm_pin_busy, 1) ? -EBUSY : 0;
@@ -1956,7 +1956,7 @@ static int ti_sn65dsi86_probe(struct i2c_client *client)
                        return ret;
        }
 
-       if (IS_ENABLED(CONFIG_PWM)) {
+       if (IS_REACHABLE(CONFIG_PWM)) {
                ret = ti_sn65dsi86_add_aux_device(pdata, &pdata->pwm_aux, "pwm");
                if (ret)
                        return ret;