public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jason Baron <jbaron@redhat.com>
To: Greg KH <greg@kroah.com>
Cc: Randy Dunlap <randy.dunlap@oracle.com>,
	linux-kernel@vger.kernel.org, akpm@linux-foundation.org,
	joe@perches.com, nick@nick-andrew.net, sam@ravnborg.org
Subject: Re: [PATCH 1/7] dynamic debug v2 - infrastructure
Date: Wed, 13 Aug 2008 15:05:33 -0400	[thread overview]
Message-ID: <20080813190533.GA6099@redhat.com> (raw)
In-Reply-To: <20080813010804.GA17446@kroah.com>

On Tue, Aug 12, 2008 at 06:08:04PM -0700, Greg KH wrote:
> On Tue, Aug 12, 2008 at 04:46:19PM -0400, Jason Baron wrote:
> > On Tue, Aug 12, 2008 at 01:09:08PM -0700, Greg KH wrote:
> > > So close, can I have a good changelog comment with the patch so people
> > > know what it is when they look in the logs?
> > > 
> > > Care to resend it with that?
> > > 
> > 
> > Base infrastructure to enable per-module debug messages.
> 
> Ah, so close...
> 
> With this patch, I get the following build error:
> 
>   CC [M]  drivers/usb/gadget/u_ether.o
> drivers/usb/gadget/u_ether.c: In function ‘gether_setup’:
> drivers/usb/gadget/u_ether.c:787: error: ‘KBUILD_MODNAME’ undeclared (first use in this function)
> drivers/usb/gadget/u_ether.c:787: error: (Each undeclared identifier is reported only once
> drivers/usb/gadget/u_ether.c:787: error: for each function it appears in.)
> drivers/usb/gadget/u_ether.c:787: error: unknown field ‘Usage’ specified in initializer
> drivers/usb/gadget/u_ether.c:787: error: expected expression before ‘.’ token
> drivers/usb/gadget/u_ether.c:787: error: initializer element is not constant
> drivers/usb/gadget/u_ether.c:787: error: (near initialization for ‘descriptor.hash’)
> drivers/usb/gadget/u_ether.c:787: error: ‘Usage’ undeclared (first use in this function)
> drivers/usb/gadget/u_ether.c:787: error: invalid operands to binary << (have ‘long long int’ and ‘char *’)
> drivers/usb/gadget/u_ether.c:787: error: expected ‘)’ before ‘:’ token
> drivers/usb/gadget/u_ether.c:787: error: invalid operands to binary & (have ‘long long int’ and ‘char *’)
> drivers/usb/gadget/u_ether.c:787: error: invalid operands to binary << (have ‘long long int’ and ‘char *’)
> drivers/usb/gadget/u_ether.c:787: error: expected ‘)’ before ‘:’ token
> drivers/usb/gadget/u_ether.c:787: error: invalid operands to binary & (have ‘long long int’ and ‘char *’)
> drivers/usb/gadget/u_ether.c:787: error: expected ‘)’ before ‘:’ token
> drivers/usb/gadget/u_ether.c:787: warning: passing argument 4 of ‘__dynamic_dbg_enabled_helper’ makes integer from pointer without a cast
> drivers/usb/gadget/u_ether.c:787: error: expected ‘)’ before ‘KBUILD_MODNAME’
> drivers/usb/gadget/u_ether.c:787: warning: too few arguments for format
> make[1]: *** [drivers/usb/gadget/u_ether.o] Error 1
> make: *** [_module_drivers/usb/gadget] Error 2
> 
> 
> Did you try a simple 'make allmodconfig'?
> 
> Also, I cleaned it up a bit to make it pass checkpatch.pl and sparse,
> doesn't anyone run these things anymore...
> 
> I've attached my fixed up version below.
> 
> Any ideas?
> 

I was working on an older kernel and so i didn't see this error.

There seem to be a couple of issues here.

First, KBUILD_MODNAME is not defined during the compile of  u_ether.c because
it is included from multiple sources. It seems that when there are multiple 
sources "modname" is set to a string of all the source names with spaces in 
between. So something used in foo and bar looks like: "foo bar".  From 
scripts/Makefile.lib:

# Note: It's possible that one object gets potentially linked into more
#       than one module. In that case KBUILD_MODNAME will be set to foo_bar,
#       where foo and bar are the name of the modules.
name-fix = $(subst $(comma),_,$(subst -,_,$1))
basename_flags = -D"KBUILD_BASENAME=KBUILD_STR($(call name-fix,$(basetarget)))"
modname_flags  = $(if $(filter 1,$(words $(modname))),\
                 -D"KBUILD_MODNAME=KBUILD_STR($(call name-fix,$(modname)))")
.
.
.


So, the comment says that the KBUILD_MODNAME should be set to "foo_bar" if
its included from multiple files...however, the modname_flags definition is not
doing that. In fact, if there are multiple sources its simply setting a
NULL modname_flag. This issue is independent of the patchset I posted, and
probably is best fixed separately. A patch which resolves this issue:

Signed-off-by: Jason Baron <jbaron@redhat.com>

---
  
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index b4ca38a..639d5dc 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -94,7 +94,8 @@ obj-dirs	:= $(addprefix $(obj)/,$(obj-dirs))
 name-fix = $(subst $(comma),_,$(subst -,_,$1))
 basename_flags = -D"KBUILD_BASENAME=KBUILD_STR($(call name-fix,$(basetarget)))"
 modname_flags  = $(if $(filter 1,$(words $(modname))),\
-                 -D"KBUILD_MODNAME=KBUILD_STR($(call name-fix,$(modname)))")
+		 -D"KBUILD_MODNAME=KBUILD_STR($(call name-fix,$(modname)))",\
+		 -D"KBUILD_MODNAME=KBUILD_STR($(subst $(space),_,$(call name-fix,$(modname))))")
 
 #hash values
 ifdef CONFIG_DYNAMIC_PRINTK_DEBUG


The second issue is then that the hash functions that i introduced don't like 
these spaces either. So on top of the patch set i posted please add the patch
below. The kernel should then compile. I tested this on the 'linux-next' tree,
which did not boot on the system i was using, but i'm not sure it was related 
to this change. 

thanks,

-Jason


Signed-off-by: Jason Baron <jbaron@redhat.com>

---


diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index 639d5dc..3b5455b 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -99,8 +99,8 @@ modname_flags  = $(if $(filter 1,$(words $(modname))),\
 
 #hash values
 ifdef CONFIG_DYNAMIC_PRINTK_DEBUG
-debug_flags = -D"DEBUG_HASH=$(shell ./scripts/basic/hash djb2 $(@D)$(modname))"\
-              -D"DEBUG_HASH2=$(shell ./scripts/basic/hash r5 $(@D)$(modname))"
+debug_flags = -D"DEBUG_HASH=$(shell ./scripts/basic/hash djb2 $(@D)$(subst $(space),_,$(modname)))"\
+              -D"DEBUG_HASH2=$(shell ./scripts/basic/hash r5 $(@D)$(subst $(space),_,$(modname)))"
 else
 debug_flags =
 endif




  parent reply	other threads:[~2008-08-13 19:29 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-15 21:31 [PATCH 1/7] dynamic debug v2 - infrastructure Jason Baron
2008-07-17  7:01 ` Greg KH
2008-07-17 21:20   ` Jason Baron
2008-07-17 22:32     ` Greg KH
2008-07-17 22:56       ` Dominik Brodowski
2008-07-17 23:35         ` Greg KH
2008-07-18  6:37           ` Dominik Brodowski
2008-07-18 14:39       ` Jason Baron
2008-08-08 21:51       ` Jason Baron
2008-08-09  1:07         ` Greg KH
2008-08-11 14:12           ` Jason Baron
2008-08-11 16:45             ` Greg KH
2008-08-09  2:38         ` Randy Dunlap
2008-08-11 17:36           ` Jason Baron
2008-08-11 22:33             ` Greg KH
2008-08-12 19:48               ` Jason Baron
2008-08-12 20:09                 ` Greg KH
2008-08-12 20:46                   ` Jason Baron
2008-08-13  1:08                     ` Greg KH
2008-08-13  1:16                       ` Andrew Morton
2008-08-13  3:38                         ` Greg KH
2008-08-13 20:00                           ` Sam Ravnborg
2008-08-13 22:49                             ` jbaron
2008-08-13 23:54                             ` Greg KH
2008-08-14  1:25                               ` Greg KH
2008-08-13 19:05                       ` Jason Baron [this message]
2008-08-14 14:53                     ` Greg KH
2008-08-14 21:05                       ` Jason Baron
2008-09-16  0:03 ` Rusty Russell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080813190533.GA6099@redhat.com \
    --to=jbaron@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=greg@kroah.com \
    --cc=joe@perches.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nick@nick-andrew.net \
    --cc=randy.dunlap@oracle.com \
    --cc=sam@ravnborg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox