On Tue, Dec 17, 2024 at 01:45:08PM +0300, Dan Carpenter wrote: > On Tue, Dec 17, 2024 at 05:12:08PM +0800, Xu Yang wrote: > > With edge irq support, the ALERT event may be missed currently. The reason > > is that ALERT_MASK register is written before devm_request_threaded_irq(). > > If ALERT event happens in this time gap, it will be missed and ALERT line > > will not recover to high level. However, we don't meet this issue with > > level irq. To avoid the issue, this will set ALERT_MASK register after > > devm_request_threaded_irq() return. > > > > Fixes: 77e85107a771 ("usb: typec: tcpci: support edge irq") > > I agree with Francesco that this was introduced by patch 1 so the > patches need to be folded together into one patch. The commit > message would be something like: > > The ordering of setting up the IRQs is not correct here. > We need to call tcpci_register_port() devm_request_threaded_irq(). > Otherwise if we recieve an IRQ before tcpci_register_port() has > completed it leads to a NULL dereference in tcpci_irq() because > tcpci->regmap and other pointers are NULL. > > However, moving tcpci_register_port() earlier creates a problem > of its own because there is a potential that tcpci_init() will be > called before devm_request_threaded_irq(). The tcpci_init() > writes the ALERT_MASK to the hardware to tell it to start > generating interrupts but we're not ready to deal with them yet. > > Move the ALERT_MASK stuff until after the call to > devm_request_threaded_irq() has finished. > > Something like that. > Okay. Thanks, Xu Yang