public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Miles Chen <miles.chen@mediatek.com>
To: Joe Perches <joe@perches.com>
Cc: Yingjoe Chen <yingjoe.chen@mediatek.com>,
	Andy Whitcroft <apw@canonical.com>,
	<linux-mediatek@lists.infradead.org>,
	<linux-kernel@vger.kernel.org>, <wsd_upstream@mediatek.com>
Subject: Re: [PATCH] checkpatch: avoid default n
Date: Thu, 4 Jul 2019 13:48:03 +0800	[thread overview]
Message-ID: <1562219283.6549.2.camel@mtkswgap22> (raw)
In-Reply-To: <c8d5cc6171d2cff131e8600ac57e2eb441812617.camel@perches.com>

On Wed, 2019-07-03 at 08:37 -0700, Joe Perches wrote:
> On Wed, 2019-07-03 at 17:03 +0800, Yingjoe Chen wrote:
> > On Wed, 2019-07-03 at 01:42 -0700, Joe Perches wrote:
> > > On Wed, 2019-07-03 at 16:30 +0800, Miles Chen wrote:
> > > > This change reports a warning when "default n" is used.
> > > > 
> > > > I have seen several "remove default n" patches, so I think
> > > > it might be helpful to add this test in checkpatch.
> > > > DEFAULT_VALUE_STYLE
> > > > tested:
> > > > WARNING: 'default n' is the default value, no need to write it explicitly.
> > > > +       default n
> > > 
> > > I don't think this is reasonable as there are
> > > several uses like:
> > > 
> > > 		default y
> > > 		default n if <foo>
> > > 
> > > For instance:
> > > 
> > > arch/alpha/Kconfig-config ALPHA_WTINT
> > > arch/alpha/Kconfig-     bool "Use WTINT" if ALPHA_SRM || ALPHA_GENERIC
> > > arch/alpha/Kconfig-     default y if ALPHA_QEMU
> > > arch/alpha/Kconfig:     default n if ALPHA_EV5 || ALPHA_EV56 || (ALPHA_EV4 && !ALPHA_LCA)
> > > arch/alpha/Kconfig:     default n if !ALPHA_SRM && !ALPHA_GENERIC
> > 
> > Hi,
> > 
> > 
> > I've sent similar patch in 2016, my version won't complain about these.
> > 
> > https://lkml.org/lkml/2016/4/22/580
> 
> Hi again.
> 
> https://lore.kernel.org/lkml/1461259011.1918.23.camel@perches.com/
> 
> I would prefer a generic solution that also handles the
> quoted use.
> 
> $ git grep -P 'default\s*\"[ynm]"' -- '*/Kconfig*'
> arch/mips/Kconfig:      default "y"
> arch/mips/Kconfig:      default "y"
> arch/mips/Kconfig:      default "y"
> arch/mips/Kconfig:      default "y"
> arch/mips/cavium-octeon/Kconfig:        default "n"
> arch/mips/cavium-octeon/Kconfig:        default "y"
> arch/mips/cavium-octeon/Kconfig:        default "y"
> arch/mips/cavium-octeon/Kconfig:        default "y"
> arch/mips/cavium-octeon/Kconfig:        default "y"
> arch/mips/cavium-octeon/Kconfig:        default "y"
> arch/mips/cavium-octeon/Kconfig:        default "y"
> arch/powerpc/Kconfig:   default "y" if PPC_POWERNV
> arch/powerpc/Kconfig:   default "y" if PPC_POWERNV
> arch/powerpc/Kconfig:   default "n"
> drivers/auxdisplay/Kconfig:     default "n"
> drivers/crypto/Kconfig: default "m"
> drivers/rapidio/devices/Kconfig:        default "n"
> 
> or maybe 2 separate patches.
> 
> And the "default y" case and probably the
> "default \!?EXPERT" is or should be generally
> discouraged.  Especially for drivers.
> 
> https://lore.kernel.org/lkml/CAHk-=wiZ24JuVehJ5sEC0UG1Gk2nvB363wO02RRsR1oEht6R9Q@mail.gmail.com/
> 
> 
Thanks for your comment, I'll send another patch for these cases:
1. default "[ynm]"
2. default \!?EXPERT
3. default n$



  reply	other threads:[~2019-07-04  5:48 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-03  8:30 [PATCH] checkpatch: avoid default n Miles Chen
2019-07-03  8:42 ` Joe Perches
2019-07-03  8:58   ` Yingjoe Chen
2019-07-03  9:03   ` Yingjoe Chen
2019-07-03 15:37     ` Joe Perches
2019-07-04  5:48       ` Miles Chen [this message]
2019-07-03 11:22   ` Miles Chen

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=1562219283.6549.2.camel@mtkswgap22 \
    --to=miles.chen@mediatek.com \
    --cc=apw@canonical.com \
    --cc=joe@perches.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=wsd_upstream@mediatek.com \
    --cc=yingjoe.chen@mediatek.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