All of lore.kernel.org
 help / color / mirror / Atom feed
From: James Bottomley <James.Bottomley@HansenPartnership.com>
To: Paul Gortmaker <paul.gortmaker@windriver.com>
Cc: Stephen Cameron <stephenmcameron@gmail.com>,
	"Stephen M. Cameron" <scameron@beardog.cce.hp.com>,
	linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org,
	matthew.gates@hp.com, thenzl@redhat.com,
	akpm@linux-foundation.org, mikem@beardog.cce.hp.com
Subject: Re: [PATCH 14/17] hpsa: use new IS_ENABLED macro
Date: Mon, 23 Apr 2012 15:56:23 +0100	[thread overview]
Message-ID: <1335192983.4191.25.camel@dabdike.lan> (raw)
In-Reply-To: <4F955F78.8070604@windriver.com>

On Mon, 2012-04-23 at 09:56 -0400, Paul Gortmaker wrote:
> On 12-04-22 10:20 PM, Stephen Cameron wrote:
> > On Sun, Apr 22, 2012 at 1:12 PM, Paul Gortmaker
> > <paul.gortmaker@windriver.com> wrote:
> >> On Fri, Apr 20, 2012 at 11:07 AM, Stephen M. Cameron
> >> <scameron@beardog.cce.hp.com> wrote:
> >>> From: Stephen M. Cameron <scameron@beardog.cce.hp.com>
> >>>
> >>> Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
> >>
> >> You've not written a commit log, so I'm left guessing what the
> >> intended rationale is here.  COMPAT, X86 and PCI_MSI are
> >> I believe all bool, so why make this change?  To me it gives
> >> a misleading message that some level of modular awareness
> >> is needed here, when there really isn't any such need.
> > 
> > Well, I saw this commit go by: 69349c2dc01c489eccaa4c472542c08e370c6d7e
> > 
> >    Using IS_ENABLED() within C (vs.  within CPP #if statements) in its
> >    current form requires us to actually define every possible bool/tristate
> >    Kconfig option twice (__enabled_* and __enabled_*_MODULE variants).
> >    [...]
> > 
> > and so I kind of thought IS_ENABLED is the new way to do that sort of thing.

I don't think you need to change the driver unless there's a good
reason.  In kernel terms, it's usually better to wait a bit to see if
the wheels fall off any particular bandwagon before leaping on it ...

> In my opinion, IS_ENABLED can/should be used when you have:
> 
> #if defined(CONFIG_FOO) || defined(CONFIG_FOO_MODULE)
> 
> i.e. "is this driver built in, or can it be loaded as a module?"
> The CONFIG_FOO_MODULE doesn't appear in your .config -- it is auto
> generated by Kbuild infrastructure.
> 
> It will do the Right Thing even for cases where CONFIG_FOO_MODULE
> is impossible, but it does as I've said, give the wrong impression
> that there is some possibility of modular presence.  At least to
> those who are familiar with the implementation and why it exists.
> [I'll grant you that the name doesn't convey the use case too well.]
> 
> > 
> > Perhaps I'm wrong about that.  Obviously the patch is not _needed_ for
> > things to work.
> 
> I don't think we want to go and mass replace all existing cases of
> 
>    #ifdef CONFIG_SOME_BOOL
> 
> with:
> 
>    #if IS_ENABLED(CONFIG_SOME_BOOL)
> 
> There is no value add.  However, replacing instances of:
> 
>    #if defined(CONFIG_FOO) || defined(CONFIG_FOO_MODULE)
> 
> with:
> 
>    #if IS_ENABLED(CONFIG_FOO)
> 
> is in my opinion, a reasonable thing to do.  It is shorter, and
> it does hide the internally generated _MODULE suffixed "shadow"
> variables from appearing directly in the main source files.  And
> it tells you that the author was thinking about both the built
> in and the modular cases when they wrote it.

To be honest, I think we want to use #if IS_ENABLED() for all cases
going forwards, including the boolean case.

The reason is that it's an easier design pattern.  If we have the #ifdef
CONFIG_X vs #if IS_ENABLED(CONFIG_X) depending on whether CONFIG_X can
be modular or not it's just creating pointless rules that someone will
annoy us all by enforcing in a checkpatch or some other script.  Whereas
#if IS_ENABLED(CONFIG_X) is obvious and simple.

James



  reply	other threads:[~2012-04-23 14:56 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-20 15:06 [PATCH 00/17] hpsa updates for April, 2012 Stephen M. Cameron
2012-04-20 15:06 ` [PATCH 01/17] hpsa: call pci_disable_device on driver unload Stephen M. Cameron
2012-04-20 15:06 ` [PATCH 02/17] hpsa: do not skip disabled devices Stephen M. Cameron
2012-04-20 15:06 ` [PATCH 03/17] hpsa: enable bus master bit after pci_enable_device Stephen M. Cameron
2012-04-20 18:41   ` Khalid Aziz
2012-04-20 20:06     ` scameron
2012-04-20 15:06 ` [PATCH 04/17] hpsa: suppress excessively chatty error messages Stephen M. Cameron
2012-04-20 22:49   ` Shergill, Gurinder
2012-04-20 22:49     ` Shergill, Gurinder
2012-04-20 15:06 ` [PATCH 05/17] hpsa: do not read from controller unnecessarily in completion code Stephen M. Cameron
2012-04-20 15:06 ` [PATCH 06/17] hpsa: retry driver initiated commands on busy status Stephen M. Cameron
2012-04-20 22:51   ` Shergill, Gurinder
2012-04-20 22:51     ` Shergill, Gurinder
2012-04-20 15:06 ` [PATCH 07/17] hpsa: remove unused parameter from finish_cmd Stephen M. Cameron
2012-04-20 15:07 ` [PATCH 08/17] hpsa: add abort error handler function Stephen M. Cameron
2012-04-20 15:07 ` [PATCH 09/17] hpsa: do aborts two ways Stephen M. Cameron
2012-04-20 15:07 ` [PATCH 10/17] hpsa: factor out tail calls to next_command() in process_(non)indexed_cmd() Stephen M. Cameron
2012-04-20 15:07 ` [PATCH 11/17] hpsa: use multiple reply queues Stephen M. Cameron
2012-04-20 15:07 ` [PATCH 12/17] hpsa: refine interrupt handler locking for greater concurrency Stephen M. Cameron
2012-04-20 15:07 ` [PATCH 13/17] hpsa: factor out hpsa_free_irqs_and_disable_msix Stephen M. Cameron
2012-04-20 15:07 ` [PATCH 14/17] hpsa: use new IS_ENABLED macro Stephen M. Cameron
2012-04-22 18:12   ` Paul Gortmaker
2012-04-22 18:12     ` Paul Gortmaker
2012-04-23  2:20     ` Stephen Cameron
2012-04-23  2:20       ` Stephen Cameron
2012-04-23 13:56       ` Paul Gortmaker
2012-04-23 13:56         ` Paul Gortmaker
2012-04-23 14:56         ` James Bottomley [this message]
2012-04-24  1:43           ` Paul Gortmaker
2012-04-24  8:25             ` James Bottomley
2012-04-24 15:15               ` Paul Gortmaker
2012-04-24 15:15                 ` Paul Gortmaker
2012-04-25 15:11                 ` scameron
2012-04-20 15:07 ` [PATCH 15/17] hpsa: add new RAID level "1(ADM)" Stephen M. Cameron
2012-04-20 15:07 ` [PATCH 16/17] hpsa: removed unused member maxQsinceinit Stephen M. Cameron
2012-04-20 15:07 ` [PATCH 17/17] hpsa: dial down lockup detection during firmware flash Stephen M. Cameron

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=1335192983.4191.25.camel@dabdike.lan \
    --to=james.bottomley@hansenpartnership.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=matthew.gates@hp.com \
    --cc=mikem@beardog.cce.hp.com \
    --cc=paul.gortmaker@windriver.com \
    --cc=scameron@beardog.cce.hp.com \
    --cc=stephenmcameron@gmail.com \
    --cc=thenzl@redhat.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 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.