From: Russell King <rmk@arm.linux.org.uk>
To: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] fix serial close hang
Date: Sun, 30 Dec 2001 14:42:35 +0000 [thread overview]
Message-ID: <20011230144235.B9625@flint.arm.linux.org.uk> (raw)
In-Reply-To: <20011230135249.A9625@flint.arm.linux.org.uk> <20011230141731.GA7314@elfie.cavy.de>
In-Reply-To: <20011230141731.GA7314@elfie.cavy.de>; from hd@cavy.de on Sun, Dec 30, 2001 at 03:17:31PM +0100
On Sun, Dec 30, 2001 at 03:17:31PM +0100, Heinz Diehl wrote:
> serial.c:3131: state' undeclared (first use in this function)
Whoops. This should fix it.
--- orig/include/linux/serialP.h Sat Jul 21 10:47:15 2001
+++ linux/include/linux/serialP.h Sun Dec 30 13:09:27 2001
@@ -70,7 +70,7 @@
int x_char; /* xon/xoff character */
int close_delay;
unsigned short closing_wait;
- unsigned short closing_wait2;
+ unsigned short closing_wait2; /* obsolete */
int IER; /* Interrupt Enable Register */
int MCR; /* Modem control register */
int LCR; /* Line control register */
--- orig/drivers/char/serial.c Sun Dec 30 13:37:23 2001
+++ linux/drivers/char/serial.c Sun Dec 30 13:49:27 2001
@@ -3095,36 +3095,52 @@
sstate = rs_table + line;
sstate->count++;
- if (sstate->info) {
- *ret_info = sstate->info;
- return 0;
- }
+ info = sstate->info;
+
+ /*
+ * If the async_struct is already allocated, do the fastpath.
+ */
+ if (info)
+ goto out;
+
info = kmalloc(sizeof(struct async_struct), GFP_KERNEL);
if (!info) {
sstate->count--;
return -ENOMEM;
}
+
memset(info, 0, sizeof(struct async_struct));
init_waitqueue_head(&info->open_wait);
init_waitqueue_head(&info->close_wait);
init_waitqueue_head(&info->delta_msr_wait);
info->magic = SERIAL_MAGIC;
info->port = sstate->port;
+ info->hub6 = sstate->hub6;
info->flags = sstate->flags;
- info->io_type = sstate->io_type;
- info->iomem_base = sstate->iomem_base;
- info->iomem_reg_shift = sstate->iomem_reg_shift;
info->xmit_fifo_size = sstate->xmit_fifo_size;
+ info->state = sstate;
info->line = line;
+ info->iomem_base = sstate->iomem_base;
+ info->iomem_reg_shift = sstate->iomem_reg_shift;
+ info->io_type = sstate->io_type;
info->tqueue.routine = do_softint;
info->tqueue.data = info;
- info->state = sstate;
+
if (sstate->info) {
kfree(info);
- *ret_info = sstate->info;
- return 0;
+ info = sstate->info;
+ } else {
+ sstate->info = info;
+ }
+
+out:
+ /*
+ * If this is the first open, copy over some timeouts.
+ */
+ if (sstate->count == 1) {
+ info->closing_wait = sstate->closing_wait;
}
- *ret_info = sstate->info = info;
+ *ret_info = info;
return 0;
}
--
Russell King (rmk@arm.linux.org.uk) The developer of ARM Linux
http://www.arm.linux.org.uk/personal/aboutme.html
next prev parent reply other threads:[~2001-12-30 14:43 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-12-30 13:52 [PATCH] fix serial close hang Russell King
2001-12-30 14:17 ` Heinz Diehl
2001-12-30 14:42 ` Russell King [this message]
2001-12-31 12:11 ` Heinz Diehl
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20011230144235.B9625@flint.arm.linux.org.uk \
--to=rmk@arm.linux.org.uk \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox