lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210618061516.662-15-jslaby@suse.cz>
Date:   Fri, 18 Jun 2021 08:14:20 +0200
From:   Jiri Slaby <jslaby@...e.cz>
To:     gregkh@...uxfoundation.org
Cc:     linux-serial@...r.kernel.org, linux-kernel@...r.kernel.org,
        Jiri Slaby <jslaby@...e.cz>
Subject: [PATCH 14/70] mxser: simplify mxser_interrupt and drop mxser_board::vector_mask

mxser_board::vector_mask is just a bitfield with bits set for all
available ports.  We can obtain this value simply by
"BIT(brd->info->nports) - 1" directly in the ISR. So remove vector_mask
and simplify the code a bit.

Signed-off-by: Jiri Slaby <jslaby@...e.cz>
---
 drivers/tty/mxser.c | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/drivers/tty/mxser.c b/drivers/tty/mxser.c
index 555b9b37b52f..df59ca88acab 100644
--- a/drivers/tty/mxser.c
+++ b/drivers/tty/mxser.c
@@ -368,7 +368,6 @@ struct mxser_board {
 	int irq;
 	const struct mxser_cardinfo *info;
 	unsigned long vector;
-	unsigned long vector_mask;
 
 	enum mxser_must_hwid must_hwid;
 	speed_t max_baud;
@@ -2273,18 +2272,18 @@ static irqreturn_t mxser_interrupt(int irq, void *dev_id)
 	struct mxser_board *brd = dev_id;
 	struct mxser_port *port;
 	unsigned int int_cnt, pass_counter = 0;
-	int max, irqbits, bits, i;
+	unsigned int i, max = brd->info->nports;
 	int handled = IRQ_NONE;
+	u8 irqbits, bits, mask = BIT(max) - 1;
 
-	max = brd->info->nports;
 	while (pass_counter++ < MXSER_ISR_PASS_LIMIT) {
-		irqbits = inb(brd->vector) & brd->vector_mask;
-		if (irqbits == brd->vector_mask)
+		irqbits = inb(brd->vector) & mask;
+		if (irqbits == mask)
 			break;
 
 		handled = IRQ_HANDLED;
 		for (i = 0, bits = 1; i < max; i++, irqbits |= bits, bits <<= 1) {
-			if (irqbits == brd->vector_mask)
+			if (irqbits == mask)
 				break;
 			if (bits & irqbits)
 				continue;
@@ -2450,7 +2449,6 @@ static int mxser_probe(struct pci_dev *pdev,
 	brd->irq = pdev->irq;
 
 	brd->must_hwid = mxser_must_get_hwid(brd->ports[0].ioaddr);
-	brd->vector_mask = 0;
 
 	for (j = 0; j < UART_INFO_NUM; j++) {
 		if (Gpci_uart_info[j].type == brd->must_hwid) {
@@ -2475,7 +2473,6 @@ static int mxser_probe(struct pci_dev *pdev,
 	}
 
 	for (i = 0; i < brd->info->nports; i++) {
-		brd->vector_mask |= (1 << i);
 		brd->ports[i].baud_base = 921600;
 	}
 
-- 
2.32.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ