/* internal functions */ static void send_ll_cmd(unsigned char cmd) { ST_LL_DBG("%s: writing %x", __func__, cmd); st_int_write(&cmd, 1); return; }
/* internal functions */ static void send_ll_cmd(struct st_data_s *st_data, unsigned char cmd) { pr_debug("%s: writing %x", __func__, cmd); st_int_write(st_data, &cmd, 1); return; }
/* * internal wakeup function * called from either * - TTY layer when write's finished * - st_write (in context of the protocol stack) */ void st_tx_wakeup(struct st_data_s *st_data) { struct sk_buff *skb; unsigned long flags; /* for irq save flags */ pr_debug("%s", __func__); /* check for sending & set flag sending here */ if (test_and_set_bit(ST_TX_SENDING, &st_data->tx_state)) { pr_debug("ST already sending"); /* keep sending */ set_bit(ST_TX_WAKEUP, &st_data->tx_state); return; /* TX_WAKEUP will be checked in another * context */ } pm_runtime_get_sync(st_data->tty_dev); do { /* come back if st_tx_wakeup is set */ /* woke-up to write */ clear_bit(ST_TX_WAKEUP, &st_data->tx_state); while ((skb = st_int_dequeue(st_data))) { int len; spin_lock_irqsave(&st_data->lock, flags); /* enable wake-up from TTY */ set_bit(TTY_DO_WRITE_WAKEUP, &st_data->tty->flags); len = st_int_write(st_data, skb->data, skb->len); skb_pull(skb, len); /* if skb->len = len as expected, skb->len=0 */ if (skb->len) { /* would be the next skb to be sent */ st_data->tx_skb = skb; spin_unlock_irqrestore(&st_data->lock, flags); break; } kfree_skb(skb); spin_unlock_irqrestore(&st_data->lock, flags); } /* if wake-up is set in another context- restart sending */ } while (test_bit(ST_TX_WAKEUP, &st_data->tx_state)); pm_runtime_put(st_data->tty_dev); /* clear flag sending */ clear_bit(ST_TX_SENDING, &st_data->tx_state); }