alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Lars-Peter Clausen <lars@metafoo.de>
To: Takashi Iwai <tiwai@suse.de>, "Harvey, Ryan" <Ryan.Harvey@cirrus.com>
Cc: Joe Perches <joe@perches.com>,
	"alsa-devel@alsa-project.org" <alsa-devel@alsa-project.org>
Subject: Re: Checkpatch warnings on switch case fallthru
Date: Sat, 9 Apr 2016 18:07:40 +0200	[thread overview]
Message-ID: <570928CC.6030404@metafoo.de> (raw)
In-Reply-To: <s5hfuuvcfsr.wl-tiwai@suse.de>

On 04/09/2016 11:06 AM, Takashi Iwai wrote:
> On Fri, 08 Apr 2016 00:23:03 +0200,
> Harvey, Ryan wrote:
>>
>> Hello,
>>
>> I receive a set of checkpatch warnings against my switch fallthru
>> structure in readable_registers().  I¹m able to eliminate these warnings
>> with a preceding comment, but that does messy the code.  Is there a method
>> better than switch for accomplishing this?
>>
>> static bool cs43130_readable_register(struct device *dev, unsigned int reg)
>> {
>>         switch (reg) {
>>         case CS43130_DEVID_AB ... CS43130_SYS_CLK_CTL_1:
>>         case CS43130_PWDN_CTL:
>>         case CS43130_PLL_SET_1 ... CS43130_PLL_SET_6:
>>         case CS43130_PLL_SET_7:
>>         case CS43130_PLL_SET_8:
>>         case CS43130_PLL_SET_9:
>>         case CS43130_PLL_SET_10:
>>         case CS43130_CLKOUT_CTL:
>>         case CS43130_ASP_NUM_1 ... CS43130_ASP_FRAME_CONF:
>>         case CS43130_HP_OUT_CTL_1:
>>         case CS43130_PCM_FILT_OPT ... CS43130_PCM_PATH_CTL_2:
>>         case CS43130_CLASS_H_CTL:
>>         case CS43130_HP_DETECT ... CS43130_HP_STATUS:
>>         case CS43130_HP_LOAD_1:
>>         case CS43130_HP_LOAD_STAT:
>>         case CS43130_INT_MASK_1 ... CS43130_INT_MASK_5:
>>                 return true;
>>         default:
>>                 return false;
>>         }
>> }
>>
>>
>> 140: [WARNING] Possible switch case/default not preceeded by break or
>> fallthrough comment
>> +	case CS43130_PLL_SET_7:
>> 141: [WARNING] Possible switch case/default not preceeded by break or
>> fallthrough comment
>> +	case CS43130_PLL_SET_8:
>> 142: [WARNING] Possible switch case/default not preceeded by break or
>> fallthrough comment
>> +	case CS43130_PLL_SET_9:
>> 143: [WARNING] Possible switch case/default not preceeded by break or
>> fallthrough comment
>> +	case CS43130_PLL_SET_10:
>> 144: [WARNING] Possible switch case/default not preceeded by break or
>> fallthrough comment
>> +	case CS43130_CLKOUT_CTL:
>> 152: [WARNING] Possible switch case/default not preceeded by break or
>> fallthrough comment
>> +	case CS43130_HP_OUT_CTL_1:
>> 154: [WARNING] Possible switch case/default not preceeded by break or
>> fallthrough comment
>> +	case CS43130_CLASS_H_CTL:
>> 156: [WARNING] Possible switch case/default not preceeded by break or
>> fallthrough comment
>> +	case CS43130_HP_LOAD_1:
>> 160: [WARNING] Possible switch case/default not preceeded by break or
>> fallthrough comment
>> +	case CS43130_HP_LOAD_STAT:
> 
> You may ignore the warnings.  The purpose of checkpatch is to improve
> the code readability, and what it suggests is exactly opposite.

It's a bug in checkpatch. It seems to get confused by the "...". The
best approach to solving those warnings is to create a fix for checkpatch.

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

  reply	other threads:[~2016-04-09 16:07 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-07 22:23 Checkpatch warnings on switch case fallthru Harvey, Ryan
2016-04-09  9:06 ` Takashi Iwai
2016-04-09 16:07   ` Lars-Peter Clausen [this message]
2016-04-09 19:45     ` Joe Perches
2016-04-11  2:26     ` [PATCH] checkpatch: Improve missing break for switch/case tests Joe Perches
2016-04-11  5:04       ` Joe Perches

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=570928CC.6030404@metafoo.de \
    --to=lars@metafoo.de \
    --cc=Ryan.Harvey@cirrus.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=joe@perches.com \
    --cc=tiwai@suse.de \
    /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;
as well as URLs for NNTP newsgroup(s).