Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1243999
| Path | csiph.com!eternal-september.org!feeder.eternal-september.org!aioe.org!bofh.it!news.nic.it!robomod |
|---|---|
| From | Peter Hurley <peter@hurleysoftware.com> |
| Newsgroups | linux.kernel |
| Subject | [PATCH 5/7] tty: r3964: Use tty->read_wait waitqueue |
| Date | Sat, 10 Oct 2015 22:10:02 +0200 |
| Message-ID | <qi8CS-2S8-13@gated-at.bofh.it> (permalink) |
| References | <qi8CR-2S8-3@gated-at.bofh.it> |
| X-Original-To | Greg Kroah-Hartman <gregkh@linuxfoundation.org> |
| X-Google-Dkim-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=VUyQ22l2gbukZKPJq7iqJVotsFEh5idY2nCTiTug1eg=; b=ABg3V5HBeGuYTPNxDBvnzxjRCYJF5hf3LrEEhLnQffVzNCSATHyZjvyD1v+YY6L6MT zD8PGVVO6SPd1ItfUCSgxMbbaW4FhmTw0ZV/2JEf1NJWQI0LkjVSIaMI7NrJSVCpk8HE 8UjTytlYqmy7BnGemJrsdAGGIbp0BTYlLBqpyfV3eodnTJMojVUkR6aYnlSFJBTjdaoX IQ4yjrCZqQ3Zar8EqxGT+891/jQ/KJugEU9oD7wPub07OjV5bJ82WjBo35spdUOrf8Qg fth57VLMMqqQxc66B/CpyV4gIKHBl2tZl/IqinI15Vh4QJxKKht5rO6Q/I/jf99OM84k 1Plg== |
| X-Gm-Message-State | ALoCoQlLyu3yYPF/Ivj4poQ4Size/TiArK2ymldNFjjt3ZmeDPMZWd+6/T8AcLLPuk0F8xA84/Ku |
| X-Received | by 10.140.96.53 with SMTP id j50mr3611368qge.100.1444507287363; Sat, 10 Oct 2015 13:01:27 -0700 (PDT) |
| X-Mailer | git-send-email 2.6.1 |
| Sender | robomod@news.nic.it |
| List-ID | <linux-kernel.vger.kernel.org> |
| X-Mailing-List | linux-kernel@vger.kernel.org |
| Approved | robomod@news.nic.it |
| Lines | 92 |
| Organization | linux.* mail to news gateway |
| X-Original-Cc | Jiri Slaby <jslaby@suse.cz>, Alan Cox <alan@linux.intel.com>, David Laight <David.Laight@aculab.com>, Arnd Bergmann <arnd@arndb.de>, linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, netdev@vger.kernel.org, David Miller <davem@davemloft.net>, Peter Hurley <peter@hurleysoftware.com> |
| X-Original-Date | Sat, 10 Oct 2015 16:00:55 -0400 |
| X-Original-Message-ID | <1444507257-7513-6-git-send-email-peter@hurleysoftware.com> |
| X-Original-References | <1444507257-7513-1-git-send-email-peter@hurleysoftware.com> |
| X-Original-Sender | linux-kernel-owner@vger.kernel.org |
| Xref | csiph.com linux.kernel:1243999 |
Show key headers only | View raw
The tty core provides read_wait waitqueue specifically for line
disciplines to wait readers; otherwise, the line discipline may
miss wakeups generated by the tty core.
NB: The tty core already provides serialization for the line discipline's
close() method, and guarantees no readers or writers will be using the
closing instance of the line discipline. Completely remove that wakeup.
Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
---
drivers/tty/n_r3964.c | 10 ++++------
include/linux/n_r3964.h | 3 ---
2 files changed, 4 insertions(+), 9 deletions(-)
diff --git a/drivers/tty/n_r3964.c b/drivers/tty/n_r3964.c
index 8b157d6..6fdef92 100644
--- a/drivers/tty/n_r3964.c
+++ b/drivers/tty/n_r3964.c
@@ -276,7 +276,7 @@ static void remove_from_tx_queue(struct r3964_info *pInfo, int error_code)
add_msg(pHeader->owner, R3964_MSG_ACK, pHeader->length,
error_code, NULL);
}
- wake_up_interruptible(&pInfo->read_wait);
+ wake_up_interruptible(&pInfo->tty->read_wait);
}
spin_lock_irqsave(&pInfo->lock, flags);
@@ -542,7 +542,7 @@ static void on_receive_block(struct r3964_info *pInfo)
pBlock);
}
}
- wake_up_interruptible(&pInfo->read_wait);
+ wake_up_interruptible(&pInfo->tty->read_wait);
pInfo->state = R3964_IDLE;
@@ -979,7 +979,6 @@ static int r3964_open(struct tty_struct *tty)
spin_lock_init(&pInfo->lock);
pInfo->tty = tty;
- init_waitqueue_head(&pInfo->read_wait);
pInfo->priority = R3964_MASTER;
pInfo->rx_first = pInfo->rx_last = NULL;
pInfo->tx_first = pInfo->tx_last = NULL;
@@ -1045,7 +1044,6 @@ static void r3964_close(struct tty_struct *tty)
}
/* Free buffers: */
- wake_up_interruptible(&pInfo->read_wait);
kfree(pInfo->rx_buf);
TRACE_M("r3964_close - rx_buf kfree %p", pInfo->rx_buf);
kfree(pInfo->tx_buf);
@@ -1077,7 +1075,7 @@ static ssize_t r3964_read(struct tty_struct *tty, struct file *file,
goto unlock;
}
/* block until there is a message: */
- wait_event_interruptible_tty(tty, pInfo->read_wait,
+ wait_event_interruptible_tty(tty, tty->read_wait,
(pMsg = remove_msg(pInfo, pClient)));
}
@@ -1227,7 +1225,7 @@ static unsigned int r3964_poll(struct tty_struct *tty, struct file *file,
pClient = findClient(pInfo, task_pid(current));
if (pClient) {
- poll_wait(file, &pInfo->read_wait, wait);
+ poll_wait(file, &tty->read_wait, wait);
spin_lock_irqsave(&pInfo->lock, flags);
pMsg = pClient->first_msg;
spin_unlock_irqrestore(&pInfo->lock, flags);
diff --git a/include/linux/n_r3964.h b/include/linux/n_r3964.h
index 5d0b2a1..e9adb42 100644
--- a/include/linux/n_r3964.h
+++ b/include/linux/n_r3964.h
@@ -152,9 +152,6 @@ struct r3964_info {
unsigned char *rx_buf; /* ring buffer */
unsigned char *tx_buf;
- wait_queue_head_t read_wait;
- //struct wait_queue *read_wait;
-
struct r3964_block_header *rx_first;
struct r3964_block_header *rx_last;
struct r3964_block_header *tx_first;
--
2.6.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@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 linux.kernel | Previous | Next | Find similar | Unroll thread
[PATCH 5/7] tty: r3964: Use tty->read_wait waitqueue Peter Hurley <peter@hurleysoftware.com> - 2015-10-10 22:10 +0200
csiph-web