All of lore.kernel.org
 help / color / mirror / Atom feed
* [Kernel-janitors] [PATCH] drivers/scsi/53c* MIN/MAX removal
@ 2004-04-22 22:16 Michael Veeck
  2004-04-23  8:00 ` Michael Veeck
  2004-04-23 15:02 ` Randy.Dunlap
  0 siblings, 2 replies; 3+ messages in thread
From: Michael Veeck @ 2004-04-22 22:16 UTC (permalink / raw)
  To: kernel-janitors

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

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

Feedback is always welcome
Michael



[-- Attachment #2: minmax_drivers_scsi_53c.patch --]
[-- Type: text/plain, Size: 2145 bytes --]

diff -Naur -X dontdiff-osdl linux-2.6.5.org/drivers/scsi/ncr53c8xx.c linux-2.6.5.new/drivers/scsi/ncr53c8xx.c
--- linux-2.6.5.org/drivers/scsi/ncr53c8xx.c	2004-04-04 05:36:54.000000000 +0200
+++ linux-2.6.5.new/drivers/scsi/ncr53c8xx.c	2004-04-22 21:04:48.361876800 +0200
@@ -307,7 +307,7 @@
 **    The maximum number of segments a transfer is split into.
 **    We support up to 127 segments for both read and write.
 **    The data scripts are broken into 2 sub-scripts.
-**    80 (MAX_SCATTERL) segments are moved from a sub-script 
+**    80 (MAX_SCATTERL) segments are moved from a sub-script
 **    in on-chip RAM. This makes data transfers shorter than 
 **    80k (assuming 1k fs) as fast as possible.
 */
@@ -4542,7 +4542,7 @@
 	/*
 	**	command
 	*/
-	memcpy(cp->cdb_buf, cmd->cmnd, MIN(cmd->cmd_len, sizeof(cp->cdb_buf)));
+	memcpy(cp->cdb_buf, cmd->cmnd, min_t(int, cmd->cmd_len, sizeof(cp->cdb_buf)));
 	cp->phys.cmd.addr		= cpu_to_scr(CCB_PHYS (cp, cdb_buf[0]));
 	cp->phys.cmd.size		= cpu_to_scr(cmd->cmd_len);
 
@@ -5172,7 +5172,7 @@
 		**	Copy back sense data to caller's buffer.
 		*/
 		memcpy(cmd->sense_buffer, cp->sense_buf,
-		       MIN(sizeof(cmd->sense_buffer), sizeof(cp->sense_buf)));
+		       min(sizeof(cmd->sense_buffer), sizeof(cp->sense_buf)));
 
 		if (DEBUG_FLAGS & (DEBUG_RESULT|DEBUG_TINY)) {
 			u_char * p = (u_char*) & cmd->sense_buffer;
diff -Naur -X dontdiff-osdl linux-2.6.5.org/drivers/scsi/sym53c8xx_comm.h linux-2.6.5.new/drivers/scsi/sym53c8xx_comm.h
--- linux-2.6.5.org/drivers/scsi/sym53c8xx_comm.h	2004-04-04 05:37:23.000000000 +0200
+++ linux-2.6.5.new/drivers/scsi/sym53c8xx_comm.h	2004-04-22 20:59:23.180311912 +0200
@@ -59,12 +59,9 @@
 **	sym53c8xx and ncr53c8xx drivers should share.
 **	The sharing will be achieved in a further version  
 **	of the driver bundle. For now, only the ncr53c8xx 
-**	driver includes	this file.
+**	driver includes this file.
 */
 
-#define MIN(a,b)        (((a) < (b)) ? (a) : (b))
-#define MAX(a,b)        (((a) > (b)) ? (a) : (b))
-
 /*==========================================================
 **
 **	Hmmm... What complex some PCI-HOST bridges actually 

[-- 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] 3+ messages in thread

* Re: [Kernel-janitors] [PATCH] drivers/scsi/53c* MIN/MAX removal
  2004-04-22 22:16 [Kernel-janitors] [PATCH] drivers/scsi/53c* MIN/MAX removal Michael Veeck
@ 2004-04-23  8:00 ` Michael Veeck
  2004-04-23 15:02 ` Randy.Dunlap
  1 sibling, 0 replies; 3+ messages in thread
From: Michael Veeck @ 2004-04-23  8:00 UTC (permalink / raw)
  To: kernel-janitors

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

Oops, those patches were against RC-2, not RC-1 of course.

Michael Veeck wrote:

> Patch (against 2.6.6-rc1) removes unnecessary min/max macros and changes
> calls to use kernel.h macros instead.
> 
> Feedback is always welcome
> Michael
> 
> 
> 
> ------------------------------------------------------------------------
> 
> diff -Naur -X dontdiff-osdl linux-2.6.5.org/drivers/scsi/ncr53c8xx.c linux-2.6.5.new/drivers/scsi/ncr53c8xx.c
> --- linux-2.6.5.org/drivers/scsi/ncr53c8xx.c	2004-04-04 05:36:54.000000000 +0200
> +++ linux-2.6.5.new/drivers/scsi/ncr53c8xx.c	2004-04-22 21:04:48.361876800 +0200
> @@ -307,7 +307,7 @@
>  **    The maximum number of segments a transfer is split into.
>  **    We support up to 127 segments for both read and write.
>  **    The data scripts are broken into 2 sub-scripts.
> -**    80 (MAX_SCATTERL) segments are moved from a sub-script 
> +**    80 (MAX_SCATTERL) segments are moved from a sub-script
>  **    in on-chip RAM. This makes data transfers shorter than 
>  **    80k (assuming 1k fs) as fast as possible.
>  */
> @@ -4542,7 +4542,7 @@
>  	/*
>  	**	command
>  	*/
> -	memcpy(cp->cdb_buf, cmd->cmnd, MIN(cmd->cmd_len, sizeof(cp->cdb_buf)));
> +	memcpy(cp->cdb_buf, cmd->cmnd, min_t(int, cmd->cmd_len, sizeof(cp->cdb_buf)));
>  	cp->phys.cmd.addr		= cpu_to_scr(CCB_PHYS (cp, cdb_buf[0]));
>  	cp->phys.cmd.size		= cpu_to_scr(cmd->cmd_len);
>  
> @@ -5172,7 +5172,7 @@
>  		**	Copy back sense data to caller's buffer.
>  		*/
>  		memcpy(cmd->sense_buffer, cp->sense_buf,
> -		       MIN(sizeof(cmd->sense_buffer), sizeof(cp->sense_buf)));
> +		       min(sizeof(cmd->sense_buffer), sizeof(cp->sense_buf)));
>  
>  		if (DEBUG_FLAGS & (DEBUG_RESULT|DEBUG_TINY)) {
>  			u_char * p = (u_char*) & cmd->sense_buffer;
> diff -Naur -X dontdiff-osdl linux-2.6.5.org/drivers/scsi/sym53c8xx_comm.h linux-2.6.5.new/drivers/scsi/sym53c8xx_comm.h
> --- linux-2.6.5.org/drivers/scsi/sym53c8xx_comm.h	2004-04-04 05:37:23.000000000 +0200
> +++ linux-2.6.5.new/drivers/scsi/sym53c8xx_comm.h	2004-04-22 20:59:23.180311912 +0200
> @@ -59,12 +59,9 @@
>  **	sym53c8xx and ncr53c8xx drivers should share.
>  **	The sharing will be achieved in a further version  
>  **	of the driver bundle. For now, only the ncr53c8xx 
> -**	driver includes	this file.
> +**	driver includes this file.
>  */
>  
> -#define MIN(a,b)        (((a) < (b)) ? (a) : (b))
> -#define MAX(a,b)        (((a) > (b)) ? (a) : (b))
> -
>  /*==========================================================
>  **
>  **	Hmmm... What complex some PCI-HOST bridges actually 
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Kernel-janitors mailing list
> Kernel-janitors@lists.osdl.org
> http://lists.osdl.org/mailman/listinfo/kernel-janitors

[-- Attachment #2: 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] 3+ messages in thread

* Re: [Kernel-janitors] [PATCH] drivers/scsi/53c* MIN/MAX removal
  2004-04-22 22:16 [Kernel-janitors] [PATCH] drivers/scsi/53c* MIN/MAX removal Michael Veeck
  2004-04-23  8:00 ` Michael Veeck
@ 2004-04-23 15:02 ` Randy.Dunlap
  1 sibling, 0 replies; 3+ messages in thread
From: Randy.Dunlap @ 2004-04-23 15:02 UTC (permalink / raw)
  To: kernel-janitors

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

On Fri, 23 Apr 2004 10:00:22 +0200 Michael Veeck wrote:

| Oops, those patches were against RC-2, not RC-1 of course.

Yes, I've applied them to -rc2.

--
~Randy

[-- Attachment #2: 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] 3+ messages in thread

end of thread, other threads:[~2004-04-23 15:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-04-22 22:16 [Kernel-janitors] [PATCH] drivers/scsi/53c* MIN/MAX removal Michael Veeck
2004-04-23  8:00 ` Michael Veeck
2004-04-23 15:02 ` Randy.Dunlap

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.