From: Lee Jones <lee.jones@linaro.org>
To: Andy Whitcroft <apw@canonical.com>, Joe Perches <joe@perches.com>
Cc: linux-kernel@vger.kernel.org
Subject: Checkpatch query
Date: Mon, 21 Jul 2014 12:39:49 +0100 [thread overview]
Message-ID: <20140721113948.GX30888@lee--X1> (raw)
Hi Andy, Joe,
When running checkpatch on drivers/mfd/tps80031.c I recieve the
following warning:
> WARNING: Possible switch case/default not preceeded by break or
> fallthrough comment
> #337: FILE: drivers/mfd/tps80031.c:337:
> + case TPS80031_BACKUP_REG:
>
> total: 0 errors, 1 warnings, 573 lines checked
... but we use switch statement fall through all the time when
identifying different types of registers used with Regmap. Placing a
fall-through comment between them all sounds very messy to me.
Also, the warning only fires on 'case's which do not use '...'
notation, which seems a little odd.
Anyway, I'm not sure placing a 'fall through' comment makes the code
any cleaner or reduces possible failure rate in any way. Is there any
chance that this check can be removed?
> static bool rd_wr_reg_id0(struct device *dev, unsigned int reg)
> {
> switch (reg) {
> case TPS80031_SMPS1_CFG_FORCE ... TPS80031_SMPS2_CFG_VOLTAGE:
> return true;
> default:
> return false;
> }
> }
>
> static bool rd_wr_reg_id1(struct device *dev, unsigned int reg)
> {
> switch (reg) {
> case TPS80031_SECONDS_REG ... TPS80031_RTC_RESET_STATUS_REG:
> case TPS80031_VALIDITY0 ... TPS80031_VALIDITY7:
> case TPS80031_PHOENIX_START_CONDITION ... TPS80031_KEY_PRESS_DUR_CFG:
> case TPS80031_SMPS4_CFG_TRANS ... TPS80031_SMPS3_CFG_VOLTAGE:
> case TPS80031_BROADCAST_ADDR_ALL ... TPS80031_BROADCAST_ADDR_CLK_RST:
> case TPS80031_VANA_CFG_TRANS ... TPS80031_LDO7_CFG_VOLTAGE:
> case TPS80031_REGEN1_CFG_TRANS ... TPS80031_TMP_CFG_STATE:
> case TPS80031_PREQ1_RES_ASS_A ... TPS80031_PREQ3_RES_ASS_C:
> case TPS80031_SMPS_OFFSET ... TPS80031_BATDEBOUNCING:
> case TPS80031_CFG_INPUT_PUPD1 ... TPS80031_CFG_SMPS_PD:
> case TPS80031_BACKUP_REG:
> return true;
> default:
> return false;
> }
> }
>
> static bool is_volatile_reg_id1(struct device *dev, unsigned int reg)
> {
> switch (reg) {
> case TPS80031_SMPS4_CFG_TRANS ... TPS80031_SMPS3_CFG_VOLTAGE:
> case TPS80031_VANA_CFG_TRANS ... TPS80031_LDO7_CFG_VOLTAGE:
> case TPS80031_REGEN1_CFG_TRANS ... TPS80031_TMP_CFG_STATE:
> case TPS80031_PREQ1_RES_ASS_A ... TPS80031_PREQ3_RES_ASS_C:
> case TPS80031_SMPS_OFFSET ... TPS80031_BATDEBOUNCING:
> case TPS80031_CFG_INPUT_PUPD1 ... TPS80031_CFG_SMPS_PD:
> return true;
> default:
> return false;
> }
> }
--
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
next reply other threads:[~2014-07-21 11:39 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-21 11:39 Lee Jones [this message]
2014-07-21 13:06 ` Checkpatch query Joe Perches
2014-07-21 13:13 ` [PATCH] checkpatch: Allow case labels with ranges Joe Perches
2014-07-21 13:21 ` Lee Jones
2014-07-21 14:28 ` Joe Perches
2014-07-21 14:54 ` Lee Jones
[not found] ` <20140721143013.11ec351d47a9f822313247d2@linux-foundation.org>
2014-07-21 23:09 ` [PATCH] checkpatch: Fix false positive MISSING_BREAK warnings with --file Joe Perches
2014-07-22 7:05 ` Lee Jones
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=20140721113948.GX30888@lee--X1 \
--to=lee.jones@linaro.org \
--cc=apw@canonical.com \
--cc=joe@perches.com \
--cc=linux-kernel@vger.kernel.org \
/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