Re: [PATCH v4 4/4] tty: implement led triggers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Uwe,

On 05/14/2018 08:24 PM, Uwe Kleine-König wrote:
On Mon, May 14, 2018 at 06:57:35PM +0200, Pavel Machek wrote:
On Mon 2018-05-14 12:15:05, Uwe Kleine-König wrote:
- return tty_register_device_attr(driver, index, device, drvdata,
-			attr_grp);
+	if (IS_ENABLED(CONFIG_TTY_LEDS_TRIGGERS)) {
+		int ret;
+
+		ret = led_trigger_register_format(&port->led_trigger_rx,
+						  "%s%d-rx", driver->name, index);
+		if (ret < 0)
+			pr_warn("Failed to register rx trigger for %s%d (%d)\n",
+				driver->name, index, ret);
+
+		ret = led_trigger_register_format(&port->led_trigger_tx,
+						  "%s%d-tx", driver->name, index);
+		if (ret < 0)
+			pr_warn("Failed to register tx trigger for %s%d (%d)\n",
+				driver->name, index, ret);
+	}

There are many ttys and you'll eat quite a bit of kernel memory with this (besides other
effects).

Could we get trigger which takes tty name and rx/tx as a parameter? That should save a bit of
RAM and some headaches with .../triggers file being too big.

Does the led core provide the needed stuff for this already today? If
yes, then I didn't understand that from your review comments so far. Is
there an example to understand how these parameters work?

There is no ready solution for tty, but it can be implemented with
not so big effort. I don't know what exactly Pavel had on mind,
but I myself see now, that the better approach would be a new
ledtrig-ttydev driver, that would expose three sysfs files: tty_id,
rx, tx. It would also expose the API like e.g.:

ttydev_trig_notify(int tty_id, bool rx)

Please see drivers/leds/trigger/ledtrig-netdev.c for an example of
a solution to the quite similar problem.

--
Best regards,
Jacek Anaszewski



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux