disp: msm: avoid using #ifdef for configurations

Use #if IS_ENABLED() instead of #ifdef for configurations as vendor module
guidelines.

Use #if IS_ENABLED(CONFIG_XXX) instead of #ifdef CONFIG_XXX to ensure that
the code inside the #if block continues to compile if the config changes
to a tristate config in the future.

The differences are as follows:
	1.#if IS_ENABLED(CONFIG_XXX) evaluates to true when CONFIG_XXX is set to
		module (=m) or built-in (=y).
	2.#ifdef CONFIG_XXX evaluates to true when CONFIG_XXX is set to
		built-in(=y) , but doesn't when CONFIG_XXX is set to module(=m).
		Use this only when you're certain you want to do the same thing
		when the config is set to module or is disabled.

Change-Id: Ia806b9b01ad8414d0e4de027a382cb68e7fb4a6a
Signed-off-by: GG Hou <quic_renjhou@quicinc.com>
这个提交包含在:
GG Hou
2021-12-07 16:10:51 +08:00
父节点 f42f39e4f8
当前提交 e29493c71d
修改 29 个文件,包含 97 行新增82 行删除

查看文件

@@ -1,5 +1,6 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/*
* Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved.
* Copyright (c) 2015-2021, The Linux Foundation. All rights reserved.
*/
@@ -310,14 +311,14 @@ int sde_rotator_base_init(struct sde_rot_data_type **pmdata,
void sde_rotator_base_destroy(struct sde_rot_data_type *data);
#ifdef CONFIG_MSM_SDE_ROTATOR
#if IS_ENABLED(CONFIG_MSM_SDE_ROTATOR)
struct sde_rot_data_type *sde_rot_get_mdata(void);
#else
static inline struct sde_rot_data_type *sde_rot_get_mdata(void)
{
return NULL;
}
#endif
#endif /* CONFIG_MSM_SDE_ROTATOR */
struct reg_bus_client *sde_reg_bus_vote_client_create(char *client_name);

查看文件

@@ -1,5 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved.
* Copyright (c) 2015-2020, The Linux Foundation. All rights reserved.
*/
@@ -3320,7 +3321,7 @@ int sde_rotator_runtime_idle(struct device *dev)
#endif
#ifdef CONFIG_PM_SLEEP
#if IS_ENABLED(CONFIG_PM_SLEEP)
/*
* sde_rotator_pm_suspend - put the device in pm suspend state by cancelling
* all active requests
@@ -3382,7 +3383,7 @@ int sde_rotator_pm_resume(struct device *dev)
sde_rot_mgr_unlock(mgr);
return 0;
}
#endif
#endif /* CONFIG_PM_SLEEP */
#if defined(CONFIG_PM) && !defined(CONFIG_PM_SLEEP)
int sde_rotator_suspend(struct platform_device *dev, pm_message_t state)

查看文件

@@ -1,5 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved.
* Copyright (c) 2015-2021, The Linux Foundation. All rights reserved.
*/
#define pr_fmt(fmt) "%s: " fmt, __func__
@@ -16,11 +17,11 @@
#include "sde_rotator_dev.h"
#include "sde_rotator_trace.h"
#ifdef CONFIG_MSM_SDE_ROTATOR_EVTLOG_DEBUG
#if IS_ENABLED(CONFIG_MSM_SDE_ROTATOR_EVTLOG_DEBUG)
#define SDE_EVTLOG_DEFAULT_ENABLE 1
#else
#define SDE_EVTLOG_DEFAULT_ENABLE 0
#endif
#endif /* CONFIG_MSM_SDE_ROTATOR_EVTLOG_DEBUG */
#define SDE_EVTLOG_DEFAULT_PANIC 1
#define SDE_EVTLOG_DEFAULT_REGDUMP SDE_ROT_DBG_DUMP_IN_MEM
#define SDE_EVTLOG_DEFAULT_VBIF_DBGBUSDUMP SDE_ROT_DBG_DUMP_IN_MEM

查看文件

@@ -1,5 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved.
* Copyright (c) 2015-2020, The Linux Foundation. All rights reserved.
*/
#define pr_fmt(fmt) "%s:%d: " fmt, __func__, __LINE__
@@ -56,10 +57,10 @@
#ifndef CONFIG_MSM_SDE_ROTATOR_INIT_ONLY
static void sde_rotator_submit_handler(struct kthread_work *work);
static void sde_rotator_retire_handler(struct kthread_work *work);
#ifdef CONFIG_COMPAT
#if IS_ENABLED(CONFIG_COMPAT)
static long sde_rotator_compat_ioctl32(struct file *file,
unsigned int cmd, unsigned long arg);
#endif
#endif /* CONFIG_COMPAT */
/*
* sde_rotator_ctx_from_fh - Get rotator context from v4l2 fh.
@@ -1909,9 +1910,9 @@ static const struct v4l2_file_operations sde_rotator_fops = {
.release = sde_rotator_release,
.poll = sde_rotator_poll,
.unlocked_ioctl = video_ioctl2,
#ifdef CONFIG_COMPAT
#if IS_ENABLED(CONFIG_COMPAT)
.compat_ioctl32 = sde_rotator_compat_ioctl32,
#endif
#endif /* CONFIG_COMPAT */
};
/*
@@ -2740,7 +2741,7 @@ static long sde_rotator_private_ioctl(struct file *file, void *fh,
return 0;
}
#ifdef CONFIG_COMPAT
#if IS_ENABLED(CONFIG_COMPAT)
/*
* sde_rotator_compat_ioctl32 - Compat ioctl handler function.
* @file: Pointer to file struct.
@@ -2809,7 +2810,7 @@ ioctl32_error:
SDEDEV_ERR(ctx->rot_dev->dev, "error handling ioctl32 cmd:%x\n", cmd);
return -EFAULT;
}
#endif
#endif /* CONFIG_COMPAT */
static int sde_rotator_ctrl_subscribe_event(struct v4l2_fh *fh,
const struct v4l2_event_subscription *sub)

查看文件

@@ -1,5 +1,6 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/*
* Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved.
* Copyright (c) 2015-2021, The Linux Foundation. All rights reserved.
*/
@@ -25,14 +26,14 @@ static inline int sde_smmu_dma_data_direction(int dir)
return dir;
}
#ifdef CONFIG_MSM_SDE_ROTATOR
#if IS_ENABLED(CONFIG_MSM_SDE_ROTATOR)
int sde_smmu_ctrl(int enable);
#else
static inline int sde_smmu_ctrl(int enable)
{
return 0;
}
#endif
#endif /* CONFIG_MSM_SDE_ROTATOR */
struct dma_buf_attachment *sde_smmu_dma_buf_attach(
struct dma_buf *dma_buf, struct device *dev, int domain);