public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Tilman Schmidt <tilman@imap.cc>
To: "Randy.Dunlap" <rdunlap@xenotime.net>
Cc: linux-usb-devel@lists.sourceforge.net, hjlipp@web.de,
	linux-kernel@vger.kernel.org, gregkh@suse.de
Subject: Re: [PATCH] reduce syslog clutter (take 2)
Date: Thu, 09 Mar 2006 11:15:31 +0100	[thread overview]
Message-ID: <44100043.2020703@imap.cc> (raw)
In-Reply-To: <20060308214724.cf987bbf.rdunlap@xenotime.net>

[-- Attachment #1: Type: text/plain, Size: 2314 bytes --]

Randy.Dunlap wrote:

>> +#if defined(CONFIG_MODULES) && defined(THIS_MODULE)
>> +#define KMSG_LOCATION_PREFIX THIS_MODULE ? THIS_MODULE->name : __FILE__
>
> Can we get parens around the expression, please?

Will do.

> and does it make sense to test
> #if defined(THIS_MODULE)
> #define KMSG_LOCATION_PREFIX (THIS_MODULE ? ...

Unfortunately, it does.

> If that does make sense (the double testing of THIS_MODULE),
> please explain why it does.

We have the following cases:

- compiling without module support, source file not including linux/module.h
  -> !defined(CONFIG_MODULES) && !defined(THIS_MODULE)
   -> compiling the expression (THIS_MODULE ? THIS_MODULE->name : __FILE__)
      fails with undefined symbol THIS_MODULE

- compiling with module support, source file not including linux/module.h
  -> defined(CONFIG_MODULES) && !defined(THIS_MODULE)
   -> compiling the expression (THIS_MODULE ? THIS_MODULE->name : __FILE__)
      fails with undefined symbol THIS_MODULE

- compiling without module support, source file including linux/module.h
  -> !defined(CONFIG_MODULES) && defined(THIS_MODULE)
   -> compiling the expression (THIS_MODULE ? THIS_MODULE->name : __FILE__)
      fails because THIS_MODULE is defined as a NULL pointer to
      struct module which in this case is an incomplete type (*sigh*)

- compiling with module support, source file including linux/module.h,
  not compiling as a module
  -> defined(CONFIG_MODULES) && defined(THIS_MODULE)
     && THIS_MODULE == ((struct module *)0)
   -> compiling the expression (THIS_MODULE ? THIS_MODULE->name : __FILE__)
      succeeds (hooray), but THIS_MODULE is a NULL pointer, though this
      time the type it points to is at least completely defined

- compiling with module support, source file including linux/module.h,
  compiling as a module
  -> defined(CONFIG_MODULES) && defined(THIS_MODULE)
     && THIS_MODULE == &__this_module
   -> compiling the expression (THIS_MODULE ? THIS_MODULE->name : __FILE__)
      succeeds and THIS_MODULE can actualy be dereferenced

I would like the code to compile and run successfully in all these cases.

--
Tilman Schmidt                    E-Mail: tilman@imap.cc
Bonn, Germany
Diese Nachricht besteht zu 100% aus wiederverwerteten Bits.
Ungeöffnet mindestens haltbar bis: (siehe Rückseite)

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 250 bytes --]

  reply	other threads:[~2006-03-09 10:16 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-03-08 22:54 [PATCH] reduce syslog clutter (take 2) Tilman Schmidt
2006-03-09  5:47 ` Randy.Dunlap
2006-03-09 10:15   ` Tilman Schmidt [this message]
2006-03-09 11:02 ` Andrew Morton
2006-03-09 16:34   ` Randy.Dunlap
2006-03-09 18:43     ` Tilman Schmidt
     [not found]       ` <9a8748490603091058l75aacacsfc5fdba3981fb074@mail.gmail.com>
2006-03-09 19:17         ` Tilman Schmidt
2006-03-09 21:03         ` Andrew Morton
2006-03-09 21:18           ` Pete Zaitcev
2006-03-09 22:42             ` Greg KH

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=44100043.2020703@imap.cc \
    --to=tilman@imap.cc \
    --cc=gregkh@suse.de \
    --cc=hjlipp@web.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb-devel@lists.sourceforge.net \
    --cc=rdunlap@xenotime.net \
    /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