@@ -1838,7 +1838,12 @@ static int xr_usb_serial_suspend(struct usb_interface *intf, pm_message_t messag
18381838
18391839 if (cnt )
18401840 return 0 ;
1841+
1842+ #if LINUX_VERSION_CODE > KERNEL_VERSION (4 , 7 , 0 )
18411843 if (tty_port_initialized (& xr_usb_serial -> port ))
1844+ #else
1845+ if (test_bit (ASYNCB_INITIALIZED , & xr_usb_serial -> port .flags ))
1846+ #endif
18421847 stop_data_traffic (xr_usb_serial );
18431848
18441849 return 0 ;
@@ -1858,8 +1863,12 @@ static int xr_usb_serial_resume(struct usb_interface *intf)
18581863
18591864 if (cnt )
18601865 return 0 ;
1861-
1862- if (tty_port_initialized (& xr_usb_serial -> port )) {
1866+ #if LINUX_VERSION_CODE > KERNEL_VERSION (4 , 7 , 0 )
1867+ if (tty_port_initialized (& xr_usb_serial -> port ))
1868+ #else
1869+ if (test_bit (ASYNCB_INITIALIZED , & xr_usb_serial -> port .flags ))
1870+ #endif
1871+ {
18631872 rv = usb_submit_urb (xr_usb_serial -> ctrlurb , GFP_NOIO );
18641873
18651874 spin_lock_irq (& xr_usb_serial -> write_lock );
@@ -1893,7 +1902,12 @@ static int xr_usb_serial_reset_resume(struct usb_interface *intf)
18931902#else
18941903 struct tty_struct * tty ;
18951904#endif
1896- if (tty_port_initialized (& xr_usb_serial -> port )){
1905+ #if LINUX_VERSION_CODE > KERNEL_VERSION (4 , 7 , 0 )
1906+ if (tty_port_initialized (& xr_usb_serial -> port ))
1907+ #else
1908+ if (test_bit (ASYNCB_INITIALIZED , & xr_usb_serial -> port .flags ))
1909+ #endif
1910+ {
18971911#if LINUX_VERSION_CODE > KERNEL_VERSION (3 , 9 , 0 )
18981912 tty_port_tty_hangup (& xr_usb_serial -> port , false);
18991913#else
0 commit comments