Linus Torvalds
287b569a5b
tty: add the option to have a tty reject a new ldisc
...
[ Upstream commit 6bd23e0c2bb6c65d4f5754d1456bc9a4427fc59b ]
... and use it to limit the virtual terminals to just N_TTY. They are
kind of special, and in particular, the "con_write()" routine violates
the "writes cannot sleep" rule that some ldiscs rely on.
This avoids the
BUG: sleeping function called from invalid context at kernel/printk/printk.c:2659
when N_GSM has been attached to a virtual console, and gsmld_write()
calls con_write() while holding a spinlock, and con_write() then tries
to get the console lock.
Tested-by: Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp >
Cc: Jiri Slaby <jirislaby@kernel.org >
Cc: Andrew Morton <akpm@linux-foundation.org >
Cc: Daniel Starke <daniel.starke@siemens.com >
Reported-by: syzbot <syzbot+dbac96d8e73b61aa559c@syzkaller.appspotmail.com >
Closes: https://syzkaller.appspot.com/bug?extid=dbac96d8e73b61aa559c
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
Link: https://lore.kernel.org/r/20240423163339.59780-1-torvalds@linux-foundation.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
Signed-off-by: Sasha Levin <sashal@kernel.org >
2024-06-27 13:49:05 +02:00
Jiri Slaby (SUSE)
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)
dcaafbe6ee
tty: propagate u8 data to tty_operations::put_char()
...
Data are now typed as u8. Propagate this change to
tty_operations::put_char().
Signed-off-by: "Jiri Slaby (SUSE)" <jirislaby@kernel.org >
Cc: Geert Uytterhoeven <geert@linux-m68k.org >
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: Karsten Keil <isdn@linux-pingi.de >
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
Cc: Jiri Slaby <jirislaby@kernel.org >
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: Mathias Nyman <mathias.nyman@intel.com >
Link: https://lore.kernel.org/r/20230810091510.13006-29-jirislaby@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2023-08-11 21:12:46 +02:00
Jiri Slaby (SUSE)
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
наб
5052df99d3
tty: remove TTY_DRIVER_MAGIC
...
According to Greg, in the context of magic numbers as defined in
magic-number.rst, "the tty layer should not need this and I'll gladly
take patches"
Acked-by: Jiri Slaby <jirislaby@kernel.org >
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz >
Ref: https://lore.kernel.org/linux-doc/YyMlovoskUcHLEb7@kroah.com/
Link: https://lore.kernel.org/r/723478a270a3858f27843cbec621df4d5d44efcc.1663288066.git.nabijaczleweli@nabijaczleweli.xyz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2022-09-22 16:12:34 +02:00
Al Viro
89bbeb7e31
termios: get rid of non-UAPI asm/termios.h
...
All non-UAPI asm/termios.h consist of include of UAPI counterpart
and, possibly, include of linux/uaccess.h
The latter can't be simply removed, even though nothing in
linux/termios.h doesn't depend upon it anymore - there are several
places that rely upon that indirect chain of includes to pull
linux/uaccess.h. So the include needs to be lifted out of there -
we lift into tty_driver.h, serdev.h and places that pull asm/termios.h,
but none of
* linux/uaccess.h (obvious)
* net/sock.h (pulls uaccess.h)
* linux/{tty,tty_driver,serdev}.h (tty.h pulls tty_driver.h)
That leaves us just with the include of UAPI asm/termios.h, which is
what <asm/termios.h> will resolve to if we simply remove non-UAPI header.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk >
Link: https://lore.kernel.org/r/YxDnKvYCHn/ogBUv@ZenIV
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2022-09-09 10:44:35 +02:00
Ilpo Järvinen
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
34d809f8b4
tty: reformat TTY_DRIVER_ flags into kernel-doc
...
We want to reference TTY_DRIVER_* flags in Documentation/ later in this
series. But the current documentation in the TTY_DRIVER_*'s header does
not allow that. Reformat it to kernel-doc using "DOC" directive and
line-feeds, so that we can include it as it is.
Signed-off-by: Jiri Slaby <jslaby@suse.cz >
Link: https://lore.kernel.org/r/20211126081611.11001-11-jslaby@suse.cz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-11-26 16:27:42 +01:00
Jiri Slaby
29d5ef6859
tty: combine tty_operations triple docs into kernel-doc
...
In Documentation/driver-api/serial/tty.rst, there are triplicated texts
about some struct tty_operations' hooks. Combine them into existing
kernel-doc comments of struct tty_operations and drop them from the
Documentation/.
Signed-off-by: Jiri Slaby <jslaby@suse.cz >
Link: https://lore.kernel.org/r/20211126081611.11001-8-jslaby@suse.cz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-11-26 16:27:42 +01:00
Jiri Slaby
1fe1830917
tty: add kernel-doc for tty_operations
...
tty_operations structure was already documented in a standalone comment
in the header beginning.
Move it right before the structure and reformat it so it complies to
kernel-doc. That way, we can include it in Documentation/ later in this
series.
Note that we named proc_show's parameters, so that we can reference
them in the text.
Signed-off-by: Jiri Slaby <jslaby@suse.cz >
Link: https://lore.kernel.org/r/20211126081611.11001-5-jslaby@suse.cz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-11-26 16:27:42 +01:00
Jiri Slaby
a656383021
tty: add kernel-doc for tty_driver
...
tty_driver used to have only short comments along its members. Convert
them into proper kernel-doc comments in front of the structure. And add
some more explanation to them where needed.
The whole structure handling is documented at the end too.
Signed-off-by: Jiri Slaby <jslaby@suse.cz >
Link: https://lore.kernel.org/r/20211126081611.11001-4-jslaby@suse.cz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-11-26 16:27:42 +01:00
Anssi Hannula
cc8d7b4aea
tty: Fix extra "not" in TTY_DRIVER_REAL_RAW description
...
TTY_DRIVER_REAL_RAW flag (which is always set for e.g. serial ports)
documentation says that driver must always set special character
handling flags in certain conditions.
However, as the following sentence makes clear, what is actually
intended is the opposite.
Fix that by removing the unintended double negation.
Acked-by: Johan Hovold <johan@kernel.org >
Signed-off-by: Anssi Hannula <anssi.hannula@bitwise.fi >
Link: https://lore.kernel.org/r/20211027102124.3049414-1-anssi.hannula@bitwise.fi
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-10-30 11:02:00 +02:00
Jiri Slaby
7894193436
tty: remove extern from functions in tty headers
...
After the recent headers cleanup, some function declarations still have
extern before them. It is superfluous (for function declarations), so
remove extern from those which still have it.
This unifies them with the rest of the files.
Signed-off-by: Jiri Slaby <jslaby@suse.cz >
Link: https://lore.kernel.org/r/20210914091134.17426-3-jslaby@suse.cz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-09-22 16:59:13 +02:00
Jiri Slaby
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
cb9ea618ee
tty: make tty_set_operations an inline
...
Since commit f34d7a5b70 (tty: The big operations rework) in 2008,
tty_set_operations() is a simple one-line assignment. There is no reason
for this to be an exported function, hence move it to a header and make
an inline from that.
Signed-off-by: Jiri Slaby <jslaby@suse.cz >
Link: https://lore.kernel.org/r/20210723074317.32690-7-jslaby@suse.cz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-07-27 12:17:21 +02:00
Jiri Slaby
56ec5880a2
tty: drop alloc_tty_driver
...
Noone uses this deprecated function now. So we can remove it.
Signed-off-by: Jiri Slaby <jslaby@suse.cz >
Link: https://lore.kernel.org/r/20210723074317.32690-6-jslaby@suse.cz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-07-27 12:17:21 +02:00
Jiri Slaby
890ebae627
tty: include kref.h in tty_driver.h
...
We use kref in tty_driver.h, but do not include kref.h. It is currently
included by linux/cdev.h -> linux/kobject.h -> linux/kref.h chain, so
everything is in order only implicitly. So make this dependency
explicit.
Signed-off-by: Jiri Slaby <jslaby@suse.cz >
Link: https://lore.kernel.org/r/20210723103147.18250-3-jslaby@suse.cz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-07-27 12:12:07 +02:00
Jiri Slaby
4d3d947866
tty: move tty_driver related prototypes to tty_driver.h
...
We already have tty_driver.h, so cleanup tty.h a bit by moving out
tty_driver-related function prototypes into tty_driver.h.
Note that tty.h already includes tty_driver.h.
Signed-off-by: Jiri Slaby <jslaby@suse.cz >
Link: https://lore.kernel.org/r/20210723103147.18250-2-jslaby@suse.cz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-07-27 12:12:07 +02:00
Jiri Slaby
76af233d9b
tty: remove unused tty_throttle
...
The last user was removed in commit e91e52e428 (n_tty: Fix stuck
throttled driver) in 2013. So remove exported tty_throttle completely.
Signed-off-by: Jiri Slaby <jslaby@suse.cz >
Link: https://lore.kernel.org/r/20210510065923.5112-1-jslaby@suse.cz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-05-13 18:29:11 +02:00
Jiri Slaby
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
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
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
1b8b20868a
tty: fix return value for unsupported ioctls
...
Drivers should return -ENOTTY ("Inappropriate I/O control operation")
when an ioctl isn't supported, while -EINVAL is used for invalid
arguments.
Fix up the TIOCMGET, TIOCMSET and TIOCGICOUNT helpers which returned
-EINVAL when a tty driver did not implement the corresponding
operations.
Note that the TIOCMGET and TIOCMSET helpers predate git and do not get a
corresponding Fixes tag below.
Fixes: d281da7ff6 ("tty: Make tiocgicount a handler")
Signed-off-by: Johan Hovold <johan@kernel.org >
Link: https://lore.kernel.org/r/20210407095208.31838-3-johan@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-04-10 10:36:34 +02:00
Jann Horn
e0efb3168d
tty: Remove dead termiox code
...
set_termiox() and the TCGETX handler bail out with -EINVAL immediately
if ->termiox is NULL, but there are no code paths that can set
->termiox to a non-NULL pointer; and no such code paths seem to have
existed since the termiox mechanism was introduced back in
commit 1d65b4a088 ("tty: Add termiox") in v2.6.28.
Similarly, no driver actually implements .set_termiox; and it looks like
no driver ever has.
Delete this dead code; but leave the definition of struct termiox in the
UAPI headers intact.
Signed-off-by: Jann Horn <jannh@google.com >
Link: https://lore.kernel.org/r/20201203020331.2394754-1-jannh@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-12-04 16:54:35 +01:00
Al Viro
2f46a2c1d4
tty_ioctl(): start taking TIOC[SG]SERIAL into separate methods
...
->set_serial() and ->get_serial() resp., both taking tty and
a kernel pointer to serial_struct.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk >
2018-09-14 11:19:30 -04:00