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
--
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux PPP]     [Linux FS]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Linmodem]     [Device Mapper]     [Linux Kernel for ARM]

  Powered by Linux