Skip to contentSkip to conversation

iio: remove unused struct fields across drivers

PATCH Applied Antoniu Miclaus 4 participants 19 messages Feb 2 – Mar 3

Subsystems (8)
lore
Share & tools
lore

Antoniu Miclaus

author maintainer
#0 lore raw

v2 cover iio: remove unused struct fields across drivers

This series removes unused struct fields found across various IIO drivers. These fields were either left over from previous refactoring, or were added during development but never actually used.

Removing them reduces memory footprint slightly and improves code clarity by eliminating dead struct members that could confuse future readers.

Each patch is independent and can be merged separately as they touch different drivers with no dependencies between them.

Changes since v1:
- Reformatted as proper series with cover letter and numbering

Antoniu Miclaus (13):
iio: adc: ad4080: remove unused dec_rate field
iio: adc: ad7768-1: remove unused mclk_div field
iio: adc: ad7793: remove unused int_vref_mv field
iio: adc: ad9467: remove unused output_mode field
iio: adc: max1363: remove unused requestedmask field
iio: adc: nau7802: remove unused min_conversions field
iio: adc: ti-ads1015: remove unused enabled field
iio: dac: adi-axi-dac: remove unused int_tone field
iio: dac: ti-dac5571: remove unused id field
iio: humidity: hdc2010: remove unused interrupt_config
iio: imu: bmi323: remove unused drdy_trigger_enabled
iio: light: apds9306: remove unused nlux_per_count
iio: light: gp2ap020a00f: remove unused debug_reg_addr

 drivers/iio/adc/ad4080.c             | 1 -
 drivers/iio/adc/ad7768-1.c           | 1 -
 drivers/iio/adc/ad7793.c             | 1 -
 drivers/iio/adc/ad9467.c             | 1 -
 drivers/iio/adc/max1363.c            | 2 --
 drivers/iio/adc/nau7802.c            | 1 -
 drivers/iio/adc/ti-ads1015.c         | 1 -
 drivers/iio/dac/adi-axi-dac.c        | 1 -
 drivers/iio/dac/ti-dac5571.c         | 1 -
 drivers/iio/humidity/hdc2010.c       | 1 -
 drivers/iio/imu/bmi323/bmi323_core.c | 1 -
 drivers/iio/light/apds9306.c         | 2 --
 drivers/iio/light/gp2ap020a00f.c     | 1 -
 13 files changed, 15 deletions(-)
Signature · 1 line
2.43.0
author maintainer
#1 lore raw

PATCH v2 1/13 iio: adc: ad4080: remove unused dec_rate field

Remove unused dec_rate field from ad4080_state struct. The driver reads/writes decimation rate directly from hardware registers via ad4080_get_dec_rate() and ad4080_set_dec_rate() functions.

---
 drivers/iio/adc/ad4080.c | 1 -
 1 file changed, 1 deletion(-)
drivers/iio/adc/ad4080.c +0 -1
index 7cf3b6ed7940..8bc092969c18 100644
@@ -185,7 +185,6 @@ struct ad4080_state {
 	 */
 	struct mutex			lock;
 	unsigned int			num_lanes;
-	unsigned int			dec_rate;
 	unsigned long			clk_rate;
 	enum ad4080_filter_type		filter_type;
 	bool				lvds_cnv_en;
Signature · 1 line
2.43.0
author maintainer
#2 lore raw

PATCH v2 2/13 iio: adc: ad7768-1: remove unused mclk_div field

In reply to Antoniu Miclaus

Remove unused mclk_div field from ad7768_state struct. The field is declared but never accessed in the driver.

---
 drivers/iio/adc/ad7768-1.c | 1 -
 1 file changed, 1 deletion(-)
drivers/iio/adc/ad7768-1.c +0 -1
index fcd8aea7152e..5a0863cf22e9 100644
@@ -290,7 +290,6 @@ struct ad7768_state {
 	unsigned int vcm_output_sel;
 	struct clk *mclk;
 	unsigned int mclk_freq;
-	unsigned int mclk_div;
 	unsigned int oversampling_ratio;
 	enum ad7768_filter_type filter_type;
 	unsigned int samp_freq;
Signature · 1 line
2.43.0
author maintainer
#3 lore raw

PATCH v2 3/13 iio: adc: ad7793: remove unused int_vref_mv field

In reply to Antoniu Miclaus

Remove unused int_vref_mv field from ad7793_state struct. The field is declared but never accessed in the driver.

---
 drivers/iio/adc/ad7793.c | 1 -
 1 file changed, 1 deletion(-)
drivers/iio/adc/ad7793.c +0 -1
index ccf18ce48e34..06317f5cb047 100644
@@ -152,7 +152,6 @@ struct ad7793_chip_info {
 
 struct ad7793_state {
 	const struct ad7793_chip_info	*chip_info;
-	u16				int_vref_mv;
 	u16				mode;
 	u16				conf;
 	u32				scale_avail[8][2];
Signature · 1 line
2.43.0
author maintainer
#4 lore raw

PATCH v2 4/13 iio: adc: ad9467: remove unused output_mode field

In reply to Antoniu Miclaus

Remove unused output_mode field from ad9467_state struct. The field is declared but never accessed in the driver.

---
 drivers/iio/adc/ad9467.c | 1 -
 1 file changed, 1 deletion(-)
drivers/iio/adc/ad9467.c +0 -1
index 9cfe66425d4e..df0c05e7c60f 100644
@@ -176,7 +176,6 @@ struct ad9467_state {
 	struct clk *clk;
 	/* used for debugfs */
 	struct ad9467_chan_test_mode *chan_test;
-	unsigned int output_mode;
 	unsigned int (*scales)[2];
 	/*
 	 * Times 2 because we may also invert the signal polarity and run the
Signature · 1 line
2.43.0
Reviewed-by on v2 4/13
#5 lore raw

Re: [PATCH v2 04/13] iio: adc: ad9467: remove unused output_mode field

Quoted 4 lines · Antoniu Miclaus

Remove unused output_mode field from ad9467_state struct. The field is declared but never accessed in the driver.

Quoted 16 lines
---
 drivers/iio/adc/ad9467.c | 1 -
 1 file changed, 1 deletion(-)
drivers/iio/adc/ad9467.c +0 -1
index 9cfe66425d4e..df0c05e7c60f 100644
@@ -176,7 +176,6 @@ struct ad9467_state {
 	struct clk *clk;
 	/* used for debugfs */
 	struct ad9467_chan_test_mode *chan_test;
-	unsigned int output_mode;
 	unsigned int (*scales)[2];
 	/*
 	 * Times 2 because we may also invert the signal polarity and run the
author maintainer
#6 lore raw

PATCH v2 5/13 iio: adc: max1363: remove unused requestedmask field

In reply to Antoniu Miclaus

Remove unused requestedmask field from max1363_state struct. The field is declared but never accessed in the driver.

---
 drivers/iio/adc/max1363.c | 2 --
 1 file changed, 2 deletions(-)
drivers/iio/adc/max1363.c +0 -2
index 9dd547e62b6c..5e0666343fcb 100644
@@ -149,7 +149,6 @@ struct max1363_chip_info {
  * @configbyte:		cache of current device config byte
  * @chip_info:		chip model specific constants, available modes, etc.
  * @current_mode:	the scan mode of this chip
- * @requestedmask:	a valid requested set of channels
  * @lock:		lock to ensure state is consistent
  * @monitor_on:		whether monitor mode is enabled
  * @monitor_speed:	parameter corresponding to device monitor speed setting
@@ -169,7 +168,6 @@ struct max1363_state {
 	u8				configbyte;
 	const struct max1363_chip_info	*chip_info;
 	const struct max1363_mode	*current_mode;
-	u32				requestedmask;
 	struct mutex			lock;
 
 	/* Using monitor modes and buffer at the same time is
Signature · 1 line
2.43.0
author maintainer
#7 lore raw

PATCH v2 6/13 iio: adc: nau7802: remove unused min_conversions field

In reply to Antoniu Miclaus

Remove unused min_conversions field from nau7802_state struct. The field is declared but never accessed in the driver.

---
 drivers/iio/adc/nau7802.c | 1 -
 1 file changed, 1 deletion(-)
drivers/iio/adc/nau7802.c +0 -1
index 458544cb8ee4..97e92c0427e9 100644
@@ -55,7 +55,6 @@ struct nau7802_state {
 	struct mutex		data_lock;
 	u32			vref_mv;
 	u32			conversion_count;
-	u32			min_conversions;
 	u8			sample_rate;
 	u32			scale_avail[8];
 	struct completion	value_ok;
Signature · 1 line
2.43.0
author maintainer
#8 lore raw

PATCH v2 7/13 iio: adc: ti-ads1015: remove unused enabled field

In reply to Antoniu Miclaus

Remove unused enabled field from ads1015_channel_data struct. The field is declared but never accessed in the driver.

---
 drivers/iio/adc/ti-ads1015.c | 1 -
 1 file changed, 1 deletion(-)
drivers/iio/adc/ti-ads1015.c +0 -1
index f2a93c63ca14..c7ffe47449e2 100644
@@ -231,7 +231,6 @@ static const struct iio_event_spec ads1015_events[] = {
 }
 
 struct ads1015_channel_data {
-	bool enabled;
 	unsigned int pga;
 	unsigned int data_rate;
 };
Signature · 1 line
2.43.0
author maintainer
#9 lore raw

PATCH v2 8/13 iio: dac: adi-axi-dac: remove unused int_tone field

In reply to Antoniu Miclaus

Remove unused int_tone field from axi_dac_state struct. The field is declared but never accessed in the driver.

---
 drivers/iio/dac/adi-axi-dac.c | 1 -
 1 file changed, 1 deletion(-)
drivers/iio/dac/adi-axi-dac.c +0 -1
index 9cc895bbe51a..1ca725c5dedc 100644
@@ -114,7 +114,6 @@ struct axi_dac_state {
 	const struct axi_dac_info *info;
 	u64 dac_clk;
 	u32 reg_config;
-	bool int_tone;
 	int dac_clk_rate;
 };
 
Signature · 1 line
2.43.0
author maintainer
#10 lore raw

PATCH v2 9/13 iio: dac: ti-dac5571: remove unused id field

In reply to Antoniu Miclaus

Remove unused id field from dac5571_data struct. The field is declared but never accessed in the driver.

---
 drivers/iio/dac/ti-dac5571.c | 1 -
 1 file changed, 1 deletion(-)
drivers/iio/dac/ti-dac5571.c +0 -1
index bdc3f94aef98..455d61fc3f13 100644
@@ -45,7 +45,6 @@ static const struct dac5571_spec dac5571_spec[] = {
 
 struct dac5571_data {
 	struct i2c_client *client;
-	int id;
 	struct mutex lock;
 	struct regulator *vref;
 	u16 val[4];
Signature · 1 line
2.43.0
author maintainer
#11 lore raw

PATCH v2 10/13 iio: humidity: hdc2010: remove unused interrupt_config

In reply to Antoniu Miclaus

Remove unused interrupt_config field from hdc2010_data struct. The field is declared but never accessed in the driver.

---
 drivers/iio/humidity/hdc2010.c | 1 -
 1 file changed, 1 deletion(-)
drivers/iio/humidity/hdc2010.c +0 -1
index 894a8b4ab193..1a0f18251381 100644
@@ -44,7 +44,6 @@ struct hdc2010_data {
 	struct i2c_client *client;
 	struct mutex lock;
 	u8 measurement_config;
-	u8 interrupt_config;
 	u8 drdy_config;
 };
 
Signature · 1 line
2.43.0
author maintainer
#12 lore raw

PATCH v2 11/13 iio: imu: bmi323: remove unused drdy_trigger_enabled

In reply to Antoniu Miclaus

Remove unused drdy_trigger_enabled field from bmi323_data struct. The field is declared but never accessed in the driver.

---
 drivers/iio/imu/bmi323/bmi323_core.c | 1 -
 1 file changed, 1 deletion(-)
drivers/iio/imu/bmi323/bmi323_core.c +0 -1
index 6bcb9a436581..f3d499423399 100644
@@ -156,7 +156,6 @@ struct bmi323_data {
 	struct iio_mount_matrix orientation;
 	enum bmi323_irq_pin irq_pin;
 	struct iio_trigger *trig;
-	bool drdy_trigger_enabled;
 	enum bmi323_state state;
 	s64 fifo_tstamp, old_fifo_tstamp;
 	u32 odrns[BMI323_SENSORS_CNT];
Signature · 1 line
2.43.0
#13 lore raw

Re: [PATCH v2 11/13] iio: imu: bmi323: remove unused drdy_trigger_enabled

Quoted 3 lines · Antoniu Miclaus

Remove unused drdy_trigger_enabled field from bmi323_data struct. The field is declared but never accessed in the driver.

...

drivers/iio/imu/bmi323/bmi323_core.c struct bmi323_data { · line 159

Quoted 6 lines

struct bmi323_data {

drivers/iio/imu/bmi323/bmi323_core.c +0 -1
 	struct iio_mount_matrix orientation;
 	enum bmi323_irq_pin irq_pin;
 	struct iio_trigger *trig;
-	bool drdy_trigger_enabled;

Hmm... Not directly related to your series, but with it applied it makes sense to revisit the structure layouts as they might be rearranged to occupy less space.

Quoted 1 line

enum bmi323_state state;

For example, this enum, if moved closer to irq_pin, might result in less gap on some architectures. (Probably not, as we use long, id est 'int' sized, enums.)

In any way, pahole can hint about that, but as I said, it's not for this series.

Quoted 2 lines
drivers/iio/imu/bmi323/bmi323_core.c +0 -0
 	s64 fifo_tstamp, old_fifo_tstamp;
 	u32 odrns[BMI323_SENSORS_CNT];
Signature · 2 lines
With Best Regards,
Andy Shevchenko
author maintainer
#14 lore raw

PATCH v2 12/13 iio: light: apds9306: remove unused nlux_per_count

In reply to Antoniu Miclaus

Remove unused nlux_per_count field from apds9306_data struct. The field is declared but never accessed in the driver.

---
 drivers/iio/light/apds9306.c | 2 --
 1 file changed, 2 deletions(-)
drivers/iio/light/apds9306.c +0 -2
index 5d18eabd961e..5ca4c87524fe 100644
@@ -168,7 +168,6 @@ struct apds9306_regfields {
  *         respectively.
  * @regmap: Regmap structure pointer
  * @rf: Regmap register fields structure
- * @nlux_per_count: Nano lux per ADC count for a particular model
  * @read_data_available: Flag set by IRQ handler for ADC data available
  */
 struct apds9306_data {
@@ -180,7 +179,6 @@ struct apds9306_data {
 	struct regmap *regmap;
 	struct apds9306_regfields rf;
 
-	int nlux_per_count;
 	int read_data_available;
 };
 
Signature · 1 line
2.43.0
author maintainer
#15 lore raw

PATCH v2 13/13 iio: light: gp2ap020a00f: remove unused debug_reg_addr

In reply to Antoniu Miclaus

Remove unused debug_reg_addr field from gp2ap020a00f_data struct. The field is declared but never accessed in the driver.

---
 drivers/iio/light/gp2ap020a00f.c | 1 -
 1 file changed, 1 deletion(-)
drivers/iio/light/gp2ap020a00f.c +0 -1
index c7df4b258e2c..7cdd61db7096 100644
@@ -246,7 +246,6 @@ struct gp2ap020a00f_data {
 	struct iio_trigger *trig;
 	struct regmap *regmap;
 	unsigned int thresh_val[4];
-	u8 debug_reg_addr;
 	struct irq_work work;
 	wait_queue_head_t data_ready_queue;
 };
Signature · 1 line
2.43.0
Reviewed-by on the v2 series
#16 lore raw
In reply to Antoniu Miclaus
Quoted 10 lines · Antoniu Miclaus

This series removes unused struct fields found across various IIO drivers. These fields were either left over from previous refactoring, or were added during development but never actually used.

Removing them reduces memory footprint slightly and improves code clarity by eliminating dead struct members that could confuse future readers.

Each patch is independent and can be merged separately as they touch different drivers with no dependencies between them.

Assuming it applies cleanly and compiles,

and I see in some cases it gains space.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
maintainer Applied
#17 lore raw
Quoted 9 lines · On Tue, 3 Feb 2026 11:44:45 +0200 Andy Shevchenko…
Quoted 8 lines · Antoniu Miclaus

This series removes unused struct fields found across various IIO drivers. These fields were either left over from previous refactoring, or were added during development but never actually used.

Removing them reduces memory footprint slightly and improves code clarity by eliminating dead struct members that could confuse future readers.

Quoted 7 lines
Quoted 2 lines

Each patch is independent and can be merged separately as they touch different drivers with no dependencies between them.

Assuming it applies cleanly and compiles,

and I see in some cases it gains space.

Applied. Thanks!

J

maintainer
#18 lore raw
Quoted 15 lines · On Thu, 5 Feb 2026 20:45:32 +0000 Jonathan Cameron <[email protected]> wrote:
Quoted 12 lines · On Tue, 3 Feb 2026 11:44:45 +0200 Andy Shevchenko…
Quoted 10 lines · Antoniu Miclaus

This series removes unused struct fields found across various IIO drivers. These fields were either left over from previous refactoring, or were added during development but never actually used.

Removing them reduces memory footprint slightly and improves code clarity by eliminating dead struct members that could confuse future readers.

Each patch is independent and can be merged separately as they touch different drivers with no dependencies between them.

Quoted 7 lines
Quoted 4 lines

Assuming it applies cleanly and compiles,

and I see in some cases it gains space.

Applied. Thanks!

Unfortunately I was a Muppet and applied this to a temporary tree then lost it. Now it's actually on the testing branch of iio.git.

Thanks,

Jonathan

Quoted 2 lines

J