mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Sam Ravnborg <sam@ravnborg.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Martin Schwidefsky <schwidefsky@de.ibm.com>
Subject: Re: [RFC] move #define pr_fmt KBUILD_MODNAME and KMSG_COMPONENT to Makefiles?
Date: Wed, 30 Sep 2009 00:54:59 -0700	[thread overview]
Message-ID: <1254297299.2960.55.camel@Joe-Laptop.home> (raw)
In-Reply-To: <20090930065533.GB13850@merkur.ravnborg.org>

On Wed, 2009-09-30 at 08:55 +0200, Sam Ravnborg wrote:
> On Tue, Sep 29, 2009 at 11:15:04AM -0700, Joe Perches wrote:
> > There are starting to be more uses of
> > #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
> > and
> > #define KMSG_COMPONENT "foo"
> > #define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
> > in kernel sources.
> > 
> > Perhaps it would be better to put these
> > defines in the appropriate Makefile and not
> > sprinkle the sources with them multiple times?
> 
> Maybe I'm a bit dense but I do not quite follow you
> here. What is it you want moved to kbuild here?
> 
> To me it looks more like a logical extension to the
> pr_* macros based on info we already have available.

Hi Sam.

I agree it's a logical extension to what exists
already, unfortunately there are already many
uses of pr_<level> calls, some that use pr_fmt(),
some that use an embedded constant string,
and some with nothing.  Using a predeclared
standardized pr_fmt would be a problem for
those calls that use embedded constant strings.

So today, every file in a module that uses
pr_fmt #defines pr_fmt before the #includes.

#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt

There are starting to be a lot of these and
likely there will be a lot more unless the
defines are standardized somehow.

Per Makefile ccflags would allow a gradual
conversion of the many pr_<level> calls that
are already prefixed with nothing, or constant
strings, or already use pr_fmt with either
KBUILD_MODNAME, KMSG_COMPONENT, or some
other fixed string.

If something like were added to a module Makefile:

	ccflags-y += -D "pr_fmt(fmt)=KBUILD_MODNAME \": \" fmt"

or if necessary a per-file entry in the Makefile:

	CFLAGS_foo.o += -D "pr_fmt(fmt)=KBUILD_MODNAME \": \" fmt"

the number of these #defines pr_fmt in source could be
reduced.

These new Makefiles -D entries could later be stripped
and the pr_fmt define standardized perhaps in the top
level Makefile after the existing pr_<level> calls with
embedded prefix strings in source are modified as necessary.

Something similar could be done in the Makefiles for
KMSG_COMPONENT uses as well.

cheers, Joe


  reply	other threads:[~2009-09-30  7:54 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-29 18:15 Joe Perches
2009-09-30  6:55 ` Sam Ravnborg
2009-09-30  7:54   ` Joe Perches [this message]
2009-09-30  9:20     ` Martin Schwidefsky
2009-09-30 14:52       ` Joe Perches
2009-10-01 11:02         ` Martin Schwidefsky

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=1254297299.2960.55.camel@Joe-Laptop.home \
    --to=joe@perches.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sam@ravnborg.org \
    --cc=schwidefsky@de.ibm.com \
    /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

all inboxes | Powered by JetHome®