Re: [PATCH 18/30] iio: gyro: fxas21002c: Move 'fxas21002c_reg_fields' to the only file its used

2020-07-22 Thread Rui Miguel Silva
Hi Lee,
Sorry for the late reply, been out of office and catching up with
mails now.
On Fri, Jul 17, 2020 at 05:55:26PM +0100, Lee Jones wrote:
> 'fxas21002c_reg_fields' is only used in '*core*', meaning that '*i2c*'
> and '*spi*' complain of a defined but not used const variable.  Let's
> move it into the source file.
> 
> Fixes the following W=1 kernel build warning(s):
> 
>  In file included from drivers/iio/gyro/fxas21002c_i2c.c:14:
>  drivers/iio/gyro/fxas21002c.h:79:31: warning: ‘fxas21002c_reg_fields’ 
> defined but not used [-Wunused-const-variable=]
>  79 | static const struct reg_field fxas21002c_reg_fields[] = {
>  | ^
>  In file included from drivers/iio/gyro/fxas21002c_spi.c:14:
>  drivers/iio/gyro/fxas21002c.h:79:31: warning: ‘fxas21002c_reg_fields’ 
> defined but not used [-Wunused-const-variable=]
>  79 | static const struct reg_field fxas21002c_reg_fields[] = {
>  | ^
> 
> Cc: Rui Miguel Silva 
>

Thanks for this, not going in time for the official tagging, since
gregkh already picked this up for staging, but fwiw:

Acked-by: Rui Miguel Silva 

--
Cheers,
 Rui

> Signed-off-by: Lee Jones 
> ---
>  drivers/iio/gyro/fxas21002c.h  | 66 --
>  drivers/iio/gyro/fxas21002c_core.c | 66 ++
>  2 files changed, 66 insertions(+), 66 deletions(-)
> 
> diff --git a/drivers/iio/gyro/fxas21002c.h b/drivers/iio/gyro/fxas21002c.h
> index 566d92de26763..c81cecee121cb 100644
> --- a/drivers/iio/gyro/fxas21002c.h
> +++ b/drivers/iio/gyro/fxas21002c.h
> @@ -76,72 +76,6 @@ enum fxas21002c_fields {
>   F_MAX_FIELDS,
>  };
>  
> -static const struct reg_field fxas21002c_reg_fields[] = {
> - [F_DR_STATUS]   = REG_FIELD(FXAS21002C_REG_STATUS, 0, 7),
> - [F_OUT_X_MSB]   = REG_FIELD(FXAS21002C_REG_OUT_X_MSB, 0, 7),
> - [F_OUT_X_LSB]   = REG_FIELD(FXAS21002C_REG_OUT_X_LSB, 0, 7),
> - [F_OUT_Y_MSB]   = REG_FIELD(FXAS21002C_REG_OUT_Y_MSB, 0, 7),
> - [F_OUT_Y_LSB]   = REG_FIELD(FXAS21002C_REG_OUT_Y_LSB, 0, 7),
> - [F_OUT_Z_MSB]   = REG_FIELD(FXAS21002C_REG_OUT_Z_MSB, 0, 7),
> - [F_OUT_Z_LSB]   = REG_FIELD(FXAS21002C_REG_OUT_Z_LSB, 0, 7),
> - [F_ZYX_OW]  = REG_FIELD(FXAS21002C_REG_DR_STATUS, 7, 7),
> - [F_Z_OW]= REG_FIELD(FXAS21002C_REG_DR_STATUS, 6, 6),
> - [F_Y_OW]= REG_FIELD(FXAS21002C_REG_DR_STATUS, 5, 5),
> - [F_X_OW]= REG_FIELD(FXAS21002C_REG_DR_STATUS, 4, 4),
> - [F_ZYX_DR]  = REG_FIELD(FXAS21002C_REG_DR_STATUS, 3, 3),
> - [F_Z_DR]= REG_FIELD(FXAS21002C_REG_DR_STATUS, 2, 2),
> - [F_Y_DR]= REG_FIELD(FXAS21002C_REG_DR_STATUS, 1, 1),
> - [F_X_DR]= REG_FIELD(FXAS21002C_REG_DR_STATUS, 0, 0),
> - [F_OVF] = REG_FIELD(FXAS21002C_REG_F_STATUS, 7, 7),
> - [F_WMKF]= REG_FIELD(FXAS21002C_REG_F_STATUS, 6, 6),
> - [F_CNT] = REG_FIELD(FXAS21002C_REG_F_STATUS, 0, 5),
> - [F_MODE]= REG_FIELD(FXAS21002C_REG_F_SETUP, 6, 7),
> - [F_WMRK]= REG_FIELD(FXAS21002C_REG_F_SETUP, 0, 5),
> - [F_EVENT]   = REG_FIELD(FXAS21002C_REG_F_EVENT, 5, 5),
> - [FE_TIME]   = REG_FIELD(FXAS21002C_REG_F_EVENT, 0, 4),
> - [F_BOOTEND] = REG_FIELD(FXAS21002C_REG_INT_SRC_FLAG, 3, 3),
> - [F_SRC_FIFO]= REG_FIELD(FXAS21002C_REG_INT_SRC_FLAG, 2, 2),
> - [F_SRC_RT]  = REG_FIELD(FXAS21002C_REG_INT_SRC_FLAG, 1, 1),
> - [F_SRC_DRDY]= REG_FIELD(FXAS21002C_REG_INT_SRC_FLAG, 0, 0),
> - [F_WHO_AM_I]= REG_FIELD(FXAS21002C_REG_WHO_AM_I, 0, 7),
> - [F_BW]  = REG_FIELD(FXAS21002C_REG_CTRL0, 6, 7),
> - [F_SPIW]= REG_FIELD(FXAS21002C_REG_CTRL0, 5, 5),
> - [F_SEL] = REG_FIELD(FXAS21002C_REG_CTRL0, 3, 4),
> - [F_HPF_EN]  = REG_FIELD(FXAS21002C_REG_CTRL0, 2, 2),
> - [F_FS]  = REG_FIELD(FXAS21002C_REG_CTRL0, 0, 1),
> - [F_ELE] = REG_FIELD(FXAS21002C_REG_RT_CFG, 3, 3),
> - [F_ZTEFE]   = REG_FIELD(FXAS21002C_REG_RT_CFG, 2, 2),
> - [F_YTEFE]   = REG_FIELD(FXAS21002C_REG_RT_CFG, 1, 1),
> - [F_XTEFE]   = REG_FIELD(FXAS21002C_REG_RT_CFG, 0, 0),
> - [F_EA]  = REG_FIELD(FXAS21002C_REG_RT_SRC, 6, 6),
> - [F_ZRT] = REG_FIELD(FXAS21002C_REG_RT_SRC, 5, 5),
> - [F_ZRT_POL] = REG_FIELD(FXAS21002C_REG_RT_SRC, 4, 4),
> - [F_YRT] = REG_FIELD(FXAS21002C_REG_RT_SRC, 3, 3),
> - [F_YRT_POL] = REG_FIELD(FXAS21002C_REG_RT_SRC, 2, 2),
> - [F_XRT] = REG_FIELD(FXAS21002C_REG_RT_SRC, 1, 1),
> - [F_XRT_POL] = REG_FIELD(FXAS21002C_REG_RT_SRC, 0, 0),
> - [F_DBCNTM]

Re: [PATCH 18/30] iio: gyro: fxas21002c: Move 'fxas21002c_reg_fields' to the only file its used

2020-07-18 Thread Jonathan Cameron
On Fri, 17 Jul 2020 17:55:26 +0100
Lee Jones  wrote:

> 'fxas21002c_reg_fields' is only used in '*core*', meaning that '*i2c*'
> and '*spi*' complain of a defined but not used const variable.  Let's
> move it into the source file.
> 
> Fixes the following W=1 kernel build warning(s):
> 
>  In file included from drivers/iio/gyro/fxas21002c_i2c.c:14:
>  drivers/iio/gyro/fxas21002c.h:79:31: warning: ‘fxas21002c_reg_fields’ 
> defined but not used [-Wunused-const-variable=]
>  79 | static const struct reg_field fxas21002c_reg_fields[] = {
>  | ^
>  In file included from drivers/iio/gyro/fxas21002c_spi.c:14:
>  drivers/iio/gyro/fxas21002c.h:79:31: warning: ‘fxas21002c_reg_fields’ 
> defined but not used [-Wunused-const-variable=]
>  79 | static const struct reg_field fxas21002c_reg_fields[] = {
>  | ^
> 
> Cc: Rui Miguel Silva 
> Signed-off-by: Lee Jones 
Sensible solution.

Applied

Thanks,

Jonathan

> ---
>  drivers/iio/gyro/fxas21002c.h  | 66 --
>  drivers/iio/gyro/fxas21002c_core.c | 66 ++
>  2 files changed, 66 insertions(+), 66 deletions(-)
> 
> diff --git a/drivers/iio/gyro/fxas21002c.h b/drivers/iio/gyro/fxas21002c.h
> index 566d92de26763..c81cecee121cb 100644
> --- a/drivers/iio/gyro/fxas21002c.h
> +++ b/drivers/iio/gyro/fxas21002c.h
> @@ -76,72 +76,6 @@ enum fxas21002c_fields {
>   F_MAX_FIELDS,
>  };
>  
> -static const struct reg_field fxas21002c_reg_fields[] = {
> - [F_DR_STATUS]   = REG_FIELD(FXAS21002C_REG_STATUS, 0, 7),
> - [F_OUT_X_MSB]   = REG_FIELD(FXAS21002C_REG_OUT_X_MSB, 0, 7),
> - [F_OUT_X_LSB]   = REG_FIELD(FXAS21002C_REG_OUT_X_LSB, 0, 7),
> - [F_OUT_Y_MSB]   = REG_FIELD(FXAS21002C_REG_OUT_Y_MSB, 0, 7),
> - [F_OUT_Y_LSB]   = REG_FIELD(FXAS21002C_REG_OUT_Y_LSB, 0, 7),
> - [F_OUT_Z_MSB]   = REG_FIELD(FXAS21002C_REG_OUT_Z_MSB, 0, 7),
> - [F_OUT_Z_LSB]   = REG_FIELD(FXAS21002C_REG_OUT_Z_LSB, 0, 7),
> - [F_ZYX_OW]  = REG_FIELD(FXAS21002C_REG_DR_STATUS, 7, 7),
> - [F_Z_OW]= REG_FIELD(FXAS21002C_REG_DR_STATUS, 6, 6),
> - [F_Y_OW]= REG_FIELD(FXAS21002C_REG_DR_STATUS, 5, 5),
> - [F_X_OW]= REG_FIELD(FXAS21002C_REG_DR_STATUS, 4, 4),
> - [F_ZYX_DR]  = REG_FIELD(FXAS21002C_REG_DR_STATUS, 3, 3),
> - [F_Z_DR]= REG_FIELD(FXAS21002C_REG_DR_STATUS, 2, 2),
> - [F_Y_DR]= REG_FIELD(FXAS21002C_REG_DR_STATUS, 1, 1),
> - [F_X_DR]= REG_FIELD(FXAS21002C_REG_DR_STATUS, 0, 0),
> - [F_OVF] = REG_FIELD(FXAS21002C_REG_F_STATUS, 7, 7),
> - [F_WMKF]= REG_FIELD(FXAS21002C_REG_F_STATUS, 6, 6),
> - [F_CNT] = REG_FIELD(FXAS21002C_REG_F_STATUS, 0, 5),
> - [F_MODE]= REG_FIELD(FXAS21002C_REG_F_SETUP, 6, 7),
> - [F_WMRK]= REG_FIELD(FXAS21002C_REG_F_SETUP, 0, 5),
> - [F_EVENT]   = REG_FIELD(FXAS21002C_REG_F_EVENT, 5, 5),
> - [FE_TIME]   = REG_FIELD(FXAS21002C_REG_F_EVENT, 0, 4),
> - [F_BOOTEND] = REG_FIELD(FXAS21002C_REG_INT_SRC_FLAG, 3, 3),
> - [F_SRC_FIFO]= REG_FIELD(FXAS21002C_REG_INT_SRC_FLAG, 2, 2),
> - [F_SRC_RT]  = REG_FIELD(FXAS21002C_REG_INT_SRC_FLAG, 1, 1),
> - [F_SRC_DRDY]= REG_FIELD(FXAS21002C_REG_INT_SRC_FLAG, 0, 0),
> - [F_WHO_AM_I]= REG_FIELD(FXAS21002C_REG_WHO_AM_I, 0, 7),
> - [F_BW]  = REG_FIELD(FXAS21002C_REG_CTRL0, 6, 7),
> - [F_SPIW]= REG_FIELD(FXAS21002C_REG_CTRL0, 5, 5),
> - [F_SEL] = REG_FIELD(FXAS21002C_REG_CTRL0, 3, 4),
> - [F_HPF_EN]  = REG_FIELD(FXAS21002C_REG_CTRL0, 2, 2),
> - [F_FS]  = REG_FIELD(FXAS21002C_REG_CTRL0, 0, 1),
> - [F_ELE] = REG_FIELD(FXAS21002C_REG_RT_CFG, 3, 3),
> - [F_ZTEFE]   = REG_FIELD(FXAS21002C_REG_RT_CFG, 2, 2),
> - [F_YTEFE]   = REG_FIELD(FXAS21002C_REG_RT_CFG, 1, 1),
> - [F_XTEFE]   = REG_FIELD(FXAS21002C_REG_RT_CFG, 0, 0),
> - [F_EA]  = REG_FIELD(FXAS21002C_REG_RT_SRC, 6, 6),
> - [F_ZRT] = REG_FIELD(FXAS21002C_REG_RT_SRC, 5, 5),
> - [F_ZRT_POL] = REG_FIELD(FXAS21002C_REG_RT_SRC, 4, 4),
> - [F_YRT] = REG_FIELD(FXAS21002C_REG_RT_SRC, 3, 3),
> - [F_YRT_POL] = REG_FIELD(FXAS21002C_REG_RT_SRC, 2, 2),
> - [F_XRT] = REG_FIELD(FXAS21002C_REG_RT_SRC, 1, 1),
> - [F_XRT_POL] = REG_FIELD(FXAS21002C_REG_RT_SRC, 0, 0),
> - [F_DBCNTM]  = REG_FIELD(FXAS21002C_REG_RT_THS, 7, 7),
> - [F_THS] = REG_FIELD(FXAS21002C_REG_RT_SRC, 0, 6),
> - [F_RT_COUNT]= REG_FIELD(FXAS21002C_REG_RT_COUNT, 0, 7),
> - [F_TEMP]