/* Sends the next queued packt to the tty port (garmin native mode only) and then sets a timer to call itself again until all queued data is sent.  */
static int garmin_flush_queue(struct garmin_data *garmin_data_p)
/* Sends the next queued packt to the tty port (garmin native mode only) and then sets a timer to call itself again until all queued data is sent.  */
static int garmin_flush_queue(struct garmin_data *garmin_data_p)
{
	unsigned long flags;
	struct garmin_packet *pkt;
	if ((garmin_data_p->flags & FLAGS_THROTTLED) == 0) {
		pkt = pkt_pop(garmin_data_p);
		if (pkt != NULL) {
			send_to_tty(garmin_data_p->port, pkt->data, pkt->size);
			kfree(pkt);
			mod_timer(&garmin_data_p->timer, (1)+jiffies);
		} else {
			spin_lock_irqsave(&garmin_data_p->lock, flags);
			garmin_data_p->flags &= ~FLAGS_QUEUING;
			spin_unlock_irqrestore(&garmin_data_p->lock, flags);
		}
	}
	return 0;
}