[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20201202113942.27024-2-johan@kernel.org>
Date: Wed, 2 Dec 2020 12:39:36 +0100
From: Johan Hovold <johan@...nel.org>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: Jiri Slaby <jirislaby@...nel.org>,
"Mychaela N . Falconia" <falcon@...ecalypso.org>,
linux-serial@...r.kernel.org, linux-usb@...r.kernel.org,
linux-kernel@...r.kernel.org, Johan Hovold <johan@...nel.org>
Subject: [PATCH v2 1/7] 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@...nel.org>
Signed-off-by: Johan Hovold <johan@...nel.org>
---
include/linux/tty.h | 30 ++++++------------------------
1 file changed, 6 insertions(+), 24 deletions(-)
diff --git a/include/linux/tty.h b/include/linux/tty.h
index a99e9b8e4e31..eca7fd5e9fd0 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -612,10 +612,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)
@@ -625,10 +622,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)
@@ -638,10 +632,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)
@@ -651,10 +642,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)
@@ -664,10 +652,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)
@@ -677,10 +662,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);
--
2.26.2
Powered by blists - more mailing lists