Skip to contentSkip to conversation

staging: iio: ad7280a: Move contents of header file to source file

PATCH In review sayli karnik 2 participants 2 messages Feb 28, 2017

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: iio: ad7280a: Move contents of header file to source file

The contents of the header file are used only by this single source file. Move content into .c and remove .h.

---
 drivers/staging/iio/adc/ad7280a.c | 15 +++++++++++++++
 drivers/staging/iio/adc/ad7280a.h | 15 ---------------
 2 files changed, 15 insertions(+), 15 deletions(-)
drivers/staging/iio/adc/ad7280a.c +15 -0
index ee679ac..44d13dc 100644
@@ -22,6 +22,21 @@
 
 #include "ad7280a.h"
 
+#define AD7280A_ACQ_TIME_400ns			0
+#define AD7280A_ACQ_TIME_800ns			1
+#define AD7280A_ACQ_TIME_1200ns			2
+#define AD7280A_ACQ_TIME_1600ns			3
+
+#define AD7280A_CONV_AVG_DIS			0
+#define AD7280A_CONV_AVG_2			1
+#define AD7280A_CONV_AVG_4			2
+#define AD7280A_CONV_AVG_8			3
+
+#define AD7280A_ALERT_REMOVE_VIN5		BIT(2)
+#define AD7280A_ALERT_REMOVE_VIN4_VIN5		BIT(3)
+#define AD7280A_ALERT_REMOVE_AUX5		BIT(0)
+#define AD7280A_ALERT_REMOVE_AUX4_AUX5		BIT(1)
+
 /* Registers */
 #define AD7280A_CELL_VOLTAGE_1		0x0  /* D11 to D0, Read only */
 #define AD7280A_CELL_VOLTAGE_2		0x1  /* D11 to D0, Read only */
drivers/staging/iio/adc/ad7280a.h +0 -15
index ccfb90d..1b50dd8 100644
@@ -13,21 +13,6 @@
  * TODO: struct ad7280_platform_data needs to go into include/linux/iio
  */
 
-#define AD7280A_ACQ_TIME_400ns			0
-#define AD7280A_ACQ_TIME_800ns			1
-#define AD7280A_ACQ_TIME_1200ns			2
-#define AD7280A_ACQ_TIME_1600ns			3
-
-#define AD7280A_CONV_AVG_DIS			0
-#define AD7280A_CONV_AVG_2			1
-#define AD7280A_CONV_AVG_4			2
-#define AD7280A_CONV_AVG_8			3
-
-#define AD7280A_ALERT_REMOVE_VIN5		BIT(2)
-#define AD7280A_ALERT_REMOVE_VIN4_VIN5		BIT(3)
-#define AD7280A_ALERT_REMOVE_AUX5		BIT(0)
-#define AD7280A_ALERT_REMOVE_AUX4_AUX5		BIT(1)
-
 struct ad7280_platform_data {
 	unsigned int		acquisition_time;
 	unsigned int		conversion_averaging;
Signature · 1 line
2.7.4
#1 lore raw
Quoted 2 lines · sayli karnik

The contents of the header file are used only by this single source file. Move content into .c and remove .h.

Hi,

Thanks for the patch. I'm afraid that these are values that are supposed to be used to initialize the fields in the platform data struct. So they have to stay in the header as well.

If you want to clean this up, convert at least the enumerations to a enum data type, so that it is clear what their function is.

Quoted 60 lines
---
 drivers/staging/iio/adc/ad7280a.c | 15 +++++++++++++++
 drivers/staging/iio/adc/ad7280a.h | 15 ---------------
 2 files changed, 15 insertions(+), 15 deletions(-)
drivers/staging/iio/adc/ad7280a.c +15 -0
index ee679ac..44d13dc 100644
@@ -22,6 +22,21 @@
 
 #include "ad7280a.h"
 
+#define AD7280A_ACQ_TIME_400ns			0
+#define AD7280A_ACQ_TIME_800ns			1
+#define AD7280A_ACQ_TIME_1200ns			2
+#define AD7280A_ACQ_TIME_1600ns			3
+
+#define AD7280A_CONV_AVG_DIS			0
+#define AD7280A_CONV_AVG_2			1
+#define AD7280A_CONV_AVG_4			2
+#define AD7280A_CONV_AVG_8			3
+
+#define AD7280A_ALERT_REMOVE_VIN5		BIT(2)
+#define AD7280A_ALERT_REMOVE_VIN4_VIN5		BIT(3)
+#define AD7280A_ALERT_REMOVE_AUX5		BIT(0)
+#define AD7280A_ALERT_REMOVE_AUX4_AUX5		BIT(1)
+
 /* Registers */
 #define AD7280A_CELL_VOLTAGE_1		0x0  /* D11 to D0, Read only */
 #define AD7280A_CELL_VOLTAGE_2		0x1  /* D11 to D0, Read only */
drivers/staging/iio/adc/ad7280a.h +0 -15
index ccfb90d..1b50dd8 100644
@@ -13,21 +13,6 @@
  * TODO: struct ad7280_platform_data needs to go into include/linux/iio
  */
 
-#define AD7280A_ACQ_TIME_400ns			0
-#define AD7280A_ACQ_TIME_800ns			1
-#define AD7280A_ACQ_TIME_1200ns			2
-#define AD7280A_ACQ_TIME_1600ns			3
-
-#define AD7280A_CONV_AVG_DIS			0
-#define AD7280A_CONV_AVG_2			1
-#define AD7280A_CONV_AVG_4			2
-#define AD7280A_CONV_AVG_8			3
-
-#define AD7280A_ALERT_REMOVE_VIN5		BIT(2)
-#define AD7280A_ALERT_REMOVE_VIN4_VIN5		BIT(3)
-#define AD7280A_ALERT_REMOVE_AUX5		BIT(0)
-#define AD7280A_ALERT_REMOVE_AUX4_AUX5		BIT(1)
-
 struct ad7280_platform_data {
 	unsigned int		acquisition_time;
 	unsigned int		conversion_averaging;