Commit 93525619 authored by Jiri Slaby's avatar Jiri Slaby Committed by Greg Kroah-Hartman

amiserial: expand serial_isroot

Having a macro (serial_isroot) for capable(CAP_SYS_ADMIN) does not save
us from anything. It rather obfuscates the code. Hence expand
serial_isroot to be explicit like every other driver is.
Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
Link: https://lore.kernel.org/r/20210714091314.8292-7-jslaby@suse.czSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 5d4317ab
...@@ -109,8 +109,6 @@ static struct serial_state rs_table[1]; ...@@ -109,8 +109,6 @@ static struct serial_state rs_table[1];
#include <linux/uaccess.h> #include <linux/uaccess.h>
#define serial_isroot() (capable(CAP_SYS_ADMIN))
/* some serial hardware definitions */ /* some serial hardware definitions */
#define SDR_OVRUN (1<<15) #define SDR_OVRUN (1<<15)
#define SDR_RBF (1<<14) #define SDR_RBF (1<<14)
...@@ -485,11 +483,11 @@ static int startup(struct tty_struct *tty, struct serial_state *info) ...@@ -485,11 +483,11 @@ static int startup(struct tty_struct *tty, struct serial_state *info)
retval = request_irq(IRQ_AMIGA_VERTB, ser_vbl_int, 0, "serial status", info); retval = request_irq(IRQ_AMIGA_VERTB, ser_vbl_int, 0, "serial status", info);
if (retval) { if (retval) {
if (serial_isroot()) { if (capable(CAP_SYS_ADMIN)) {
set_bit(TTY_IO_ERROR, &tty->flags); set_bit(TTY_IO_ERROR, &tty->flags);
retval = 0; retval = 0;
} }
goto errout; goto errout;
} }
/* enable both Rx and Tx interrupts */ /* enable both Rx and Tx interrupts */
...@@ -955,7 +953,7 @@ static int set_serial_info(struct tty_struct *tty, struct serial_struct *ss) ...@@ -955,7 +953,7 @@ static int set_serial_info(struct tty_struct *tty, struct serial_struct *ss)
if (closing_wait != ASYNC_CLOSING_WAIT_NONE) if (closing_wait != ASYNC_CLOSING_WAIT_NONE)
closing_wait = msecs_to_jiffies(closing_wait * 10); closing_wait = msecs_to_jiffies(closing_wait * 10);
if (!serial_isroot()) { if (!capable(CAP_SYS_ADMIN)) {
if ((ss->baud_base != state->baud_base) || if ((ss->baud_base != state->baud_base) ||
(close_delay != port->close_delay) || (close_delay != port->close_delay) ||
(closing_wait != port->closing_wait) || (closing_wait != port->closing_wait) ||
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment