@@ -1852,7 +1852,12 @@ static int xr_usb_serial_suspend(struct usb_interface *intf, pm_message_t messag
18521852
18531853 if (cnt )
18541854 return 0 ;
1855+
1856+ #if LINUX_VERSION_CODE > KERNEL_VERSION (4 , 7 , 0 )
18551857 if (tty_port_initialized (& xr_usb_serial -> port ))
1858+ #else
1859+ if (test_bit (ASYNCB_INITIALIZED , & xr_usb_serial -> port .flags ))
1860+ #endif
18561861 stop_data_traffic (xr_usb_serial );
18571862
18581863 return 0 ;
@@ -1872,8 +1877,12 @@ static int xr_usb_serial_resume(struct usb_interface *intf)
18721877
18731878 if (cnt )
18741879 return 0 ;
1875-
1876- if (tty_port_initialized (& xr_usb_serial -> port )) {
1880+ #if LINUX_VERSION_CODE > KERNEL_VERSION (4 , 7 , 0 )
1881+ if (tty_port_initialized (& xr_usb_serial -> port ))
1882+ #else
1883+ if (test_bit (ASYNCB_INITIALIZED , & xr_usb_serial -> port .flags ))
1884+ #endif
1885+ {
18771886 rv = usb_submit_urb (xr_usb_serial -> ctrlurb , GFP_NOIO );
18781887
18791888 spin_lock_irq (& xr_usb_serial -> write_lock );
@@ -1907,7 +1916,12 @@ static int xr_usb_serial_reset_resume(struct usb_interface *intf)
19071916#else
19081917 struct tty_struct * tty ;
19091918#endif
1910- if (tty_port_initialized (& xr_usb_serial -> port )){
1919+ #if LINUX_VERSION_CODE > KERNEL_VERSION (4 , 7 , 0 )
1920+ if (tty_port_initialized (& xr_usb_serial -> port ))
1921+ #else
1922+ if (test_bit (ASYNCB_INITIALIZED , & xr_usb_serial -> port .flags ))
1923+ #endif
1924+ {
19111925#if LINUX_VERSION_CODE > KERNEL_VERSION (3 , 9 , 0 )
19121926 tty_port_tty_hangup (& xr_usb_serial -> port , false);
19131927#else
0 commit comments