[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHp75VcU5YeB3YMfk8JrmhJVjFCZ0ity6eACefkK1kQVTyJStQ@mail.gmail.com>
Date: Wed, 25 Nov 2015 22:26:12 +0200
From: Andy Shevchenko <andy.shevchenko@...il.com>
To: Konstantin Shkolnyy <konstantin.shkolnyy@...il.com>
Cc: johan@...nel.org, USB <linux-usb@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2] USB: serial: cp210x: Add tx_empty()
On Wed, Nov 25, 2015 at 12:28 AM, Konstantin Shkolnyy
<konstantin.shkolnyy@...il.com> wrote:
> Added tx_empty callback needed for generic wait-until-sent support.
> Without this function, when the port is closed usbserial can't know that
> there are still data in the chip's transmit FIFO. The chip gets disabled
> and untransmitted data lost. When the actual byte count is reported by
> tx-empty the close can be delayed until all data are sent.
>
> /*
> + * Read how many bytes are waiting in the TX queue.
> + */
One line?
> +static bool cp210x_tx_empty(struct usb_serial_port *port)
> +{
> + int err;
> + u32 count;
> +
> + err = cp210x_get_tx_queue_byte_count(port, &count);
> + if (!err && count)
> + return false;
> +
> + return true;
return err || !count;
Btw, can be count left uninitialized?
--
With Best Regards,
Andy Shevchenko
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists