Skip to contentSkip to conversation

USB: ezusb: make some vars/funcs static

PATCH In review Fengguang Wu 2 participants 3 messages Sep 27, 2012 – Sep 28, 2012

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

PATCH 1/1 USB: ezusb: make some vars/funcs static

---
 drivers/usb/misc/ezusb.c |   16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
tree:   git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-next
head:   70c048a238c780c226eb4b115ebaa908cb3b34ec
commit: 70c048a238c780c226eb4b115ebaa908cb3b34ec [72/73] USB: ezusb: move ezusb.c from drivers/usb/serial to drivers/usb/misc

+ drivers/usb/misc/ezusb.c:25:22: sparse: symbol 'ezusb_fx1' was not declared. Should it be static?
+ drivers/usb/misc/ezusb.c:30:22: sparse: symbol 'ezusb_fx2' was not declared. Should it be static?
+ drivers/usb/misc/ezusb.c:39:5: sparse: symbol 'ezusb_writememory' was not declared. Should it be static?
+ drivers/usb/misc/ezusb.c:63:5: sparse: symbol 'ezusb_set_reset' was not declared. Should it be static?
+ drivers/usb/misc/ezusb.c:73:5: sparse: symbol 'ezusb_fx1_set_reset' was not declared. Should it be static?
+ drivers/usb/misc/ezusb.c:79:5: sparse: symbol 'ezusb_fx2_set_reset' was not declared. Should it be static?
+ drivers/usb/misc/ezusb.c:147:5: sparse: symbol 'ezusb_fx1_ihex_firmware_download' was not declared. Should it be static?
+ drivers/usb/misc/ezusb.c:154:5: sparse: symbol 'ezusb_fx2_ihex_firmware_download' was not declared. Should it be static?

drivers/usb/misc/ezusb.c +8 -8
@@ -22,12 +22,12 @@ struct ezusb_fx_type {
 	unsigned short max_internal_adress;
 };
 
-struct ezusb_fx_type ezusb_fx1 = {
+static struct ezusb_fx_type ezusb_fx1 = {
 	.cpucs_reg = 0x7F92,
 	.max_internal_adress = 0x1B3F,
 };
 
-struct ezusb_fx_type ezusb_fx2 = {
+static struct ezusb_fx_type ezusb_fx2 = {
 	.cpucs_reg = 0xE600,
 	.max_internal_adress = 0x3FFF,
 };
@@ -36,7 +36,7 @@ struct ezusb_fx_type ezusb_fx2 = {
 #define WRITE_INT_RAM 0xA0
 #define WRITE_EXT_RAM 0xA3
 
-int ezusb_writememory(struct usb_device *dev, int address,
+static int ezusb_writememory(struct usb_device *dev, int address,
 				unsigned char *data, int length, __u8 request)
 {
 	int result;
@@ -60,7 +60,7 @@ int ezusb_writememory(struct usb_device
 }
 EXPORT_SYMBOL_GPL(ezusb_writememory);
 
-int ezusb_set_reset(struct usb_device *dev, unsigned short cpucs_reg,
+static int ezusb_set_reset(struct usb_device *dev, unsigned short cpucs_reg,
 			 unsigned char reset_bit)
 {
 	int response = ezusb_writememory(dev, cpucs_reg, &reset_bit, 1, WRITE_INT_RAM);
@@ -70,13 +70,13 @@ int ezusb_set_reset(struct usb_device *d
 	return response;
 }
 
-int ezusb_fx1_set_reset(struct usb_device *dev, unsigned char reset_bit)
+static int ezusb_fx1_set_reset(struct usb_device *dev, unsigned char reset_bit)
 {
 	return ezusb_set_reset(dev, ezusb_fx1.cpucs_reg, reset_bit);
 }
 EXPORT_SYMBOL_GPL(ezusb_fx1_set_reset);
 
-int ezusb_fx2_set_reset(struct usb_device *dev, unsigned char reset_bit)
+static int ezusb_fx2_set_reset(struct usb_device *dev, unsigned char reset_bit)
 {
 	return ezusb_set_reset(dev, ezusb_fx2.cpucs_reg, reset_bit);
 }
@@ -144,14 +144,14 @@ out:
 	return ret;
 }
 
-int ezusb_fx1_ihex_firmware_download(struct usb_device *dev,
+static int ezusb_fx1_ihex_firmware_download(struct usb_device *dev,
 				     const char *firmware_path)
 {
 	return ezusb_ihex_firmware_download(dev, ezusb_fx1, firmware_path);
 }
 EXPORT_SYMBOL_GPL(ezusb_fx1_ihex_firmware_download);
 
-int ezusb_fx2_ihex_firmware_download(struct usb_device *dev,
+static int ezusb_fx2_ihex_firmware_download(struct usb_device *dev,
 				     const char *firmware_path)
 {
 	return ezusb_ihex_firmware_download(dev, ezusb_fx2, firmware_path);
#1 lore raw
Quoted 9 lines · Fengguang Wu
---
 drivers/usb/misc/ezusb.c |   16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
tree:   git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-next
head:   70c048a238c780c226eb4b115ebaa908cb3b34ec
commit: 70c048a238c780c226eb4b115ebaa908cb3b34ec [72/73] USB: ezusb: move ezusb.c from drivers/usb/serial to drivers/usb/misc
Quoted 8 lines

+ drivers/usb/misc/ezusb.c:25:22: sparse: symbol 'ezusb_fx1' was not declared. Should it be static?
+ drivers/usb/misc/ezusb.c:30:22: sparse: symbol 'ezusb_fx2' was not declared. Should it be static?
+ drivers/usb/misc/ezusb.c:39:5: sparse: symbol 'ezusb_writememory' was not declared. Should it be static?
+ drivers/usb/misc/ezusb.c:63:5: sparse: symbol 'ezusb_set_reset' was not declared. Should it be static?
+ drivers/usb/misc/ezusb.c:73:5: sparse: symbol 'ezusb_fx1_set_reset' was not declared. Should it be static?
+ drivers/usb/misc/ezusb.c:79:5: sparse: symbol 'ezusb_fx2_set_reset' was not declared. Should it be static?
+ drivers/usb/misc/ezusb.c:147:5: sparse: symbol 'ezusb_fx1_ihex_firmware_download' was not declared. Should it be static?
+ drivers/usb/misc/ezusb.c:154:5: sparse: symbol 'ezusb_fx2_ihex_firmware_download' was not declared. Should it be static?

Put all of this information (well the sparse warnings) up above in the changelog area of the patch, it's good to have.

drivers/usb/misc/ezusb.c int ezusb_writememory(struct usb_device · line 61

Quoted 12 lines
drivers/usb/misc/ezusb.c +1 -1
@@ -36,7 +36,7 @@ struct ezusb_fx_type ezusb_fx2 = {
 #define WRITE_INT_RAM 0xA0
 #define WRITE_EXT_RAM 0xA3
 
-int ezusb_writememory(struct usb_device *dev, int address,
+static int ezusb_writememory(struct usb_device *dev, int address,
 				unsigned char *data, int length, __u8 request)
 {
 	int result;
@@ -60,7 +60,7 @@ int ezusb_writememory(struct usb_device
 }
 EXPORT_SYMBOL_GPL(ezusb_writememory);

You just marked a symbol that is exported as static? What is going on here? This can't be correct, is there a .h file somewhere that we need to add these exported symbols to which would fix up sparse, right?

Rene, why have functions exported that no one uses outside of the module?

As it is, I can't take this patch, sorry.

greg k-h

#2 lore raw
In reply to Fengguang Wu
Quoted 19 lines · Greg KH
Quoted 9 lines · Fengguang Wu
---
 drivers/usb/misc/ezusb.c |   16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
tree:   git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-next
head:   70c048a238c780c226eb4b115ebaa908cb3b34ec
commit: 70c048a238c780c226eb4b115ebaa908cb3b34ec [72/73] USB: ezusb: move ezusb.c from drivers/usb/serial to drivers/usb/misc
Quoted 8 lines

+ drivers/usb/misc/ezusb.c:25:22: sparse: symbol 'ezusb_fx1' was not declared. Should it be static?
+ drivers/usb/misc/ezusb.c:30:22: sparse: symbol 'ezusb_fx2' was not declared. Should it be static?
+ drivers/usb/misc/ezusb.c:39:5: sparse: symbol 'ezusb_writememory' was not declared. Should it be static?
+ drivers/usb/misc/ezusb.c:63:5: sparse: symbol 'ezusb_set_reset' was not declared. Should it be static?
+ drivers/usb/misc/ezusb.c:73:5: sparse: symbol 'ezusb_fx1_set_reset' was not declared. Should it be static?
+ drivers/usb/misc/ezusb.c:79:5: sparse: symbol 'ezusb_fx2_set_reset' was not declared. Should it be static?
+ drivers/usb/misc/ezusb.c:147:5: sparse: symbol 'ezusb_fx1_ihex_firmware_download' was not declared. Should it be static?
+ drivers/usb/misc/ezusb.c:154:5: sparse: symbol 'ezusb_fx2_ihex_firmware_download' was not declared. Should it be static?

Quoted 2 lines

Put all of this information (well the sparse warnings) up above in the changelog area of the patch, it's good to have.

OK, I'll put original error messages in changelog in future.

Quoted 4 lines
Quoted 4 lines
drivers/usb/misc/ezusb.c +0 -0
@@ -36,7 +36,7 @@ struct ezusb_fx_type ezusb_fx2 = {
 #define WRITE_INT_RAM 0xA0
 #define WRITE_EXT_RAM 0xA3
 
Quoted 12 lines

drivers/usb/misc/ezusb.c int ezusb_writememory(struct usb_device · line 61

Quoted 8 lines
drivers/usb/misc/ezusb.c +1 -1
-int ezusb_writememory(struct usb_device *dev, int address,
+static int ezusb_writememory(struct usb_device *dev, int address,
 				unsigned char *data, int length, __u8 request)
 {
 	int result;
@@ -60,7 +60,7 @@ int ezusb_writememory(struct usb_device
 }
 EXPORT_SYMBOL_GPL(ezusb_writememory);

You just marked a symbol that is exported as static? What is going on here? This can't be correct, is there a .h file somewhere that we need to add these exported symbols to which would fix up sparse, right?

Sorry I'm kind of too trusting the error reports -- because I know the patch will be auto compile tested before sending out. Anyway, I added lines to detect this EXPORT_SYMBOL* case as well. :-)

Quoted 2 lines

Rene, why have functions exported that no one uses outside of the module?

Yeah. At least no other users in your tree head.

Quoted 1 line

As it is, I can't take this patch, sorry.

No problem.

Thanks,
Fengguang