From: Jiri Slaby <jslaby@suse.cz>
To: gregkh@linuxfoundation.org
Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org,
Jiri Slaby <jslaby@suse.cz>
Subject: [PATCH 05/11] serial: pic32: simplify pic32_sport::enable_tx_irq handling
Date: Tue, 3 May 2022 08:31:16 +0200 [thread overview]
Message-ID: <20220503063122.20957-6-jslaby@suse.cz> (raw)
In-Reply-To: <20220503063122.20957-1-jslaby@suse.cz>
Make it a bool, so use true+false. And remove the wrap-around macro --
i.e. access the member directly.
It makes the code more obvious.
BTW the macro did not have 'sport' in parentheses, so it was potentially
problematic wrt expansion.
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
drivers/tty/serial/pic32_uart.c | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/drivers/tty/serial/pic32_uart.c b/drivers/tty/serial/pic32_uart.c
index 42269e96b3f8..a6d548d5833d 100644
--- a/drivers/tty/serial/pic32_uart.c
+++ b/drivers/tty/serial/pic32_uart.c
@@ -63,7 +63,7 @@ struct pic32_sport {
const char *irq_rx_name;
int irq_tx;
const char *irq_tx_name;
- u8 enable_tx_irq;
+ bool enable_tx_irq;
bool hw_flow_ctrl;
int cts_gpio;
@@ -74,7 +74,6 @@ struct pic32_sport {
};
#define to_pic32_sport(c) container_of(c, struct pic32_sport, port)
#define pic32_get_port(sport) (&sport->port)
-#define tx_irq_enabled(sport) (sport->enable_tx_irq)
static inline void pic32_uart_writel(struct pic32_sport *sport,
u32 reg, u32 val)
@@ -195,16 +194,16 @@ static unsigned int pic32_uart_get_mctrl(struct uart_port *port)
*/
static inline void pic32_uart_irqtxen(struct pic32_sport *sport, u8 en)
{
- if (en && !tx_irq_enabled(sport)) {
+ if (en && !sport->enable_tx_irq) {
enable_irq(sport->irq_tx);
- tx_irq_enabled(sport) = 1;
- } else if (!en && tx_irq_enabled(sport)) {
+ sport->enable_tx_irq = true;
+ } else if (!en && sport->enable_tx_irq) {
/* use disable_irq_nosync() and not disable_irq() to avoid self
* imposed deadlock by not waiting for irq handler to end,
* since this callback is called from interrupt context.
*/
disable_irq_nosync(sport->irq_tx);
- tx_irq_enabled(sport) = 0;
+ sport->enable_tx_irq = false;
}
}
@@ -497,7 +496,7 @@ static int pic32_uart_startup(struct uart_port *port)
* For each irq request_irq() is called with interrupt disabled.
* And the irq is enabled as soon as we are ready to handle them.
*/
- tx_irq_enabled(sport) = 0;
+ sport->enable_tx_irq = false;
sport->irq_fault_name = kasprintf(GFP_KERNEL, "%s%d-fault",
pic32_uart_type(port),
--
2.36.0
next prev parent reply other threads:[~2022-05-03 6:31 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-03 6:31 [PATCH 00/11] serial: pic32: cleanup Jiri Slaby
2022-05-03 6:31 ` [PATCH 01/11] serial: pic32: remove unused items from the header Jiri Slaby
2022-05-03 6:31 ` [PATCH 02/11] serial: pic32: move header content to .c Jiri Slaby
2022-05-03 6:31 ` [PATCH 03/11] serial: pic32: remove constants from struct pic32_sport Jiri Slaby
2022-05-03 6:31 ` [PATCH 04/11] serial: pic32: simplify clk handling Jiri Slaby
2022-05-03 6:31 ` Jiri Slaby [this message]
2022-05-03 6:31 ` [PATCH 06/11] serial: pic32: remove pic32_get_port() macro Jiri Slaby
2022-05-03 6:31 ` [PATCH 07/11] serial: pic32: convert to_pic32_sport() to an inline Jiri Slaby
2022-05-03 6:31 ` [PATCH 08/11] serial: pic32: don't assign pic32_sport::cts_gpio twice Jiri Slaby
2022-05-03 6:31 ` [PATCH 09/11] serial: pic32: don't zero members of kzalloc-ated structure Jiri Slaby
2022-05-03 6:31 ` [PATCH 10/11] serial: pic32: free up irq names correctly Jiri Slaby
2022-05-03 6:31 ` [PATCH 11/11] serial: pic32: restore disabled irqs in pic32_uart_startup() Jiri Slaby
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220503063122.20957-6-jslaby@suse.cz \
--to=jslaby@suse.cz \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).