Commit 746ffb12 authored by Randy Dunlap's avatar Randy Dunlap Committed by James Bottomley

[PATCH] (4/5) nsp32 (ninja): use kernel.h min/max/ARRAY_SIZE

From: Michael Veeck <michael.veeck@gmx.net>
Subject: [Kernel-janitors] [PATCH] drivers/scsi/nsp MIN/MAX/NUMBER removal

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


 drivers/scsi/nsp32.c |   24 ++++++++++++------------
 drivers/scsi/nsp32.h |    4 ----
 2 files changed, 12 insertions(+), 16 deletions(-)
parent 6235d0b5
...@@ -859,7 +859,7 @@ static int nsp32_reselection(Scsi_Cmnd *SCpnt, unsigned char newlun) ...@@ -859,7 +859,7 @@ static int nsp32_reselection(Scsi_Cmnd *SCpnt, unsigned char newlun)
* or current nexus is not existed, unexpected * or current nexus is not existed, unexpected
* reselection is occurred. Send reject message. * 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"); nsp32_msg(KERN_WARNING, "unknown id/lun");
return FALSE; return FALSE;
} else if(data->lunt[newid][newlun].SCpnt == NULL) { } else if(data->lunt[newid][newlun].SCpnt == NULL) {
...@@ -1568,7 +1568,7 @@ static int nsp32_proc_info( ...@@ -1568,7 +1568,7 @@ static int nsp32_proc_info(
SPRINTF("SDTR status\n"); 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); SPRINTF("id %d: ", id);
...@@ -1610,7 +1610,7 @@ static int nsp32_proc_info( ...@@ -1610,7 +1610,7 @@ static int nsp32_proc_info(
} }
thislength = MIN(thislength, length); thislength = min(thislength, length);
*start = buffer + offset; *start = buffer + offset;
return thislength; return thislength;
...@@ -2753,17 +2753,17 @@ static int nsp32_detect(Scsi_Host_Template *sht) ...@@ -2753,17 +2753,17 @@ static int nsp32_detect(Scsi_Host_Template *sht)
case CLOCK_4: case CLOCK_4:
/* If data->clock is CLOCK_4, then select 40M sync table. */ /* If data->clock is CLOCK_4, then select 40M sync table. */
data->synct = nsp32_sync_table_40M; data->synct = nsp32_sync_table_40M;
data->syncnum = NUMBER(nsp32_sync_table_40M); data->syncnum = ARRAY_SIZE(nsp32_sync_table_40M);
break; break;
case CLOCK_2: case CLOCK_2:
/* If data->clock is CLOCK_2, then select 20M sync table. */ /* If data->clock is CLOCK_2, then select 20M sync table. */
data->synct = nsp32_sync_table_20M; data->synct = nsp32_sync_table_20M;
data->syncnum = NUMBER(nsp32_sync_table_20M); data->syncnum = ARRAY_SIZE(nsp32_sync_table_20M);
break; break;
case PCICLK: case PCICLK:
/* If data->clock is PCICLK, then select pci sync table. */ /* If data->clock is PCICLK, then select pci sync table. */
data->synct = nsp32_sync_table_pci; data->synct = nsp32_sync_table_pci;
data->syncnum = NUMBER(nsp32_sync_table_pci); data->syncnum = ARRAY_SIZE(nsp32_sync_table_pci);
break; break;
default: default:
nsp32_msg(KERN_WARNING, nsp32_msg(KERN_WARNING,
...@@ -2771,7 +2771,7 @@ static int nsp32_detect(Scsi_Host_Template *sht) ...@@ -2771,7 +2771,7 @@ static int nsp32_detect(Scsi_Host_Template *sht)
/* Use default value CLOCK_4 */ /* Use default value CLOCK_4 */
data->clock = CLOCK_4; data->clock = CLOCK_4;
data->synct = nsp32_sync_table_40M; 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 @@ static int nsp32_detect(Scsi_Host_Template *sht) ...@@ -2805,9 +2805,9 @@ static int nsp32_detect(Scsi_Host_Template *sht)
goto free_autoparam; goto free_autoparam;
} }
for (i = 0; i < NUMBER(data->lunt); i++) { for (i = 0; i < ARRAY_SIZE(data->lunt); i++) {
for (j = 0; j < NUMBER(data->lunt[0]); j++) { for (j = 0; j < ARRAY_SIZE(data->lunt[0]); j++) {
int offset = i * NUMBER(data->lunt[0]) + j; int offset = i * ARRAY_SIZE(data->lunt[0]) + j;
nsp32_lunt tmp = { nsp32_lunt tmp = {
.SCpnt = NULL, .SCpnt = NULL,
.save_datp = 0, .save_datp = 0,
...@@ -2825,7 +2825,7 @@ static int nsp32_detect(Scsi_Host_Template *sht) ...@@ -2825,7 +2825,7 @@ static int nsp32_detect(Scsi_Host_Template *sht)
/* /*
* setup target * 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]); nsp32_target *target = &(data->target[i]);
target->limit_entry = 0; target->limit_entry = 0;
...@@ -3021,7 +3021,7 @@ static void nsp32_do_bus_reset(nsp32_hw_data *data) ...@@ -3021,7 +3021,7 @@ static void nsp32_do_bus_reset(nsp32_hw_data *data)
* fall back to asynchronous transfer mode * fall back to asynchronous transfer mode
* initialize SDTR negotiation flag * 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]; nsp32_target *target = &data->target[i];
target->sync_flag = 0; target->sync_flag = 0;
......
...@@ -70,11 +70,7 @@ typedef u16 u16_le; ...@@ -70,11 +70,7 @@ typedef u16 u16_le;
/* /*
* MACRO * MACRO
*/ */
#define NUMBER(arr) ((int) (sizeof(arr) / sizeof(arr[0])))
#define BIT(x) (1UL << (x)) #define BIT(x) (1UL << (x))
#ifndef MIN
# define MIN(a,b) ((a) > (b) ? (b) : (a))
#endif
/* /*
* BASIC Definitions * BASIC Definitions
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment