public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Lee Jones <lee@kernel.org>
To: Jiri Slaby <jirislaby@kernel.org>
Cc: Florian Eckert <fe@dev.tdt.de>,
	u.kleine-koenig@pengutronix.de, gregkh@linuxfoundation.org,
	pavel@ucw.cz, linux-kernel@vger.kernel.org,
	linux-leds@vger.kernel.org, Eckert.Florian@googlemail.com
Subject: Re: [PATCH v7 2/2] trigger: ledtrig-tty: add additional modes
Date: Mon, 6 Mar 2023 09:04:56 +0000	[thread overview]
Message-ID: <20230306090456.GA9667@google.com> (raw)
In-Reply-To: <be7c90cf-4c65-1cf0-3001-8706415c3d34@kernel.org>

On Mon, 06 Mar 2023, Jiri Slaby wrote:

> On 03. 03. 23, 15:11, Lee Jones wrote:
> > On Wed, 22 Feb 2023, Florian Eckert wrote:
> > > @@ -113,21 +207,38 @@ static void ledtrig_tty_work(struct work_struct *work)
> > >   		trigger_data->tty = tty;
> > >   	}
> > > -	ret = tty_get_icount(trigger_data->tty, &icount);
> > > -	if (ret) {
> > > -		dev_info(trigger_data->tty->dev, "Failed to get icount, stopped polling\n");
> > > -		mutex_unlock(&trigger_data->mutex);
> > > -		return;
> > > -	}
> > > -
> > > -	if (icount.rx != trigger_data->rx ||
> > > -	    icount.tx != trigger_data->tx) {
> > > -		led_set_brightness_sync(trigger_data->led_cdev, LED_ON);
> > > -
> > > -		trigger_data->rx = icount.rx;
> > > -		trigger_data->tx = icount.tx;
> > > -	} else {
> > > -		led_set_brightness_sync(trigger_data->led_cdev, LED_OFF);
> > > +	switch (trigger_data->mode) {
> > > +	case TTY_LED_CTS:
> > > +		ledtrig_tty_flags(trigger_data, TIOCM_CTS);
> > > +		break;
> > > +	case TTY_LED_DSR:
> > > +		ledtrig_tty_flags(trigger_data, TIOCM_DSR);
> > > +		break;
> > > +	case TTY_LED_CAR:
> > > +		ledtrig_tty_flags(trigger_data, TIOCM_CAR);
> > > +		break;
> > > +	case TTY_LED_RNG:
> > > +		ledtrig_tty_flags(trigger_data, TIOCM_RNG);
> > > +		break;
> > > +	case TTY_LED_CNT:
> > 
> > I believe this requires a 'fall-through' statement.
> 
> I don't think this is the case. Isn't fallthrough required only in cases
> when there is at least one statement, i.e. a block?

There's no mention of this caveat in the document.

To my untrained eyes, the rule looks fairly explicit, starting with "All".

"
  All switch/case blocks must end in one of:

  * break;
  * fallthrough;
  * continue;
  * goto <label>;
  * return [expression];
"

If you're aware of something I'm not, please consider updating the doc.

> > Documentation/process/deprecated.rst
> > 
> > > +	default:
> > > +		ret = tty_get_icount(trigger_data->tty, &icount);
> > > +		if (ret) {
> > > +			dev_info(trigger_data->tty->dev, "Failed to get icount, stopped polling\n");
> > > +			mutex_unlock(&trigger_data->mutex);
> > > +			return;
> > > +		}
> > > +

-- 
Lee Jones [李琼斯]

  parent reply	other threads:[~2023-03-06  9:05 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-22  8:33 [PATCH v7 0/2] leds: ledtrig-tty: add tty_led_mode xtension Florian Eckert
2023-02-22  8:33 ` [PATCH v7 1/2] tty: new helper function tty_get_mget Florian Eckert
2023-02-22  8:33 ` [PATCH v7 2/2] trigger: ledtrig-tty: add additional modes Florian Eckert
2023-03-03 14:11   ` Lee Jones
2023-03-06  6:57     ` Jiri Slaby
2023-03-06  7:13       ` Florian Eckert
2023-03-06  9:04       ` Lee Jones [this message]
2023-03-06  9:23         ` Uwe Kleine-König
2023-03-06  9:35         ` Jiri Slaby
2023-03-06 10:04           ` Lee Jones
2023-03-06  9:35   ` Uwe Kleine-König
2023-03-06 10:12     ` Florian Eckert

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=20230306090456.GA9667@google.com \
    --to=lee@kernel.org \
    --cc=Eckert.Florian@googlemail.com \
    --cc=fe@dev.tdt.de \
    --cc=gregkh@linuxfoundation.org \
    --cc=jirislaby@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=pavel@ucw.cz \
    --cc=u.kleine-koenig@pengutronix.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