From patchwork Wed May 19 07:21:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 442957 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2606DC433ED for ; Wed, 19 May 2021 07:21:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id ED76561244 for ; Wed, 19 May 2021 07:21:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238781AbhESHXP (ORCPT ); Wed, 19 May 2021 03:23:15 -0400 Received: from mx2.suse.de ([195.135.220.15]:39318 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237293AbhESHXP (ORCPT ); Wed, 19 May 2021 03:23:15 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 822D9AD4B; Wed, 19 May 2021 07:21:54 +0000 (UTC) From: Jiri Slaby To: gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Jiri Slaby Subject: [PATCH 1/4] tty/serial: clean up uart_match_port Date: Wed, 19 May 2021 09:21:50 +0200 Message-Id: <20210519072153.3859-1-jslaby@suse.cz> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org * make parameters const (as they are only read) * return bool (as comparison results are returned) * add \n before final return Signed-off-by: Jiri Slaby --- drivers/tty/serial/serial_core.c | 16 +++++++++------- include/linux/serial_core.h | 3 ++- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c index 33a817c57494..e379fa2e32af 100644 --- a/drivers/tty/serial/serial_core.c +++ b/drivers/tty/serial/serial_core.c @@ -3005,26 +3005,28 @@ int uart_remove_one_port(struct uart_driver *drv, struct uart_port *uport) /* * Are the two ports equivalent? */ -int uart_match_port(struct uart_port *port1, struct uart_port *port2) +bool uart_match_port(const struct uart_port *port1, + const struct uart_port *port2) { if (port1->iotype != port2->iotype) - return 0; + return false; switch (port1->iotype) { case UPIO_PORT: - return (port1->iobase == port2->iobase); + return port1->iobase == port2->iobase; case UPIO_HUB6: - return (port1->iobase == port2->iobase) && - (port1->hub6 == port2->hub6); + return port1->iobase == port2->iobase && + port1->hub6 == port2->hub6; case UPIO_MEM: case UPIO_MEM16: case UPIO_MEM32: case UPIO_MEM32BE: case UPIO_AU: case UPIO_TSI: - return (port1->mapbase == port2->mapbase); + return port1->mapbase == port2->mapbase; } - return 0; + + return false; } EXPORT_SYMBOL(uart_match_port); diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h index 7445c8fd88c0..52d7fb92a69d 100644 --- a/include/linux/serial_core.h +++ b/include/linux/serial_core.h @@ -408,7 +408,8 @@ int uart_register_driver(struct uart_driver *uart); void uart_unregister_driver(struct uart_driver *uart); int uart_add_one_port(struct uart_driver *reg, struct uart_port *port); int uart_remove_one_port(struct uart_driver *reg, struct uart_port *port); -int uart_match_port(struct uart_port *port1, struct uart_port *port2); +bool uart_match_port(const struct uart_port *port1, + const struct uart_port *port2); /* * Power Management From patchwork Wed May 19 07:21:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 443750 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B2B80C43460 for ; Wed, 19 May 2021 07:21:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 917B16139A for ; Wed, 19 May 2021 07:21:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233202AbhESHXP (ORCPT ); Wed, 19 May 2021 03:23:15 -0400 Received: from mx2.suse.de ([195.135.220.15]:39348 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237490AbhESHXP (ORCPT ); Wed, 19 May 2021 03:23:15 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id B7B22AFEF; Wed, 19 May 2021 07:21:54 +0000 (UTC) From: Jiri Slaby To: gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Jiri Slaby Subject: [PATCH 2/4] tty/serial: make port of serial8250_register_8250_port const Date: Wed, 19 May 2021 09:21:51 +0200 Message-Id: <20210519072153.3859-2-jslaby@suse.cz> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210519072153.3859-1-jslaby@suse.cz> References: <20210519072153.3859-1-jslaby@suse.cz> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org After the previous patch, we can make port passed to serial8250_find_match_or_unused const. And then we can make const also port of serial8250_register_8250_port. Signed-off-by: Jiri Slaby --- drivers/tty/serial/8250/8250_core.c | 4 ++-- include/linux/serial_8250.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/tty/serial/8250/8250_core.c b/drivers/tty/serial/8250/8250_core.c index 1082e76c4d37..1ce193daea7f 100644 --- a/drivers/tty/serial/8250/8250_core.c +++ b/drivers/tty/serial/8250/8250_core.c @@ -906,7 +906,7 @@ static struct platform_device *serial8250_isa_devs; */ static DEFINE_MUTEX(serial_mutex); -static struct uart_8250_port *serial8250_find_match_or_unused(struct uart_port *port) +static struct uart_8250_port *serial8250_find_match_or_unused(const struct uart_port *port) { int i; @@ -971,7 +971,7 @@ static void serial_8250_overrun_backoff_work(struct work_struct *work) * * On success the port is ready to use and the line number is returned. */ -int serial8250_register_8250_port(struct uart_8250_port *up) +int serial8250_register_8250_port(const struct uart_8250_port *up) { struct uart_8250_port *uart; int ret = -ENOSPC; diff --git a/include/linux/serial_8250.h b/include/linux/serial_8250.h index 9e655055112d..5db211f43b29 100644 --- a/include/linux/serial_8250.h +++ b/include/linux/serial_8250.h @@ -146,7 +146,7 @@ static inline struct uart_8250_port *up_to_u8250p(struct uart_port *up) return container_of(up, struct uart_8250_port, port); } -int serial8250_register_8250_port(struct uart_8250_port *); +int serial8250_register_8250_port(const struct uart_8250_port *); void serial8250_unregister_port(int line); void serial8250_suspend_port(int line); void serial8250_resume_port(int line); From patchwork Wed May 19 07:21:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 443751 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9FC38C433B4 for ; Wed, 19 May 2021 07:21:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 75B8B6135C for ; Wed, 19 May 2021 07:21:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239624AbhESHXP (ORCPT ); Wed, 19 May 2021 03:23:15 -0400 Received: from mx2.suse.de ([195.135.220.15]:39364 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237886AbhESHXP (ORCPT ); Wed, 19 May 2021 03:23:15 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 010FFAF06; Wed, 19 May 2021 07:21:55 +0000 (UTC) From: Jiri Slaby To: gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Jiri Slaby , Linus Torvalds Subject: [PATCH 3/4] tty: fix kernel-doc for tty_{read,write} Date: Wed, 19 May 2021 09:21:52 +0200 Message-Id: <20210519072153.3859-3-jslaby@suse.cz> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210519072153.3859-1-jslaby@suse.cz> References: <20210519072153.3859-1-jslaby@suse.cz> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org After commits a9cbbb80e3e7 (tty: avoid using vfs_iocb_iter_write() for redirected console writes) and dd78b0c483e3 (tty: implement read_iter), the tty_read and tty_write kernel-doc comments don't match the code: tty_io.c:931: warning: Function parameter or member 'iocb' not described in 'tty_read' tty_io.c:931: warning: Function parameter or member 'to' not described in 'tty_read' tty_io.c:931: warning: Excess function parameter 'file' description in 'tty_read' tty_io.c:931: warning: Excess function parameter 'buf' description in 'tty_read' tty_io.c:931: warning: Excess function parameter 'count' description in 'tty_read' tty_io.c:931: warning: Excess function parameter 'ppos' description in 'tty_read' tty_io.c:1115: warning: Function parameter or member 'iocb' not described in 'file_tty_write' tty_io.c:1115: warning: Function parameter or member 'from' not described in 'file_tty_write' tty_io.c:1115: warning: expecting prototype for tty_write(). Prototype was for file_tty_write() instead Fix them to correspond the reality, i.e. the switch from read/write to read_iter/write_iter. Signed-off-by: Jiri Slaby Cc: Linus Torvalds --- drivers/tty/tty_io.c | 37 ++++++++++++++++--------------------- 1 file changed, 16 insertions(+), 21 deletions(-) diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c index 8f9e89715a68..ad64232cecae 100644 --- a/drivers/tty/tty_io.c +++ b/drivers/tty/tty_io.c @@ -911,10 +911,8 @@ static int iterate_tty_read(struct tty_ldisc *ld, struct tty_struct *tty, /** * tty_read - read method for tty device files - * @file: pointer to tty file - * @buf: user buffer - * @count: size of user buffer - * @ppos: unused + * @iocb: kernel I/O control block + * @to: destination for the data read * * Perform the read system call function on this terminal device. Checks * for hung up devices before calling the line discipline method. @@ -1092,23 +1090,6 @@ void tty_write_message(struct tty_struct *tty, char *msg) } } - -/** - * tty_write - write method for tty device file - * @file: tty file pointer - * @buf: user data to write - * @count: bytes to write - * @ppos: unused - * - * Write data to a tty device via the line discipline. - * - * Locking: - * Locks the line discipline as required - * Writes to the tty driver are serialized by the atomic_write_lock - * and are then processed in chunks to the device. The line discipline - * write method will not be invoked in parallel for each device. - */ - static ssize_t file_tty_write(struct file *file, struct kiocb *iocb, struct iov_iter *from) { struct tty_struct *tty = file_tty(file); @@ -1133,6 +1114,20 @@ static ssize_t file_tty_write(struct file *file, struct kiocb *iocb, struct iov_ return ret; } +/** + * tty_write - write method for tty device file + * @iocb: kernel I/O control block + * @from: iov_iter with data to write + * + * Write data to a tty device via the line discipline. + * + * Locking: + * Locks the line discipline as required + * Writes to the tty driver are serialized by the atomic_write_lock + * and are then processed in chunks to the device. The line + * discipline write method will not be invoked in parallel for + * each device. + */ static ssize_t tty_write(struct kiocb *iocb, struct iov_iter *from) { return file_tty_write(iocb->ki_filp, iocb, from); From patchwork Wed May 19 07:21:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 442956 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 093A7C43461 for ; Wed, 19 May 2021 07:21:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D4AB161364 for ; Wed, 19 May 2021 07:21:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239651AbhESHXQ (ORCPT ); Wed, 19 May 2021 03:23:16 -0400 Received: from mx2.suse.de ([195.135.220.15]:39378 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238016AbhESHXP (ORCPT ); Wed, 19 May 2021 03:23:15 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 2FA52B159; Wed, 19 May 2021 07:21:55 +0000 (UTC) From: Jiri Slaby To: gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Jiri Slaby Subject: [PATCH 4/4] tty: fix kernel-doc for {start,stop}_tty Date: Wed, 19 May 2021 09:21:53 +0200 Message-Id: <20210519072153.3859-4-jslaby@suse.cz> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210519072153.3859-1-jslaby@suse.cz> References: <20210519072153.3859-1-jslaby@suse.cz> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org Commit f9e053dcfc02 (tty: Serialize tty flow control changes with flow_lock) renamed start_tty to __start_tty and stop_tty to __stop_tty and introduced new start_tty and stop_tty. But it left kernel-doc comments on the old locations: tty_io.c:785: warning: expecting prototype for stop_tty(). Prototype was for __stop_tty() instead tty_io.c:816: warning: expecting prototype for start_tty(). Prototype was for __start_tty() instead Fix that by moving the comments to appropriate locations. Signed-off-by: Jiri Slaby --- drivers/tty/tty_io.c | 40 +++++++++++++++++++--------------------- 1 file changed, 19 insertions(+), 21 deletions(-) diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c index ad64232cecae..26debec26b4e 100644 --- a/drivers/tty/tty_io.c +++ b/drivers/tty/tty_io.c @@ -761,6 +761,15 @@ int tty_hung_up_p(struct file *filp) } EXPORT_SYMBOL(tty_hung_up_p); +void __stop_tty(struct tty_struct *tty) +{ + if (tty->flow.stopped) + return; + tty->flow.stopped = true; + if (tty->ops->stop) + tty->ops->stop(tty); +} + /** * stop_tty - propagate flow control * @tty: tty to stop @@ -777,16 +786,6 @@ EXPORT_SYMBOL(tty_hung_up_p); * Locking: * flow.lock */ - -void __stop_tty(struct tty_struct *tty) -{ - if (tty->flow.stopped) - return; - tty->flow.stopped = true; - if (tty->ops->stop) - tty->ops->stop(tty); -} - void stop_tty(struct tty_struct *tty) { unsigned long flags; @@ -797,6 +796,16 @@ void stop_tty(struct tty_struct *tty) } EXPORT_SYMBOL(stop_tty); +void __start_tty(struct tty_struct *tty) +{ + if (!tty->flow.stopped || tty->flow.tco_stopped) + return; + tty->flow.stopped = false; + if (tty->ops->start) + tty->ops->start(tty); + tty_wakeup(tty); +} + /** * start_tty - propagate flow control * @tty: tty to start @@ -808,17 +817,6 @@ EXPORT_SYMBOL(stop_tty); * Locking: * flow.lock */ - -void __start_tty(struct tty_struct *tty) -{ - if (!tty->flow.stopped || tty->flow.tco_stopped) - return; - tty->flow.stopped = false; - if (tty->ops->start) - tty->ops->start(tty); - tty_wakeup(tty); -} - void start_tty(struct tty_struct *tty) { unsigned long flags;