Skip to contentSkip to conversation

staging/wlags49_hs: Fix build error when CONFIG_SYSFS is not set

PATCH In review Javier Martinez Canillas 2 participants 5 messages Jun 11, 2010

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

PATCH 1/1 staging/wlags49_hs: Fix build error when CONFIG_SYSFS is not set

With current linux-next I got a build error with wlags49_h2 driver when CONFIG_SYSFS is not set.

This patch solves the issue.

---
 drivers/staging/wlags49_h2/wl_sysfs.h |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/staging/wlags49_h2/wl_sysfs.h +2 -2
index 6d96d03..7d5895d 100644
@@ -2,6 +2,6 @@
 extern void register_wlags_sysfs(struct net_device *);
 extern void unregister_wlags_sysfs(struct net_device *);
 #else
-static void register_wlags_sysfs(struct net_device *) { return; };
-static void unregister_wlags_sysfs(struct net_device *) { return; };
+#define register_wlags_sysfs(net_device) { }
+#define unregister_wlags_sysfs(net_device) { }
 #endif
Signature · 1 line
1.7.0.4
#1 lore raw
Quoted 6 lines · Javier Martinez Canillas

With current linux-next I got a build error with wlags49_h2 driver when CONFIG_SYSFS is not set.

drivers/staging/wlags49_h2/wl_sysfs.h +0 -0
index 6d96d03..7d5895d 100644

drivers/staging/wlags49_h2/wl_sysfs.h line 7

Quoted 8 lines
drivers/staging/wlags49_h2/wl_sysfs.h +2 -2
@@ -2,6 +2,6 @@
 extern void register_wlags_sysfs(struct net_device *);
 extern void unregister_wlags_sysfs(struct net_device *);
 #else
-static void register_wlags_sysfs(struct net_device *) { return; };
-static void unregister_wlags_sysfs(struct net_device *) { return; };
+#define register_wlags_sysfs(net_device) { }
+#define unregister_wlags_sysfs(net_device) { }
 #endif

Yes, that works, but a better fix would be to remove the semicolons after the function close braces.
---

(quoted diff) +0 -0

b/drivers/staging/wlags49_h2/wl_sysfs.h
index 6d96d03..7d5895d 100644

drivers/staging/wlags49_h2/wl_sysfs.h +2 -2
@@ -2,6 +2,6 @@
 extern void register_wlags_sysfs(struct net_device *);
 extern void unregister_wlags_sysfs(struct net_device *);
 #else
-static void register_wlags_sysfs(struct net_device *) { return; };
-static void unregister_wlags_sysfs(struct net_device *) { return; };
+static void register_wlags_sysfs(struct net_device *) { return; }
+static void unregister_wlags_sysfs(struct net_device *) { return; }
 #endif
#2 lore raw
Quoted 4 lines
Quoted 4 lines

 extern void register_wlags_sysfs(struct net_device *); extern void unregister_wlags_sysfs(struct net_device *); #else
-static void register_wlags_sysfs(struct net_device *) { return; };

Quoted 8 lines
Quoted 4 lines
(quoted diff) +2 -1
-static void unregister_wlags_sysfs(struct net_device *) { return; };
+#define register_wlags_sysfs(net_device) { }
+#define unregister_wlags_sysfs(net_device) { }

 #endif

Yes, that works, but a better fix would be to remove the semicolons after the function close braces.
---

Why would it be better? With a macro you avoid the overhead of a function call that does nothing.
I personally think a macro fit better in this case.

Best regards,

-----------------------------------------
Javier Martínez Canillas
+595 981 88 66 58

#3 lore raw
Quoted 11 lines · Javier Martinez Canillas
Quoted 11 lines

drivers/staging/wlags49_h2/wl_sysfs.h line 7

Quoted 8 lines

extern void register_wlags_sysfs(struct net_device *); extern void unregister_wlags_sysfs(struct net_device *); #else

drivers/staging/wlags49_h2/wl_sysfs.h +2 -2
-static void register_wlags_sysfs(struct net_device *) { return; };
-static void unregister_wlags_sysfs(struct net_device *) { return; };
+#define register_wlags_sysfs(net_device) { }
+#define unregister_wlags_sysfs(net_device) { }
 #endif

Yes, that works, but a better fix would be to remove the semicolons after the function close braces.
---

Quoted 2 lines

Why would it be better? With a macro you avoid the overhead of a function call that does nothing.

Check the generated code.

$ make drivers/staging/wlags49_h2/wl_sysfs.lst
Quoted 1 line

I personally think a macro fit better in this case.

Check the general kernel use of macros vs functions. Functions verify proper arguments, macros do not.

#4 lore raw
Quoted 7 lines · Joe Perches

On Fri, 2010-06-11 at 08:46 -0400, Javier Martinez Canillas wrote:

Check the general kernel use of macros vs functions. Functions verify proper arguments, macros do not.

I see. thank you very much for clarify this. I'm will generate a correct patch and resend.

Best regards,

-----------------------------------------
Javier Martínez Canillas
+595 981 88 66 58
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html