* [Patch] drbd: check MODULE for THIS_MODULE
@ 2012-04-03 6:13 Cong Wang
2012-04-09 23:14 ` Andrew Morton
0 siblings, 1 reply; 3+ messages in thread
From: Cong Wang @ 2012-04-03 6:13 UTC (permalink / raw)
To: linux-kernel; +Cc: Andrew Morton, Lars Ellenberg, WANG Cong, drbd-user
THIS_MODULE is NULL only when drbd is compiled as built-in,
so the #ifdef CONFIG_MODULES should be #ifdef MODULE instead.
This fixes the warning:
drivers/block/drbd/drbd_main.c: In function ‘drbd_buildtag’:
drivers/block/drbd/drbd_main.c:4187:24: warning: the comparison will always evaluate as ‘true’ for the address of ‘__this_module’ will never be NULL [-Waddress]
Cc: Lars Ellenberg <drbd-dev@lists.linbit.com>
Signed-off-by: WANG Cong <xiyou.wangcong@gmail.com>
---
diff --git a/drivers/block/drbd/drbd_main.c b/drivers/block/drbd/drbd_main.c
index 211fc44..96c432f 100644
--- a/drivers/block/drbd/drbd_main.c
+++ b/drivers/block/drbd/drbd_main.c
@@ -4183,12 +4183,11 @@ const char *drbd_buildtag(void)
static char buildtag[38] = "\0uilt-in";
if (buildtag[0] == 0) {
-#ifdef CONFIG_MODULES
- if (THIS_MODULE != NULL)
- sprintf(buildtag, "srcversion: %-24s", THIS_MODULE->srcversion);
- else
+#ifdef MODULE
+ sprintf(buildtag, "srcversion: %-24s", THIS_MODULE->srcversion);
+#else
+ buildtag[0] = 'b';
#endif
- buildtag[0] = 'b';
}
return buildtag;
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Patch] drbd: check MODULE for THIS_MODULE
2012-04-03 6:13 [Patch] drbd: check MODULE for THIS_MODULE Cong Wang
@ 2012-04-09 23:14 ` Andrew Morton
2012-04-12 8:33 ` [Drbd-dev] " Lars Ellenberg
0 siblings, 1 reply; 3+ messages in thread
From: Andrew Morton @ 2012-04-09 23:14 UTC (permalink / raw)
To: Cong Wang; +Cc: linux-kernel, Lars Ellenberg, drbd-user
On Tue, 3 Apr 2012 14:13:36 +0800
Cong Wang <xiyou.wangcong@gmail.com> wrote:
> THIS_MODULE is NULL only when drbd is compiled as built-in,
> so the #ifdef CONFIG_MODULES should be #ifdef MODULE instead.
>
> This fixes the warning:
>
> drivers/block/drbd/drbd_main.c: In function ___drbd_buildtag___:
> drivers/block/drbd/drbd_main.c:4187:24: warning: the comparison will always evaluate as ___true___ for the address of _____this_module___ will never be NULL [-Waddress]
>
> Cc: Lars Ellenberg <drbd-dev@lists.linbit.com>
> Signed-off-by: WANG Cong <xiyou.wangcong@gmail.com>
>
> ---
> diff --git a/drivers/block/drbd/drbd_main.c b/drivers/block/drbd/drbd_main.c
> index 211fc44..96c432f 100644
> --- a/drivers/block/drbd/drbd_main.c
> +++ b/drivers/block/drbd/drbd_main.c
> @@ -4183,12 +4183,11 @@ const char *drbd_buildtag(void)
> static char buildtag[38] = "\0uilt-in";
>
> if (buildtag[0] == 0) {
> -#ifdef CONFIG_MODULES
> - if (THIS_MODULE != NULL)
> - sprintf(buildtag, "srcversion: %-24s", THIS_MODULE->srcversion);
> - else
> +#ifdef MODULE
> + sprintf(buildtag, "srcversion: %-24s", THIS_MODULE->srcversion);
> +#else
> + buildtag[0] = 'b';
> #endif
> - buildtag[0] = 'b';
> }
>
> return buildtag;
If the MODULE_SRCVERSION_ALL help in init/Kconfig is to be believed,
this should depend on CONFIG_MODULE_SRCVERSION_ALL?
But drbd is the only driver in all of Linux which plays with
srcversion. Can we just delete this code?
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Drbd-dev] [Patch] drbd: check MODULE for THIS_MODULE
2012-04-09 23:14 ` Andrew Morton
@ 2012-04-12 8:33 ` Lars Ellenberg
0 siblings, 0 replies; 3+ messages in thread
From: Lars Ellenberg @ 2012-04-12 8:33 UTC (permalink / raw)
To: Andrew Morton; +Cc: Cong Wang, linux-kernel, Lars Ellenberg
On Mon, Apr 09, 2012 at 04:14:27PM -0700, Andrew Morton wrote:
> On Tue, 3 Apr 2012 14:13:36 +0800
> Cong Wang <xiyou.wangcong@gmail.com> wrote:
>
> > THIS_MODULE is NULL only when drbd is compiled as built-in,
> > so the #ifdef CONFIG_MODULES should be #ifdef MODULE instead.
> >
> > This fixes the warning:
> >
> > drivers/block/drbd/drbd_main.c: In function ___drbd_buildtag___:
> > drivers/block/drbd/drbd_main.c:4187:24: warning: the comparison will always evaluate as ___true___ for the address of _____this_module___ will never be NULL [-Waddress]
> >
> > Cc: Lars Ellenberg <drbd-dev@lists.linbit.com>
> > Signed-off-by: WANG Cong <xiyou.wangcong@gmail.com>
> >
> > ---
> > diff --git a/drivers/block/drbd/drbd_main.c b/drivers/block/drbd/drbd_main.c
> > index 211fc44..96c432f 100644
> > --- a/drivers/block/drbd/drbd_main.c
> > +++ b/drivers/block/drbd/drbd_main.c
> > @@ -4183,12 +4183,11 @@ const char *drbd_buildtag(void)
> > static char buildtag[38] = "\0uilt-in";
> >
> > if (buildtag[0] == 0) {
> > -#ifdef CONFIG_MODULES
> > - if (THIS_MODULE != NULL)
> > - sprintf(buildtag, "srcversion: %-24s", THIS_MODULE->srcversion);
> > - else
> > +#ifdef MODULE
> > + sprintf(buildtag, "srcversion: %-24s", THIS_MODULE->srcversion);
> > +#else
> > + buildtag[0] = 'b';
> > #endif
> > - buildtag[0] = 'b';
> > }
> >
> > return buildtag;
>
> If the MODULE_SRCVERSION_ALL help in init/Kconfig is to be believed,
> this should depend on CONFIG_MODULE_SRCVERSION_ALL?
>
> But drbd is the only driver in all of Linux which plays with
> srcversion. Can we just delete this code?
Technically we sure can.
cat /proc/drbd is the first thing we ask for in problem reports, and it
sure helps and saves a few roundtrips knowing which exact version of
in-tree or out-of-tree drbd version is in use.
For an out-of-tree build, we print the exact git-hash there.
For an in-tree build, the srcversion was the "obvious" substitute.
If it is not too much trouble, I'd like to keep that info.
Lars
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-04-12 8:41 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-03 6:13 [Patch] drbd: check MODULE for THIS_MODULE Cong Wang
2012-04-09 23:14 ` Andrew Morton
2012-04-12 8:33 ` [Drbd-dev] " Lars Ellenberg
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.