All of lore.kernel.org
 help / color / mirror / Atom feed
* [Kernel-janitors] [PATCH] drivers/char/rocket_int.h MIN/MAX removal
@ 2004-07-03 15:05 Michael Veeck
  2004-07-03 15:05 ` [Kernel-janitors] [PATCH] drivers/char/riscom8.c " Michael Veeck
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Michael Veeck @ 2004-07-03 15:05 UTC (permalink / raw)
  To: kernel-janitors

[-- Attachment #1: Type: text/plain, Size: 150 bytes --]

Patch (against 2.6.7) removes unnecessary min/max macros and changes
calls to use kernel.h macros instead.

Feedback is always welcome
Michael








[-- Attachment #2: patch-char-rocketinth --]
[-- Type: text/plain, Size: 392 bytes --]

--- linux-2.6.7-old/drivers/char/rocket_int.h	2004-07-04 11:04:14.000000000 +0200
+++ linux-2.6.7-new/drivers/char/rocket_int.h	2004-07-04 15:56:26.584650312 +0200
@@ -1241,10 +1241,6 @@
 #define TTY_ROCKET_MAJOR	46
 #define CUA_ROCKET_MAJOR	47
 
-#ifndef MIN
-#define MIN(a,b)	((a) < (b) ? (a) : (b))
-#endif
-
 #ifdef PCI_VENDOR_ID_RP
 #undef PCI_VENDOR_ID_RP
 #undef PCI_DEVICE_ID_RP8OCTA

[-- Attachment #3: Type: text/plain, Size: 167 bytes --]

_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Kernel-janitors] [PATCH] drivers/char/riscom8.c MIN/MAX removal
  2004-07-03 15:05 [Kernel-janitors] [PATCH] drivers/char/rocket_int.h MIN/MAX removal Michael Veeck
@ 2004-07-03 15:05 ` Michael Veeck
  2004-07-03 15:07 ` [Kernel-janitors] [PATCH] drivers/char/rocket.c " Michael Veeck
  2004-07-12 15:32 ` [Kernel-janitors] [PATCH] drivers/char/riscom8.c " Michael Veeck
  2 siblings, 0 replies; 4+ messages in thread
From: Michael Veeck @ 2004-07-03 15:05 UTC (permalink / raw)
  To: kernel-janitors

[-- Attachment #1: Type: text/plain, Size: 150 bytes --]

Patch (against 2.6.7) removes unnecessary min/max macros and changes
calls to use kernel.h macros instead.

Feedback is always welcome
Michael








[-- Attachment #2: patch-char-riscom8 --]
[-- Type: text/plain, Size: 2030 bytes --]

--- linux-2.6.7-old/drivers/char/riscom8.c	2004-07-04 11:04:14.000000000 +0200
+++ linux-2.6.7-new/drivers/char/riscom8.c	2004-07-04 15:51:50.013695488 +0200
@@ -75,10 +75,6 @@
 	 ASYNC_SPD_HI       | ASYNC_SPEED_VHI    | ASYNC_SESSION_LOCKOUT | \
 	 ASYNC_PGRP_LOCKOUT | ASYNC_CALLOUT_NOHUP)
 
-#ifndef MIN
-#define MIN(a,b) ((a) < (b) ? (a) : (b))
-#endif
-
 #define RS_EVENT_WRITE_WAKEUP	0
 
 static struct riscom_board * IRQ_to_board[16];
@@ -107,7 +103,7 @@
 };
 
 static struct riscom_port rc_port[RC_NBOARD * RC_NPORT];
-		
+
 /* RISCom/8 I/O ports addresses (without address translation) */
 static unsigned short rc_ioport[] =  {
 #if 1	
@@ -483,7 +479,7 @@
 				rc_out(bp, CD180_TDR, CD180_C_SBRK);
 				port->COR2 &= ~COR2_ETC;
 			}
-			count = MIN(port->break_length, 0xff);
+			count = min_t(int, port->break_length, 0xff);
 			rc_out(bp, CD180_TDR, CD180_C_ESC);
 			rc_out(bp, CD180_TDR, CD180_C_DELAY);
 			rc_out(bp, CD180_TDR, count);
@@ -1165,8 +1161,8 @@
 		down(&tmp_buf_sem);
 		while (1) {
 			cli();		
-			c = MIN(count, MIN(SERIAL_XMIT_SIZE - port->xmit_cnt - 1,
-					   SERIAL_XMIT_SIZE - port->xmit_head));
+			c = min_t(int, count, min(SERIAL_XMIT_SIZE - port->xmit_cnt - 1,
+						  SERIAL_XMIT_SIZE - port->xmit_head));
 			if (c <= 0)
 				break;
 
@@ -1178,8 +1174,8 @@
 			}
 
 			cli();
-			c = MIN(c, MIN(SERIAL_XMIT_SIZE - port->xmit_cnt - 1,
-				       SERIAL_XMIT_SIZE - port->xmit_head));
+			c = min_t(c, min(SERIAL_XMIT_SIZE - port->xmit_cnt - 1,
+					 SERIAL_XMIT_SIZE - port->xmit_head));
 			memcpy(port->xmit_buf + port->xmit_head, tmp_buf, c);
 			port->xmit_head = (port->xmit_head + c) & (SERIAL_XMIT_SIZE-1);
 			port->xmit_cnt += c;
@@ -1193,8 +1189,8 @@
 	} else {
 		while (1) {
 			cli();		
-			c = MIN(count, MIN(SERIAL_XMIT_SIZE - port->xmit_cnt - 1,
-					   SERIAL_XMIT_SIZE - port->xmit_head));
+			c = min_t(int, count, min(SERIAL_XMIT_SIZE - port->xmit_cnt - 1,
+						  SERIAL_XMIT_SIZE - port->xmit_head));
 			if (c <= 0) {
 				restore_flags(flags);
 				break;

[-- Attachment #3: Type: text/plain, Size: 167 bytes --]

_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Kernel-janitors] [PATCH] drivers/char/rocket.c MIN/MAX removal
  2004-07-03 15:05 [Kernel-janitors] [PATCH] drivers/char/rocket_int.h MIN/MAX removal Michael Veeck
  2004-07-03 15:05 ` [Kernel-janitors] [PATCH] drivers/char/riscom8.c " Michael Veeck
@ 2004-07-03 15:07 ` Michael Veeck
  2004-07-12 15:32 ` [Kernel-janitors] [PATCH] drivers/char/riscom8.c " Michael Veeck
  2 siblings, 0 replies; 4+ messages in thread
From: Michael Veeck @ 2004-07-03 15:07 UTC (permalink / raw)
  To: kernel-janitors

[-- Attachment #1: Type: text/plain, Size: 150 bytes --]

Patch (against 2.6.7) removes unnecessary min/max macros and changes
calls to use kernel.h macros instead.

Feedback is always welcome
Michael








[-- Attachment #2: patch-char-rocket --]
[-- Type: text/plain, Size: 1446 bytes --]

--- linux-2.6.7-old/drivers/char/rocket.c	2004-07-04 11:04:14.000000000 +0200
+++ linux-2.6.7-new/drivers/char/rocket.c	2004-07-04 16:34:13.544020104 +0200
@@ -389,7 +389,7 @@
 	while (1) {
 		if (tty->stopped || tty->hw_stopped)
 			break;
-		c = MIN(info->xmit_fifo_room, MIN(info->xmit_cnt, XMIT_BUF_SIZE - info->xmit_tail));
+		c = min(info->xmit_fifo_room, min(info->xmit_cnt, XMIT_BUF_SIZE - info->xmit_tail));
 		if (c <= 0 || info->xmit_fifo_room <= 0)
 			break;
 		sOutStrW(sGetTxRxDataIO(cp), (unsigned short *) (info->xmit_buf + info->xmit_tail), c / 2);
@@ -1661,7 +1661,7 @@
 	 *  into FIFO.  Use the write queue for temp storage.
          */
 	if (!tty->stopped && !tty->hw_stopped && info->xmit_cnt == 0 && info->xmit_fifo_room > 0) {
-		c = MIN(count, info->xmit_fifo_room);
+		c = min(count, info->xmit_fifo_room);
 		b = buf;
 		if (from_user) {
 			if (copy_from_user(info->xmit_buf, buf, c)) {
@@ -1671,7 +1671,7 @@
 			if (info->tty == 0)
 				goto end;
 			b = info->xmit_buf;
-			c = MIN(c, info->xmit_fifo_room);
+			c = min(c, info->xmit_fifo_room);
 		}
 
 		/*  Push data into FIFO, 2 bytes at a time */
@@ -1699,7 +1699,7 @@
 		if (info->tty == 0)	/*   Seemingly obligatory check... */
 			goto end;
 
-		c = MIN(count, MIN(XMIT_BUF_SIZE - info->xmit_cnt - 1, XMIT_BUF_SIZE - info->xmit_head));
+		c = min(count, min(XMIT_BUF_SIZE - info->xmit_cnt - 1, XMIT_BUF_SIZE - info->xmit_head));
 		if (c <= 0)
 			break;
 

[-- Attachment #3: Type: text/plain, Size: 167 bytes --]

_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Kernel-janitors] [PATCH] drivers/char/riscom8.c MIN/MAX removal
  2004-07-03 15:05 [Kernel-janitors] [PATCH] drivers/char/rocket_int.h MIN/MAX removal Michael Veeck
  2004-07-03 15:05 ` [Kernel-janitors] [PATCH] drivers/char/riscom8.c " Michael Veeck
  2004-07-03 15:07 ` [Kernel-janitors] [PATCH] drivers/char/rocket.c " Michael Veeck
@ 2004-07-12 15:32 ` Michael Veeck
  2 siblings, 0 replies; 4+ messages in thread
From: Michael Veeck @ 2004-07-12 15:32 UTC (permalink / raw)
  To: kernel-janitors

[-- Attachment #1: Type: text/plain, Size: 262 bytes --]

Sorry, one bug was in the last patch, so heres the new one, against 
2.6.8-rc1.

Michael Veeck schrieb:

> Patch (against 2.6.7) removes unnecessary min/max macros and changes
> calls to use kernel.h macros instead.
> 
> Feedback is always welcome
> Michael
> 


[-- Attachment #2: drivers-char-riscom8-minmax.patch --]
[-- Type: text/plain, Size: 2193 bytes --]

--- linux-2.6.8-rc1-old/drivers/char/riscom8.c	2004-07-04 11:04:14.000000000 +0200
+++ linux-2.6.8-rc1-new/drivers/char/riscom8.c	2004-07-12 17:22:47.988047720 +0200
@@ -75,10 +75,6 @@
 	 ASYNC_SPD_HI       | ASYNC_SPEED_VHI    | ASYNC_SESSION_LOCKOUT | \
 	 ASYNC_PGRP_LOCKOUT | ASYNC_CALLOUT_NOHUP)
 
-#ifndef MIN
-#define MIN(a,b) ((a) < (b) ? (a) : (b))
-#endif
-
 #define RS_EVENT_WRITE_WAKEUP	0
 
 static struct riscom_board * IRQ_to_board[16];
@@ -454,7 +450,6 @@ static inline void rc_transmit(struct ri
 	struct tty_struct *tty;
 	unsigned char count;
 	
-	
 	if (!(port = rc_get_port(bp, "Transmit")))
 		return;
 	
@@ -483,7 +478,7 @@ static inline void rc_transmit(struct ri
 				rc_out(bp, CD180_TDR, CD180_C_SBRK);
 				port->COR2 &= ~COR2_ETC;
 			}
-			count = MIN(port->break_length, 0xff);
+			count = min_t(unsigned char, port->break_length, 0xff);
 			rc_out(bp, CD180_TDR, CD180_C_ESC);
 			rc_out(bp, CD180_TDR, CD180_C_DELAY);
 			rc_out(bp, CD180_TDR, count);
@@ -1165,8 +1160,8 @@ static int rc_write(struct tty_struct * 
 		down(&tmp_buf_sem);
 		while (1) {
 			cli();		
-			c = MIN(count, MIN(SERIAL_XMIT_SIZE - port->xmit_cnt - 1,
-					   SERIAL_XMIT_SIZE - port->xmit_head));
+			c = min_t(int, count, min(SERIAL_XMIT_SIZE - port->xmit_cnt - 1,
+						  SERIAL_XMIT_SIZE - port->xmit_head));
 			if (c <= 0)
 				break;
 
@@ -1178,8 +1173,8 @@ static int rc_write(struct tty_struct * 
 			}
 
 			cli();
-			c = MIN(c, MIN(SERIAL_XMIT_SIZE - port->xmit_cnt - 1,
-				       SERIAL_XMIT_SIZE - port->xmit_head));
+			c = min_t(int, c, min(SERIAL_XMIT_SIZE - port->xmit_cnt - 1,
+					      SERIAL_XMIT_SIZE - port->xmit_head));
 			memcpy(port->xmit_buf + port->xmit_head, tmp_buf, c);
 			port->xmit_head = (port->xmit_head + c) & (SERIAL_XMIT_SIZE-1);
 			port->xmit_cnt += c;
@@ -1193,8 +1188,8 @@ static int rc_write(struct tty_struct * 
 	} else {
 		while (1) {
 			cli();		
-			c = MIN(count, MIN(SERIAL_XMIT_SIZE - port->xmit_cnt - 1,
-					   SERIAL_XMIT_SIZE - port->xmit_head));
+			c = min_t(int, count, min(SERIAL_XMIT_SIZE - port->xmit_cnt - 1,
+						  SERIAL_XMIT_SIZE - port->xmit_head));
 			if (c <= 0) {
 				restore_flags(flags);
 				break;

[-- Attachment #3: Type: text/plain, Size: 167 bytes --]

_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2004-07-12 15:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-07-03 15:05 [Kernel-janitors] [PATCH] drivers/char/rocket_int.h MIN/MAX removal Michael Veeck
2004-07-03 15:05 ` [Kernel-janitors] [PATCH] drivers/char/riscom8.c " Michael Veeck
2004-07-03 15:07 ` [Kernel-janitors] [PATCH] drivers/char/rocket.c " Michael Veeck
2004-07-12 15:32 ` [Kernel-janitors] [PATCH] drivers/char/riscom8.c " Michael Veeck

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.