Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

usb: typec: tcpci_rt1711h: avoid screaming irq causing boot hangs

John reported screaming irq caused by rt1711h when system boot[1],
this is because irq request is done before tcpci_register_port(),
so the chip->tcpci has not been setup, irq handler is entered but
can't do anything, this patch is to address this by moving the irq
request after tcpci_register_port().

[1] https://lore.kernel.org/linux-usb/20200530040157.31038-1-john.stultz@linaro.org

Fixes: ce08eaeb6388 ("staging: typec: rt1711h typec chip driver")
Cc: stable <stable@vger.kernel.org> # v4.18+
Cc: John Stultz <john.stultz@linaro.org>
Reported-and-tested-by: John Stultz <john.stultz@linaro.org>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
Link: https://lore.kernel.org/r/20200604112118.38062-1-jun.li@nxp.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Li Jun and committed by
Greg Kroah-Hartman
302c570b 07c112fb

+10 -21
+10 -21
drivers/usb/typec/tcpm/tcpci_rt1711h.c
··· 179 179 return tcpci_irq(chip->tcpci); 180 180 } 181 181 182 - static int rt1711h_init_alert(struct rt1711h_chip *chip, 183 - struct i2c_client *client) 184 - { 185 - int ret; 186 - 187 - /* Disable chip interrupts before requesting irq */ 188 - ret = rt1711h_write16(chip, TCPC_ALERT_MASK, 0); 189 - if (ret < 0) 190 - return ret; 191 - 192 - ret = devm_request_threaded_irq(chip->dev, client->irq, NULL, 193 - rt1711h_irq, 194 - IRQF_ONESHOT | IRQF_TRIGGER_LOW, 195 - dev_name(chip->dev), chip); 196 - if (ret < 0) 197 - return ret; 198 - enable_irq_wake(client->irq); 199 - return 0; 200 - } 201 - 202 182 static int rt1711h_sw_reset(struct rt1711h_chip *chip) 203 183 { 204 184 int ret; ··· 240 260 if (ret < 0) 241 261 return ret; 242 262 243 - ret = rt1711h_init_alert(chip, client); 263 + /* Disable chip interrupts before requesting irq */ 264 + ret = rt1711h_write16(chip, TCPC_ALERT_MASK, 0); 244 265 if (ret < 0) 245 266 return ret; 246 267 ··· 251 270 chip->tcpci = tcpci_register_port(chip->dev, &chip->data); 252 271 if (IS_ERR_OR_NULL(chip->tcpci)) 253 272 return PTR_ERR(chip->tcpci); 273 + 274 + ret = devm_request_threaded_irq(chip->dev, client->irq, NULL, 275 + rt1711h_irq, 276 + IRQF_ONESHOT | IRQF_TRIGGER_LOW, 277 + dev_name(chip->dev), chip); 278 + if (ret < 0) 279 + return ret; 280 + enable_irq_wake(client->irq); 254 281 255 282 return 0; 256 283 }