Welcome to Soft32 Linux Forums!
FAQFAQ    SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

[PATCH 00/11] Sort out sdio_uart - stage two

 
   Soft32 Home -> Linux -> Kernel RSS
Next:  postfix question regarding smtpd_recipient_restri..  
Author Message
Alan Cox

External


Since: Jul 08, 2009
Posts: 19



(Msg. 1) Posted: Tue Nov 03, 2009 9:20 am
Post subject: [PATCH 00/11] Sort out sdio_uart - stage two
Archived from groups: linux>kernel (more info?)

With the bugs Nicolas reported hopefully now nailed.
---

Alan Cox (10):
sdio_uart: add modem functionality
sdio_uart: Fix the locking on "func" for new code
sdio_uart: Style fixes
sdio_uart: Use kfifo instead of the messy circ stuff
sdio_uart: Fix termios handling
sdio_uart: Switch to the open/close helpers
sdio_uart: Move the open lock
sdio_uart: refcount the tty objects
sdio_uart: use tty_port
tty_port: Move hupcl handling

Nicolas Pitre (1):
sdio_uart: Fix oops caused by the previous changeset


drivers/char/tty_port.c | 13 +
drivers/mmc/card/sdio_uart.c | 392 ++++++++++++++++++++++++------------------
2 files changed, 233 insertions(+), 172 deletions(-)

--
"The IETF already has more than enough RFCs that codify the obvious, make
stupidity illegal, support truth, justice, and the IETF way, and generally
demonstrate the author is a brilliant and valuable Contributor to The
Standards Process." -- Vernon Schryver

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo DeleteThis @vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to top
Login to vote
Alan Cox

External


Since: Jul 08, 2009
Posts: 19



(Msg. 2) Posted: Tue Nov 03, 2009 9:20 am
Post subject: [PATCH 07/11] sdio_uart: Fix termios handling [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Switching between two non standard baud rates fails because of the cflag
test. Do as we did elsewhere and just kill the "optimisation".

Signed-off-by: Alan Cox <alan.RemoveThis@linux.intel.com>
---

drivers/mmc/card/sdio_uart.c | 6 ------
1 files changed, 0 insertions(+), 6 deletions(-)


diff --git a/drivers/mmc/card/sdio_uart.c b/drivers/mmc/card/sdio_uart.c
index 3e2ae66..d41aa35 100644
--- a/drivers/mmc/card/sdio_uart.c
+++ b/drivers/mmc/card/sdio_uart.c
@@ -901,12 +901,6 @@ static void sdio_uart_set_termios(struct tty_struct *tty, struct ktermios *old_t
struct sdio_uart_port *port = tty->driver_data;
unsigned int cflag = tty->termios->c_cflag;

-#define RELEVANT_IFLAG(iflag) ((iflag) & (IGNBRK|BRKINT|IGNPAR|PARMRK|INPCK))
-
- if ((cflag ^ old_termios->c_cflag) == 0 &&
- RELEVANT_IFLAG(tty->termios->c_iflag ^ old_termios->c_iflag) == 0)
- return;
-
if (sdio_uart_claim_func(port) != 0)
return;


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo.RemoveThis@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to top
Login to vote
Alan Cox

External


Since: Jul 08, 2009
Posts: 19



(Msg. 3) Posted: Tue Nov 03, 2009 9:20 am
Post subject: [PATCH 01/11] tty_port: Move hupcl handling [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Move the HUCPL handling from the end of close_port_start to the beginning
of close_port_end. What this actually does is change the ordering from

port shutdown
port->dtr_rts

to

port->dtr_rts
port shutdown

Some hardware drops the physical connection on shutdown so we must perform
the port operations before the shutdown.

Signed-off-by: Alan Cox <alan.DeleteThis@linux.intel.com>
---

drivers/char/tty_port.c | 13 ++++++++-----
1 files changed, 8 insertions(+), 5 deletions(-)


diff --git a/drivers/char/tty_port.c b/drivers/char/tty_port.c
index da12fae..cf4b16a 100644
--- a/drivers/char/tty_port.c
+++ b/drivers/char/tty_port.c
@@ -357,6 +357,14 @@ int tty_port_close_start(struct tty_port *port,
timeout = 2 * HZ;
schedule_timeout_interruptible(timeout);
}
+ /* Flush the ldisc buffering */
+ tty_ldisc_flush(tty);
+
+ /* Drop DTR/RTS if HUPCL is set. This causes any attached modem to
+ hang up the line */
+ if (tty->termios->c_cflag & HUPCL)
+ tty_port_lower_dtr_rts(port);
+
/* Don't call port->drop for the last reference. Callers will want
to drop the last active reference in ->shutdown() or the tty
shutdown path */
@@ -368,11 +376,6 @@ void tty_port_close_end(struct tty_port *port, struct tty_struct *tty)
{
unsigned long flags;

- tty_ldisc_flush(tty);
-
- if (tty->termios->c_cflag & HUPCL)
- tty_port_lower_dtr_rts(port);
-
spin_lock_irqsave(&port->lock, flags);
tty->closing = 0;


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo.DeleteThis@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to top
Login to vote
Alan Cox

External


Since: Jul 08, 2009
Posts: 19



(Msg. 4) Posted: Tue Nov 03, 2009 9:20 am
Post subject: [PATCH 02/11] sdio_uart: use tty_port [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Add a tty_port object to the sdio uart. For the moment just begin using the
tty field of the port, as this is the critical one to clean up.

Signed-off-by: Alan Cox <alan DeleteThis @linux.intel.com>
---

drivers/mmc/card/sdio_uart.c | 41 +++++++++++++++++++++++------------------
1 files changed, 23 insertions(+), 18 deletions(-)


diff --git a/drivers/mmc/card/sdio_uart.c b/drivers/mmc/card/sdio_uart.c
index b8e7c5a..c2759db 100644
--- a/drivers/mmc/card/sdio_uart.c
+++ b/drivers/mmc/card/sdio_uart.c
@@ -73,6 +73,7 @@ struct uart_icount {
};

struct sdio_uart_port {
+ struct tty_port port;
struct kref kref;
struct tty_struct *tty;
unsigned int index;
@@ -172,7 +173,7 @@ static void sdio_uart_port_remove(struct sdio_uart_port *port)
port->func = NULL;
mutex_unlock(&port->func_lock);
if (port->opened)
- tty_hangup(port->tty);
+ tty_hangup(port->port.tty);
mutex_unlock(&port->open_lock);
sdio_release_irq(func);
sdio_disable_func(func);
@@ -391,7 +392,7 @@ static void sdio_uart_stop_rx(struct sdio_uart_port *port)
static void sdio_uart_receive_chars(struct sdio_uart_port *port,
unsigned int *status)
{
- struct tty_struct *tty = port->tty;
+ struct tty_struct *tty = port->port.tty;
unsigned int ch, flag;
int max_count = 256;

@@ -446,6 +447,7 @@ static void sdio_uart_transmit_chars(struct sdio_uart_port *port)
{
struct circ_buf *xmit = &port->xmit;
int count;
+ struct tty_struct *tty = port->port.tty;

if (port->x_char) {
sdio_out(port, UART_TX, port->x_char);
@@ -453,7 +455,7 @@ static void sdio_uart_transmit_chars(struct sdio_uart_port *port)
port->x_char = 0;
return;
}
- if (circ_empty(xmit) || port->tty->stopped || port->tty->hw_stopped) {
+ if (circ_empty(xmit) || tty->stopped || tty->hw_stopped) {
sdio_uart_stop_tx(port);
return;
}
@@ -468,7 +470,7 @@ static void sdio_uart_transmit_chars(struct sdio_uart_port *port)
} while (--count > 0);

if (circ_chars_pending(xmit) < WAKEUP_CHARS)
- tty_wakeup(port->tty);
+ tty_wakeup(tty);

if (circ_empty(xmit))
sdio_uart_stop_tx(port);
@@ -477,6 +479,7 @@ static void sdio_uart_transmit_chars(struct sdio_uart_port *port)
static void sdio_uart_check_modem_status(struct sdio_uart_port *port)
{
int status;
+ struct tty_struct *tty = port->port.tty;

status = sdio_in(port, UART_MSR);

@@ -491,17 +494,17 @@ static void sdio_uart_check_modem_status(struct sdio_uart_port *port)
port->icount.dcd++;
if (status & UART_MSR_DCTS) {
port->icount.cts++;
- if (port->tty->termios->c_cflag & CRTSCTS) {
+ if (tty->termios->c_cflag & CRTSCTS) {
int cts = (status & UART_MSR_CTS);
- if (port->tty->hw_stopped) {
+ if (tty->hw_stopped) {
if (cts) {
- port->tty->hw_stopped = 0;
+ tty->hw_stopped = 0;
sdio_uart_start_tx(port);
- tty_wakeup(port->tty);
+ tty_wakeup(tty);
}
} else {
if (!cts) {
- port->tty->hw_stopped = 1;
+ tty->hw_stopped = 1;
sdio_uart_stop_tx(port);
}
}
@@ -546,12 +549,13 @@ static int sdio_uart_startup(struct sdio_uart_port *port)
{
unsigned long page;
int ret;
+ struct tty_struct *tty = port->port.tty;

/*
* Set the TTY IO error marker - we will only clear this
* once we have successfully opened the port.
*/
- set_bit(TTY_IO_ERROR, &port->tty->flags);
+ set_bit(TTY_IO_ERROR, &tty->flags);

/* Initialise and allocate the transmit buffer. */
page = __get_free_page(GFP_KERNEL);
@@ -595,14 +599,14 @@ static int sdio_uart_startup(struct sdio_uart_port *port)
port->ier = UART_IER_RLSI | UART_IER_RDI | UART_IER_RTOIE | UART_IER_UUE;
port->mctrl = TIOCM_OUT2;

- sdio_uart_change_speed(port, port->tty->termios, NULL);
+ sdio_uart_change_speed(port, tty->termios, NULL);

- if (port->tty->termios->c_cflag & CBAUD)
+ if (tty->termios->c_cflag & CBAUD)
sdio_uart_set_mctrl(port, TIOCM_RTS | TIOCM_DTR);

- if (port->tty->termios->c_cflag & CRTSCTS)
+ if (tty->termios->c_cflag & CRTSCTS)
if (!(sdio_uart_get_mctrl(port) & TIOCM_CTS))
- port->tty->hw_stopped = 1;
+ tty->hw_stopped = 1;

clear_bit(TTY_IO_ERROR, &port->tty->flags);

@@ -634,7 +638,7 @@ static void sdio_uart_shutdown(struct sdio_uart_port *port)
/* TODO: wait here for TX FIFO to drain */

/* Turn off DTR and RTS early. */
- if (port->tty->termios->c_cflag & HUPCL)
+ if (port->port.tty->termios->c_cflag & HUPCL)
sdio_uart_clear_mctrl(port, TIOCM_DTR | TIOCM_RTS);

/* Disable interrupts from this port */
@@ -684,11 +688,11 @@ static int sdio_uart_open(struct tty_struct *tty, struct file *filp)

if (!port->opened) {
tty->driver_data = port;
- port->tty = tty;
+ port->port.tty = tty;
ret = sdio_uart_startup(port);
if (ret) {
tty->driver_data = NULL;
- port->tty = NULL;
+ port->port.tty = NULL;
mutex_unlock(&port->open_lock);
sdio_uart_port_put(port);
return ret;
@@ -723,7 +727,7 @@ static void sdio_uart_close(struct tty_struct *tty, struct file * filp)
tty->closing = 1;
sdio_uart_shutdown(port);
tty_ldisc_flush(tty);
- port->tty = NULL;
+ port->port.tty = NULL;
tty->driver_data = NULL;
tty->closing = 0;
}
@@ -1068,6 +1072,7 @@ static int sdio_uart_probe(struct sdio_func *func,

port->func = func;
sdio_set_drvdata(func, port);
+ tty_port_init(&port->port);

ret = sdio_uart_add_port(port);
if (ret) {

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo DeleteThis @vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to top
Login to vote
Nicolas Pitre

External


Since: Sep 14, 2009
Posts: 3



(Msg. 5) Posted: Tue Nov 03, 2009 3:20 pm
Post subject: Re: [PATCH 00/11] Sort out sdio_uart - stage two [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On Tue, 3 Nov 2009, Alan Cox wrote:

> With the bugs Nicolas reported hopefully now nailed.

Progress, but still not there yet.

I'm still using the same "cat /dev/ttySDIO0" test with a GPS card.

Yanking the card out does terminate the cat process properly. Inserting
the card back in and restarting cat always fails with:

cat: /dev/ttySDIO0: Input/output error

The same thing occurs if I terminate cat with ^C instead of pulling the
card out.

From what I can see, sdio_uart_open() and sdio_uart_activate() are
called on the first cat invocation, and then sdio_uart_close() and
sdio_uart_shutdown() when cat is stopped with ^C. However neither
sdio_uart_open() nor sdio_uart_activate() is ever called anymore with
any subsequent cat invocations until a reboot. Some upper layer must
have taken upon itself to return -EIO to user space.


Nicolas
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo DeleteThis @vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to top
Login to vote
Alan Cox

External


Since: Sep 11, 2004
Posts: 928



(Msg. 6) Posted: Tue Nov 03, 2009 7:20 pm
Post subject: Re: [PATCH 00/11] Sort out sdio_uart - stage two [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

> >From what I can see, sdio_uart_open() and sdio_uart_activate() are
> called on the first cat invocation, and then sdio_uart_close() and
> sdio_uart_shutdown() when cat is stopped with ^C. However neither

I would have expected the cat to terminate when the port is unplugged
(and the uart remove method called - doing a hangup)

> sdio_uart_open() nor sdio_uart_activate() is ever called anymore with
> any subsequent cat invocations until a reboot. Some upper layer must
> have taken upon itself to return -EIO to user space.

The first call into the driver is to sdio_uart_install which looks up the
port from tty->index and would blow up if for some reason the get method
failed.

Still digging.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo RemoveThis @vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to top
Login to vote
Nicolas Pitre

External


Since: Sep 14, 2009
Posts: 3



(Msg. 7) Posted: Tue Nov 03, 2009 9:20 pm
Post subject: Re: [PATCH 00/11] Sort out sdio_uart - stage two [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On Wed, 4 Nov 2009, Alan Cox wrote:

> > >From what I can see, sdio_uart_open() and sdio_uart_activate() are
> > called on the first cat invocation, and then sdio_uart_close() and
> > sdio_uart_shutdown() when cat is stopped with ^C. However neither
>
> I would have expected the cat to terminate when the port is unplugged
> (and the uart remove method called - doing a hangup)

That works fine... the first time only. After the card is inserted back
then -EIO is always returned on open() from user space, same thing as
subsequent open() after ^C.

> > sdio_uart_open() nor sdio_uart_activate() is ever called anymore with
> > any subsequent cat invocations until a reboot. Some upper layer must
> > have taken upon itself to return -EIO to user space.
>
> The first call into the driver is to sdio_uart_install which looks up the
> port from tty->index and would blow up if for some reason the get method
> failed.

Well, same issue: I see it being called the first time. No calls what
so ever afterward until the next reboot.


Nicolas
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo.TakeThisOut@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to top
Login to vote
Display posts from previous:   
Related Topics:
[PATCH] pci quirks: Sort out the VIA mess once and for all.. - Perform the VIA fixup only on the devices on the V-Link on the VIA bridges that have it, and nowhere else. Doing this....

[PATCH] AF_RXRPC: Sort out MTU handling - Sort out the MTU determination and handling in AF_RXRPC: (1) If it's present, parse the additional information..

[PATCH 0/5] fixing errors handling during pci_driver resum.. - Where are several places where errors ignored during pci_driver resume stage. In most most cases return value of..

[PATCH] iomap: Sort out the broken address reporting cause.. - Add an iomap_name() function which translates an I/O map into a string to print Use it for the Libata layer For now we...

header files that are (sort of) referenced - based on that last response, i'm curious about which header files are technically "unreferenced" in the sourc...

2.6.21.1 fails to suspend/resume to disk (sort of) - Hi, I am trying to upgrade from my ubuntu kernel 2.6.17.3 to 2.6.21.1 and I have quite a bunch of problems with..
       Soft32 Home -> Linux -> Kernel All times are: Pacific Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

Categories:
 Windows
  Linux
 Mac
 PDA


[ Contact us | Terms of Service/Privacy Policy ]