Skip to contentSkip to conversation

Staging: fbtft: move externs to header file

PATCH In review Drew Fustini 3 participants 5 messages Mar 3, 2015 – Mar 4, 2015

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

PATCH 1/1 Staging: fbtft: move externs to header file

Move extern declartions from fbtft-core.c to fbtft header file. This resovles the warning from checkpatch.pl that "externs should be avoided in .c files".

---
 drivers/staging/fbtft/fbtft-core.c | 5 -----
 drivers/staging/fbtft/fbtft.h      | 7 +++++++
 2 files changed, 7 insertions(+), 5 deletions(-)
drivers/staging/fbtft/fbtft-core.c +0 -5
index ac4287f..3422faf 100644
@@ -42,11 +42,6 @@
 
 #include "fbtft.h"
 
-extern void fbtft_sysfs_init(struct fbtft_par *par);
-extern void fbtft_sysfs_exit(struct fbtft_par *par);
-extern void fbtft_expand_debug_value(unsigned long *debug);
-extern int fbtft_gamma_parse_str(struct fbtft_par *par, unsigned long *curves,
-						const char *str, int size);
 
 static unsigned long debug;
 module_param(debug, ulong, 0);
drivers/staging/fbtft/fbtft.h +7 -0
index 0dbf3f9..9e729e5 100644
@@ -277,6 +277,13 @@ extern int fbtft_init_display(struct fbtft_par *par);
 extern int fbtft_probe_common(struct fbtft_display *display,
 	struct spi_device *sdev, struct platform_device *pdev);
 extern int fbtft_remove_common(struct device *dev, struct fb_info *info);
+extern void fbtft_sysfs_init(struct fbtft_par *par);
+extern void fbtft_sysfs_exit(struct fbtft_par *par);
+extern void fbtft_expand_debug_value(unsigned long *debug);
+extern int fbtft_gamma_parse_str(struct fbtft_par *par, unsigned long *curves,
+						const char *str, int size);
+
+
 
 /* fbtft-io.c */
 extern int fbtft_write_spi(struct fbtft_par *par, void *buf, size_t len);
Signature · 1 line
2.1.4
#1 lore raw
Quoted 2 lines · Drew Fustini

Move extern declartions from fbtft-core.c to fbtft header file. This resovles the warning from checkpatch.pl that "externs should be avoided in .c files".

but now it adds 6 additional warning in checkpatch --strict "extern prototypes should be avoided in .h files"

regards
sudip

Quoted 3 lines

---

#2 lore raw
Quoted 2 lines · Sudip Mukherjee

but now it adds 6 additional warning in checkpatch --strict "extern prototypes should be avoided in .h files"

Thanks, Sudip. I did not realize that was an option for checkpatch. I see now that there are additional warnings as you mentioned:

CHECK: extern prototypes should be avoided in .h files
CHECK: Alignment should match open parenthesis
CHECK: Please don't use multiple blank lines

Drew

#3 lore raw
In reply to Drew Fustini

Den 03.03.2015 11:19, skrev Drew Fustini:

Quoted 33 lines

Move extern declartions from fbtft-core.c to fbtft header file. This resovles the warning from checkpatch.pl that "externs should be avoided in .c files".

---
  drivers/staging/fbtft/fbtft-core.c | 5 -----
  drivers/staging/fbtft/fbtft.h      | 7 +++++++
  2 files changed, 7 insertions(+), 5 deletions(-)
drivers/staging/fbtft/fbtft-core.c +0 -5
index ac4287f..3422faf 100644
@@ -42,11 +42,6 @@
 
  #include "fbtft.h"
 
-extern void fbtft_sysfs_init(struct fbtft_par *par);
-extern void fbtft_sysfs_exit(struct fbtft_par *par);
-extern void fbtft_expand_debug_value(unsigned long *debug);
-extern int fbtft_gamma_parse_str(struct fbtft_par *par, unsigned long *curves,
-						const char *str, int size);
 
  static unsigned long debug;
  module_param(debug, ulong, 0);
drivers/staging/fbtft/fbtft.h +0 -0
index 0dbf3f9..9e729e5 100644
@@ -277,6 +277,13 @@ extern int fbtft_init_display(struct fbtft_par *par);
  extern int fbtft_probe_common(struct fbtft_display *display,
  	struct spi_device *sdev, struct platform_device *pdev);
  extern int fbtft_remove_common(struct device *dev, struct fb_info *info);

drivers/staging/fbtft/fbtft.h extern int fbtft_init_display(struct fbtft_par *par); · line 289

Quoted 10 lines
drivers/staging/fbtft/fbtft.h +7 -0
+extern void fbtft_sysfs_init(struct fbtft_par *par);
+extern void fbtft_sysfs_exit(struct fbtft_par *par);
+extern void fbtft_expand_debug_value(unsigned long *debug);
+extern int fbtft_gamma_parse_str(struct fbtft_par *par, unsigned long *curves,
+						const char *str, int size);
+
+
 
  /* fbtft-io.c */
  extern int fbtft_write_spi(struct fbtft_par *par, void *buf, size_t len);

These functions are defined in fbtft-sysfs.c and internal to the fbtft module. I think it's better to put them in an 'internal.h' file.
The fbtft.h file will eventually live in include/linux/fbtft.h or something like that.

Noralf.

#4 lore raw
Quoted 5 lines · Noralf Trønnes

These functions are defined in fbtft-sysfs.c and internal to the fbtft module.
I think it's better to put them in an 'internal.h' file. The fbtft.h file will eventually live in include/linux/fbtft.h or something like that.

Thanks, Noralf. I have posted a new patch based on your suggestion:
[PATCH] Staging: fbtft: add header for internal functions

Drew