Cc (sorry):
Alex Elder <elder(a)kernel.org>
Andrew Lunn <andrew+netdev(a)lunn.ch>
Andy Shevchenko <andriy.shevchenko(a)linux.intel.com>
David Lin <dtwlin(a)gmail.com>
"David S. Miller" <davem(a)davemloft.net>
Eric Dumazet <edumazet(a)google.com>
greybus-dev(a)lists.linaro.org
"Ilpo Järvinen" <ilpo.jarvinen(a)linux.intel.com>
Jakub Kicinski <kuba(a)kernel.org>
Johan Hovold <johan(a)kernel.org>
linux-alpha(a)vger.kernel.org
linux-mmc(a)vger.kernel.org
linux-staging(a)lists.linux.dev
Matt Turner <mattst88(a)gmail.com>
netdev(a)vger.kernel.org
Paolo Abeni <pabeni(a)redhat.com>
Richard Henderson <richard.henderson(a)linaro.org>
Rob Herring <robh(a)kernel.org>
sparclinux(a)vger.kernel.org
Ulf Hansson <ulf.hansson(a)linaro.org>
On 17. 03. 25, 8:00, Jiri Slaby (SUSE) wrote:
> Hi,
>
> this is (again) a series of cleanup in tty. I am trying to rework
> tty+serial to avoid limitations of devices (so called NR_UART or
> tty_alloc_driver()'s first parameter). And the below popped up while
> crawling through the code. So this is only a prep cleanup.
>
> * many tty flags are now enums
> * many functions were improved for readability
> * quite a few unused or old code dropped
>
> In particular, the runtime behaviour of the kernel before and after the
> changes is supposed to be bug to bug compatible (except moxa's ioctl
> and ISA evils dropped). That is, noone should notice.
>
> [v2]
> * use serial_port_in/out() helpers in 26/30 (and not use serial_in/out())
> * the last patch is new
>
> Jiri Slaby (SUSE) (31):
> tty: convert "TTY Struct Flags" to an enum
> tty: audit: do not use N_TTY_BUF_SIZE
> tty: caif: do not use N_TTY_BUF_SIZE
> tty: move N_TTY_BUF_SIZE to n_tty
> tty: n_tty: use uint for space returned by tty_write_room()
> tty: n_tty: simplify process_output()
> tty: n_tty: clean up process_output_block()
> tty: n_tty: drop n_tty_trace()
> tty: n_tty: extract n_tty_continue_cookie() from n_tty_read()
> tty: n_tty: extract n_tty_wait_for_input()
> tty: n_tty: move more_to_be_read to the end of n_tty_read()
> tty: tty_driver: move TTY macros to the top
> tty: tty_driver: convert "TTY Driver Flags" to an enum
> tty: tty_driver: document both {,__}tty_alloc_driver() properly
> tty: tty_driver: introduce TTY driver sub/types enums
> tty: serdev: drop serdev_controller_ops::write_room()
> tty: mmc: sdio: use bool for cts and remove parentheses
> tty: moxa: drop version dump to logs
> tty: moxa: drop ISA support
> tty: moxa: carve out special ioctls and extra tty_port
> tty: srmcons: fix retval from srmcons_init()
> tty: staging/greybus: pass tty_driver flags to tty_alloc_driver()
> tty: sunsu: drop serial_{in,out}p()
> tty: sunsu: remove unused serial_icr_read()
> serial: remove redundant tty_port_link_device()
> serial: pass struct uart_state to uart_line_info()
> serial: 8250: use serial_port_in/out() helpers
> serial: 8250_rsa: simplify rsa8250_{request/release}_resource()
> serial: 8250_port: do not use goto for UPQ_NO_TXEN_TEST code flow
> serial: 8250_port: simplify serial8250_request_std_resource()
> serial: switch change_irq and change_port to bool in uart_set_info()
>
> Documentation/driver-api/tty/tty_driver.rst | 4 +-
> Documentation/driver-api/tty/tty_struct.rst | 2 +-
> arch/alpha/kernel/srmcons.c | 62 ++---
> drivers/mmc/core/sdio_uart.c | 2 +-
> drivers/net/caif/caif_serial.c | 2 +-
> drivers/staging/greybus/uart.c | 4 +-
> drivers/tty/Kconfig | 2 +-
> drivers/tty/moxa.c | 251 +-------------------
> drivers/tty/n_tty.c | 212 ++++++++---------
> drivers/tty/serdev/core.c | 11 -
> drivers/tty/serdev/serdev-ttyport.c | 9 -
> drivers/tty/serial/8250/8250_dw.c | 16 +-
> drivers/tty/serial/8250/8250_fsl.c | 8 +-
> drivers/tty/serial/8250/8250_omap.c | 2 +-
> drivers/tty/serial/8250/8250_port.c | 59 ++---
> drivers/tty/serial/8250/8250_rsa.c | 21 +-
> drivers/tty/serial/serial_core.c | 10 +-
> drivers/tty/serial/sunsu.c | 178 ++++++--------
> drivers/tty/tty_audit.c | 10 +-
> drivers/tty/tty_io.c | 8 +-
> include/linux/serdev.h | 6 -
> include/linux/tty.h | 53 +++--
> include/linux/tty_driver.h | 180 +++++++-------
> 23 files changed, 412 insertions(+), 700 deletions(-)
>
--
js
suse labs
Hi,
this is (again) a series of cleanup in tty. I am trying to rework
tty+serial to avoid limitations of devices (so called NR_UART or
tty_alloc_driver()'s first parameter). And the below popped up while
crawling through the code. So this is only a prep cleanup.
* many tty flags are now enums
* many functions were improved for readability
* quite a few unused or old code dropped
In particular, the runtime behaviour of the kernel before and after the
changes is supposed to be bug to bug compatible (except moxa's ioctl
and ISA evils dropped). That is, noone should notice.
Cc: Alex Elder <elder(a)kernel.org>
Cc: Andrew Lunn <andrew+netdev(a)lunn.ch>
Cc: Andy Shevchenko <andriy.shevchenko(a)linux.intel.com>
Cc: David Lin <dtwlin(a)gmail.com>
Cc: "David S. Miller" <davem(a)davemloft.net>
Cc: Eric Dumazet <edumazet(a)google.com>
Cc: greybus-dev(a)lists.linaro.org
Cc: "Ilpo Järvinen" <ilpo.jarvinen(a)linux.intel.com>
Cc: Jakub Kicinski <kuba(a)kernel.org>
Cc: Johan Hovold <johan(a)kernel.org>
Cc: linux-alpha(a)vger.kernel.org
Cc: linux-staging(a)lists.linux.dev
Cc: Matt Turner <mattst88(a)gmail.com>
Cc: netdev(a)vger.kernel.org
Cc: Paolo Abeni <pabeni(a)redhat.com>
Cc: Richard Henderson <richard.henderson(a)linaro.org>
Cc: Rob Herring <robh(a)kernel.org>
Cc: sparclinux(a)vger.kernel.org
Jiri Slaby (SUSE) (29):
tty: convert "TTY Struct Flags" to an enum
tty: audit: do not use N_TTY_BUF_SIZE
tty: caif: do not use N_TTY_BUF_SIZE
tty: move N_TTY_BUF_SIZE to n_tty
tty: n_tty: use uint for space returned by tty_write_room()
tty: n_tty: simplify process_output()
tty: n_tty: clean up process_output_block()
tty: n_tty: drop n_tty_trace()
tty: n_tty: extract n_tty_continue_cookie() from n_tty_read()
tty: n_tty: extract n_tty_wait_for_input()
tty: n_tty: move more_to_be_read to the end of n_tty_read()
tty: tty_driver: move TTY macros to the top
tty: tty_driver: convert "TTY Driver Flags" to an enum
tty: tty_driver: document both {,__}tty_alloc_driver() properly
tty: tty_driver: introduce TTY driver sub/types enums
tty: serdev: drop serdev_controller_ops::write_room()
tty: moxa: drop version dump to logs
tty: moxa: drop ISA support
tty: moxa: carve out special ioctls and extra tty_port
tty: srmcons: fix retval from srmcons_init()
tty: staging/greybus: pass tty_driver flags to tty_alloc_driver()
tty: sunsu: drop serial_{in,out}p()
tty: sunsu: remove unused serial_icr_read()
serial: remove redundant tty_port_link_device()
serial: pass struct uart_state to uart_line_info()
serial: 8250: use serial_in/out() helpers
serial: 8250_rsa: simplify rsa8250_{request/release}_resource()
serial: 8250_port: do not use goto for UPQ_NO_TXEN_TEST code flow
serial: 8250_port: simplify serial8250_request_std_resource()
Documentation/driver-api/tty/tty_driver.rst | 4 +-
Documentation/driver-api/tty/tty_struct.rst | 2 +-
arch/alpha/kernel/srmcons.c | 62 ++---
drivers/net/caif/caif_serial.c | 2 +-
drivers/staging/greybus/uart.c | 4 +-
drivers/tty/Kconfig | 2 +-
drivers/tty/moxa.c | 251 +-------------------
drivers/tty/n_tty.c | 212 ++++++++---------
drivers/tty/serdev/core.c | 11 -
drivers/tty/serdev/serdev-ttyport.c | 9 -
drivers/tty/serial/8250/8250_dw.c | 17 +-
drivers/tty/serial/8250/8250_fsl.c | 8 +-
drivers/tty/serial/8250/8250_omap.c | 2 +-
drivers/tty/serial/8250/8250_port.c | 59 ++---
drivers/tty/serial/8250/8250_rsa.c | 21 +-
drivers/tty/serial/serial_core.c | 6 +-
drivers/tty/serial/sunsu.c | 178 ++++++--------
drivers/tty/tty_audit.c | 10 +-
drivers/tty/tty_io.c | 8 +-
include/linux/serdev.h | 6 -
include/linux/tty.h | 53 +++--
include/linux/tty_driver.h | 180 +++++++-------
22 files changed, 410 insertions(+), 697 deletions(-)
--
2.48.1
Previously,the module was freed without detaching it from the list which could lead to memory leak
this patch uses list_del to safely remove the module from the list
Signed-off-by: Atharva Tiwari <evepolonium(a)gmail.com>
---
drivers/staging/greybus/audio_manager_module.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/staging/greybus/audio_manager_module.c b/drivers/staging/greybus/audio_manager_module.c
index 4a4dfb42f50f..7e52c3f95692 100644
--- a/drivers/staging/greybus/audio_manager_module.c
+++ b/drivers/staging/greybus/audio_manager_module.c
@@ -69,7 +69,8 @@ static void gb_audio_module_release(struct kobject *kobj)
struct gb_audio_manager_module *module = to_gb_audio_module(kobj);
pr_info("Destroying audio module #%d\n", module->id);
- /* TODO -> delete from list */
+ if (module->list.prev && module->list.next)
+ list_del(&module->list);
kfree(module);
}
--
2.39.5
Our static checker found a bug where set_serial_info() uses a mutex, but
get_serial_info() does not. Fortunately, the impact of this is relatively
minor. It doesn't cause a crash or any other serious issues. However, if a
race condition occurs between set_serial_info() and get_serial_info(),
there is a chance that the data returned by get_serial_info() will be
meaningless.
Signed-off-by: Qiu-ji Chen <chenqiuji666(a)gmail.com>
Fixes: 0aad5ad563c8 ("greybus/uart: switch to ->[sg]et_serial()")
---
V2:
Modified the patch description to make it more concise and easier to understand.
Changed the fix code to ensure the logic is correct.
Thanks to Johan Hovold and Dan Carpenter for helpful suggestion.
V3:
Used the correct patch prefix.
Thanks Johan Hovold, Dan Carpenter, Alex Elder and Greg KH for helpful suggestion.
---
drivers/staging/greybus/uart.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/staging/greybus/uart.c b/drivers/staging/greybus/uart.c
index cdf4ebb93b10..8eab94cb06fa 100644
--- a/drivers/staging/greybus/uart.c
+++ b/drivers/staging/greybus/uart.c
@@ -596,11 +596,13 @@ static int get_serial_info(struct tty_struct *tty,
struct gb_tty *gb_tty = tty->driver_data;
ss->line = gb_tty->minor;
+ mutex_lock(&gb_tty->port.mutex);
ss->close_delay = jiffies_to_msecs(gb_tty->port.close_delay) / 10;
ss->closing_wait =
gb_tty->port.closing_wait == ASYNC_CLOSING_WAIT_NONE ?
ASYNC_CLOSING_WAIT_NONE :
jiffies_to_msecs(gb_tty->port.closing_wait) / 10;
+ mutex_unlock(&gb_tty->port.mutex);
return 0;
}
--
2.34.1
Our static checker found a bug where set_serial_info() uses a mutex, but
get_serial_info() does not. Fortunately, the impact of this is relatively
minor. It doesn't cause a crash or any other serious issues. However, if a
race condition occurs between set_serial_info() and get_serial_info(),
there is a chance that the data returned by get_serial_info() will be
meaningless.
Signed-off-by: Qiu-ji Chen <chenqiuji666(a)gmail.com>
Fixes: 0aad5ad563c8 ("greybus/uart: switch to ->[sg]et_serial()")
---
V2:
Modified the patch description to make it more concise and easier to understand.
Changed the fix code to ensure the logic is correct.
Thanks to Johan Hovold and Dan Carpenter for helpful suggestion.
---
drivers/staging/greybus/uart.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/staging/greybus/uart.c b/drivers/staging/greybus/uart.c
index cdf4ebb93b10..8eab94cb06fa 100644
--- a/drivers/staging/greybus/uart.c
+++ b/drivers/staging/greybus/uart.c
@@ -596,11 +596,13 @@ static int get_serial_info(struct tty_struct *tty,
struct gb_tty *gb_tty = tty->driver_data;
ss->line = gb_tty->minor;
+ mutex_lock(&gb_tty->port.mutex);
ss->close_delay = jiffies_to_msecs(gb_tty->port.close_delay) / 10;
ss->closing_wait =
gb_tty->port.closing_wait == ASYNC_CLOSING_WAIT_NONE ?
ASYNC_CLOSING_WAIT_NONE :
jiffies_to_msecs(gb_tty->port.closing_wait) / 10;
+ mutex_unlock(&gb_tty->port.mutex);
return 0;
}
--
2.34.1