You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

48 lines
1.8 KiB

  1. From e4d127ddc83c5fbd93b9c8e2e4fe63b820ac28b6 Mon Sep 17 00:00:00 2001
  2. From: David Bauer <mail@david-bauer.net>
  3. Date: Sat, 22 May 2021 10:37:06 +0200
  4. Subject: [PATCH] common.c: fix kernel 5.10 builds with CONFIG_PM enabled
  5. Building the xr_usb_serial module fails for Kenel 5.10 with CONFIG_PM
  6. enabled:
  7. xr_usb_serial_common.c:1574:15: error: 'ASYNCB_INITIALIZED' undeclared
  8. (first use in this function); did you mean 'RCU_INITIALIZER'?
  9. Use tty_port_initialized in order to determine the status of the TTY
  10. port. This is compatible with Kernel 5.10 and at least Kernel 5.4.
  11. Signed-off-by: David Bauer <mail@david-bauer.net>
  12. ---
  13. xr_usb_serial_common-1a/xr_usb_serial_common.c | 6 +++---
  14. 1 file changed, 3 insertions(+), 3 deletions(-)
  15. --- a/xr_usb_serial_common-1a/xr_usb_serial_common.c
  16. +++ b/xr_usb_serial_common-1a/xr_usb_serial_common.c
  17. @@ -1571,7 +1571,7 @@ static int xr_usb_serial_suspend(struct
  18. if (cnt)
  19. return 0;
  20. - if (test_bit(ASYNCB_INITIALIZED, &xr_usb_serial->port.flags))
  21. + if (tty_port_initialized(&xr_usb_serial->port))
  22. stop_data_traffic(xr_usb_serial);
  23. return 0;
  24. @@ -1592,7 +1592,7 @@ static int xr_usb_serial_resume(struct u
  25. if (cnt)
  26. return 0;
  27. - if (test_bit(ASYNCB_INITIALIZED, &xr_usb_serial->port.flags)) {
  28. + if (tty_port_initialized(&xr_usb_serial->port)) {
  29. rv = usb_submit_urb(xr_usb_serial->ctrlurb, GFP_NOIO);
  30. spin_lock_irq(&xr_usb_serial->write_lock);
  31. @@ -1623,7 +1623,7 @@ static int xr_usb_serial_reset_resume(st
  32. {
  33. struct xr_usb_serial *xr_usb_serial = usb_get_intfdata(intf);
  34. struct tty_struct *tty;
  35. - if (test_bit(ASYNCB_INITIALIZED, &xr_usb_serial->port.flags)){
  36. + if (tty_port_initialized(&xr_usb_serial->port)){
  37. #if LINUX_VERSION_CODE > KERNEL_VERSION(3, 9, 0)
  38. tty_port_tty_hangup(&xr_usb_serial->port, false);
  39. #else