public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] staging/wlags49_hs: Fix build error when CONFIG_SYSFS is
@ 2010-06-11  6:35 Javier Martinez Canillas
  2010-06-11  6:41 ` [PATCH] staging/wlags49_hs: Fix build error when CONFIG_SYSFS Joe Perches
  2010-06-11 22:18 ` Javier Martinez Canillas
  0 siblings, 2 replies; 6+ messages in thread
From: Javier Martinez Canillas @ 2010-06-11  6:35 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Henk de Groot, linux-kernel, devel,
	kernel-janitors

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

This patch solves the issue.

Signed-off-by: Javier Martinez Canillas <martinez.javier@gmail.com>
---
 drivers/staging/wlags49_h2/wl_sysfs.h |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/wlags49_h2/wl_sysfs.h b/drivers/staging/wlags49_h2/wl_sysfs.h
index 6d96d03..7d5895d 100644
--- a/drivers/staging/wlags49_h2/wl_sysfs.h
+++ b/drivers/staging/wlags49_h2/wl_sysfs.h
@@ -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
-- 
1.7.0.4






^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] staging/wlags49_hs: Fix build error when CONFIG_SYSFS
  2010-06-11  6:35 [PATCH] staging/wlags49_hs: Fix build error when CONFIG_SYSFS is Javier Martinez Canillas
@ 2010-06-11  6:41 ` Joe Perches
  2010-06-11 12:46   ` [PATCH] staging/wlags49_hs: Fix build error when CONFIG_SYSFS is Javier Martinez Canillas
  2010-06-11 22:18 ` Javier Martinez Canillas
  1 sibling, 1 reply; 6+ messages in thread
From: Joe Perches @ 2010-06-11  6:41 UTC (permalink / raw)
  To: Javier Martinez Canillas
  Cc: Greg Kroah-Hartman, Henk de Groot, linux-kernel, devel,
	kernel-janitors

On Fri, 2010-06-11 at 02:35 -0400, Javier Martinez Canillas wrote:
> With current linux-next I got a build error with wlags49_h2 driver when CONFIG_SYSFS is not set.
> diff --git a/drivers/staging/wlags49_h2/wl_sysfs.h b/drivers/staging/wlags49_h2/wl_sysfs.h
> index 6d96d03..7d5895d 100644
> --- a/drivers/staging/wlags49_h2/wl_sysfs.h
> +++ b/drivers/staging/wlags49_h2/wl_sysfs.h
> @@ -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.
---
diff --git a/drivers/staging/wlags49_h2/wl_sysfs.h
b/drivers/staging/wlags49_h2/wl_sysfs.h
index 6d96d03..7d5895d 100644
--- a/drivers/staging/wlags49_h2/wl_sysfs.h
+++ b/drivers/staging/wlags49_h2/wl_sysfs.h
@@ -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



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] staging/wlags49_hs: Fix build error when CONFIG_SYSFS is
  2010-06-11  6:41 ` [PATCH] staging/wlags49_hs: Fix build error when CONFIG_SYSFS Joe Perches
@ 2010-06-11 12:46   ` Javier Martinez Canillas
  2010-06-11 16:52     ` [PATCH] staging/wlags49_hs: Fix build error when CONFIG_SYSFS Joe Perches
  0 siblings, 1 reply; 6+ messages in thread
From: Javier Martinez Canillas @ 2010-06-11 12:46 UTC (permalink / raw)
  To: Joe Perches
  Cc: Greg Kroah-Hartman, Henk de Groot, linux-kernel, devel,
	kernel-janitors

>>  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.
> ---

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] staging/wlags49_hs: Fix build error when CONFIG_SYSFS
  2010-06-11 12:46   ` [PATCH] staging/wlags49_hs: Fix build error when CONFIG_SYSFS is Javier Martinez Canillas
@ 2010-06-11 16:52     ` Joe Perches
  2010-06-11 22:12       ` [PATCH] staging/wlags49_hs: Fix build error when CONFIG_SYSFS is Javier Martinez Canillas
  0 siblings, 1 reply; 6+ messages in thread
From: Joe Perches @ 2010-06-11 16:52 UTC (permalink / raw)
  To: Javier Martinez Canillas
  Cc: Henk de Groot, devel, Greg Kroah-Hartman, kernel-janitors,
	linux-kernel

On Fri, 2010-06-11 at 08:46 -0400, Javier Martinez Canillas wrote:
> >>  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.
> > ---
> 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

> 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.



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] staging/wlags49_hs: Fix build error when CONFIG_SYSFS is
  2010-06-11 16:52     ` [PATCH] staging/wlags49_hs: Fix build error when CONFIG_SYSFS Joe Perches
@ 2010-06-11 22:12       ` Javier Martinez Canillas
  0 siblings, 0 replies; 6+ messages in thread
From: Javier Martinez Canillas @ 2010-06-11 22:12 UTC (permalink / raw)
  To: Joe Perches
  Cc: Henk de Groot, devel, Greg Kroah-Hartman, kernel-janitors,
	linux-kernel

On Fri, Jun 11, 2010 at 12:52 PM, Joe Perches <joe@perches.com> wrote:
> 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 majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH] staging/wlags49_hs: Fix build error when CONFIG_SYSFS is
  2010-06-11  6:35 [PATCH] staging/wlags49_hs: Fix build error when CONFIG_SYSFS is Javier Martinez Canillas
  2010-06-11  6:41 ` [PATCH] staging/wlags49_hs: Fix build error when CONFIG_SYSFS Joe Perches
@ 2010-06-11 22:18 ` Javier Martinez Canillas
  1 sibling, 0 replies; 6+ messages in thread
From: Javier Martinez Canillas @ 2010-06-11 22:18 UTC (permalink / raw)
  To: Joe Perches, Henk de Groot, devel, Greg Kroah-Hartman,
	kernel-janitors, linux-kernel

I got a build error in linux-next while compiling wlags49_h2 driver when CONFIG_SYSFS not set.

This is the second version of this patch, as Joe recommended I'm using functions instead of macros.

Thanks a lot

Signed-off-by: Javier Martinez Canillas <martinez.javier@gmail.com>
---
 drivers/staging/wlags49_h2/wl_sysfs.h |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/wlags49_h2/wl_sysfs.h b/drivers/staging/wlags49_h2/wl_sysfs.h
index 6d96d03..fa658c3 100644
--- a/drivers/staging/wlags49_h2/wl_sysfs.h
+++ b/drivers/staging/wlags49_h2/wl_sysfs.h
@@ -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 inline void register_wlags_sysfs(struct net_device *net) { }
+static inline void unregister_wlags_sysfs(struct net_device *net) { }
 #endif
-- 
1.7.0.4





^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2010-06-11 22:18 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-11  6:35 [PATCH] staging/wlags49_hs: Fix build error when CONFIG_SYSFS is Javier Martinez Canillas
2010-06-11  6:41 ` [PATCH] staging/wlags49_hs: Fix build error when CONFIG_SYSFS Joe Perches
2010-06-11 12:46   ` [PATCH] staging/wlags49_hs: Fix build error when CONFIG_SYSFS is Javier Martinez Canillas
2010-06-11 16:52     ` [PATCH] staging/wlags49_hs: Fix build error when CONFIG_SYSFS Joe Perches
2010-06-11 22:12       ` [PATCH] staging/wlags49_hs: Fix build error when CONFIG_SYSFS is Javier Martinez Canillas
2010-06-11 22:18 ` Javier Martinez Canillas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox