[PATCH 1/2] staging: iio: adt7316: remove unused macros

Michael Harris posted 2 patches 1 week, 1 day ago
[PATCH 1/2] staging: iio: adt7316: remove unused macros
Posted by Michael Harris 1 week, 1 day ago
Delete macros that aren't in use

Signed-off-by: Michael Harris <michaelharriscode@gmail.com>
---
 drivers/staging/iio/addac/adt7316.c | 11 -----------
 1 file changed, 11 deletions(-)

diff --git a/drivers/staging/iio/addac/adt7316.c b/drivers/staging/iio/addac/adt7316.c
index 8a9a8262c2bec34f3c3e79d8174f492b9a23fb70..4173c8822fff495e8c69d9cf6c11be9e9227a8c1 100644
--- a/drivers/staging/iio/addac/adt7316.c
+++ b/drivers/staging/iio/addac/adt7316.c
@@ -111,7 +111,6 @@
 #define ADT7316_AD_SINGLE_CH_MODE	0x10
 #define ADT7316_DISABLE_AVERAGING	0x20
 #define ADT7316_EN_SMBUS_TIMEOUT	0x40
-#define ADT7316_RESET			0x80
 
 /*
  * ADT7316 config3
@@ -154,7 +153,6 @@
 /*
  * ADT7316 value masks
  */
-#define ADT7316_VALUE_MASK		0xfff
 #define ADT7316_T_VALUE_SIGN		0x400
 #define ADT7316_T_VALUE_FLOAT_OFFSET	2
 #define ADT7316_T_VALUE_FLOAT_MASK	0x2
@@ -194,15 +192,6 @@ struct adt7316_chip_info {
  * Logic interrupt mask for user application to enable
  * interrupts.
  */
-#define ADT7316_IN_TEMP_HIGH_INT_MASK	0x1
-#define ADT7316_IN_TEMP_LOW_INT_MASK	0x2
-#define ADT7316_EX_TEMP_HIGH_INT_MASK	0x4
-#define ADT7316_EX_TEMP_LOW_INT_MASK	0x8
-#define ADT7316_EX_TEMP_FAULT_INT_MASK	0x10
-#define ADT7516_AIN1_INT_MASK		0x4
-#define ADT7516_AIN2_INT_MASK		0x20
-#define ADT7516_AIN3_INT_MASK		0x40
-#define ADT7516_AIN4_INT_MASK		0x80
 #define ADT7316_VDD_INT_MASK		0x100
 #define ADT7316_TEMP_INT_MASK		0x1F
 #define ADT7516_AIN_INT_MASK		0xE0

-- 
2.52.0
Re: [PATCH 1/2] staging: iio: adt7316: remove unused macros
Posted by Jonathan Cameron 1 week, 1 day ago
On Fri, 30 Jan 2026 23:38:27 -0800
Michael Harris <michaelharriscode@gmail.com> wrote:

> Delete macros that aren't in use
Hi Michael,

Why?  

I'm not against driver authors only introducing register defines they
are using, but I'm also not against them deciding on comprehensive defines
or at least making sure they cover all the fields in a given register.

Having only parts of a register defined sometimes makes people miss
that they can't just write the whole thing because there may be other
bits they do not indent to change. As such it can be useful to have them there.

Thanks,

Jonathan


> 
> Signed-off-by: Michael Harris <michaelharriscode@gmail.com>
> ---
>  drivers/staging/iio/addac/adt7316.c | 11 -----------
>  1 file changed, 11 deletions(-)
> 
> diff --git a/drivers/staging/iio/addac/adt7316.c b/drivers/staging/iio/addac/adt7316.c
> index 8a9a8262c2bec34f3c3e79d8174f492b9a23fb70..4173c8822fff495e8c69d9cf6c11be9e9227a8c1 100644
> --- a/drivers/staging/iio/addac/adt7316.c
> +++ b/drivers/staging/iio/addac/adt7316.c
> @@ -111,7 +111,6 @@
>  #define ADT7316_AD_SINGLE_CH_MODE	0x10
>  #define ADT7316_DISABLE_AVERAGING	0x20
>  #define ADT7316_EN_SMBUS_TIMEOUT	0x40
> -#define ADT7316_RESET			0x80
>  
>  /*
>   * ADT7316 config3
> @@ -154,7 +153,6 @@
>  /*
>   * ADT7316 value masks
>   */
> -#define ADT7316_VALUE_MASK		0xfff
>  #define ADT7316_T_VALUE_SIGN		0x400
>  #define ADT7316_T_VALUE_FLOAT_OFFSET	2
>  #define ADT7316_T_VALUE_FLOAT_MASK	0x2
> @@ -194,15 +192,6 @@ struct adt7316_chip_info {
>   * Logic interrupt mask for user application to enable
>   * interrupts.
>   */
> -#define ADT7316_IN_TEMP_HIGH_INT_MASK	0x1
> -#define ADT7316_IN_TEMP_LOW_INT_MASK	0x2
> -#define ADT7316_EX_TEMP_HIGH_INT_MASK	0x4
> -#define ADT7316_EX_TEMP_LOW_INT_MASK	0x8
> -#define ADT7316_EX_TEMP_FAULT_INT_MASK	0x10
> -#define ADT7516_AIN1_INT_MASK		0x4
> -#define ADT7516_AIN2_INT_MASK		0x20
> -#define ADT7516_AIN3_INT_MASK		0x40
> -#define ADT7516_AIN4_INT_MASK		0x80
>  #define ADT7316_VDD_INT_MASK		0x100
>  #define ADT7316_TEMP_INT_MASK		0x1F
>  #define ADT7516_AIN_INT_MASK		0xE0
>
Re: [PATCH 1/2] staging: iio: adt7316: remove unused macros
Posted by Michael Harris 1 week, 1 day ago
(Resent to include the mailing list, apologies for the duplicate)

On 1/31/26 7:54 AM, Jonathan Cameron wrote:
>> Delete macros that aren't in use
> Why?
>
> I'm not against driver authors only introducing register defines they
> are using, but I'm also not against them deciding on comprehensive defines
> or at least making sure they cover all the fields in a given register.
>
> Having only parts of a register defined sometimes makes people miss
> that they can't just write the whole thing because there may be other
> bits they do not indent to change. As such it can be useful to have them there.

Hi Jonathan,

I was under the impression that it was good practice to remove unused
code (including macros) for the purpose of reducing clutter. Hearing
your thoughts, I see why it would be better to leave them, despite
being unused.

Please disregard this patch.

Thanks for your feedback,
Michael

On Sat, Jan 31, 2026 at 7:54 AM Jonathan Cameron <jic23@kernel.org> wrote:
>
> On Fri, 30 Jan 2026 23:38:27 -0800
> Michael Harris <michaelharriscode@gmail.com> wrote:
>
> > Delete macros that aren't in use
> Hi Michael,
>
> Why?
>
> I'm not against driver authors only introducing register defines they
> are using, but I'm also not against them deciding on comprehensive defines
> or at least making sure they cover all the fields in a given register.
>
> Having only parts of a register defined sometimes makes people miss
> that they can't just write the whole thing because there may be other
> bits they do not indent to change. As such it can be useful to have them there.
>
> Thanks,
>
> Jonathan
>
>
> >
> > Signed-off-by: Michael Harris <michaelharriscode@gmail.com>
> > ---
> >  drivers/staging/iio/addac/adt7316.c | 11 -----------
> >  1 file changed, 11 deletions(-)
> >
> > diff --git a/drivers/staging/iio/addac/adt7316.c b/drivers/staging/iio/addac/adt7316.c
> > index 8a9a8262c2bec34f3c3e79d8174f492b9a23fb70..4173c8822fff495e8c69d9cf6c11be9e9227a8c1 100644
> > --- a/drivers/staging/iio/addac/adt7316.c
> > +++ b/drivers/staging/iio/addac/adt7316.c
> > @@ -111,7 +111,6 @@
> >  #define ADT7316_AD_SINGLE_CH_MODE    0x10
> >  #define ADT7316_DISABLE_AVERAGING    0x20
> >  #define ADT7316_EN_SMBUS_TIMEOUT     0x40
> > -#define ADT7316_RESET                        0x80
> >
> >  /*
> >   * ADT7316 config3
> > @@ -154,7 +153,6 @@
> >  /*
> >   * ADT7316 value masks
> >   */
> > -#define ADT7316_VALUE_MASK           0xfff
> >  #define ADT7316_T_VALUE_SIGN         0x400
> >  #define ADT7316_T_VALUE_FLOAT_OFFSET 2
> >  #define ADT7316_T_VALUE_FLOAT_MASK   0x2
> > @@ -194,15 +192,6 @@ struct adt7316_chip_info {
> >   * Logic interrupt mask for user application to enable
> >   * interrupts.
> >   */
> > -#define ADT7316_IN_TEMP_HIGH_INT_MASK        0x1
> > -#define ADT7316_IN_TEMP_LOW_INT_MASK 0x2
> > -#define ADT7316_EX_TEMP_HIGH_INT_MASK        0x4
> > -#define ADT7316_EX_TEMP_LOW_INT_MASK 0x8
> > -#define ADT7316_EX_TEMP_FAULT_INT_MASK       0x10
> > -#define ADT7516_AIN1_INT_MASK                0x4
> > -#define ADT7516_AIN2_INT_MASK                0x20
> > -#define ADT7516_AIN3_INT_MASK                0x40
> > -#define ADT7516_AIN4_INT_MASK                0x80
> >  #define ADT7316_VDD_INT_MASK         0x100
> >  #define ADT7316_TEMP_INT_MASK                0x1F
> >  #define ADT7516_AIN_INT_MASK         0xE0
> >
>