Xiaofei Tan
eb460edb5f
tty: tty_baudrate: Remove unnecessary tab and spaces in comment sentence
...
Remove unnecessary tab and spaces in comment sentence, reported
by checkpatch.pl.
Signed-off-by: Xiaofei Tan <tanxiaofei@huawei.com >
Link: https://lore.kernel.org/r/1620811585-18582-2-git-send-email-tanxiaofei@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-05-13 18:29:12 +02:00
Christophe JAILLET
31a9a31825
tty: nozomi: Fix a resource leak in an error handling function
...
A 'request_irq()' call is not balanced by a corresponding 'free_irq()' in
the error handling path, as already done in the remove function.
Add it.
Fixes: 9842c38e91 ("kfifo: fix warn_unused_result")
Reviewed-by: Jiri Slaby <jirislaby@kernel.org >
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr >
Link: https://lore.kernel.org/r/4f0d2b3038e82f081d370ccb0cade3ad88463fe7.1620580838.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-05-13 18:29:12 +02:00
Samo Pogačnik
2fee881121
ttyprintk: Removed unnecessary TTY ioctl callback
...
It turns-out, that TIOCCONS is completely handled in tty_io.c, so
the current local ioctl callback is of no real use.
Signed-off-by: Samo Pogačnik <samo_pogacnik@t-2.net >
Link: https://lore.kernel.org/r/1502946c760b1aae3ad9cffcf4ea3b9f37206585.camel@t-2.net
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-05-13 18:29:12 +02:00
Samo Pogačnik
bf3d6ab9bc
ttyprintk: Add TTY port shutdown callback
...
By adding the TTY port shutdown callback, the final buffer flush has
been moved from tpk_close() to tpk_port_shutdown(). This enables buffer
flush upon close and hangup as well. The change also removes the
specific 'buf == NULL' handling in tpk_printk(), which became useless.
Signed-off-by: Samo Pogačnik <samo_pogacnik@t-2.net >
Link: https://lore.kernel.org/r/f236ea26520fbef176fefec2e06a43548f63fa9c.camel@t-2.net
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-05-13 18:29:12 +02:00
Zihao Tang
27dede097d
tty: serial: sb1250-duart: include <linux/io.h> instead of <asm/io.h>
...
Include the more general linux/io.h instead of asm/io.h
as checkpatch suggests.
Signed-off-by: Zihao Tang <tangzihao1@hisilicon.com >
Signed-off-by: Jay Fang <f.fangjian@huawei.com >
Link: https://lore.kernel.org/r/1620874904-39285-13-git-send-email-f.fangjian@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-05-13 18:29:12 +02:00
Zihao Tang
7d5a3ec537
tty: serial: vr41xx_siu: include <linux/io.h> instead of <asm/io.h>
...
Include the more general linux/io.h instead of asm/io.h
as checkpatch suggests.
Signed-off-by: Zihao Tang <tangzihao1@hisilicon.com >
Signed-off-by: Jay Fang <f.fangjian@huawei.com >
Link: https://lore.kernel.org/r/1620874904-39285-12-git-send-email-f.fangjian@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-05-13 18:29:12 +02:00
Zihao Tang
933100787d
tty: serial: sunzilog: include <linux/io.h> instead of <asm/io.h>
...
Include the more general linux/io.h instead of asm/io.h
as checkpatch suggests.
Signed-off-by: Zihao Tang <tangzihao1@hisilicon.com >
Signed-off-by: Jay Fang <f.fangjian@huawei.com >
Link: https://lore.kernel.org/r/1620874904-39285-11-git-send-email-f.fangjian@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-05-13 18:29:12 +02:00
Zihao Tang
4f1c658130
tty: serial: sunsu: include <linux/io.h> instead of <asm/io.h>
...
Include the more general linux/io.h instead of asm/io.h
as checkpatch suggests.
Signed-off-by: Zihao Tang <tangzihao1@hisilicon.com >
Signed-off-by: Jay Fang <f.fangjian@huawei.com >
Link: https://lore.kernel.org/r/1620874904-39285-10-git-send-email-f.fangjian@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-05-13 18:29:12 +02:00
Zihao Tang
d890c50876
tty: serial: sunsab: include <linux/io.h> instead of <asm/io.h>
...
Include the more general linux/io.h instead of asm/io.h
as checkpatch suggests.
Signed-off-by: Zihao Tang <tangzihao1@hisilicon.com >
Signed-off-by: Jay Fang <f.fangjian@huawei.com >
Link: https://lore.kernel.org/r/1620874904-39285-9-git-send-email-f.fangjian@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-05-13 18:29:12 +02:00
Zihao Tang
10dab44f78
tty: serial: txx9: include <linux/io.h> instead of <asm/io.h>
...
Include the more general linux/io.h instead of asm/io.h
as checkpatch suggests.
Signed-off-by: Zihao Tang <tangzihao1@hisilicon.com >
Signed-off-by: Jay Fang <f.fangjian@huawei.com >
Link: https://lore.kernel.org/r/1620874904-39285-8-git-send-email-f.fangjian@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-05-13 18:29:12 +02:00
Zihao Tang
ce6ff28069
tty: serial: pmac_zilog: include <linux/io.h> insteiad of <asm/io.h>
...
Include the more general linux/io.h instead of asm/io.h
as checkpatch suggests.
Signed-off-by: Zihao Tang <tangzihao1@hisilicon.com >
Signed-off-by: Jay Fang <f.fangjian@huawei.com >
Link: https://lore.kernel.org/r/1620874904-39285-7-git-send-email-f.fangjian@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-05-13 18:29:12 +02:00
Zihao Tang
b1c92c121b
tty: serial: mux: include <linux/io.h> instead of <asm/io.h>
...
Include the more general linux/io.h instead of asm/io.h
as checkpatch suggests.
Signed-off-by: Zihao Tang <tangzihao1@hisilicon.com >
Signed-off-by: Jay Fang <f.fangjian@huawei.com >
Link: https://lore.kernel.org/r/1620874904-39285-6-git-send-email-f.fangjian@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-05-13 18:29:12 +02:00
Zihao Tang
3dccc357b7
tty: serial: ip22zilog: include <linux/io.h> instead of <asm/io.h>
...
Include the more general linux/io.h instead of asm/io.h
as checkpatch suggests.
Signed-off-by: Zihao Tang <tangzihao1@hisilicon.com >
Signed-off-by: Jay Fang <f.fangjian@huawei.com >
Link: https://lore.kernel.org/r/1620874904-39285-5-git-send-email-f.fangjian@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-05-13 18:29:12 +02:00
Zihao Tang
0ebee1ebbc
tty: serial: icom: include <linux/io.h> instead of <asm/io.h>
...
Include the more general linux/io.h instead of asm/io.h
as checkpatch suggests.
Signed-off-by: Zihao Tang <tangzihao1@hisilicon.com >
Signed-off-by: Jay Fang <f.fangjian@huawei.com >
Link: https://lore.kernel.org/r/1620874904-39285-4-git-send-email-f.fangjian@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-05-13 18:29:11 +02:00
Zihao Tang
27bcf79b8a
tty: serial: dz: include <linux/io.h> instead of <asm/io.h>
...
Include the more general linux/io.h instead of asm/io.h
as checkpatch suggests.
Signed-off-by: Zihao Tang <tangzihao1@hisilicon.com >
Signed-off-by: Jay Fang <f.fangjian@huawei.com >
Link: https://lore.kernel.org/r/1620874904-39285-3-git-send-email-f.fangjian@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-05-13 18:29:11 +02:00
Zihao Tang
635b258962
tty: serial: atmel: include <linux/io.h> instead of <asm/io.h>
...
Include the more general linux/io.h instead of asm/io.h
as checkpatch suggests.
Signed-off-by: Zihao Tang <tangzihao1@hisilicon.com >
Signed-off-by: Jay Fang <f.fangjian@huawei.com >
Link: https://lore.kernel.org/r/1620874904-39285-2-git-send-email-f.fangjian@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-05-13 18:29:11 +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
1bf4229663
isdn: capi, drop useless pr_debugs
...
capi have many pr_debugs in tty_operations hooks to print only a
functions name. We have better debugging aids in the kernel many years
now. So remove these useless pr_debugs.
Signed-off-by: Jiri Slaby <jslaby@suse.cz >
Cc: Karsten Keil <isdn@linux-pingi.de >
Cc: netdev@vger.kernel.org
Link: https://lore.kernel.org/r/20210505091928.22010-34-jslaby@suse.cz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-05-13 18:29:11 +02:00
Jiri Slaby
3e679e1da5
isdn: capi, remove optional tty ops
...
break_ctl and set_ldisc are optional tty_operations hooks. Given capi
does nothing useful in them, just remove these.
Signed-off-by: Jiri Slaby <jslaby@suse.cz >
Cc: Karsten Keil <isdn@linux-pingi.de >
Cc: netdev@vger.kernel.org
Link: https://lore.kernel.org/r/20210505091928.22010-33-jslaby@suse.cz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-05-13 18:29:11 +02:00
Jiri Slaby
4da872befc
tty: remove empty tty_operations::set_termios
...
tty_operations::set_termios is optional. If it doesn't exist, nothing is
called. So remove almost¹ empty set_termios implementations.
¹ capi had an useless pr_debug in it.
Signed-off-by: Jiri Slaby <jslaby@suse.cz >
Cc: Jeff Dike <jdike@addtoit.com >
Cc: Richard Weinberger <richard@nod.at >
Cc: Karsten Keil <isdn@linux-pingi.de >
Acked-By: Anton Ivanov <anton.ivanov@cambridgegreys.com >
Link: https://lore.kernel.org/r/20210505091928.22010-32-jslaby@suse.cz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-05-13 18:29:11 +02:00
Jiri Slaby
4fb266e197
tty: remove empty tty_operations::flush_buffer
...
tty_operations::flush_buffer is optional. If it doesn't exist, nothing
is called. So remove almost¹ empty flush_buffer implementations.
¹ capi had an useless pr_debug in it.
Signed-off-by: Jiri Slaby <jslaby@suse.cz >
Cc: Karsten Keil <isdn@linux-pingi.de >
Cc: Heiko Carstens <hca@linux.ibm.com >
Cc: Vasily Gorbik <gor@linux.ibm.com >
Cc: Christian Borntraeger <borntraeger@de.ibm.com >
Link: https://lore.kernel.org/r/20210505091928.22010-31-jslaby@suse.cz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-05-13 18:29:11 +02:00
Jiri Slaby
3d18354248
nozomi: simplify ntty_chars_in_buffer
...
ntty_chars_in_buffer is overly complicated. Simplify it by inverting the
condition.
Side FIXME: how can dc or port be NULL here?
Signed-off-by: Jiri Slaby <jslaby@suse.cz >
Link: https://lore.kernel.org/r/20210505091928.22010-29-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
fa7501e57e
tty: remove tty_operations::chars_in_buffer for non-buffering
...
The only user of tty_ops::chars_in_buffer is tty_chars_in_buffer. And it
considers tty_ops::chars_in_buffer optional. In case it's NULL, zero is
returned. So remove all those chars_in_buffer from tty_ops which return
zero. (Zero means such driver doesn't buffer.)
Signed-off-by: Jiri Slaby <jslaby@suse.cz >
Cc: Richard Henderson <rth@twiddle.net >
Acked-by: Max Filippov <jcmvbkbc@gmail.com > # xtensa
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: Chris Zankel <chris@zankel.net >
Cc: Heiko Carstens <hca@linux.ibm.com >
Cc: Vasily Gorbik <gor@linux.ibm.com >
Cc: Christian Borntraeger <borntraeger@de.ibm.com >
Link: https://lore.kernel.org/r/20210505091928.22010-26-jslaby@suse.cz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-05-13 18:29:11 +02:00
Jiri Slaby
9a33fbf9d2
tty: make tty_buffer_space_avail return uint
...
tty_buffer_space_avail returns values >= 0, so make it clear by the
return type.
Signed-off-by: Jiri Slaby <jslaby@suse.cz >
Cc: Joel Stanley <joel@jms.id.au >
Link: https://lore.kernel.org/r/20210505091928.22010-25-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
0f29b503bd
ti-st: use tty_write_room
...
Don't access tty->ops->write_room directly, use tty_write_room helper
instead.
Signed-off-by: Jiri Slaby <jslaby@suse.cz >
Cc: Arnd Bergmann <arnd@arndb.de >
Link: https://lore.kernel.org/r/20210505091928.22010-22-jslaby@suse.cz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-05-13 17:03:20 +02:00
Jiri Slaby
303e8ebf5d
ti-st: use goto-failpath in st_core_init
...
Use the classic failpath handling using gotos in st_core_init. That way,
tty_unregister_ldisc needs not be repeated on two places.
Signed-off-by: Jiri Slaby <jslaby@suse.cz >
Cc: Arnd Bergmann <arnd@arndb.de >
Link: https://lore.kernel.org/r/20210505091928.22010-21-jslaby@suse.cz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-05-13 16:57:17 +02:00
Jiri Slaby
f6f19595a7
tty: return void from tty_unregister_ldisc
...
Now that noone checks the return value of tty_unregister_ldisc, make the
function return 'void'.
Signed-off-by: Jiri Slaby <jslaby@suse.cz >
Link: https://lore.kernel.org/r/20210505091928.22010-20-jslaby@suse.cz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-05-13 16:57:17 +02:00
Jiri Slaby
357a6a875f
tty: no checking of tty_unregister_ldisc
...
tty_unregister_ldisc now returns 0 = success. No need to check the
return value. In fact, the users only warned if an error occured and
didn't do anything useful anyway -- the ldisc module was unloaded in any
case.
Signed-off-by: Jiri Slaby <jslaby@suse.cz >
Cc: William Hubbs <w.d.hubbs@gmail.com >
Cc: Chris Brannon <chris@the-brannons.com >
Cc: Kirk Reiser <kirk@reisers.ca >
Cc: Samuel Thibault <samuel.thibault@ens-lyon.org >
Cc: Marcel Holtmann <marcel@holtmann.org >
Cc: Johan Hedberg <johan.hedberg@gmail.com >
Cc: Luiz Augusto von Dentz <luiz.dentz@gmail.com >
Cc: Arnd Bergmann <arnd@arndb.de >
Cc: Wolfgang Grandegger <wg@grandegger.com >
Cc: Marc Kleine-Budde <mkl@pengutronix.de >
Cc: "David S. Miller" <davem@davemloft.net >
Cc: Jakub Kicinski <kuba@kernel.org >
Cc: Andreas Koensgen <ajk@comnets.uni-bremen.de >
Cc: Paul Mackerras <paulus@samba.org >
Cc: Rodolfo Giometti <giometti@enneenne.com >
Cc: Peter Ujfalusi <peter.ujfalusi@gmail.com >
Cc: Liam Girdwood <lgirdwood@gmail.com >
Cc: Mark Brown <broonie@kernel.org >
Cc: Jaroslav Kysela <perex@perex.cz >
Cc: Takashi Iwai <tiwai@suse.com >
Link: https://lore.kernel.org/r/20210505091928.22010-19-jslaby@suse.cz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-05-13 16:57:17 +02:00
Jiri Slaby
1947520933
tty: drop tty_ldisc_ops::refcount
...
The refcount is checked only in tty_unregister_ldisc and EBUSY returned
if it is nonzero. But none of the tty_unregister_ldisc callers act
anyhow if this (or any other) error is returned. So remove
tty_ldisc_ops::refcount completely and make tty_unregister_ldisc return
'void' in the next patches. That means we assume tty_unregister_ldisc is
not called while the ldisc might be in use. That relies on
try_module_get in get_ldops and module_put in put_ldops.
Signed-off-by: Jiri Slaby <jslaby@suse.cz >
Link: https://lore.kernel.org/r/20210505091928.22010-18-jslaby@suse.cz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-05-13 16:57:17 +02:00
Jiri Slaby
f81ee8b8b8
tty: make tty_ldisc_ops a param in tty_unregister_ldisc
...
Make tty_unregister_ldisc symmetric to tty_register_ldisc by accepting
struct tty_ldisc_ops as a parameter instead of ldisc number. This avoids
checking of the ldisc number bounds in tty_unregister_ldisc.
Signed-off-by: Jiri Slaby <jslaby@suse.cz >
Cc: William Hubbs <w.d.hubbs@gmail.com >
Cc: Chris Brannon <chris@the-brannons.com >
Cc: Kirk Reiser <kirk@reisers.ca >
Cc: Samuel Thibault <samuel.thibault@ens-lyon.org >
Cc: Marcel Holtmann <marcel@holtmann.org >
Cc: Johan Hedberg <johan.hedberg@gmail.com >
Cc: Luiz Augusto von Dentz <luiz.dentz@gmail.com >
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com >
Cc: Arnd Bergmann <arnd@arndb.de >
Cc: "David S. Miller" <davem@davemloft.net >
Cc: Jakub Kicinski <kuba@kernel.org >
Cc: Wolfgang Grandegger <wg@grandegger.com >
Cc: Marc Kleine-Budde <mkl@pengutronix.de >
Cc: Andreas Koensgen <ajk@comnets.uni-bremen.de >
Cc: Paul Mackerras <paulus@samba.org >
Cc: Rodolfo Giometti <giometti@enneenne.com >
Cc: Peter Ujfalusi <peter.ujfalusi@gmail.com >
Cc: Liam Girdwood <lgirdwood@gmail.com >
Cc: Mark Brown <broonie@kernel.org >
Cc: Jaroslav Kysela <perex@perex.cz >
Cc: Takashi Iwai <tiwai@suse.com >
Link: https://lore.kernel.org/r/20210505091928.22010-17-jslaby@suse.cz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-05-13 16:57:16 +02:00
Jiri Slaby
839e0f226d
n_gsm: use goto-failpaths in gsm_init
...
Use the classic failpath handling using gotos in gsm_init. That way,
tty_unregister_ldisc needs not be repeated on two places.
Signed-off-by: Jiri Slaby <jslaby@suse.cz >
Link: https://lore.kernel.org/r/20210505091928.22010-16-jslaby@suse.cz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-05-13 16:57:16 +02:00
Jiri Slaby
fbadf70a80
tty: set tty_ldisc_ops::num statically
...
There is no reason to pass the ldisc number to tty_register_ldisc
separately. Just set it in the already defined tty_ldisc_ops in all the
ldiscs.
This simplifies tty_register_ldisc a bit too (no need to set the num
member there).
Signed-off-by: Jiri Slaby <jslaby@suse.cz >
Cc: William Hubbs <w.d.hubbs@gmail.com >
Cc: Chris Brannon <chris@the-brannons.com >
Cc: Kirk Reiser <kirk@reisers.ca >
Cc: Samuel Thibault <samuel.thibault@ens-lyon.org >
Cc: Marcel Holtmann <marcel@holtmann.org >
Cc: Johan Hedberg <johan.hedberg@gmail.com >
Cc: Luiz Augusto von Dentz <luiz.dentz@gmail.com >
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com >
Cc: Arnd Bergmann <arnd@arndb.de >
Cc: "David S. Miller" <davem@davemloft.net >
Cc: Jakub Kicinski <kuba@kernel.org >
Cc: Wolfgang Grandegger <wg@grandegger.com >
Cc: Marc Kleine-Budde <mkl@pengutronix.de >
Cc: Andreas Koensgen <ajk@comnets.uni-bremen.de >
Cc: Paul Mackerras <paulus@samba.org >
Cc: Rodolfo Giometti <giometti@enneenne.com >
Cc: Peter Ujfalusi <peter.ujfalusi@gmail.com >
Cc: Liam Girdwood <lgirdwood@gmail.com >
Cc: Mark Brown <broonie@kernel.org >
Cc: Jaroslav Kysela <perex@perex.cz >
Cc: Takashi Iwai <tiwai@suse.com >
Link: https://lore.kernel.org/r/20210505091928.22010-15-jslaby@suse.cz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-05-13 16:57:16 +02:00
Jiri Slaby
64d608db38
tty: cumulate and document tty_struct::ctrl* members
...
Group the ctrl members under a single struct called ctrl. The new struct
contains 'pgrp', 'session', 'pktstatus', and 'packet'. 'pktstatus' and
'packet' used to be bits in a bitfield. The struct also contains the
lock protecting them to 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::ctrl_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.
Add a kerneldoc comment for this grouped members.
Signed-off-by: Jiri Slaby <jslaby@suse.cz >
Cc: "David S. Miller" <davem@davemloft.net >
Cc: Jakub Kicinski <kuba@kernel.org >
Cc: netdev@vger.kernel.org
Link: https://lore.kernel.org/r/20210505091928.22010-14-jslaby@suse.cz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-05-13 16:57:16 +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
Jiri Slaby
0f3dcf3b5d
tty: make fp of tty_ldisc_ops::receive_buf{,2} const
...
Char pointer (cp) passed to tty_ldisc_ops::receive_buf{,2} is const.
There is no reason for flag pointer (fp) not to be too. So switch it in
the definition and all uses.
Signed-off-by: Jiri Slaby <jslaby@suse.cz >
Cc: William Hubbs <w.d.hubbs@gmail.com >
Cc: Chris Brannon <chris@the-brannons.com >
Cc: Kirk Reiser <kirk@reisers.ca >
Cc: Samuel Thibault <samuel.thibault@ens-lyon.org >
Cc: Marcel Holtmann <marcel@holtmann.org >
Cc: Johan Hedberg <johan.hedberg@gmail.com >
Cc: Luiz Augusto von Dentz <luiz.dentz@gmail.com >
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com >
Cc: Arnd Bergmann <arnd@arndb.de >
Cc: "David S. Miller" <davem@davemloft.net >
Cc: Jakub Kicinski <kuba@kernel.org >
Cc: Wolfgang Grandegger <wg@grandegger.com >
Cc: Marc Kleine-Budde <mkl@pengutronix.de >
Cc: Andreas Koensgen <ajk@comnets.uni-bremen.de >
Cc: Paul Mackerras <paulus@samba.org >
Cc: Liam Girdwood <lgirdwood@gmail.com >
Cc: Mark Brown <broonie@kernel.org >
Cc: Jaroslav Kysela <perex@perex.cz >
Cc: Takashi Iwai <tiwai@suse.com >
Cc: Peter Ujfalusi <peter.ujfalusi@gmail.com >
Link: https://lore.kernel.org/r/20210505091928.22010-12-jslaby@suse.cz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-05-13 16:57:16 +02:00
Jiri Slaby
fc0df90b78
n_tty: remove superfluous return from n_tty_receive_signal_char
...
A return at the end of a void-returning function is superfluous. Get rid
of it.
Signed-off-by: Jiri Slaby <jslaby@suse.cz >
Link: https://lore.kernel.org/r/20210505091928.22010-11-jslaby@suse.cz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-05-13 16:57:16 +02:00
Jiri Slaby
e8f2a139ff
n_tty: invert TTY_NORMAL condition in n_tty_receive_buf_standard
...
Handle !TTY_NORMAL as a short path and 'continue' the loop. Do the rest as
a normal code flow. This decreases the indentation level by one and
makes the code flow more understandable.
IOW, we avoid
if (cond) {
LONG CODE;
} else
single_line();
by
if (!cond) {
single_line();
continue;
}
LONG CODE;
While at it, invert also the 'if (!test_bit) A else B' into 'if
(test_bit) B else A'.
Signed-off-by: Jiri Slaby <jslaby@suse.cz >
Link: https://lore.kernel.org/r/20210505091928.22010-10-jslaby@suse.cz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-05-13 16:57:16 +02:00
Jiri Slaby
3a7d530a0c
n_tty: do only one cp dereference in n_tty_receive_buf_standard
...
It might be confusing for readers: there are three distinct dereferences
and increments of 'cp' in n_tty_receive_buf_standard. Do it on a single
place, along with/before the 'fp' dereference.
Signed-off-by: Jiri Slaby <jslaby@suse.cz >
Link: https://lore.kernel.org/r/20210505091928.22010-9-jslaby@suse.cz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-05-13 16:57:16 +02:00
Jiri Slaby
16765365a0
n_tty: make n_tty_receive_char_special return void
...
After the previous patch, noone cares about the return value of
n_tty_receive_char_special. ldata->lnext is checked instead.
So switch return type of n_tty_receive_char_special to void.
Signed-off-by: Jiri Slaby <jslaby@suse.cz >
Link: https://lore.kernel.org/r/20210505091928.22010-8-jslaby@suse.cz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-05-13 16:57:16 +02:00
Jiri Slaby
67a620d58b
n_tty: move lnext handling
...
Move lnext handling from __receive_buf to n_tty_receive_buf_standard. It
simplifies the handling as it needs not fetching 'flag' and decrement
'count' in __receive_buf. Instead, all this is left up to the loop in
n_tty_receive_buf_standard which already does that.
This way, no need to repeat the action when n_tty_receive_char_special
returns true -- ldata->lnext is set there in that case, so the 'if
(ldata->lnext)' check is sufficient. The next patch will switch
n_tty_receive_char_special to return 'void'.
The result is much simplified code flow.
Signed-off-by: Jiri Slaby <jslaby@suse.cz >
Link: https://lore.kernel.org/r/20210505091928.22010-7-jslaby@suse.cz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-05-13 16:57:16 +02:00
Jiri Slaby
95aafe3278
n_tty: drop parmrk_dbl from n_tty_receive_char
...
After the previous cleanup patches, parmrk_dbl parameter is always true
-- I_PARMRK is checked only in n_tty_receive_char now. So remove
parmrk_dbl completely.
Signed-off-by: Jiri Slaby <jslaby@suse.cz >
Link: https://lore.kernel.org/r/20210505091928.22010-6-jslaby@suse.cz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-05-13 16:57:15 +02:00
Jiri Slaby
1ed2dfedd2
n_tty: drop n_tty_receive_buf_fast
...
After the previous patches, n_tty_receive_buf_standard and
n_tty_receive_buf_fast differ only in handling of tty line and input
controls. Unlike n_tty_receive_buf_fast, n_tty_receive_buf_standard
handles them all (I_ISTRIP, I_IUCLC, L_IEXTEN, L_EXTPROC, and I_PARMRK).
So remove n_tty_receive_buf_fast and let n_tty_receive_buf_standard do
the handling. Actually most of the tests are only moved from
__receive_buf to n_tty_receive_buf_standard.
Again, the code duplication is not worth the theoretical speedup.
Signed-off-by: Jiri Slaby <jslaby@suse.cz >
Link: https://lore.kernel.org/r/20210505091928.22010-5-jslaby@suse.cz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-05-13 16:57:15 +02:00
Jiri Slaby
89bb4a3622
n_tty: remove n_tty_receive_char_fast
...
n_tty_receive_char_fast is a copy of n_tty_receive_char with one
exception: PARMRK is not doubled in the former. Unify these two and
double PARMRK depending on a newly added parameter (bool parmrk_dbl).
I don't think the theoretical speedup is worth the code duplication.
Which is directly connected with maintenance burden.
Signed-off-by: Jiri Slaby <jslaby@suse.cz >
Link: https://lore.kernel.org/r/20210505091928.22010-4-jslaby@suse.cz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-05-13 16:57:15 +02:00
Jiri Slaby
7fb8a8affd
n_tty: remove n_tty_receive_char wrapper
...
The wrapper was meant as an optimization in commits eb3e4668bd (n_tty:
Un-inline slow-path n_tty_receive_char()) and e60d27c4d8 (n_tty:
Factor LNEXT processing from per-char i/o path). But the current
compiler (gcc 10) inlines it anyway (as expected). Actually, I'm not
sure it ever didn't. It would need to be marked with the noinline
attribute.
So remove this useless wrapper.
And if we ever introduce something similar, we need confirming numbers
first.
Signed-off-by: Jiri Slaby <jslaby@suse.cz >
Link: https://lore.kernel.org/r/20210505091928.22010-3-jslaby@suse.cz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-05-13 16:57:15 +02:00
Jiri Slaby
ed5aecd3da
tty: remove broken r3964 line discipline
...
Noone stepped up in the past two years since it was marked as BROKEN by
commit c7084edc3f (tty: mark Siemens R3964 line discipline as BROKEN).
Remove the line discipline for good.
Three remarks:
* we remove also the uapi header (as noone is able to use that interface
anyway)
* we do *not* remove the N_R3964 constant definition from tty.h, so it
remains reserved.
* in_interrupt() check is now removed from vt's con_put_char. Noone else
calls tty_operations::put_char from interrupt context.
Signed-off-by: Jiri Slaby <jslaby@suse.cz >
Link: https://lore.kernel.org/r/20210505091928.22010-2-jslaby@suse.cz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-05-13 16:57:15 +02:00
Dan Carpenter
d7e325aaa8
serial: 8250_omap: fix a timeout loop condition
...
This loop ends on -1 so the error message will never be printed.
Fixes: 4bcf59a5de ("serial: 8250: 8250_omap: Account for data in flight during DMA teardown")
Reviewed-by: Alexander Sverdlin <alexander.sverdlin@gmail.com >
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com >
Link: https://lore.kernel.org/r/YIpd+kOpXKMpEXPf@mwanda
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-05-13 16:26:16 +02:00
Christophe JAILLET
26f7591632
serial: 8250: Add an empty line and remove some useless {}
...
This fixes the following checkpatch.pl warnings:
WARNING: Missing a blank line after declarations
WARNING: braces {} are not necessary for any arm of this statement
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com >
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr >
Link: https://lore.kernel.org/r/257ffd691b4a062ad017333c9430d69da6dbd29a.1619594713.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-05-13 16:25:42 +02:00
Christophe JAILLET
89e7800129
serial: 8250: Use 'hlist_for_each_entry' to simplify code
...
Use 'hlist_for_each_entry' instead of hand writing it.
This saves a few lines of code.
The comment about warning generated by some gcc version is also removed.
The way 'hlist_for_each_entry' is written should prevent such a warning to
be emitted.
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com >
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr >
Link: https://lore.kernel.org/r/14024ddeb2b3a8c5b0138b5ba5083f54d00164a9.1619594713.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-05-13 16:25:42 +02:00