On Tue, Feb 25, 2020 at 09:55:03AM +0100, Johan Hovold wrote: > On Thu, Feb 20, 2020 at 12:04:27PM +0100, Uwe Kleine-König wrote: > > Ah I think I see. tty_driver_lookup_tty() might return NULL which for > > the trigger driver indicates that tty_kopen_shared should be retried, > > right? > > I'm not sure how best to handle this, but yes, your trigger can only be > enabled while the port is open currently. And no error is returned to a > user trying to enable the trigger before it has been opened. > > But regardless of the error reporting, I don't think failing when the > port isn't open is the right thing to do as as this makes the interface > rather useless since you cannot enable a trigger from for example a udev > rule. > > If this approach is to be used at all, it seems you may need to allocate > the struct tty when the trigger is enabled. And make sure you don't mess > up some other assumption in tty core... My idea is instead to retry opening the device later. At least this sounds easier. Best regards Uwe -- Pengutronix e.K. | Uwe Kleine-König | Industrial Linux Solutions | https://www.pengutronix.de/ |