File tree Expand file tree Collapse file tree 1 file changed +10
-7
lines changed Expand file tree Collapse file tree 1 file changed +10
-7
lines changed Original file line number Diff line number Diff line change @@ -796,9 +796,9 @@ static int can327_netdev_close(struct net_device *dev)
796
796
797
797
netif_stop_queue (dev );
798
798
799
- /* Give UART one final chance to flush. */
800
- clear_bit ( TTY_DO_WRITE_WAKEUP , & elm -> tty -> flags );
801
- flush_work ( & elm -> tx_work );
799
+ /* We don't flush the UART TX queue here, as we want final stop
800
+ * commands (like the above dummy char) to be flushed out.
801
+ */
802
802
803
803
can_rx_offload_disable (& elm -> offload );
804
804
elm -> can .state = CAN_STATE_STOPPED ;
@@ -1069,12 +1069,15 @@ static void can327_ldisc_close(struct tty_struct *tty)
1069
1069
{
1070
1070
struct can327 * elm = (struct can327 * )tty -> disc_data ;
1071
1071
1072
- /* unregister_netdev() calls .ndo_stop() so we don't have to.
1073
- * Our .ndo_stop() also flushes the TTY write wakeup handler,
1074
- * so we can safely set elm->tty = NULL after this.
1075
- */
1072
+ /* unregister_netdev() calls .ndo_stop() so we don't have to. */
1076
1073
unregister_candev (elm -> dev );
1077
1074
1075
+ /* Give UART one final chance to flush.
1076
+ * No need to clear TTY_DO_WRITE_WAKEUP since .write_wakeup() is
1077
+ * serialised against .close() and will not be called once we return.
1078
+ */
1079
+ flush_work (& elm -> tx_work );
1080
+
1078
1081
/* Mark channel as dead */
1079
1082
spin_lock_bh (& elm -> lock );
1080
1083
tty -> disc_data = NULL ;
You can’t perform that action at this time.
0 commit comments