[PATCH] drm/i915: use IS_ENABLED() instead of defined() on config options

Dixit, Ashutosh ashutosh.dixit at intel.com
Wed Sep 4 15:57:27 UTC 2024


On Wed, 04 Sep 2024 07:52:18 -0700, Jani Nikula wrote:
>
> Prefer IS_ENABLED() instead of defined() for checking whether a kconfig
> option is enabled.

Reviewed-by: Ashutosh Dixit <ashutosh.dixit at intel.com>

>
> Signed-off-by: Jani Nikula <jani.nikula at intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_display_irq.c | 2 +-
>  drivers/gpu/drm/i915/display/intel_dp_tunnel.h   | 2 +-
>  drivers/gpu/drm/i915/gem/i915_gem_pm.c           | 2 +-
>  drivers/gpu/drm/i915/gt/uc/intel_guc_fw.c        | 2 +-
>  drivers/gpu/drm/i915/gt/uc/intel_guc_log.c       | 2 +-
>  drivers/gpu/drm/i915/gt/uc/intel_huc.c           | 2 +-
>  drivers/gpu/drm/i915/i915_trace.h                | 2 +-
>  drivers/gpu/drm/i915/i915_utils.h                | 2 +-
>  drivers/gpu/drm/i915/selftests/mock_gem_device.c | 4 ++--
>  9 files changed, 10 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_display_irq.c b/drivers/gpu/drm/i915/display/intel_display_irq.c
> index 73369847ed66..9c0b83abbe3c 100644
> --- a/drivers/gpu/drm/i915/display/intel_display_irq.c
> +++ b/drivers/gpu/drm/i915/display/intel_display_irq.c
> @@ -298,7 +298,7 @@ void i915_enable_asle_pipestat(struct drm_i915_private *dev_priv)
>	spin_unlock_irq(&dev_priv->irq_lock);
>  }
>
> -#if defined(CONFIG_DEBUG_FS)
> +#if IS_ENABLED(CONFIG_DEBUG_FS)
>  static void display_pipe_crc_irq_handler(struct drm_i915_private *dev_priv,
>					 enum pipe pipe,
>					 u32 crc0, u32 crc1,
> diff --git a/drivers/gpu/drm/i915/display/intel_dp_tunnel.h b/drivers/gpu/drm/i915/display/intel_dp_tunnel.h
> index a0c00b7d3303..e9314cf25a19 100644
> --- a/drivers/gpu/drm/i915/display/intel_dp_tunnel.h
> +++ b/drivers/gpu/drm/i915/display/intel_dp_tunnel.h
> @@ -20,7 +20,7 @@ struct intel_dp;
>  struct intel_encoder;
>  struct intel_link_bw_limits;
>
> -#if defined(CONFIG_DRM_I915_DP_TUNNEL) && defined(I915)
> +#if IS_ENABLED(CONFIG_DRM_I915_DP_TUNNEL) && defined(I915)
>
>  int intel_dp_tunnel_detect(struct intel_dp *intel_dp, struct drm_modeset_acquire_ctx *ctx);
>  void intel_dp_tunnel_disconnect(struct intel_dp *intel_dp);
> diff --git a/drivers/gpu/drm/i915/gem/i915_gem_pm.c b/drivers/gpu/drm/i915/gem/i915_gem_pm.c
> index 3b27218aabe2..900c08337942 100644
> --- a/drivers/gpu/drm/i915/gem/i915_gem_pm.c
> +++ b/drivers/gpu/drm/i915/gem/i915_gem_pm.c
> @@ -13,7 +13,7 @@
>  #include "i915_driver.h"
>  #include "i915_drv.h"
>
> -#if defined(CONFIG_X86)
> +#if IS_ENABLED(CONFIG_X86)
>  #include <asm/smp.h>
>  #else
>  #define wbinvd_on_all_cpus() \
> diff --git a/drivers/gpu/drm/i915/gt/uc/intel_guc_fw.c b/drivers/gpu/drm/i915/gt/uc/intel_guc_fw.c
> index 23f54c84cbab..fe53e8eccf4b 100644
> --- a/drivers/gpu/drm/i915/gt/uc/intel_guc_fw.c
> +++ b/drivers/gpu/drm/i915/gt/uc/intel_guc_fw.c
> @@ -145,7 +145,7 @@ static inline bool guc_load_done(struct intel_uncore *uncore, u32 *status, bool
>   * an end user should hit the timeout is in case of extreme thermal throttling.
>   * And a system that is that hot during boot is probably dead anyway!
>   */
> -#if defined(CONFIG_DRM_I915_DEBUG_GEM)
> +#if IS_ENABLED(CONFIG_DRM_I915_DEBUG_GEM)
>  #define GUC_LOAD_RETRY_LIMIT	20
>  #else
>  #define GUC_LOAD_RETRY_LIMIT	3
> diff --git a/drivers/gpu/drm/i915/gt/uc/intel_guc_log.c b/drivers/gpu/drm/i915/gt/uc/intel_guc_log.c
> index bf16351c9349..222c95f62156 100644
> --- a/drivers/gpu/drm/i915/gt/uc/intel_guc_log.c
> +++ b/drivers/gpu/drm/i915/gt/uc/intel_guc_log.c
> @@ -14,7 +14,7 @@
>  #include "intel_guc_log.h"
>  #include "intel_guc_print.h"
>
> -#if defined(CONFIG_DRM_I915_DEBUG_GUC)
> +#if IS_ENABLED(CONFIG_DRM_I915_DEBUG_GUC)
>  #define GUC_LOG_DEFAULT_CRASH_BUFFER_SIZE	SZ_2M
>  #define GUC_LOG_DEFAULT_DEBUG_BUFFER_SIZE	SZ_16M
>  #define GUC_LOG_DEFAULT_CAPTURE_BUFFER_SIZE	SZ_1M
> diff --git a/drivers/gpu/drm/i915/gt/uc/intel_huc.c b/drivers/gpu/drm/i915/gt/uc/intel_huc.c
> index 2d9152eb7282..d7ac31c3254c 100644
> --- a/drivers/gpu/drm/i915/gt/uc/intel_huc.c
> +++ b/drivers/gpu/drm/i915/gt/uc/intel_huc.c
> @@ -455,7 +455,7 @@ static const char *auth_mode_string(struct intel_huc *huc,
>   * an end user should hit the timeout is in case of extreme thermal throttling.
>   * And a system that is that hot during boot is probably dead anyway!
>   */
> -#if defined(CONFIG_DRM_I915_DEBUG_GEM)
> +#if IS_ENABLED(CONFIG_DRM_I915_DEBUG_GEM)
>  #define HUC_LOAD_RETRY_LIMIT   20
>  #else
>  #define HUC_LOAD_RETRY_LIMIT   3
> diff --git a/drivers/gpu/drm/i915/i915_trace.h b/drivers/gpu/drm/i915/i915_trace.h
> index ce1cbee1b39d..09d89bdf82f4 100644
> --- a/drivers/gpu/drm/i915/i915_trace.h
> +++ b/drivers/gpu/drm/i915/i915_trace.h
> @@ -322,7 +322,7 @@ DEFINE_EVENT(i915_request, i915_request_add,
>	     TP_ARGS(rq)
>  );
>
> -#if defined(CONFIG_DRM_I915_LOW_LEVEL_TRACEPOINTS)
> +#if IS_ENABLED(CONFIG_DRM_I915_LOW_LEVEL_TRACEPOINTS)
>  DEFINE_EVENT(i915_request, i915_request_guc_submit,
>	     TP_PROTO(struct i915_request *rq),
>	     TP_ARGS(rq)
> diff --git a/drivers/gpu/drm/i915/i915_utils.h b/drivers/gpu/drm/i915/i915_utils.h
> index 71bdc89bd621..609214231ffc 100644
> --- a/drivers/gpu/drm/i915/i915_utils.h
> +++ b/drivers/gpu/drm/i915/i915_utils.h
> @@ -270,7 +270,7 @@ wait_remaining_ms_from_jiffies(unsigned long timestamp_jiffies, int to_wait_ms)
>  #define wait_for(COND, MS)		_wait_for((COND), (MS) * 1000, 10, 1000)
>
>  /* If CONFIG_PREEMPT_COUNT is disabled, in_atomic() always reports false. */
> -#if defined(CONFIG_DRM_I915_DEBUG) && defined(CONFIG_PREEMPT_COUNT)
> +#if IS_ENABLED(CONFIG_DRM_I915_DEBUG) && IS_ENABLED(CONFIG_PREEMPT_COUNT)
>  # define _WAIT_FOR_ATOMIC_CHECK(ATOMIC) WARN_ON_ONCE((ATOMIC) && !in_atomic())
>  #else
>  # define _WAIT_FOR_ATOMIC_CHECK(ATOMIC) do { } while (0)
> diff --git a/drivers/gpu/drm/i915/selftests/mock_gem_device.c b/drivers/gpu/drm/i915/selftests/mock_gem_device.c
> index 91794ca17a58..70f3d7bf47d0 100644
> --- a/drivers/gpu/drm/i915/selftests/mock_gem_device.c
> +++ b/drivers/gpu/drm/i915/selftests/mock_gem_device.c
> @@ -137,7 +137,7 @@ static const struct intel_device_info mock_info = {
>
>  struct drm_i915_private *mock_gem_device(void)
>  {
> -#if IS_ENABLED(CONFIG_IOMMU_API) && defined(CONFIG_INTEL_IOMMU)
> +#if IS_ENABLED(CONFIG_IOMMU_API) && IS_ENABLED(CONFIG_INTEL_IOMMU)
>	static struct dev_iommu fake_iommu = { .priv = (void *)-1 };
>  #endif
>	struct drm_i915_private *i915;
> @@ -153,7 +153,7 @@ struct drm_i915_private *mock_gem_device(void)
>	dev_set_name(&pdev->dev, "mock");
>	dma_coerce_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
>
> -#if IS_ENABLED(CONFIG_IOMMU_API) && defined(CONFIG_INTEL_IOMMU)
> +#if IS_ENABLED(CONFIG_IOMMU_API) && IS_ENABLED(CONFIG_INTEL_IOMMU)
>	/* HACK to disable iommu for the fake device; force identity mapping */
>	pdev->dev.iommu = &fake_iommu;
>  #endif
> --
> 2.39.2
>


More information about the Intel-gfx mailing list