From: Alex Elder <elder@ieee.org>
To: "Gustavo A. R. Silva" <gustavoars@kernel.org>,
Johan Hovold <johan@kernel.org>, Alex Elder <elder@kernel.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: greybus-dev@lists.linaro.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH][next] greybus: Use fallthrough pseudo-keyword
Date: Tue, 28 Jul 2020 17:37:05 -0500 [thread overview]
Message-ID: <63871608-e076-26b0-85df-cff11699c3a3@ieee.org> (raw)
In-Reply-To: <20200727183258.GA28571@embeddedor>
On 7/27/20 1:32 PM, Gustavo A. R. Silva wrote:
> Replace the existing /* fall through */ comments and its variants with
> the new pseudo-keyword macro fallthrough[1].
>
> [1] https://www.kernel.org/doc/html/v5.7/process/deprecated.html?highlight=fallthrough#implicit-switch-case-fall-through
Thanks for the patch. It looks good, but it raises
another question I'd like discussion on.
It seems that Johan likes default (or final) cases in
switch statements without a "break" statement. Viresh
and Bryan appear to be fond of this too.
It's pedantic, but I don't like that. Am I wrong?
--> Johan/Viresh/Bryan would you please comment?
If they aren't convincing (or don't care) I think break
statements should also be added here:
- In gb_interface_read_and_clear_init_status() for the
default case
- In gb_interface_activate() for the default case.
- In gb_svc_process_deferred_request() for the default
case
But let's wait to see what Johan (et al) says. If you
don't want to do that, say so and I'll do it later.
I looked at the code in drivers/staging/greybus/ and saw
no need to add a "fallthrough" anywhere, but:
- In fw_mgmt_backend_fw_version_operation() Viresh
seems to have skipped the break in the fault statement
- In gb_uart_request_handler() Bryan did this too.
Depending on discussion, these could be fixed in a
separate patch as well.
These cases aren't found by "checkpatch.pl" because it only
looks at case "blocks" that are followed by another case.
So the last case isn't checked.
-Alex
> Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
> ---
> drivers/greybus/es2.c | 2 +-
> drivers/greybus/interface.c | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/greybus/es2.c b/drivers/greybus/es2.c
> index 366716f11b1a..1df6ab5d339d 100644
> --- a/drivers/greybus/es2.c
> +++ b/drivers/greybus/es2.c
> @@ -759,7 +759,7 @@ static int check_urb_status(struct urb *urb)
> case -EOVERFLOW:
> dev_err(dev, "%s: overflow actual length is %d\n",
> __func__, urb->actual_length);
> - /* fall through */
> + fallthrough;
> case -ECONNRESET:
> case -ENOENT:
> case -ESHUTDOWN:
> diff --git a/drivers/greybus/interface.c b/drivers/greybus/interface.c
> index 67dbe6fda9a1..58ea374d8aaa 100644
> --- a/drivers/greybus/interface.c
> +++ b/drivers/greybus/interface.c
> @@ -1233,7 +1233,7 @@ int gb_interface_add(struct gb_interface *intf)
> case GB_INTERFACE_TYPE_GREYBUS:
> dev_info(&intf->dev, "GMP VID=0x%08x, PID=0x%08x\n",
> intf->vendor_id, intf->product_id);
> - /* fall-through */
> + fallthrough;
> case GB_INTERFACE_TYPE_UNIPRO:
> dev_info(&intf->dev, "DDBL1 Manufacturer=0x%08x, Product=0x%08x\n",
> intf->ddbl1_manufacturer_id,
>
next prev parent reply other threads:[~2020-07-28 22:37 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-27 18:32 Gustavo A. R. Silva
2020-07-28 22:37 ` Alex Elder [this message]
2020-07-29 0:25 ` Joe Perches
2020-07-29 10:51 ` [greybus-dev] " Viresh Kumar
2020-07-29 12:15 ` Alex Elder
2020-08-05 13:14 ` Alex Elder
2020-08-05 16:21 ` Johan Hovold
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=63871608-e076-26b0-85df-cff11699c3a3@ieee.org \
--to=elder@ieee.org \
--cc=elder@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=greybus-dev@lists.linaro.org \
--cc=gustavoars@kernel.org \
--cc=johan@kernel.org \
--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
all inboxes | Powered by JetHome®