[PATCH 6/7] Char: stallion, fix compiler warnings

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Jiri Slaby
Date: Friday, November 9, 2007 - 4:38 pm

stallion, fix compiler warnings

Don't emit warnings on 64 bit platforms from min(). sizeof() on those
is not uint, neither 2 pointers difference, cast it to uint by min_t in
both cases.

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>

---
commit 7a411a4d1729e34bd7dc6697a8eedec7dd989c32
tree 2422610e5f3cdde71c9a5cec4d134baf9b72daa5
parent f412e3e0d4d012b7b57e381ae85ddfb1b5fc99bf
author Jiri Slaby <jirislaby@gmail.com> Tue, 23 Oct 2007 12:47:28 +0200
committer Jiri Slaby <jirislaby@gmail.com> Fri, 09 Nov 2007 22:36:31 +0100

 drivers/char/stallion.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/char/stallion.c b/drivers/char/stallion.c
index 45758d5..5050aa5 100644
--- a/drivers/char/stallion.c
+++ b/drivers/char/stallion.c
@@ -3546,7 +3546,8 @@ static void stl_cd1400txisr(struct stlpanel *panelp, int ioaddr)
 	} else {
 		len = min(len, CD1400_TXFIFOSIZE);
 		portp->stats.txtotal += len;
-		stlen = min(len, ((portp->tx.buf + STL_TXBUFSIZE) - tail));
+		stlen = min_t(unsigned int, len,
+				(portp->tx.buf + STL_TXBUFSIZE) - tail);
 		outb((TDR + portp->uartaddr), ioaddr);
 		outsb((ioaddr + EREG_DATA), tail, stlen);
 		len -= stlen;
@@ -3599,7 +3600,7 @@ static void stl_cd1400rxisr(struct stlpanel *panelp, int ioaddr)
 		outb((RDCR + portp->uartaddr), ioaddr);
 		len = inb(ioaddr + EREG_DATA);
 		if (tty == NULL || (buflen = tty_buffer_request_room(tty, len)) == 0) {
-			len = min(len, sizeof(stl_unwanted));
+			len = min_t(unsigned int, len, sizeof(stl_unwanted));
 			outb((RDSR + portp->uartaddr), ioaddr);
 			insb((ioaddr + EREG_DATA), &stl_unwanted[0], len);
 			portp->stats.rxlost += len;
@@ -4465,7 +4466,8 @@ static void stl_sc26198txisr(struct stlport *portp)
 	} else {
 		len = min(len, SC26198_TXFIFOSIZE);
 		portp->stats.txtotal += len;
-		stlen = min(len, ((portp->tx.buf + STL_TXBUFSIZE) - tail));
+		stlen = min_t(unsigned int, len,
+				(portp->tx.buf + STL_TXBUFSIZE) - tail);
 		outb(GTXFIFO, (ioaddr + XP_ADDR));
 		outsb((ioaddr + XP_DATA), tail, stlen);
 		len -= stlen;
@@ -4506,7 +4508,7 @@ static void stl_sc26198rxisr(struct stlport *portp, unsigned int iack)
 
 	if ((iack & IVR_TYPEMASK) == IVR_RXDATA) {
 		if (tty == NULL || (buflen = tty_buffer_request_room(tty, len)) == 0) {
-			len = min(len, sizeof(stl_unwanted));
+			len = min_t(unsigned int, len, sizeof(stl_unwanted));
 			outb(GRXFIFO, (ioaddr + XP_ADDR));
 			insb((ioaddr + XP_DATA), &stl_unwanted[0], len);
 			portp->stats.rxlost += len;
-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 2/7] Char: rocket, printk cleanup, Jiri Slaby, (Fri Nov 9, 4:35 pm)
[PATCH 3/7] Char: rocket, remove useless macros, Jiri Slaby, (Fri Nov 9, 4:36 pm)
[PATCH 5/7] Char: mxser_new, ioaddresses are ulong, Jiri Slaby, (Fri Nov 9, 4:37 pm)
[PATCH 6/7] Char: stallion, fix compiler warnings, Jiri Slaby, (Fri Nov 9, 4:38 pm)
Re: [PATCH 2/7] Char: rocket, printk cleanup, Alan Cox, (Fri Nov 9, 4:41 pm)