Repack struct elmcan
[elmcan.git] / module / elmcan.c
index 7707c4d4c04fdae1cfc8173e84b77cc2df46c84a..8a542406c8db0160fa2e1a26eb785c89c3e8c82c 100644 (file)
@@ -92,18 +92,18 @@ struct elmcan {
        u8 rxbuf[ELM327_SIZE_RXBUF];
        u8 txbuf[ELM327_SIZE_TXBUF] ____cacheline_aligned;
 
-       /* TTY buffer accounting */
-       struct work_struct tx_work;     /* Flushes TTY TX buffer */
-       u8 *txhead;                     /* Next TX byte */
-       unsigned txleft;                /* Bytes left to TX */
-       int rxfill;                     /* Bytes already RX'd in buffer */
+       /* Per-channel lock */
+       spinlock_t lock;
 
        /* TTY and netdev devices that we're bridging */
        struct tty_struct *tty;
        struct net_device *dev;
 
-       /* Per-channel lock */
-       spinlock_t lock;
+       /* TTY buffer accounting */
+       struct work_struct tx_work;     /* Flushes TTY TX buffer */
+       u8 *txhead;                     /* Next TX byte */
+       size_t txleft;                  /* Bytes left to TX */
+       int rxfill;                     /* Bytes already RX'd in buffer */
 
        /* State machine */
        enum {
@@ -303,6 +303,8 @@ static inline void elm327_uart_side_failure(struct elmcan *elm)
 
        elm->uart_side_failure = true;
 
+       clear_bit(TTY_DO_WRITE_WAKEUP, &elm->tty->flags);
+
        elm->can.can_stats.bus_off++;
        netif_stop_queue(elm->dev);
        elm->can.state = CAN_STATE_BUS_OFF;