From: Pavel Machek <pavel@ucw.cz>
To: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
linux-kernel@vger.kernel.org, Johan Hovold <johan@kernel.org>,
Jacek Anaszewski <jacek.anaszewski@gmail.com>,
linux-serial@vger.kernel.org, Jiri Slaby <jslaby@suse.com>,
kernel@pengutronix.de, linux-leds@vger.kernel.org,
Dan Murphy <dmurphy@ti.com>
Subject: Re: [PATCH v11] leds: trigger: implement a tty trigger
Date: Thu, 18 Feb 2021 14:37:33 +0100 [thread overview]
Message-ID: <20210218133733.GB12948@duo.ucw.cz> (raw)
In-Reply-To: <20210113173018.bq2fkea2o3yp6rf6@pengutronix.de>
[-- Attachment #1: Type: text/plain, Size: 1128 bytes --]
Hi!
Close, but see below:
> +static ssize_t ttyname_store(struct device *dev,
> + struct device_attribute *attr, const char *buf,
> + size_t size)
> +{
> + struct ledtrig_tty_data *trigger_data = led_trigger_get_drvdata(dev);
> + char *ttyname;
> + ssize_t ret = size;
> + bool running;
> +
> + if (size > 0 && buf[size - 1] == '\n')
> + size -= 1;
> +
> + if (size) {
> + ttyname = kmemdup_nul(buf, size, GFP_KERNEL);
> + if (!ttyname) {
> + ret = -ENOMEM;
> + goto out_unlock;
Unlock without a lock:
> +out_unlock:
> + mutex_unlock(&trigger_data->mutex);
> +
> + if (ttyname && !running)
> + ledtrig_tty_restart(trigger_data);
> +
> + return ret;
> +}
> +
> + tty = tty_kopen_shared(devno);
> + if (IS_ERR(tty) || !tty)
> + /* What to do? retry or abort */
> + goto out;
Abort would make sense to me.
> + if (icount.rx != trigger_data->rx ||
> + icount.tx != trigger_data->tx) {
> + led_set_brightness(trigger_data->led_cdev, LED_ON);
Please use _sync version.
Best regards,
Pavel
--
http://www.livejournal.com/~pavelmachek
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]
next prev parent reply other threads:[~2021-02-18 17:06 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-18 10:42 [PATCH v10 0/3] leds: trigger: implement a tty trigger Uwe Kleine-König
2020-12-18 10:42 ` [PATCH v10 1/3] tty: rename tty_kopen() and add new function tty_kopen_shared() Uwe Kleine-König
2020-12-18 10:42 ` [PATCH v10 2/3] tty: new helper function tty_get_icount() Uwe Kleine-König
2020-12-18 10:42 ` [PATCH v10 3/3] leds: trigger: implement a tty trigger Uwe Kleine-König
2021-01-13 16:16 ` Greg Kroah-Hartman
2021-01-13 17:30 ` [PATCH v11] " Uwe Kleine-König
2021-01-13 18:34 ` Greg Kroah-Hartman
2021-02-18 13:33 ` Pavel Machek
2021-02-18 21:19 ` Uwe Kleine-König
2021-02-18 21:21 ` Greg Kroah-Hartman
2021-02-18 13:37 ` Pavel Machek [this message]
2021-02-19 8:00 ` Uwe Kleine-König
2020-12-28 15:10 ` [PATCH v10 0/3] " Greg Kroah-Hartman
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=20210218133733.GB12948@duo.ucw.cz \
--to=pavel@ucw.cz \
--cc=dmurphy@ti.com \
--cc=gregkh@linuxfoundation.org \
--cc=jacek.anaszewski@gmail.com \
--cc=johan@kernel.org \
--cc=jslaby@suse.com \
--cc=kernel@pengutronix.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-leds@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--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;
as well as URLs for NNTP newsgroup(s).