Skip to contentSkip to conversation

staging: iio: Single source header file reorganization

PATCH In review Sreya Mittal 2 participants 3 messages Feb 25, 2017 – Mar 6, 2017

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

PATCH v2 1/1 staging: iio: Single source header file reorganization

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

---

Changes in v2:
Correct the indentation.

 drivers/staging/iio/trigger/iio-trig-bfin-timer.c | 33 +++++++++++++++++------
 drivers/staging/iio/trigger/iio-trig-bfin-timer.h | 24 -----------------
 2 files changed, 25 insertions(+), 32 deletions(-)
 delete mode 100644 drivers/staging/iio/trigger/iio-trig-bfin-timer.h
drivers/staging/iio/trigger/iio-trig-bfin-timer.c +25 -8
index 4e0b4ee..5a7ff57 100644
@@ -5,21 +5,38 @@
  *
  */
 
+#include <asm/gptimers.h>
+#include <asm/portmux.h>
+#include <linux/delay.h>
+#include <linux/interrupt.h>
+#include <linux/irq.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/platform_device.h>
 #include <linux/slab.h>
-#include <linux/interrupt.h>
-#include <linux/irq.h>
-#include <linux/delay.h>
-
-#include <asm/gptimers.h>
-#include <asm/portmux.h>
-
 #include <linux/iio/iio.h>
 #include <linux/iio/trigger.h>
 
-#include "iio-trig-bfin-timer.h"
+/**
+ * struct iio_bfin_timer_trigger_pdata - timer trigger platform data
+ * @output_enable: Enable external trigger pulse generation.
+ * @active_low: Whether the trigger pulse is active low.
+ * @duty_ns: Length of the trigger pulse in nanoseconds.
+ * 
+ * This struct is used to configure the output pulse generation of the blackfin
+ * timer trigger. If output_enable is set to true an external trigger signal
+ * will generated on the pin corresponding to the timer. This is useful for
+ * converters which needs an external signal to start conversion. active_low and
+ * duty_ns are used to configure the type of the trigger pulse. If output_enable
+ * is set to false no external trigger pulse will be generated and active_low
+ * and duty_ns are ignored.
+ **/
+
+struct iio_bfin_timer_trigger_pdata {
+		bool output_enable;
+		bool active_low;
+		unsigned int duty_ns;
+};
 
 struct bfin_timer {
 	unsigned short id, bit;
drivers/staging/iio/trigger/iio-trig-bfin-timer.h deleted +0 -24
deleted file mode 100644
index c07321f..0000000
@@ -1,24 +0,0 @@
-#ifndef __IIO_BFIN_TIMER_TRIGGER_H__
-#define __IIO_BFIN_TIMER_TRIGGER_H__
-
-/**
- * struct iio_bfin_timer_trigger_pdata - timer trigger platform data
- * @output_enable: Enable external trigger pulse generation.
- * @active_low: Whether the trigger pulse is active low.
- * @duty_ns: Length of the trigger pulse in nanoseconds.
- *
- * This struct is used to configure the output pulse generation of the blackfin
- * timer trigger. If output_enable is set to true an external trigger signal
- * will generated on the pin corresponding to the timer. This is useful for
- * converters which needs an external signal to start conversion. active_low and
- * duty_ns are used to configure the type of the trigger pulse. If output_enable
- * is set to false no external trigger pulse will be generated and active_low
- * and duty_ns are ignored.
- **/
-struct iio_bfin_timer_trigger_pdata {
-	bool output_enable;
-	bool active_low;
-	unsigned int duty_ns;
-};
-
-#endif
Signature · 1 line
2.9.3
maintainer
#1 lore raw
Quoted 5 lines · Sreya Mittal

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

Hi,

The issue here is similar to that seen in other patches recently. It appears to be moving the platform data structure into the c file. Whilst this is only used in the mainline kernel within this single c file, that is not true in general. This platform data file is included and used in board files for boards that have this device and hence needs to remain in the header.

Jonathan

Quoted 92 lines

---

Changes in v2:
Correct the indentation.

 drivers/staging/iio/trigger/iio-trig-bfin-timer.c | 33 +++++++++++++++++------
 drivers/staging/iio/trigger/iio-trig-bfin-timer.h | 24 -----------------
 2 files changed, 25 insertions(+), 32 deletions(-)
 delete mode 100644 drivers/staging/iio/trigger/iio-trig-bfin-timer.h
drivers/staging/iio/trigger/iio-trig-bfin-timer.c +25 -8
index 4e0b4ee..5a7ff57 100644
@@ -5,21 +5,38 @@
  *
  */
 
+#include <asm/gptimers.h>
+#include <asm/portmux.h>
+#include <linux/delay.h>
+#include <linux/interrupt.h>
+#include <linux/irq.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/platform_device.h>
 #include <linux/slab.h>
-#include <linux/interrupt.h>
-#include <linux/irq.h>
-#include <linux/delay.h>
-
-#include <asm/gptimers.h>
-#include <asm/portmux.h>
-
 #include <linux/iio/iio.h>
 #include <linux/iio/trigger.h>
 
-#include "iio-trig-bfin-timer.h"
+/**
+ * struct iio_bfin_timer_trigger_pdata - timer trigger platform data
+ * @output_enable: Enable external trigger pulse generation.
+ * @active_low: Whether the trigger pulse is active low.
+ * @duty_ns: Length of the trigger pulse in nanoseconds.
+ * 
+ * This struct is used to configure the output pulse generation of the blackfin
+ * timer trigger. If output_enable is set to true an external trigger signal
+ * will generated on the pin corresponding to the timer. This is useful for
+ * converters which needs an external signal to start conversion. active_low and
+ * duty_ns are used to configure the type of the trigger pulse. If output_enable
+ * is set to false no external trigger pulse will be generated and active_low
+ * and duty_ns are ignored.
+ **/
+
+struct iio_bfin_timer_trigger_pdata {
+		bool output_enable;
+		bool active_low;
+		unsigned int duty_ns;
+};
 
 struct bfin_timer {
 	unsigned short id, bit;
drivers/staging/iio/trigger/iio-trig-bfin-timer.h deleted +0 -24
deleted file mode 100644
index c07321f..0000000
@@ -1,24 +0,0 @@
-#ifndef __IIO_BFIN_TIMER_TRIGGER_H__
-#define __IIO_BFIN_TIMER_TRIGGER_H__
-
-/**
- * struct iio_bfin_timer_trigger_pdata - timer trigger platform data
- * @output_enable: Enable external trigger pulse generation.
- * @active_low: Whether the trigger pulse is active low.
- * @duty_ns: Length of the trigger pulse in nanoseconds.
- *
- * This struct is used to configure the output pulse generation of the blackfin
- * timer trigger. If output_enable is set to true an external trigger signal
- * will generated on the pin corresponding to the timer. This is useful for
- * converters which needs an external signal to start conversion. active_low and
- * duty_ns are used to configure the type of the trigger pulse. If output_enable
- * is set to false no external trigger pulse will be generated and active_low
- * and duty_ns are ignored.
- **/
-struct iio_bfin_timer_trigger_pdata {
-	bool output_enable;
-	bool active_low;
-	unsigned int duty_ns;
-};
-
-#endif
#2 lore raw
Quoted 7 lines · Jonathan Cameron
Quoted 5 lines · Sreya Mittal

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

Signed-off-by Sreya Mittal <[email protected] <javascript:>>
Quoted 9 lines

Hi,

The issue here is similar to that seen in other patches recently. It appears to be moving the platform data structure into the c file. Whilst this is only used in the mainline kernel within this single c file, that is not true in general. This platform data file is included and used in board files for boards that have this device and hence needs to remain in the header.

Thanks for clarifying it, So basically, this patch was unrequired since the header file contained only the platform data structure.

Sreya

Quoted 112 lines

Jonathan

Quoted 6 lines

---

Changes in v2:
Correct the indentation.

 drivers/staging/iio/trigger/iio-trig-bfin-timer.c | 33 

+++++++++++++++++------

Quoted 1 line
 drivers/staging/iio/trigger/iio-trig-bfin-timer.h | 24 

-----------------

Review

Quoted 4 lines
 2 files changed, 25 insertions(+), 32 deletions(-) 
 delete mode 100644 drivers/staging/iio/trigger/iio-trig-bfin-timer.h 
(quoted diff) +0 -0

b/drivers/staging/iio/trigger/iio-trig-bfin-timer.c

Quoted 24 lines

index 4e0b4ee..5a7ff57 100644

drivers/staging/iio/trigger/iio-trig-bfin-timer.c +5 -7
@@ -5,21 +5,38 @@ 
  * 
  */ 
 
+#include <asm/gptimers.h> 
+#include <asm/portmux.h> 
+#include <linux/delay.h> 
+#include <linux/interrupt.h> 
+#include <linux/irq.h> 
 #include <linux/kernel.h> 
 #include <linux/module.h> 
 #include <linux/platform_device.h> 
 #include <linux/slab.h> 
-#include <linux/interrupt.h> 
-#include <linux/irq.h> 
-#include <linux/delay.h> 
- 
-#include <asm/gptimers.h> 
-#include <asm/portmux.h> 
- 
 #include <linux/iio/iio.h> 

drivers/staging/iio/trigger/iio-trig-bfin-timer.c line 26

Quoted 10 lines
drivers/staging/iio/trigger/iio-trig-bfin-timer.c +7 -1
 #include <linux/iio/trigger.h> 
 
-#include "iio-trig-bfin-timer.h" 
+/** 
+ * struct iio_bfin_timer_trigger_pdata - timer trigger platform data 
+ * @output_enable: Enable external trigger pulse generation. 
+ * @active_low: Whether the trigger pulse is active low. 
+ * @duty_ns: Length of the trigger pulse in nanoseconds. 
+ * 
+ * This struct is used to configure the output pulse generation of the 

blackfin

drivers/staging/iio/trigger/iio-trig-bfin-timer.c line 27

Quoted 1 line
drivers/staging/iio/trigger/iio-trig-bfin-timer.c +1 -0
+ * timer trigger. If output_enable is set to true an external trigger 

signal

drivers/staging/iio/trigger/iio-trig-bfin-timer.c line 28

Quoted 1 line
drivers/staging/iio/trigger/iio-trig-bfin-timer.c +1 -0
+ * will generated on the pin corresponding to the timer. This is useful 

for

drivers/staging/iio/trigger/iio-trig-bfin-timer.c line 29

Quoted 1 line
drivers/staging/iio/trigger/iio-trig-bfin-timer.c +1 -0
+ * converters which needs an external signal to start conversion. 

active_low and

drivers/staging/iio/trigger/iio-trig-bfin-timer.c line 30

Quoted 1 line
drivers/staging/iio/trigger/iio-trig-bfin-timer.c +1 -0
+ * duty_ns are used to configure the type of the trigger pulse. If 

output_enable

drivers/staging/iio/trigger/iio-trig-bfin-timer.c line 31

Quoted 1 line
drivers/staging/iio/trigger/iio-trig-bfin-timer.c +1 -0
+ * is set to false no external trigger pulse will be generated and 

active_low

Review

Quoted 12 lines
drivers/staging/iio/trigger/iio-trig-bfin-timer.c +8 -0
+ * and duty_ns are ignored. 
+ **/ 
+ 
+struct iio_bfin_timer_trigger_pdata { 
+                bool output_enable; 
+                bool active_low; 
+                unsigned int duty_ns; 
+}; 
 
 struct bfin_timer { 
         unsigned short id, bit; 
(quoted diff) +0 -0

b/drivers/staging/iio/trigger/iio-trig-bfin-timer.h

Quoted 5 lines

deleted file mode 100644
index c07321f..0000000

drivers/staging/iio/trigger/iio-trig-bfin-timer.h line 10

Quoted 10 lines
drivers/staging/iio/trigger/iio-trig-bfin-timer.h deleted +0 -10
@@ -1,24 +0,0 @@ 
-#ifndef __IIO_BFIN_TIMER_TRIGGER_H__ 
-#define __IIO_BFIN_TIMER_TRIGGER_H__ 
- 
-/** 
- * struct iio_bfin_timer_trigger_pdata - timer trigger platform data 
- * @output_enable: Enable external trigger pulse generation. 
- * @active_low: Whether the trigger pulse is active low. 
- * @duty_ns: Length of the trigger pulse in nanoseconds. 
- * 
- * This struct is used to configure the output pulse generation of the 

blackfin

drivers/staging/iio/trigger/iio-trig-bfin-timer.h line 11

Quoted 1 line
drivers/staging/iio/trigger/iio-trig-bfin-timer.h deleted +0 -1
- * timer trigger. If output_enable is set to true an external trigger 

signal

drivers/staging/iio/trigger/iio-trig-bfin-timer.h line 12

Quoted 1 line
drivers/staging/iio/trigger/iio-trig-bfin-timer.h deleted +0 -1
- * will generated on the pin corresponding to the timer. This is useful 

for

drivers/staging/iio/trigger/iio-trig-bfin-timer.h line 13

Quoted 1 line
drivers/staging/iio/trigger/iio-trig-bfin-timer.h deleted +0 -1
- * converters which needs an external signal to start conversion. 

active_low and

drivers/staging/iio/trigger/iio-trig-bfin-timer.h line 14

Quoted 1 line
drivers/staging/iio/trigger/iio-trig-bfin-timer.h deleted +0 -1
- * duty_ns are used to configure the type of the trigger pulse. If 

output_enable

drivers/staging/iio/trigger/iio-trig-bfin-timer.h line 15

Quoted 1 line
drivers/staging/iio/trigger/iio-trig-bfin-timer.h deleted +0 -1
- * is set to false no external trigger pulse will be generated and 

active_low

Quoted 10 lines
drivers/staging/iio/trigger/iio-trig-bfin-timer.h deleted +0 -9
- * and duty_ns are ignored. 
- **/ 
-struct iio_bfin_timer_trigger_pdata { 
-        bool output_enable; 
-        bool active_low; 
-        unsigned int duty_ns; 
-}; 
- 
-#endif