summaryrefslogtreecommitdiff
path: root/include/linux/tty.h
diff options
context:
space:
mode:
authorJohan Hovold <johan@kernel.org>2020-12-02 12:39:36 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-12-09 15:26:31 +0100
commitaf633212c4aac1dbd3a48615a834646ce072346d (patch)
treef557952526337f7cc87ed2099caa5f41d0487533 /include/linux/tty.h
parent76437b340b242fd21952f54ba8965d21a1ffa8c8 (diff)
tty: use assign_bit() in port-flag accessors
Use the new assign_bit() wrapper in the port-flag accessors instead of open coding. Suggested-by: Jiri Slaby <jirislaby@kernel.org> Signed-off-by: Johan Hovold <johan@kernel.org> Link: https://lore.kernel.org/r/20201202113942.27024-2-johan@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'include/linux/tty.h')
-rw-r--r--include/linux/tty.h30
1 files changed, 6 insertions, 24 deletions
diff --git a/include/linux/tty.h b/include/linux/tty.h
index 0c2f97ba8018..9b8e7d5bf2fc 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -615,10 +615,7 @@ static inline bool tty_port_cts_enabled(struct tty_port *port)
static inline void tty_port_set_cts_flow(struct tty_port *port, bool val)
{
- if (val)
- set_bit(TTY_PORT_CTS_FLOW, &port->iflags);
- else
- clear_bit(TTY_PORT_CTS_FLOW, &port->iflags);
+ assign_bit(TTY_PORT_CTS_FLOW, &port->iflags, val);
}
static inline bool tty_port_active(struct tty_port *port)
@@ -628,10 +625,7 @@ static inline bool tty_port_active(struct tty_port *port)
static inline void tty_port_set_active(struct tty_port *port, bool val)
{
- if (val)
- set_bit(TTY_PORT_ACTIVE, &port->iflags);
- else
- clear_bit(TTY_PORT_ACTIVE, &port->iflags);
+ assign_bit(TTY_PORT_ACTIVE, &port->iflags, val);
}
static inline bool tty_port_check_carrier(struct tty_port *port)
@@ -641,10 +635,7 @@ static inline bool tty_port_check_carrier(struct tty_port *port)
static inline void tty_port_set_check_carrier(struct tty_port *port, bool val)
{
- if (val)
- set_bit(TTY_PORT_CHECK_CD, &port->iflags);
- else
- clear_bit(TTY_PORT_CHECK_CD, &port->iflags);
+ assign_bit(TTY_PORT_CHECK_CD, &port->iflags, val);
}
static inline bool tty_port_suspended(struct tty_port *port)
@@ -654,10 +645,7 @@ static inline bool tty_port_suspended(struct tty_port *port)
static inline void tty_port_set_suspended(struct tty_port *port, bool val)
{
- if (val)
- set_bit(TTY_PORT_SUSPENDED, &port->iflags);
- else
- clear_bit(TTY_PORT_SUSPENDED, &port->iflags);
+ assign_bit(TTY_PORT_SUSPENDED, &port->iflags, val);
}
static inline bool tty_port_initialized(struct tty_port *port)
@@ -667,10 +655,7 @@ static inline bool tty_port_initialized(struct tty_port *port)
static inline void tty_port_set_initialized(struct tty_port *port, bool val)
{
- if (val)
- set_bit(TTY_PORT_INITIALIZED, &port->iflags);
- else
- clear_bit(TTY_PORT_INITIALIZED, &port->iflags);
+ assign_bit(TTY_PORT_INITIALIZED, &port->iflags, val);
}
static inline bool tty_port_kopened(struct tty_port *port)
@@ -680,10 +665,7 @@ static inline bool tty_port_kopened(struct tty_port *port)
static inline void tty_port_set_kopened(struct tty_port *port, bool val)
{
- if (val)
- set_bit(TTY_PORT_KOPENED, &port->iflags);
- else
- clear_bit(TTY_PORT_KOPENED, &port->iflags);
+ assign_bit(TTY_PORT_KOPENED, &port->iflags, val);
}
extern struct tty_struct *tty_port_tty_get(struct tty_port *port);