Message ID | 20220331223424.1054715-20-bvanassche@acm.org |
---|---|
State | Superseded |
Headers | show |
Series | UFS patches for kernel v5.19 | expand |
> In the Linux kernel coding style document > (Documentation/process/coding-style.rst) it is recommended to use the type > 'bool' and also the values 'true' and 'false'. Hence this patch that > removes the definitions and uses of TRUE and FALSE from the UFS driver. The third parameter of ufshcd_dme_set is "int" type. I think the coding-style doc recommends to use "bool" as comparison purpose not int type conversion. However, regarding C99 and C11, they might be converted to 0 and 1 respectively. Reviewed-by: Chanho Park <chanho61.park@samsung.com> The usage of 'TRUE' and 'FALSE' seems to be written as following the description of below JEDEC doc. > A Flag is a single Boolean value that represents a TRUE or FALSE, '0' or '1', ON or OFF type of value. Best Regards, Chanho Park > > Signed-off-by: Bart Van Assche <bvanassche@acm.org> > --- > drivers/scsi/ufs/ufs-exynos.c | 4 ++-- drivers/scsi/ufs/ufs-exynos.h | > 8 ++++---- > drivers/scsi/ufs/ufshcd.c | 8 ++++---- > drivers/scsi/ufs/unipro.h | 14 -------------- > 4 files changed, 10 insertions(+), 24 deletions(-) > > diff --git a/drivers/scsi/ufs/ufs-exynos.c b/drivers/scsi/ufs/ufs-exynos.c > index 474a4a064a68..0b99c74955ef 100644 > --- a/drivers/scsi/ufs/ufs-exynos.c > +++ b/drivers/scsi/ufs/ufs-exynos.c > @@ -704,7 +704,7 @@ static void exynos_ufs_establish_connt(struct > exynos_ufs *ufs) > > /* local unipro attributes */ > ufshcd_dme_set(hba, UIC_ARG_MIB(N_DEVICEID), DEV_ID); > - ufshcd_dme_set(hba, UIC_ARG_MIB(N_DEVICEID_VALID), TRUE); > + ufshcd_dme_set(hba, UIC_ARG_MIB(N_DEVICEID_VALID), true); > ufshcd_dme_set(hba, UIC_ARG_MIB(T_PEERDEVICEID), PEER_DEV_ID); > ufshcd_dme_set(hba, UIC_ARG_MIB(T_PEERCPORTID), PEER_CPORT_ID); > ufshcd_dme_set(hba, UIC_ARG_MIB(T_CPORTFLAGS), CPORT_DEF_FLAGS); @@ > -1028,7 +1028,7 @@ static int exynos_ufs_post_link(struct ufs_hba *hba) > > if (ufs->opts & EXYNOS_UFS_OPT_SKIP_CONNECTION_ESTAB) > ufshcd_dme_set(hba, > - UIC_ARG_MIB(T_DBG_SKIP_INIT_HIBERN8_EXIT), TRUE); > + UIC_ARG_MIB(T_DBG_SKIP_INIT_HIBERN8_EXIT), true); > > if (attr->pa_granularity) { > exynos_ufs_enable_dbg_mode(hba); > diff --git a/drivers/scsi/ufs/ufs-exynos.h b/drivers/scsi/ufs/ufs-exynos.h > index 1c33e5466082..0b0a3d530ca6 100644 > --- a/drivers/scsi/ufs/ufs-exynos.h > +++ b/drivers/scsi/ufs/ufs-exynos.h > @@ -248,22 +248,22 @@ long exynos_ufs_calc_time_cntr(struct exynos_ufs *, > long); > > static inline void exynos_ufs_enable_ov_tm(struct ufs_hba *hba) { > - ufshcd_dme_set(hba, UIC_ARG_MIB(PA_DBG_OV_TM), TRUE); > + ufshcd_dme_set(hba, UIC_ARG_MIB(PA_DBG_OV_TM), true); > } > > static inline void exynos_ufs_disable_ov_tm(struct ufs_hba *hba) { > - ufshcd_dme_set(hba, UIC_ARG_MIB(PA_DBG_OV_TM), FALSE); > + ufshcd_dme_set(hba, UIC_ARG_MIB(PA_DBG_OV_TM), false); > } > > static inline void exynos_ufs_enable_dbg_mode(struct ufs_hba *hba) { > - ufshcd_dme_set(hba, UIC_ARG_MIB(PA_DBG_MODE), TRUE); > + ufshcd_dme_set(hba, UIC_ARG_MIB(PA_DBG_MODE), true); > } > > static inline void exynos_ufs_disable_dbg_mode(struct ufs_hba *hba) { > - ufshcd_dme_set(hba, UIC_ARG_MIB(PA_DBG_MODE), FALSE); > + ufshcd_dme_set(hba, UIC_ARG_MIB(PA_DBG_MODE), false); > } > > #endif /* _UFS_EXYNOS_H_ */ > diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index > c36658d97774..c81b5f3f0b9a 100644 > --- a/drivers/scsi/ufs/ufshcd.c > +++ b/drivers/scsi/ufs/ufshcd.c > @@ -4325,18 +4325,18 @@ static int ufshcd_change_power_mode(struct ufs_hba > *hba, > pwr_mode->lane_rx); > if (pwr_mode->pwr_rx == FASTAUTO_MODE || > pwr_mode->pwr_rx == FAST_MODE) > - ufshcd_dme_set(hba, UIC_ARG_MIB(PA_RXTERMINATION), TRUE); > + ufshcd_dme_set(hba, UIC_ARG_MIB(PA_RXTERMINATION), true); > else > - ufshcd_dme_set(hba, UIC_ARG_MIB(PA_RXTERMINATION), FALSE); > + ufshcd_dme_set(hba, UIC_ARG_MIB(PA_RXTERMINATION), false); > > ufshcd_dme_set(hba, UIC_ARG_MIB(PA_TXGEAR), pwr_mode->gear_tx); > ufshcd_dme_set(hba, UIC_ARG_MIB(PA_ACTIVETXDATALANES), > pwr_mode->lane_tx); > if (pwr_mode->pwr_tx == FASTAUTO_MODE || > pwr_mode->pwr_tx == FAST_MODE) > - ufshcd_dme_set(hba, UIC_ARG_MIB(PA_TXTERMINATION), TRUE); > + ufshcd_dme_set(hba, UIC_ARG_MIB(PA_TXTERMINATION), true); > else > - ufshcd_dme_set(hba, UIC_ARG_MIB(PA_TXTERMINATION), FALSE); > + ufshcd_dme_set(hba, UIC_ARG_MIB(PA_TXTERMINATION), false); > > if (pwr_mode->pwr_rx == FASTAUTO_MODE || > pwr_mode->pwr_tx == FASTAUTO_MODE || diff --git > a/drivers/scsi/ufs/unipro.h b/drivers/scsi/ufs/unipro.h index > bdd0fa6a3c74..91152d8386e6 100644 > --- a/drivers/scsi/ufs/unipro.h > +++ b/drivers/scsi/ufs/unipro.h > @@ -298,20 +298,6 @@ enum ufs_unipro_ver { > #define T_TC0TXMAXSDUSIZE 0x4060 > #define T_TC1TXMAXSDUSIZE 0x4061 > > -#ifdef FALSE > -#undef FALSE > -#endif > - > -#ifdef TRUE > -#undef TRUE > -#endif > - > -/* Boolean attribute values */ > -enum { > - FALSE = 0, > - TRUE, > -}; > - > /* CPort setting */ > #define E2EFC_ON (1 << 0) > #define E2EFC_OFF (0 << 0)
diff --git a/drivers/scsi/ufs/ufs-exynos.c b/drivers/scsi/ufs/ufs-exynos.c index 474a4a064a68..0b99c74955ef 100644 --- a/drivers/scsi/ufs/ufs-exynos.c +++ b/drivers/scsi/ufs/ufs-exynos.c @@ -704,7 +704,7 @@ static void exynos_ufs_establish_connt(struct exynos_ufs *ufs) /* local unipro attributes */ ufshcd_dme_set(hba, UIC_ARG_MIB(N_DEVICEID), DEV_ID); - ufshcd_dme_set(hba, UIC_ARG_MIB(N_DEVICEID_VALID), TRUE); + ufshcd_dme_set(hba, UIC_ARG_MIB(N_DEVICEID_VALID), true); ufshcd_dme_set(hba, UIC_ARG_MIB(T_PEERDEVICEID), PEER_DEV_ID); ufshcd_dme_set(hba, UIC_ARG_MIB(T_PEERCPORTID), PEER_CPORT_ID); ufshcd_dme_set(hba, UIC_ARG_MIB(T_CPORTFLAGS), CPORT_DEF_FLAGS); @@ -1028,7 +1028,7 @@ static int exynos_ufs_post_link(struct ufs_hba *hba) if (ufs->opts & EXYNOS_UFS_OPT_SKIP_CONNECTION_ESTAB) ufshcd_dme_set(hba, - UIC_ARG_MIB(T_DBG_SKIP_INIT_HIBERN8_EXIT), TRUE); + UIC_ARG_MIB(T_DBG_SKIP_INIT_HIBERN8_EXIT), true); if (attr->pa_granularity) { exynos_ufs_enable_dbg_mode(hba); diff --git a/drivers/scsi/ufs/ufs-exynos.h b/drivers/scsi/ufs/ufs-exynos.h index 1c33e5466082..0b0a3d530ca6 100644 --- a/drivers/scsi/ufs/ufs-exynos.h +++ b/drivers/scsi/ufs/ufs-exynos.h @@ -248,22 +248,22 @@ long exynos_ufs_calc_time_cntr(struct exynos_ufs *, long); static inline void exynos_ufs_enable_ov_tm(struct ufs_hba *hba) { - ufshcd_dme_set(hba, UIC_ARG_MIB(PA_DBG_OV_TM), TRUE); + ufshcd_dme_set(hba, UIC_ARG_MIB(PA_DBG_OV_TM), true); } static inline void exynos_ufs_disable_ov_tm(struct ufs_hba *hba) { - ufshcd_dme_set(hba, UIC_ARG_MIB(PA_DBG_OV_TM), FALSE); + ufshcd_dme_set(hba, UIC_ARG_MIB(PA_DBG_OV_TM), false); } static inline void exynos_ufs_enable_dbg_mode(struct ufs_hba *hba) { - ufshcd_dme_set(hba, UIC_ARG_MIB(PA_DBG_MODE), TRUE); + ufshcd_dme_set(hba, UIC_ARG_MIB(PA_DBG_MODE), true); } static inline void exynos_ufs_disable_dbg_mode(struct ufs_hba *hba) { - ufshcd_dme_set(hba, UIC_ARG_MIB(PA_DBG_MODE), FALSE); + ufshcd_dme_set(hba, UIC_ARG_MIB(PA_DBG_MODE), false); } #endif /* _UFS_EXYNOS_H_ */ diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index c36658d97774..c81b5f3f0b9a 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -4325,18 +4325,18 @@ static int ufshcd_change_power_mode(struct ufs_hba *hba, pwr_mode->lane_rx); if (pwr_mode->pwr_rx == FASTAUTO_MODE || pwr_mode->pwr_rx == FAST_MODE) - ufshcd_dme_set(hba, UIC_ARG_MIB(PA_RXTERMINATION), TRUE); + ufshcd_dme_set(hba, UIC_ARG_MIB(PA_RXTERMINATION), true); else - ufshcd_dme_set(hba, UIC_ARG_MIB(PA_RXTERMINATION), FALSE); + ufshcd_dme_set(hba, UIC_ARG_MIB(PA_RXTERMINATION), false); ufshcd_dme_set(hba, UIC_ARG_MIB(PA_TXGEAR), pwr_mode->gear_tx); ufshcd_dme_set(hba, UIC_ARG_MIB(PA_ACTIVETXDATALANES), pwr_mode->lane_tx); if (pwr_mode->pwr_tx == FASTAUTO_MODE || pwr_mode->pwr_tx == FAST_MODE) - ufshcd_dme_set(hba, UIC_ARG_MIB(PA_TXTERMINATION), TRUE); + ufshcd_dme_set(hba, UIC_ARG_MIB(PA_TXTERMINATION), true); else - ufshcd_dme_set(hba, UIC_ARG_MIB(PA_TXTERMINATION), FALSE); + ufshcd_dme_set(hba, UIC_ARG_MIB(PA_TXTERMINATION), false); if (pwr_mode->pwr_rx == FASTAUTO_MODE || pwr_mode->pwr_tx == FASTAUTO_MODE || diff --git a/drivers/scsi/ufs/unipro.h b/drivers/scsi/ufs/unipro.h index bdd0fa6a3c74..91152d8386e6 100644 --- a/drivers/scsi/ufs/unipro.h +++ b/drivers/scsi/ufs/unipro.h @@ -298,20 +298,6 @@ enum ufs_unipro_ver { #define T_TC0TXMAXSDUSIZE 0x4060 #define T_TC1TXMAXSDUSIZE 0x4061 -#ifdef FALSE -#undef FALSE -#endif - -#ifdef TRUE -#undef TRUE -#endif - -/* Boolean attribute values */ -enum { - FALSE = 0, - TRUE, -}; - /* CPort setting */ #define E2EFC_ON (1 << 0) #define E2EFC_OFF (0 << 0)
In the Linux kernel coding style document (Documentation/process/coding-style.rst) it is recommended to use the type 'bool' and also the values 'true' and 'false'. Hence this patch that removes the definitions and uses of TRUE and FALSE from the UFS driver. Signed-off-by: Bart Van Assche <bvanassche@acm.org> --- drivers/scsi/ufs/ufs-exynos.c | 4 ++-- drivers/scsi/ufs/ufs-exynos.h | 8 ++++---- drivers/scsi/ufs/ufshcd.c | 8 ++++---- drivers/scsi/ufs/unipro.h | 14 -------------- 4 files changed, 10 insertions(+), 24 deletions(-)