[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20101227100817.10a53243@lembas.zaitcev.lan>
Date: Mon, 27 Dec 2010 10:08:17 -0700
From: Pete Zaitcev <zaitcev@...hat.com>
To: Tsozik <tsozik@...oo.com>
Cc: Greg Kroah-Hartman <gregkh@...e.de>, linux-usb@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/1] mct_u232: added _ioctl and _get_icount functions
On Sun, 26 Dec 2010 22:34:23 -0800 (PST)
Tsozik <tsozik@...oo.com> wrote:
> Usually MSR contains information about both states which are raised and
> states which are changed. It looks like we use upper MSR nibble which
> contains information about 4 states which were raised, not lower MSR
> nibble which contains information about 4 states which were changed.
Sure, I know how typical UART works. Does the MCT device deliver the
change states? If it does and you want to use those, go ahead.
> I also researched implementations under usb/serial and saw that all of
> them are rely on the current states (not change states) to increment
> the respective counter variables.
Here's drivers/usb/serial/io_edgeport.c:
static void handle_new_msr(struct edgeport_port *edge_port, __u8 newMsr)
{
struct async_icount *icount;
dbg("%s %02x", __func__, newMsr);
if (newMsr & (EDGEPORT_MSR_DELTA_CTS | EDGEPORT_MSR_DELTA_DSR |
EDGEPORT_MSR_DELTA_RI | EDGEPORT_MSR_DELTA_CD)) {
icount = &edge_port->icount;
/* update input line counters */
if (newMsr & EDGEPORT_MSR_DELTA_CTS)
icount->cts++;
if (newMsr & EDGEPORT_MSR_DELTA_DSR)
icount->dsr++;
if (newMsr & EDGEPORT_MSR_DELTA_CD)
icount->dcd++;
if (newMsr & EDGEPORT_MSR_DELTA_RI)
icount->rng++;
wake_up_interruptible(&edge_port->delta_msr_wait);
}
Looks like it counts changes to me. And in any case, the gold standard
is in drivers/serial/8250.c:
static unsigned int check_modem_status(struct uart_8250_port *up)
{
unsigned int status = serial_in(up, UART_MSR);
status |= up->msr_saved_flags;
up->msr_saved_flags = 0;
if (status & UART_MSR_ANY_DELTA && up->ier & UART_IER_MSI &&
up->port.state != NULL) {
if (status & UART_MSR_TERI)
up->port.icount.rng++;
if (status & UART_MSR_DDSR)
up->port.icount.dsr++;
if (status & UART_MSR_DDCD)
uart_handle_dcd_change(&up->port, status & UART_MSR_DCD);
if (status & UART_MSR_DCTS)
uart_handle_cts_change(&up->port, status & UART_MSR_CTS);
wake_up_interruptible(&up->port.state->port.delta_msr_wait);
}
I only proposed accomplishing the same result by comparing states
in place of relying on hardware change reports like both of the
above do.
-- Pete
--
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