Jiri Slaby (SUSE) and Greg Kroah-Hartman
1c7736dc68
tty: moxa: use guard()s
...
Use guards in the moxa code. This improves readability, makes error
handling easier, and marks locked portions of code explicit. All that
while being sure the lock is unlocked.
Signed-off-by: Jiri Slaby (SUSE) <jirislaby@kernel.org >
Link: https://patch.msgid.link/20251119100140.830761-6-jirislaby@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2025-11-21 18:30:40 +01:00
Thomas Gleixner and Ingo Molnar
8fa7292fee
treewide: Switch/rename to timer_delete[_sync]()
...
timer_delete[_sync]() replaces del_timer[_sync](). Convert the whole tree
over and remove the historical wrapper inlines.
Conversion was done with coccinelle plus manual fixups where necessary.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de >
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2025-04-05 10:30:12 +02:00
Jiri Slaby (SUSE) and Greg Kroah-Hartman
794d7b2721
tty: moxa: carve out special ioctls and extra tty_port
...
These ioctls are undocumented and not exposed -- they are defined
locally. Given they need a special tty_port just for them, this is very
ugly. So drop this whole functionality. It is barely used for something
real. (And if it is, we'd need a common functionality to all drivers.)
Signed-off-by: Jiri Slaby (SUSE) <jirislaby@kernel.org >
Link: https://lore.kernel.org/r/20250317070046.24386-21-jirislaby@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2025-03-20 08:00:51 -07:00
Jiri Slaby (SUSE) and Greg Kroah-Hartman
eed0d31176
tty: moxa: drop ISA support
...
I doubt anyone actually uses this driver (unlike mxser.c and serial
moxa driven devices). Even less there is anyone with a moxa ISA card.
The newer mxser dropped the support for ISA in 2021. Let this moxa
follow now.
Good diet.
Signed-off-by: Jiri Slaby (SUSE) <jirislaby@kernel.org >
Link: https://lore.kernel.org/r/20250317070046.24386-20-jirislaby@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2025-03-20 08:00:51 -07:00
Jiri Slaby (SUSE) and Greg Kroah-Hartman
0fdbeabf21
tty: moxa: drop version dump to logs
...
The arbitrary MOXA_VERSION is dumped to the logs when the driver is
loaded. Avoid this as a driver should be silent unless something breaks.
Signed-off-by: Jiri Slaby (SUSE) <jirislaby@kernel.org >
Link: https://lore.kernel.org/r/20250317070046.24386-19-jirislaby@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2025-03-20 08:00:51 -07:00
Jiri Slaby (SUSE) and Greg Kroah-Hartman
cb8566b9b3
tty: moxa: convert to u8 and size_t
...
Switch character types to u8 and sizes to size_t. To conform to
characters/sizes in the rest of the tty layer.
Signed-off-by: "Jiri Slaby (SUSE)" <jirislaby@kernel.org >
Link: https://lore.kernel.org/r/20231206073712.17776-18-jirislaby@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2023-12-08 12:02:38 +01:00
Jiri Slaby (SUSE) and Greg Kroah-Hartman
95713967ba
tty: make tty_operations::write()'s count size_t
...
Unify with the rest of the code. Use size_t for counts and ssize_t for
retval.
Signed-off-by: "Jiri Slaby (SUSE)" <jirislaby@kernel.org >
Link: https://lore.kernel.org/r/20230810091510.13006-30-jirislaby@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2023-08-11 21:12:46 +02:00
Jiri Slaby (SUSE) and Greg Kroah-Hartman
69851e4ab8
tty: propagate u8 data to tty_operations::write()
...
Data are now typed as u8. Propagate this change to
tty_operations::write().
Signed-off-by: "Jiri Slaby (SUSE)" <jirislaby@kernel.org >
Cc: Richard Henderson <richard.henderson@linaro.org >
Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru >
Cc: Matt Turner <mattst88@gmail.com >
Cc: Geert Uytterhoeven <geert@linux-m68k.org >
Cc: Richard Weinberger <richard@nod.at >
Cc: Anton Ivanov <anton.ivanov@cambridgegreys.com >
Cc: Johannes Berg <johannes@sipsolutions.net >
Cc: Chris Zankel <chris@zankel.net >
Cc: Max Filippov <jcmvbkbc@gmail.com >
Cc: Arnd Bergmann <arnd@arndb.de >
Cc: Vaibhav Gupta <vaibhavgupta40@gmail.com >
Cc: Jens Taprogge <jens.taprogge@taprogge.org >
Cc: Karsten Keil <isdn@linux-pingi.de >
Cc: Scott Branden <scott.branden@broadcom.com >
Cc: Ulf Hansson <ulf.hansson@linaro.org >
Cc: "David S. Miller" <davem@davemloft.net >
Cc: Eric Dumazet <edumazet@google.com >
Cc: Jakub Kicinski <kuba@kernel.org >
Cc: Paolo Abeni <pabeni@redhat.com >
Cc: Heiko Carstens <hca@linux.ibm.com >
Cc: Vasily Gorbik <gor@linux.ibm.com >
Cc: Alexander Gordeev <agordeev@linux.ibm.com >
Cc: Christian Borntraeger <borntraeger@linux.ibm.com >
Cc: Sven Schnelle <svens@linux.ibm.com >
Cc: David Lin <dtwlin@gmail.com >
Cc: Johan Hovold <johan@kernel.org >
Cc: Alex Elder <elder@kernel.org >
Cc: Laurentiu Tudor <laurentiu.tudor@nxp.com >
Cc: Jiri Kosina <jikos@kernel.org >
Cc: David Sterba <dsterba@suse.com >
Cc: Shawn Guo <shawnguo@kernel.org >
Cc: Sascha Hauer <s.hauer@pengutronix.de >
Cc: Pengutronix Kernel Team <kernel@pengutronix.de >
Cc: Fabio Estevam <festevam@gmail.com >
Cc: NXP Linux Team <linux-imx@nxp.com >
Cc: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com >
Cc: Oliver Neukum <oneukum@suse.com >
Cc: Mathias Nyman <mathias.nyman@intel.com >
Cc: Marcel Holtmann <marcel@holtmann.org >
Cc: Johan Hedberg <johan.hedberg@gmail.com >
Cc: Luiz Augusto von Dentz <luiz.dentz@gmail.com >
Link: https://lore.kernel.org/r/20230810091510.13006-28-jirislaby@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2023-08-11 21:12:46 +02:00
Ilpo Järvinen and Greg Kroah-Hartman
2d762dab66
tty: moxa: Rename dtr/rts parameters/variables to active
...
Use active consistently for naming parameters and variables.
Reviewed-by: Jiri Slaby <jirislaby@kernel.org >
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com >
Link: https://lore.kernel.org/r/20230117090358.4796-13-ilpo.jarvinen@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2023-01-19 16:04:35 +01:00
Ilpo Järvinen and Greg Kroah-Hartman
5d42039907
tty: Convert ->dtr_rts() to take bool argument
...
Convert the raise/on parameter in ->dtr_rts() to bool through the
callchain. The parameter is used like bool. In USB serial, there
remains a few implicit bool -> larger type conversions because some
devices use u8 in their control messages.
In moxa_tiocmget(), dtr variable was reused for line status which
requires int so use a separate variable for status.
Reviewed-by: Jiri Slaby <jirislaby@kernel.org >
Acked-by: Ulf Hansson <ulf.hansson@linaro.org > # For MMC
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com >
Link: https://lore.kernel.org/r/20230117090358.4796-8-ilpo.jarvinen@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2023-01-19 16:04:35 +01:00
Ilpo Järvinen and Greg Kroah-Hartman
b300fb26c5
tty: Convert ->carrier_raised() and callchains to bool
...
Return boolean from ->carrier_raised() instead of 0 and 1. Make the
return type change also to tty_port_carrier_raised() that makes the
->carrier_raised() call (+ cd variable in moxa into which its return
value is stored).
Also cleans up a few unnecessary constructs related to this change:
return xx ? 1 : 0;
-> return xx;
if (xx)
return 1;
return 0;
-> return xx;
Reviewed-by: Jiri Slaby <jirislaby@kernel.org >
Acked-by: Ulf Hansson <ulf.hansson@linaro.org > # For MMC
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com >
Link: https://lore.kernel.org/r/20230117090358.4796-7-ilpo.jarvinen@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2023-01-19 16:04:35 +01:00
Ilpo Järvinen and Greg Kroah-Hartman
c2ac4bfa04
tty: moxa: Make local var storing tty_port_initialized() bool
...
Return type of tty_port_initialized() is bool, use matching type for
the local variable.
Also reorder the local vars to reverse-xmas-tree while at it.
Reviewed-by: Jiri Slaby <jirislaby@kernel.org >
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com >
Link: https://lore.kernel.org/r/20230117090358.4796-5-ilpo.jarvinen@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2023-01-19 16:04:34 +01:00
Ilpo Järvinen and Greg Kroah-Hartman
515be7baed
tty: Cleanup tty_port_set_initialized() bool parameter
...
Make callers pass true/false consistently for bool val.
Reviewed-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com >
Reviewed-by: Jiri Slaby <jirislaby@kernel.org >
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com >
Link: https://lore.kernel.org/r/20230117090358.4796-2-ilpo.jarvinen@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2023-01-19 16:04:34 +01:00
Ilpo Järvinen and Greg Kroah-Hartman
a8c11c1520
tty: Make ->set_termios() old ktermios const
...
There should be no reason to adjust old ktermios which is going to get
discarded anyway.
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com >
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com >
Link: https://lore.kernel.org/r/20220816115739.10928-9-ilpo.jarvinen@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2022-08-30 14:22:35 +02:00
Jiri Slaby and Greg Kroah-Hartman
5f6a85158c
tty: drivers/tty/, stop using tty_schedule_flip()
...
Since commit a9c3f68f3c (tty: Fix low_latency BUG) in 2014,
tty_flip_buffer_push() is only a wrapper to tty_schedule_flip(). We are
going to remove the latter (as it is used less), so call the former in
drivers/tty/.
Cc: Vladimir Zapolskiy <vz@mleia.com >
Reviewed-by: Johan Hovold <johan@kernel.org >
Signed-off-by: Jiri Slaby <jslaby@suse.cz >
Link: https://lore.kernel.org/r/20211122111648.30379-2-jslaby@suse.cz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-11-25 18:35:23 +01:00
Jiri Slaby and Greg Kroah-Hartman
b55c8aa6b1
tty: moxa: merge moxa.h into moxa.c
...
There is no need for existence of a separate header for Moxa's Intellio
cards. Merge it into moxa.c to clean up the tty dir a bit.
Signed-off-by: Jiri Slaby <jslaby@suse.cz >
Link: https://lore.kernel.org/r/20210914090823.17206-1-jslaby@suse.cz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-09-14 11:17:27 +02:00
Dan Carpenter and Greg Kroah-Hartman
322003b907
tty: moxa: use semi-colons instead of commas
...
This code works but it's cleaner to use a semi-colon to end a statement
instead of a comma.
Acked-by: Jiri Slaby <jirislaby@kernel.org >
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com >
Link: https://lore.kernel.org/r/20210825072405.GA13013@kili
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-08-26 14:48:07 +02:00
Jiri Slaby and Greg Kroah-Hartman
9f90a4ddef
tty: drop put_tty_driver
...
put_tty_driver() is an alias for tty_driver_kref_put(). There is no need
for two exported identical functions, therefore switch all users of
old put_tty_driver() to new tty_driver_kref_put() and remove the former
for good.
Cc: Richard Henderson <rth@twiddle.net >
Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru >
Cc: Matt Turner <mattst88@gmail.com >
Cc: Geert Uytterhoeven <geert@linux-m68k.org >
Cc: Jeff Dike <jdike@addtoit.com >
Cc: Richard Weinberger <richard@nod.at >
Cc: Anton Ivanov <anton.ivanov@cambridgegreys.com >
Cc: Chris Zankel <chris@zankel.net >
Cc: Max Filippov <jcmvbkbc@gmail.com >
Cc: Arnd Bergmann <arnd@arndb.de >
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
Cc: Samuel Iglesias Gonsalvez <siglesias@igalia.com >
Cc: Jens Taprogge <jens.taprogge@taprogge.org >
Cc: Karsten Keil <isdn@linux-pingi.de >
Cc: Scott Branden <scott.branden@broadcom.com >
Cc: Ulf Hansson <ulf.hansson@linaro.org >
Cc: "David S. Miller" <davem@davemloft.net >
Cc: Jakub Kicinski <kuba@kernel.org >
Cc: Heiko Carstens <hca@linux.ibm.com >
Cc: Vasily Gorbik <gor@linux.ibm.com >
Cc: Christian Borntraeger <borntraeger@de.ibm.com >
Cc: David Lin <dtwlin@gmail.com >
Cc: Johan Hovold <johan@kernel.org >
Cc: Alex Elder <elder@kernel.org >
Cc: Jiri Slaby <jirislaby@kernel.org >
Cc: Laurentiu Tudor <laurentiu.tudor@nxp.com >
Cc: Jiri Kosina <jikos@kernel.org >
Cc: David Sterba <dsterba@suse.com >
Cc: Shawn Guo <shawnguo@kernel.org >
Cc: Sascha Hauer <s.hauer@pengutronix.de >
Cc: Pengutronix Kernel Team <kernel@pengutronix.de >
Cc: Fabio Estevam <festevam@gmail.com >
Cc: NXP Linux Team <linux-imx@nxp.com >
Cc: Oliver Neukum <oneukum@suse.com >
Cc: Felipe Balbi <balbi@kernel.org >
Cc: Mathias Nyman <mathias.nyman@intel.com >
Cc: Marcel Holtmann <marcel@holtmann.org >
Cc: Johan Hedberg <johan.hedberg@gmail.com >
Cc: Luiz Augusto von Dentz <luiz.dentz@gmail.com >
Acked-by: Alex Elder <elder@linaro.org >
Acked-by: Christian Borntraeger <borntraeger@de.ibm.com >
Acked-by: Max Filippov <jcmvbkbc@gmail.com >
Acked-by: David Sterba <dsterba@suse.com >
Acked-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com >
Signed-off-by: Jiri Slaby <jslaby@suse.cz >
Link: https://lore.kernel.org/r/20210723074317.32690-8-jslaby@suse.cz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-07-27 12:17:21 +02:00
Jiri Slaby and Greg Kroah-Hartman
fff4ef17a9
tty: make tty_operations::chars_in_buffer return uint
...
tty_operations::chars_in_buffer is another hook which is expected to
return values >= 0. So make it explicit by the return type too -- use
unsigned int.
Signed-off-by: Jiri Slaby <jslaby@suse.cz >
Acked-By: Anton Ivanov <anton.ivanov@cambridgegreys.com >
Acked-by: David Sterba <dsterba@suse.com >
Cc: Jeff Dike <jdike@addtoit.com >
Cc: Richard Weinberger <richard@nod.at >
Cc: Arnd Bergmann <arnd@arndb.de >
Cc: Samuel Iglesias Gonsalvez <siglesias@igalia.com >
Cc: Jens Taprogge <jens.taprogge@taprogge.org >
Cc: Karsten Keil <isdn@linux-pingi.de >
Cc: Ulf Hansson <ulf.hansson@linaro.org >
Cc: "David S. Miller" <davem@davemloft.net >
Cc: Jakub Kicinski <kuba@kernel.org >
Cc: Heiko Carstens <hca@linux.ibm.com >
Cc: Vasily Gorbik <gor@linux.ibm.com >
Cc: Christian Borntraeger <borntraeger@de.ibm.com >
Cc: David Lin <dtwlin@gmail.com >
Cc: Johan Hovold <johan@kernel.org >
Cc: Alex Elder <elder@kernel.org >
Cc: Jiri Kosina <jikos@kernel.org >
Cc: Shawn Guo <shawnguo@kernel.org >
Cc: Sascha Hauer <s.hauer@pengutronix.de >
Cc: Oliver Neukum <oneukum@suse.com >
Cc: Felipe Balbi <balbi@kernel.org >
Cc: Mathias Nyman <mathias.nyman@intel.com >
Cc: Marcel Holtmann <marcel@holtmann.org >
Cc: Johan Hedberg <johan.hedberg@gmail.com >
Cc: Luiz Augusto von Dentz <luiz.dentz@gmail.com >
Link: https://lore.kernel.org/r/20210505091928.22010-27-jslaby@suse.cz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-05-13 18:29:11 +02:00
Jiri Slaby and Greg Kroah-Hartman
03b3b1a240
tty: make tty_operations::write_room return uint
...
Line disciplines expect a positive value or zero returned from
tty->ops->write_room (invoked by tty_write_room). So make this
assumption explicit by using unsigned int as a return value. Both of
tty->ops->write_room and tty_write_room.
Signed-off-by: Jiri Slaby <jslaby@suse.cz >
Acked-by: Laurentiu Tudor <laurentiu.tudor@nxp.com >
Acked-by: Alex Elder <elder@linaro.org >
Acked-by: Max Filippov <jcmvbkbc@gmail.com > # xtensa
Acked-by: David Sterba <dsterba@suse.com >
Acked-By: Anton Ivanov <anton.ivanov@cambridgegreys.com >
Acked-by: Geert Uytterhoeven <geert@linux-m68k.org >
Cc: Richard Henderson <rth@twiddle.net >
Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru >
Cc: Matt Turner <mattst88@gmail.com >
Cc: "James E.J. Bottomley" <James.Bottomley@HansenPartnership.com >
Cc: Helge Deller <deller@gmx.de >
Cc: Jeff Dike <jdike@addtoit.com >
Cc: Richard Weinberger <richard@nod.at >
Cc: Chris Zankel <chris@zankel.net >
Cc: Arnd Bergmann <arnd@arndb.de >
Cc: Samuel Iglesias Gonsalvez <siglesias@igalia.com >
Cc: Jens Taprogge <jens.taprogge@taprogge.org >
Cc: Karsten Keil <isdn@linux-pingi.de >
Cc: Scott Branden <scott.branden@broadcom.com >
Cc: Ulf Hansson <ulf.hansson@linaro.org >
Cc: "David S. Miller" <davem@davemloft.net >
Cc: Jakub Kicinski <kuba@kernel.org >
Cc: Heiko Carstens <hca@linux.ibm.com >
Cc: Vasily Gorbik <gor@linux.ibm.com >
Cc: Christian Borntraeger <borntraeger@de.ibm.com >
Cc: David Lin <dtwlin@gmail.com >
Cc: Johan Hovold <johan@kernel.org >
Cc: Jiri Kosina <jikos@kernel.org >
Cc: Shawn Guo <shawnguo@kernel.org >
Cc: Sascha Hauer <s.hauer@pengutronix.de >
Cc: Oliver Neukum <oneukum@suse.com >
Cc: Felipe Balbi <balbi@kernel.org >
Cc: Mathias Nyman <mathias.nyman@intel.com >
Cc: Marcel Holtmann <marcel@holtmann.org >
Cc: Johan Hedberg <johan.hedberg@gmail.com >
Cc: Luiz Augusto von Dentz <luiz.dentz@gmail.com >
Link: https://lore.kernel.org/r/20210505091928.22010-23-jslaby@suse.cz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-05-13 17:03:20 +02:00
Jiri Slaby and Greg Kroah-Hartman
6e94dbc7a4
tty: cumulate and document tty_struct::flow* members
...
Group the flow flags under a single struct called flow. The new struct
contains 'stopped' and 'tco_stopped' bools which used to be bits in a
bitfield. The struct also contains the lock protecting them to
potentially share the same cache line.
Note that commit c545b66c69 (tty: Serialize tcflow() with other tty
flow control changes) added a padding to the original bitfield. It was
for the bitfield to occupy a whole 64b word to avoid interferring stores
on Alpha (cannot we evaporate this arch with weird implications to C
code yet?). But it doesn't work as expected as the padding
(tty_struct::unused) is aligned to a 8B boundary too and occupies some
bytes from the next word.
So make it reliable by:
1) setting __aligned of the struct -- that aligns the start, and
2) making 'unsigned long unused[0]' as the last member of the struct --
pads the end.
This is also the perfect time to start the documentation of tty_struct
where all this lives. So we start by documenting what these bools
actually serve for. And why we do all the alignment dances. Only the few
up-to-date information from the Theodore's comment made it into this new
Kerneldoc comment.
Signed-off-by: Jiri Slaby <jslaby@suse.cz >
Cc: "David S. Miller" <davem@davemloft.net >
Cc: Jakub Kicinski <kuba@kernel.org >
Cc: Jonathan Corbet <corbet@lwn.net >
Cc: Arnd Bergmann <arnd@arndb.de >
Cc: Ulf Hansson <ulf.hansson@linaro.org >
Cc: Heiko Carstens <hca@linux.ibm.com >
Cc: Vasily Gorbik <gor@linux.ibm.com >
Cc: Christian Borntraeger <borntraeger@de.ibm.com >
Cc: Shawn Guo <shawnguo@kernel.org >
Cc: Sascha Hauer <s.hauer@pengutronix.de >
Cc: Vineet Gupta <vgupta@synopsys.com >
Cc: "Maciej W. Rozycki" <macro@orcam.me.uk >
Link: https://lore.kernel.org/r/20210505091928.22010-13-jslaby@suse.cz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-05-13 16:57:16 +02:00
Johan Hovold and Greg Kroah-Hartman
bf510acbea
tty: moxa: fix TIOCSSERIAL implementation
...
TIOCSSERIAL is a horrid, underspecified, legacy interface which for most
serial devices is only useful for setting the close_delay and
closing_wait parameters.
A non-privileged user has only ever been able to set the since long
deprecated ASYNC_SPD flags and trying to change any other *supported*
feature should result in -EPERM being returned. Setting the current
values for any supported features should return success.
Fix the moxa implementation which was returning -EPERM also for a
privileged user when trying to change certain unsupported parameters and
instead return success consistently.
Signed-off-by: Johan Hovold <johan@kernel.org >
Link: https://lore.kernel.org/r/20210407102334.32361-13-johan@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-04-07 17:22:07 +02:00
Johan Hovold and Greg Kroah-Hartman
dc8c843765
tty: moxa: fix TIOCSSERIAL permission check
...
Changing the port close delay or type are privileged operations so make
sure to return -EPERM if a regular user tries to change them.
Cc: stable@vger.kernel.org
Signed-off-by: Johan Hovold <johan@kernel.org >
Link: https://lore.kernel.org/r/20210407102334.32361-12-johan@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-04-07 17:22:07 +02:00
Johan Hovold and Greg Kroah-Hartman
6e70b73ca5
tty: moxa: fix TIOCSSERIAL jiffies conversions
...
The port close_delay parameter set by TIOCSSERIAL is specified in
jiffies, while the value returned by TIOCGSERIAL is specified in
centiseconds.
Add the missing conversions so that TIOCGSERIAL works as expected also
when HZ is not 100.
Cc: stable@vger.kernel.org
Signed-off-by: Johan Hovold <johan@kernel.org >
Link: https://lore.kernel.org/r/20210407102334.32361-11-johan@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-04-07 17:22:07 +02:00
Jiri Slaby and Greg Kroah-Hartman
6c2e6317c9
tty: do not check tty_unregister_driver's return value
...
These drivers check tty_unregister_driver return value. But they don't
handle a failure correctly (they free the driver in any case). So stop
checking tty_unregister_driver return value and remove also the prints.
In the next patch, tty_unregister_driver's return type will be switched
to void.
Cc: Chris Zankel <chris@zankel.net >
Cc: Max Filippov <jcmvbkbc@gmail.com >
Cc: linux-xtensa@linux-xtensa.org
Cc: Jiri Kosina <jikos@kernel.org >
Cc: David Sterba <dsterba@suse.com >
Reviewed-by: Max Filippov <jcmvbkbc@gmail.com >
Acked-by: David Sterba <dsterba@suse.com >
Signed-off-by: Jiri Slaby <jslaby@suse.cz >
Link: https://lore.kernel.org/r/20210302062214.29627-34-jslaby@suse.cz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-03-10 09:34:09 +01:00