LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH 7/9] drivers/serial/m32r_sio.c: Correct use of ! and &
@ 2008-02-26 20:45 Julia Lawall
  0 siblings, 0 replies; only message in thread
From: Julia Lawall @ 2008-02-26 20:45 UTC (permalink / raw)
  To: takata, linux-m32r, linux-kernel, kernel-janitors

From: Julia Lawall <julia@diku.dk>

In commit e6bafba5b4765a5a252f1b8d31cbf6d2459da337, a bug was fixed that
involved converting !x & y to !(x & y).  The code below shows the same
pattern, and thus should perhaps be fixed in the same way.

This is not tested and clearly changes the semantics, so it is only
something to consider.

The semantic patch that makes this change is as follows:
(http://www.emn.fr/x-info/coccinelle/)

// <smpl>
@@ expression E1,E2; @@
(
  !E1 & !E2
|
- !E1 & E2
+ !(E1 & E2)
)
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>

---

diff -u -p a/drivers/serial/m32r_sio.c b/drivers/serial/m32r_sio.c
--- a/drivers/serial/m32r_sio.c 2007-10-22 11:25:24.000000000 +0200
+++ b/drivers/serial/m32r_sio.c 2008-02-26 08:12:18.000000000 +0100
@@ -421,7 +421,7 @@ static void transmit_chars(struct uart_s
 		up->port.icount.tx++;
 		if (uart_circ_empty(xmit))
 			break;
-		while (!serial_in(up, UART_LSR) & UART_LSR_THRE);
+		while (!(serial_in(up, UART_LSR) & UART_LSR_THRE));
 
 	} while (--count > 0);
 

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-02-26 20:45 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-02-26 20:45 [PATCH 7/9] drivers/serial/m32r_sio.c: Correct use of ! and & Julia Lawall

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).