Jiri Slaby
555b4ef797
vt: selection, localize use_unicode
...
use_unicode needs not be global. It is used only in set_selection_kernel
and sel_pos (a callee). It is also always set there prior calling
sel_pos. So make use_unicode local and rename it to plain shorter
"unicode". Finally, propagate it to sel_pos via parameter.
Signed-off-by: Jiri Slaby <jslaby@suse.cz >
Link: https://lore.kernel.org/r/20200219073951.16151-4-jslaby@suse.cz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-03-06 08:35:38 +01:00
Jiri Slaby
101f227c24
vt: selection, remove 2 local variables from set_selection_kernel
...
multiplier and mode are not actually needed:
* multiplier is used only in kmalloc_array, so use "use_unicode ? 4 : 1"
directly
* mode is used only to assign a bool in this manner:
if (cond)
x = true;
else
x = false;
So do "x = cond" directly.
Signed-off-by: Jiri Slaby <jslaby@suse.cz >
Link: https://lore.kernel.org/r/20200219073951.16151-3-jslaby@suse.cz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-03-06 08:35:38 +01:00
Jay Dolan
10c5ccc3c6
serial: 8250_exar: add support for ACCES cards
...
Add ACCES VIDs and PIDs that use the Exar chips
Signed-off-by: Jay Dolan <jay.dolan@accesio.com >
Cc: stable <stable@vger.kernel.org >
Link: https://lore.kernel.org/r/20200305140504.22237-1-jay.dolan@accesio.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-03-05 21:30:04 +01:00
tangbin
4a3e208474
tty:serial:mvebu-uart:fix a wrong return
...
in this place, the function should return a
negative value and the PTR_ERR already returns
a negative,so return -PTR_ERR() is wrong.
Signed-off-by: tangbin <tangbin@cmss.chinamobile.com >
Cc: stable <stable@vger.kernel.org >
Acked-by: Jiri Slaby <jslaby@suse.cz >
Link: https://lore.kernel.org/r/20200305013823.20976-1-tangbin@cmss.chinamobile.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-03-05 21:26:34 +01:00
Jiri Slaby
e8c75a30a2
vt: selection, push sel_lock up
...
sel_lock cannot nest in the console lock. Thanks to syzkaller, the
kernel states firmly:
> WARNING: possible circular locking dependency detected
> 5.6.0-rc3-syzkaller #0 Not tainted
> ------------------------------------------------------
> syz-executor.4/20336 is trying to acquire lock:
> ffff8880a2e952a0 (&tty->termios_rwsem){++++}, at: tty_unthrottle+0x22/0x100 drivers/tty/tty_ioctl.c:136
>
> but task is already holding lock:
> ffffffff89462e70 (sel_lock){+.+.}, at: paste_selection+0x118/0x470 drivers/tty/vt/selection.c:374
>
> which lock already depends on the new lock.
>
> the existing dependency chain (in reverse order) is:
>
> -> #2 (sel_lock){+.+.}:
> mutex_lock_nested+0x1b/0x30 kernel/locking/mutex.c:1118
> set_selection_kernel+0x3b8/0x18a0 drivers/tty/vt/selection.c:217
> set_selection_user+0x63/0x80 drivers/tty/vt/selection.c:181
> tioclinux+0x103/0x530 drivers/tty/vt/vt.c:3050
> vt_ioctl+0x3f1/0x3a30 drivers/tty/vt/vt_ioctl.c:364
This is ioctl(TIOCL_SETSEL).
Locks held on the path: console_lock -> sel_lock
> -> #1 (console_lock){+.+.}:
> console_lock+0x46/0x70 kernel/printk/printk.c:2289
> con_flush_chars+0x50/0x650 drivers/tty/vt/vt.c:3223
> n_tty_write+0xeae/0x1200 drivers/tty/n_tty.c:2350
> do_tty_write drivers/tty/tty_io.c:962 [inline]
> tty_write+0x5a1/0x950 drivers/tty/tty_io.c:1046
This is write().
Locks held on the path: termios_rwsem -> console_lock
> -> #0 (&tty->termios_rwsem){++++}:
> down_write+0x57/0x140 kernel/locking/rwsem.c:1534
> tty_unthrottle+0x22/0x100 drivers/tty/tty_ioctl.c:136
> mkiss_receive_buf+0x12aa/0x1340 drivers/net/hamradio/mkiss.c:902
> tty_ldisc_receive_buf+0x12f/0x170 drivers/tty/tty_buffer.c:465
> paste_selection+0x346/0x470 drivers/tty/vt/selection.c:389
> tioclinux+0x121/0x530 drivers/tty/vt/vt.c:3055
> vt_ioctl+0x3f1/0x3a30 drivers/tty/vt/vt_ioctl.c:364
This is ioctl(TIOCL_PASTESEL).
Locks held on the path: sel_lock -> termios_rwsem
> other info that might help us debug this:
>
> Chain exists of:
> &tty->termios_rwsem --> console_lock --> sel_lock
Clearly. From the above, we have:
console_lock -> sel_lock
sel_lock -> termios_rwsem
termios_rwsem -> console_lock
Fix this by reversing the console_lock -> sel_lock dependency in
ioctl(TIOCL_SETSEL). First, lock sel_lock, then console_lock.
Signed-off-by: Jiri Slaby <jslaby@suse.cz >
Reported-by: syzbot+26183d9746e62da329b8@syzkaller.appspotmail.com
Fixes: 07e6124a1a
("vt: selection, close sel_buffer race")
Cc: stable <stable@vger.kernel.org >
Link: https://lore.kernel.org/r/20200228115406.5735-2-jslaby@suse.cz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-02-28 16:06:49 +01:00
Jiri Slaby
4b70dd57a1
vt: selection, push console lock down
...
We need to nest the console lock in sel_lock, so we have to push it down
a bit. Fortunately, the callers of set_selection_* just lock the console
lock around the function call. So moving it down is easy.
In the next patch, we switch the order.
Signed-off-by: Jiri Slaby <jslaby@suse.cz >
Fixes: 07e6124a1a
("vt: selection, close sel_buffer race")
Cc: stable <stable@vger.kernel.org >
Link: https://lore.kernel.org/r/20200228115406.5735-1-jslaby@suse.cz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-02-28 16:06:49 +01:00
Greg Kroah-Hartman
ba08cf452f
Merge 5.6-rc3 into tty-next
...
We want the tty fixes in here as well.
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-02-24 08:39:55 +01:00
Kees Cook
e24cd4e6d6
n_tty: Distribute switch variables for initialization
...
Variables declared in a switch statement before any case statements
cannot be automatically initialized with compiler instrumentation (as
they are not part of any execution flow). With GCC's proposed automatic
stack variable initialization feature, this triggers a warning (and they
don't get initialized). Clang's automatic stack variable initialization
(via CONFIG_INIT_STACK_ALL=y) doesn't throw a warning, but it also
doesn't initialize such variables[1]. Note that these warnings (or silent
skipping) happen before the dead-store elimination optimization phase,
so even when the automatic initializations are later elided in favor of
direct initializations, the warnings remain.
To avoid these problems, move such variables into the "case" where
they're used or lift them up into the main function body.
drivers/tty/n_tty.c: In function ‘__process_echoes’:
drivers/tty/n_tty.c:657:18: warning: statement will never be executed [-Wswitch-unreachable]
657 | unsigned int num_chars, num_bs;
| ^~~~~~~~~
[1] https://bugs.llvm.org/show_bug.cgi?id=44916
Reviewed-by: Jiri Slaby <jslaby@suse.cz >
Signed-off-by: Kees Cook <keescook@chromium.org >
Link: https://lore.kernel.org/r/20200220062313.69209-1-keescook@chromium.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-02-23 20:14:50 +01:00
Jiri Slaby
e587e8f174
vt: ioctl, switch VT_IS_IN_USE and VT_BUSY to inlines
...
These two were macros. Switch them to static inlines, so that it's more
understandable what they are doing.
Signed-off-by: Jiri Slaby <jslaby@suse.cz >
Link: https://lore.kernel.org/r/20200219073951.16151-2-jslaby@suse.cz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-02-21 10:31:18 +01:00
Jiri Slaby
dce05aa6ee
vt: selection, introduce vc_is_sel
...
Avoid global variables (namely sel_cons) by introducing vc_is_sel. It
checks whether the parameter is the current selection console. This will
help putting sel_cons to a struct later.
Signed-off-by: Jiri Slaby <jslaby@suse.cz >
Link: https://lore.kernel.org/r/20200219073951.16151-1-jslaby@suse.cz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-02-21 10:31:18 +01:00
Jiri Slaby
80967ff2d1
n_hdlc: wrap a comment properly
...
Signed-off-by: Jiri Slaby <jslaby@suse.cz >
Link: https://lore.kernel.org/r/20200219084118.26491-24-jslaby@suse.cz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-02-21 10:24:34 +01:00
Jiri Slaby
1283c72135
n_hdlc: fix whitespace around binary operators
...
Signed-off-by: Jiri Slaby <jslaby@suse.cz >
Link: https://lore.kernel.org/r/20200219084118.26491-23-jslaby@suse.cz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-02-21 10:24:34 +01:00
Jiri Slaby
8d79bb5c4b
n_hdlc: add missing spaces after commas
...
Signed-off-by: Jiri Slaby <jslaby@suse.cz >
Link: https://lore.kernel.org/r/20200219084118.26491-22-jslaby@suse.cz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-02-21 10:24:34 +01:00
Jiri Slaby
2bfb2b753b
n_hdlc: remove spaces between function name and (
...
Signed-off-by: Jiri Slaby <jslaby@suse.cz >
Link: https://lore.kernel.org/r/20200219084118.26491-21-jslaby@suse.cz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-02-21 10:24:34 +01:00
Jiri Slaby
43741e9bc0
n_hdlc: remove useless whitespace at line wraps
...
Do
s@[ \t]\+$@@
s@ \+\t@\t@
on the file as there are many spaces at the begininning of lines and
many spaces/tabs at EOLs. And vim screamed.
git show -w is supposed to show no difference here.
Signed-off-by: Jiri Slaby <jslaby@suse.cz >
Link: https://lore.kernel.org/r/20200219084118.26491-20-jslaby@suse.cz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-02-21 10:24:34 +01:00
Jiri Slaby
d86b05cb0e
n_hdlc: use __func__ and pr_ print helpers
...
* we mark the message in n_hdlc_tty_receive as error
* we use __func__ instead of explicit function name
* we switch the remaining prints to pr_* helpers
Signed-off-by: Jiri Slaby <jslaby@suse.cz >
Link: https://lore.kernel.org/r/20200219084118.26491-19-jslaby@suse.cz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-02-21 10:24:34 +01:00
Jiri Slaby
b9c010dfe8
n_hdlc: remove unneeded ifdef
...
TTY_NO_WRITE_SPLIT is (always) defined in linux/tty.h, so no need to
check for it.
Signed-off-by: Jiri Slaby <jslaby@suse.cz >
Link: https://lore.kernel.org/r/20200219084118.26491-18-jslaby@suse.cz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-02-21 10:24:34 +01:00
Jiri Slaby
0f23829814
n_hdlc: switch tbusy and woke_up to bools
...
They are in fact bools, so save some bytes (8B on x86_64). Also describe
@woke_up as we know what it is.
Signed-off-by: Jiri Slaby <jslaby@suse.cz >
Link: https://lore.kernel.org/r/20200219084118.26491-17-jslaby@suse.cz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-02-21 10:24:33 +01:00
Jiri Slaby
edee649f9d
n_hdlc: move tty_ldisc_ops to the bottom
...
This makes forward declarations unnecessary. So drop them.
Signed-off-by: Jiri Slaby <jslaby@suse.cz >
Link: https://lore.kernel.org/r/20200219084118.26491-16-jslaby@suse.cz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-02-21 10:24:33 +01:00
Jiri Slaby
740708abbb
n_hdlc: add helper for buffers allocation
...
Given both rx and tx allocations do the same, add a new helper
(n_hdlc_alloc_buf) and use it for both of them. This cleans up
n_hdlc_alloc slightly.
Signed-off-by: Jiri Slaby <jslaby@suse.cz >
Link: https://lore.kernel.org/r/20200219084118.26491-15-jslaby@suse.cz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-02-21 10:24:33 +01:00
Jiri Slaby
844cc5f9e5
n_hdlc: remove checking of n_hdlc
...
We got rid of backup_tty recently. Also, the tty layer ensures not to
call other ldisc hooks after ldisc close. That means, all those tests
are superfluous now so remove them.
Note that we remove the magic check in write after schedule too. The tty
cannot change during schedule.
Signed-off-by: Jiri Slaby <jslaby@suse.cz >
Link: https://lore.kernel.org/r/20200219084118.26491-14-jslaby@suse.cz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-02-21 10:24:33 +01:00
Jiri Slaby
df6de639d4
n_hdlc: remove cached tty
...
It's not needed, as now it's clear, that it's always the same as the one
passed from the tty layer.
Signed-off-by: Jiri Slaby <jslaby@suse.cz >
Link: https://lore.kernel.org/r/20200219084118.26491-13-jslaby@suse.cz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-02-21 10:24:33 +01:00
Jiri Slaby
43e784eca8
n_hdlc: inline n_hdlc_release
...
Put the body of n_hdlc_release into the only caller. It can be seen,
that the "if" is superfluous now -- the same happens few lines above in
n_hdlc_tty_close already. So drop it.
Drop also n_hdlc2tty macro as this was the only user.
Signed-off-by: Jiri Slaby <jslaby@suse.cz >
Link: https://lore.kernel.org/r/20200219084118.26491-12-jslaby@suse.cz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-02-21 10:24:33 +01:00
Jiri Slaby
75011682e7
n_hdlc: expand tty2n_hdlc macro
...
It's simple tty->disc_data, but it obfuscates code. So expand it to all
locations and drop it.
Signed-off-by: Jiri Slaby <jslaby@suse.cz >
Link: https://lore.kernel.org/r/20200219084118.26491-11-jslaby@suse.cz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-02-21 10:24:33 +01:00
Jiri Slaby
4040c82860
n_hdlc: remove unused backup_tty
...
It's only set to NULL and never properly used.
Signed-off-by: Jiri Slaby <jslaby@suse.cz >
Link: https://lore.kernel.org/r/20200219084118.26491-10-jslaby@suse.cz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-02-21 10:24:33 +01:00
Jiri Slaby
a1274b26ac
n_hdlc: remove unused flags
...
They are only set to 0 and never read.
Signed-off-by: Jiri Slaby <jslaby@suse.cz >
Link: https://lore.kernel.org/r/20200219084118.26491-9-jslaby@suse.cz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-02-21 10:24:33 +01:00
Jiri Slaby
5f2895143d
n_hdlc: invert conditions in n_hdlc_tty_close and n_hdlc_tty_poll
...
This makes the functions return immediatelly on invalid state. And we
can push the indent of the later code one level left.
Pass "-w" to "git show" to see we are changing only the conditions (and
whitespace).
Signed-off-by: Jiri Slaby <jslaby@suse.cz >
Link: https://lore.kernel.org/r/20200219084118.26491-8-jslaby@suse.cz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-02-21 10:24:33 +01:00
Jiri Slaby
30fafd92c2
n_hdlc: simplify freeing of buffer list
...
n_hdlc_release contains four loops to free each buffer list. Create a
helper (n_hdlc_free_buf_list) and call it for every list instead. It
makes n_hdlc_release more readable.
We are switching from "for (;;)" to "do {} while (buf)" which avoids the
"if (buf)" completely -- kfree is a nop for NULL pointers.
Signed-off-by: Jiri Slaby <jslaby@suse.cz >
Link: https://lore.kernel.org/r/20200219084118.26491-7-jslaby@suse.cz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-02-21 10:24:33 +01:00
Jiri Slaby
c549725ff8
n_hdlc: use clamp() for maxframe
...
It is easier to read. And use MAX_HDLC_FRAME_SIZE instead of magic
constant.
Signed-off-by: Jiri Slaby <jslaby@suse.cz >
Link: https://lore.kernel.org/r/20200219084118.26491-6-jslaby@suse.cz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-02-21 10:24:32 +01:00
Jiri Slaby
cda3756ca5
n_hdlc: cleanup messages during registration
...
1) n_hdlc prints two lines during registration. Squeeze it into one.
2) prefix the error message with "N_HDLC: ", so that it's clear which
ldisc failed to register.
Signed-off-by: Jiri Slaby <jslaby@suse.cz >
Link: https://lore.kernel.org/r/20200219084118.26491-5-jslaby@suse.cz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-02-21 10:24:32 +01:00
Jiri Slaby
aebe5fc3b5
n_hdlc: put init/exit strings directly to prints
...
These strings were put aside from prints to save some bytes after module
load or when built-in -- they were freed after module load (__init ones) or
when the driver is selected as built-in (__exit ones).
The savings are negligible, but the code readability is worse by the
order of magnitude. So put the strings where they belong. Note that it
also used to make little sense putting const data in .data (the __exit
case).
While at it, switch to pr_info, pr_err, not using the KERN_INFO and _ERR
directly.
Signed-off-by: Jiri Slaby <jslaby@suse.cz >
Link: https://lore.kernel.org/r/20200219084118.26491-4-jslaby@suse.cz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-02-21 10:24:32 +01:00
Jiri Slaby
f3c2e27750
n_hdlc: convert debuglevel use to pr_debug
...
With pr_debug we have a fine-grained control about debugging prints. So
convert the use of global debuglevel variable and tests to a commonly
used pr_debug. And drop debuglevel completely.
This also implicitly adds a loglevel to the messages (KERN_DEBUG) as it
was missing on most of them.
And also use __func__ instead of function names explicitly typed.
Signed-off-by: Jiri Slaby <jslaby@suse.cz >
Link: https://lore.kernel.org/r/20200219084118.26491-3-jslaby@suse.cz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-02-21 10:24:32 +01:00
Jiri Slaby
683efabc66
n_hdlc: remove unused macros
...
VERSION and bset are unused. Remove them.
Signed-off-by: Jiri Slaby <jslaby@suse.cz >
Link: https://lore.kernel.org/r/20200219084118.26491-2-jslaby@suse.cz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-02-21 10:24:32 +01:00
Jiri Slaby
66c3bdf11d
n_hdlc: remove tracing debug prints
...
We can trace functions using ftrace, so there is no need for this
additional prints. Remove them.
We keep only those which print some additional info, not only function
name & "entry"/"exit".
Signed-off-by: Jiri Slaby <jslaby@suse.cz >
Link: https://lore.kernel.org/r/20200219084118.26491-1-jslaby@suse.cz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-02-21 10:24:32 +01:00
Greg Kroah-Hartman
3b3845bb6c
tty: serial: samsung_tty: remove SERIAL_SAMSUNG_DEBUG
...
Since a05025d0ce
("tty: serial: samsung_tty: use standard debugging
macros") this configuration option is not used at all, so remove it from
the Kconfig file.
Cc: linux-kernel@vger.kernel.org
Cc: linux-serial@vger.kernel.org
Cc: linux-samsung-soc@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org
Cc: Jiri Slaby <jslaby@suse.com >
Cc: Shinbeom Choi <sbeom.choi@samsung.com >
Cc: HYUN-KI KOO <hyunki00.koo@samsung.com >
Cc: Hyunki Koo <kkoos00@naver.com >
Cc: Donghoon Yu <hoony.yu@samsung.com >
Cc: Kukjin Kim <kgene@kernel.org >
Reviewed-by: Krzysztof Kozlowski <krzk@kernel.org >
Link: https://lore.kernel.org/r/20200220102628.3371996-2-gregkh@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-02-20 13:46:28 +01:00
Greg Kroah-Hartman
175b558d0e
tty: serial: samsung_tty: build it for any platform
...
There is no need to tie this driver to only a specific SoC, or compile
test, so remove that dependancy from the Kconfig rules.
Cc: linux-kernel@vger.kernel.org
Cc: linux-serial@vger.kernel.org
Cc: linux-samsung-soc@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org
Cc: Jiri Slaby <jslaby@suse.com >
Cc: Shinbeom Choi <sbeom.choi@samsung.com >
Cc: HYUN-KI KOO <hyunki00.koo@samsung.com >
Cc: Hyunki Koo <kkoos00@naver.com >
Cc: Donghoon Yu <hoony.yu@samsung.com >
Cc: Kukjin Kim <kgene@kernel.org >
Reviewed-by: Krzysztof Kozlowski <krzk@kernel.org >
Link: https://lore.kernel.org/r/20200220102628.3371996-1-gregkh@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-02-20 13:46:19 +01:00
Jiri Slaby
c50704bdef
n_gsm: switch escape to bool
...
gsm_mux->escape is used as a bool, so treat it as such.
Signed-off-by: Jiri Slaby <jslaby@suse.cz >
Link: https://lore.kernel.org/r/20200219084949.28074-10-jslaby@suse.cz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-02-19 12:46:48 +01:00
Jiri Slaby
7a9ed9c069
n_gsm: switch constipated to bool
...
Both gsm_dlci->constipated and gsm_mux->constipated are used as bools,
so treat them as such.
Signed-off-by: Jiri Slaby <jslaby@suse.cz >
Link: https://lore.kernel.org/r/20200219084949.28074-9-jslaby@suse.cz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-02-19 12:46:48 +01:00
Jiri Slaby
e9360b9a0d
n_gsm: switch throttled to bool
...
gsm_dlci->throttled is used as a bool, so treat it as such.
Signed-off-by: Jiri Slaby <jslaby@suse.cz >
Link: https://lore.kernel.org/r/20200219084949.28074-8-jslaby@suse.cz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-02-19 12:46:48 +01:00
Jiri Slaby
5677fcf376
n_gsm: switch dead to bool
...
Both gsm_dlci->dead and gsm_mux->dead are used as bools, so treat them
as such.
Signed-off-by: Jiri Slaby <jslaby@suse.cz >
Link: https://lore.kernel.org/r/20200219084949.28074-7-jslaby@suse.cz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-02-19 12:46:48 +01:00
Jiri Slaby
d8ca4ecf8d
n_gsm: add missing \n to prints
...
Signed-off-by: Jiri Slaby <jslaby@suse.cz >
Link: https://lore.kernel.org/r/20200219084949.28074-6-jslaby@suse.cz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-02-19 12:46:48 +01:00
Jiri Slaby
edd05a735a
n_gsm: add missing __user annotations
...
sparse warns about incorrect types:
n_gsm.c:2638:35: warning: incorrect type in argument 1 (different address spaces)
n_gsm.c:2638:35: expected void [noderef] <asn:1> *to
n_gsm.c:2638:35: got void *
The ioctl handler casts its `arg' to (void *) without __user. Add that.
Signed-off-by: Jiri Slaby <jslaby@suse.cz >
Link: https://lore.kernel.org/r/20200219084949.28074-5-jslaby@suse.cz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-02-19 12:46:47 +01:00
Jiri Slaby
329aa6e6e1
n_gsm: introduce enum gsm_mux_state
...
gsm_mux->state is clearly an enumeration. So introduce one and use it
-- compiler now checks if valid values are assigned to the field.
Note that a compiler warns about unhandled cases in switch. Add default
cases with a pr_debug (which is not printed by default).
The values of the states are preserved thanks to the nature of enum.
Signed-off-by: Jiri Slaby <jslaby@suse.cz >
Link: https://lore.kernel.org/r/20200219084949.28074-4-jslaby@suse.cz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-02-19 12:46:47 +01:00
Jiri Slaby
e1785996f4
n_gsm: introduce enum gsm_dlci_mode
...
gsm_dlci->mode is clearly an enumeration. So introduce one and use it
-- compiler now checks if valid values are assigned to the field.
Signed-off-by: Jiri Slaby <jslaby@suse.cz >
Link: https://lore.kernel.org/r/20200219084949.28074-3-jslaby@suse.cz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-02-19 12:46:47 +01:00
Jiri Slaby
72ae8cc192
n_gsm: introduce enum gsm_dlci_state
...
gsm_dlci->state is clearly an enumeration. So introduce one and use it
-- compiler now checks if valid values are assigned to the field.
Note that a compiler warns about unhandled cases in switch. Add default
cases with a pr_debug (which is not printed by default).
Signed-off-by: Jiri Slaby <jslaby@suse.cz >
Link: https://lore.kernel.org/r/20200219084949.28074-2-jslaby@suse.cz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-02-19 12:46:47 +01:00
Jiri Slaby
036bca1fcc
n_gsm: drop unneeded gsm_dlci->fifo field
...
gsm_dlci->fifo always points to gsm_dlci->_fifo. So drop the pointer and
rename _fifo to fifo. And update all the users (add & to them).
Signed-off-by: Jiri Slaby <jslaby@suse.cz >
Link: https://lore.kernel.org/r/20200219084949.28074-1-jslaby@suse.cz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-02-19 12:46:47 +01:00
Andy Shevchenko
21680a6dcb
serial: 8250_port: Use dev_*() instead of pr_*()
...
Convert pr_*() calls to dev_*() ones. We have a port, we should use it.
Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com >
Link: https://lore.kernel.org/r/20200217114016.49856-5-andriy.shevchenko@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-02-19 11:38:58 +01:00
Andy Shevchenko
567a0e17f7
serial: 8250_port: Switch to use DEVICE_ATTR_RW()
...
Move device attributes to DEVICE_ATTR_RW() as that would make things
a lot more "obvious" what is happening here.
Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com >
Link: https://lore.kernel.org/r/20200217114016.49856-4-andriy.shevchenko@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-02-19 11:38:58 +01:00
Alexandre Belloni
47eff47cc2
tty: serial: efm32: fix spelling mistake "reserverd" -> "reserved"
...
Fix a spelling mistake in a comment.
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com >
Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de >
Link: https://lore.kernel.org/r/20200214141406.20792-1-alexandre.belloni@bootlin.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-02-19 11:38:58 +01:00
Christophe JAILLET
9ff2f0f7f2
tty: serial: Kconfig: Fix a typo
...
'exsisting' has an extra 's'
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr >
Link: https://lore.kernel.org/r/20200216102742.19298-1-christophe.jaillet@wanadoo.fr
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-02-19 11:38:58 +01:00