All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michael Veeck <michael.veeck@gmx.net>
To: kernel-janitors@vger.kernel.org
Subject: [Kernel-janitors] [PATCH] drivers/scsi/nsp MIN/MAX/NUMBER removal
Date: Thu, 22 Apr 2004 22:15:21 +0000	[thread overview]
Message-ID: <408843F9.30108@gmx.net> (raw)

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

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

Feedback is always welcome
Michael


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

diff -Nau linux-2.6.5.org/drivers/scsi/nsp32.c linux-2.6.5.new/drivers/scsi/nsp32.c
--- linux-2.6.5.org/drivers/scsi/nsp32.c	2004-04-04 05:36:56.000000000 +0200
+++ linux-2.6.5.new/drivers/scsi/nsp32.c	2004-04-07 00:25:29.424100712 +0200
@@ -859,7 +859,7 @@
 	 * or current nexus is not existed, unexpected
 	 * reselection is occurred. Send reject message.
 	 */
-	if (newid >= NUMBER(data->lunt) || newlun >= NUMBER(data->lunt[0])) {
+	if (newid >= ARRAY_SIZE(data->lunt) || newlun >= ARRAY_SIZE(data->lunt[0])) {
 		nsp32_msg(KERN_WARNING, "unknown id/lun");
 		return FALSE;
 	} else if(data->lunt[newid][newlun].SCpnt == NULL) {
@@ -1568,7 +1568,7 @@
 
 
 	SPRINTF("SDTR status\n");
-	for(id = 0; id < NUMBER(data->target); id++) {
+	for (id = 0; id < ARRAY_SIZE(data->target); id++) {
 
                 SPRINTF("id %d: ", id);
 
@@ -1610,7 +1610,7 @@
         }
 
 
-	thislength = MIN(thislength, length);
+	thislength = min(thislength, length);
 	*start = buffer + offset;
 
 	return thislength;
@@ -2753,17 +2753,17 @@
 	case CLOCK_4:
 		/* If data->clock is CLOCK_4, then select 40M sync table. */
 		data->synct   = nsp32_sync_table_40M;
-		data->syncnum = NUMBER(nsp32_sync_table_40M);
+		data->syncnum = ARRAY_SIZE(nsp32_sync_table_40M);
 		break;
 	case CLOCK_2:
 		/* If data->clock is CLOCK_2, then select 20M sync table. */
 		data->synct   = nsp32_sync_table_20M;
-		data->syncnum = NUMBER(nsp32_sync_table_20M);
+		data->syncnum = ARRAY_SIZE(nsp32_sync_table_20M);
 		break;
 	case PCICLK:
 		/* If data->clock is PCICLK, then select pci sync table. */
 		data->synct   = nsp32_sync_table_pci;
-		data->syncnum = NUMBER(nsp32_sync_table_pci);
+		data->syncnum = ARRAY_SIZE(nsp32_sync_table_pci);
 		break;
 	default:
 		nsp32_msg(KERN_WARNING,
@@ -2771,7 +2771,7 @@
 		/* Use default value CLOCK_4 */
 		data->clock   = CLOCK_4;
 		data->synct   = nsp32_sync_table_40M;
-		data->syncnum = NUMBER(nsp32_sync_table_40M);
+		data->syncnum = ARRAY_SIZE(nsp32_sync_table_40M);
 	}
 
 	/*
@@ -2805,9 +2805,9 @@
 		goto free_autoparam;
 	}
 
-	for (i = 0; i < NUMBER(data->lunt); i++) {
-		for (j = 0; j < NUMBER(data->lunt[0]); j++) {
-			int offset = i * NUMBER(data->lunt[0]) + j;
+	for (i = 0; i < ARRAY_SIZE(data->lunt); i++) {
+		for (j = 0; j < ARRAY_SIZE(data->lunt[0]); j++) {
+			int offset = i * ARRAY_SIZE(data->lunt[0]) + j;
 			nsp32_lunt tmp = {
 				.SCpnt       = NULL,
 				.save_datp   = 0,
@@ -2825,7 +2825,7 @@
 	/*
 	 * setup target
 	 */
-	for (i = 0; i < NUMBER(data->target); i++) {
+	for (i = 0; i < ARRAY_SIZE(data->target); i++) {
 		nsp32_target *target = &(data->target[i]);
 
 		target->limit_entry  = 0;
@@ -3021,7 +3021,7 @@
 	 * fall back to asynchronous transfer mode
 	 * initialize SDTR negotiation flag
 	 */
-	for (i = 0; i < NUMBER(data->target); i++) {
+	for (i = 0; i < ARRAY_SIZE(data->target); i++) {
 		nsp32_target *target = &data->target[i];
 
 		target->sync_flag = 0;
diff -Nau linux-2.6.5.org/drivers/scsi/nsp32.h linux-2.6.5.new/drivers/scsi/nsp32.h
--- linux-2.6.5.org/drivers/scsi/nsp32.h	2004-04-04 05:36:11.000000000 +0200
+++ linux-2.6.5.new/drivers/scsi/nsp32.h	2004-04-07 00:26:09.976935744 +0200
@@ -70,11 +70,7 @@
 /*
  * MACRO
  */
-#define NUMBER(arr) ((int) (sizeof(arr) / sizeof(arr[0])))
 #define BIT(x)      (1UL << (x))
-#ifndef MIN
-# define MIN(a,b)   ((a) > (b) ? (b) : (a))
-#endif
 
 /*
  * BASIC Definitions

[-- 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

                 reply	other threads:[~2004-04-22 22:15 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=408843F9.30108@gmx.net \
    --to=michael.veeck@gmx.net \
    --cc=kernel-janitors@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.