diff options
author | Matthew Wilcox <matthew@wil.cx> | 2007-07-26 11:00:51 -0400 |
---|---|---|
committer | James Bottomley <jejb@mulgrave.localdomain> | 2007-10-12 14:38:37 -0400 |
commit | 2a437959e963d98e04dbbcd26b69bfb1985567ce (patch) | |
tree | 3e22b7da80b554948a935bc43337d8b273e12c5c /drivers | |
parent | 8c6af9e174abdf40c30a4a229bbd11b458869f97 (diff) |
[SCSI] advansys: Clean up proc_info implementation
Just use the Scsi_Host passed in, rather than looking through the driver's
own array of boards for one that matches it.
Signed-off-by: Matthew Wilcox <matthew@wil.cx>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/scsi/advansys.c | 36 |
1 files changed, 12 insertions, 24 deletions
diff --git a/drivers/scsi/advansys.c b/drivers/scsi/advansys.c index 8ace30ed4186..6d11076bbd02 100644 --- a/drivers/scsi/advansys.c +++ b/drivers/scsi/advansys.c | |||
@@ -4031,9 +4031,7 @@ static int | |||
4031 | advansys_proc_info(struct Scsi_Host *shost, char *buffer, char **start, | 4031 | advansys_proc_info(struct Scsi_Host *shost, char *buffer, char **start, |
4032 | off_t offset, int length, int inout) | 4032 | off_t offset, int length, int inout) |
4033 | { | 4033 | { |
4034 | struct Scsi_Host *shp; | ||
4035 | asc_board_t *boardp; | 4034 | asc_board_t *boardp; |
4036 | int i; | ||
4037 | char *cp; | 4035 | char *cp; |
4038 | int cplen; | 4036 | int cplen; |
4039 | int cnt; | 4037 | int cnt; |
@@ -4058,18 +4056,7 @@ advansys_proc_info(struct Scsi_Host *shost, char *buffer, char **start, | |||
4058 | * User read of /proc/scsi/advansys/[0...] file. | 4056 | * User read of /proc/scsi/advansys/[0...] file. |
4059 | */ | 4057 | */ |
4060 | 4058 | ||
4061 | /* Find the specified board. */ | 4059 | boardp = ASC_BOARDP(shost); |
4062 | for (i = 0; i < asc_board_count; i++) { | ||
4063 | if (asc_host[i]->host_no == shost->host_no) { | ||
4064 | break; | ||
4065 | } | ||
4066 | } | ||
4067 | if (i == asc_board_count) { | ||
4068 | return (-ENOENT); | ||
4069 | } | ||
4070 | |||
4071 | shp = asc_host[i]; | ||
4072 | boardp = ASC_BOARDP(shp); | ||
4073 | 4060 | ||
4074 | /* Copy read data starting at the beginning of the buffer. */ | 4061 | /* Copy read data starting at the beginning of the buffer. */ |
4075 | *start = buffer; | 4062 | *start = buffer; |
@@ -4083,7 +4070,7 @@ advansys_proc_info(struct Scsi_Host *shost, char *buffer, char **start, | |||
4083 | * | 4070 | * |
4084 | * advansys_info() returns the board string from its own static buffer. | 4071 | * advansys_info() returns the board string from its own static buffer. |
4085 | */ | 4072 | */ |
4086 | cp = (char *)advansys_info(shp); | 4073 | cp = (char *)advansys_info(shost); |
4087 | strcat(cp, "\n"); | 4074 | strcat(cp, "\n"); |
4088 | cplen = strlen(cp); | 4075 | cplen = strlen(cp); |
4089 | /* Copy board information. */ | 4076 | /* Copy board information. */ |
@@ -4102,7 +4089,7 @@ advansys_proc_info(struct Scsi_Host *shost, char *buffer, char **start, | |||
4102 | */ | 4089 | */ |
4103 | if (ASC_WIDE_BOARD(boardp)) { | 4090 | if (ASC_WIDE_BOARD(boardp)) { |
4104 | cp = boardp->prtbuf; | 4091 | cp = boardp->prtbuf; |
4105 | cplen = asc_prt_adv_bios(shp, cp, ASC_PRTBUF_SIZE); | 4092 | cplen = asc_prt_adv_bios(shost, cp, ASC_PRTBUF_SIZE); |
4106 | ASC_ASSERT(cplen < ASC_PRTBUF_SIZE); | 4093 | ASC_ASSERT(cplen < ASC_PRTBUF_SIZE); |
4107 | cnt = | 4094 | cnt = |
4108 | asc_proc_copy(advoffset, offset, curbuf, leftlen, cp, | 4095 | asc_proc_copy(advoffset, offset, curbuf, leftlen, cp, |
@@ -4121,7 +4108,7 @@ advansys_proc_info(struct Scsi_Host *shost, char *buffer, char **start, | |||
4121 | * Display driver information for each device attached to the board. | 4108 | * Display driver information for each device attached to the board. |
4122 | */ | 4109 | */ |
4123 | cp = boardp->prtbuf; | 4110 | cp = boardp->prtbuf; |
4124 | cplen = asc_prt_board_devices(shp, cp, ASC_PRTBUF_SIZE); | 4111 | cplen = asc_prt_board_devices(shost, cp, ASC_PRTBUF_SIZE); |
4125 | ASC_ASSERT(cplen < ASC_PRTBUF_SIZE); | 4112 | ASC_ASSERT(cplen < ASC_PRTBUF_SIZE); |
4126 | cnt = asc_proc_copy(advoffset, offset, curbuf, leftlen, cp, cplen); | 4113 | cnt = asc_proc_copy(advoffset, offset, curbuf, leftlen, cp, cplen); |
4127 | totcnt += cnt; | 4114 | totcnt += cnt; |
@@ -4138,9 +4125,9 @@ advansys_proc_info(struct Scsi_Host *shost, char *buffer, char **start, | |||
4138 | */ | 4125 | */ |
4139 | cp = boardp->prtbuf; | 4126 | cp = boardp->prtbuf; |
4140 | if (ASC_NARROW_BOARD(boardp)) { | 4127 | if (ASC_NARROW_BOARD(boardp)) { |
4141 | cplen = asc_prt_asc_board_eeprom(shp, cp, ASC_PRTBUF_SIZE); | 4128 | cplen = asc_prt_asc_board_eeprom(shost, cp, ASC_PRTBUF_SIZE); |
4142 | } else { | 4129 | } else { |
4143 | cplen = asc_prt_adv_board_eeprom(shp, cp, ASC_PRTBUF_SIZE); | 4130 | cplen = asc_prt_adv_board_eeprom(shost, cp, ASC_PRTBUF_SIZE); |
4144 | } | 4131 | } |
4145 | ASC_ASSERT(cplen < ASC_PRTBUF_SIZE); | 4132 | ASC_ASSERT(cplen < ASC_PRTBUF_SIZE); |
4146 | cnt = asc_proc_copy(advoffset, offset, curbuf, leftlen, cp, cplen); | 4133 | cnt = asc_proc_copy(advoffset, offset, curbuf, leftlen, cp, cplen); |
@@ -4157,7 +4144,7 @@ advansys_proc_info(struct Scsi_Host *shost, char *buffer, char **start, | |||
4157 | * Display driver configuration and information for the board. | 4144 | * Display driver configuration and information for the board. |
4158 | */ | 4145 | */ |
4159 | cp = boardp->prtbuf; | 4146 | cp = boardp->prtbuf; |
4160 | cplen = asc_prt_driver_conf(shp, cp, ASC_PRTBUF_SIZE); | 4147 | cplen = asc_prt_driver_conf(shost, cp, ASC_PRTBUF_SIZE); |
4161 | ASC_ASSERT(cplen < ASC_PRTBUF_SIZE); | 4148 | ASC_ASSERT(cplen < ASC_PRTBUF_SIZE); |
4162 | cnt = asc_proc_copy(advoffset, offset, curbuf, leftlen, cp, cplen); | 4149 | cnt = asc_proc_copy(advoffset, offset, curbuf, leftlen, cp, cplen); |
4163 | totcnt += cnt; | 4150 | totcnt += cnt; |
@@ -4174,7 +4161,7 @@ advansys_proc_info(struct Scsi_Host *shost, char *buffer, char **start, | |||
4174 | * Display driver statistics for the board. | 4161 | * Display driver statistics for the board. |
4175 | */ | 4162 | */ |
4176 | cp = boardp->prtbuf; | 4163 | cp = boardp->prtbuf; |
4177 | cplen = asc_prt_board_stats(shp, cp, ASC_PRTBUF_SIZE); | 4164 | cplen = asc_prt_board_stats(shost, cp, ASC_PRTBUF_SIZE); |
4178 | ASC_ASSERT(cplen <= ASC_PRTBUF_SIZE); | 4165 | ASC_ASSERT(cplen <= ASC_PRTBUF_SIZE); |
4179 | cnt = asc_proc_copy(advoffset, offset, curbuf, leftlen, cp, cplen); | 4166 | cnt = asc_proc_copy(advoffset, offset, curbuf, leftlen, cp, cplen); |
4180 | totcnt += cnt; | 4167 | totcnt += cnt; |
@@ -4191,7 +4178,8 @@ advansys_proc_info(struct Scsi_Host *shost, char *buffer, char **start, | |||
4191 | */ | 4178 | */ |
4192 | for (tgt_id = 0; tgt_id <= ADV_MAX_TID; tgt_id++) { | 4179 | for (tgt_id = 0; tgt_id <= ADV_MAX_TID; tgt_id++) { |
4193 | cp = boardp->prtbuf; | 4180 | cp = boardp->prtbuf; |
4194 | cplen = asc_prt_target_stats(shp, tgt_id, cp, ASC_PRTBUF_SIZE); | 4181 | cplen = asc_prt_target_stats(shost, tgt_id, cp, |
4182 | ASC_PRTBUF_SIZE); | ||
4195 | ASC_ASSERT(cplen <= ASC_PRTBUF_SIZE); | 4183 | ASC_ASSERT(cplen <= ASC_PRTBUF_SIZE); |
4196 | cnt = | 4184 | cnt = |
4197 | asc_proc_copy(advoffset, offset, curbuf, leftlen, cp, | 4185 | asc_proc_copy(advoffset, offset, curbuf, leftlen, cp, |
@@ -4213,9 +4201,9 @@ advansys_proc_info(struct Scsi_Host *shost, char *buffer, char **start, | |||
4213 | */ | 4201 | */ |
4214 | cp = boardp->prtbuf; | 4202 | cp = boardp->prtbuf; |
4215 | if (ASC_NARROW_BOARD(boardp)) { | 4203 | if (ASC_NARROW_BOARD(boardp)) { |
4216 | cplen = asc_prt_asc_board_info(shp, cp, ASC_PRTBUF_SIZE); | 4204 | cplen = asc_prt_asc_board_info(shost, cp, ASC_PRTBUF_SIZE); |
4217 | } else { | 4205 | } else { |
4218 | cplen = asc_prt_adv_board_info(shp, cp, ASC_PRTBUF_SIZE); | 4206 | cplen = asc_prt_adv_board_info(shost, cp, ASC_PRTBUF_SIZE); |
4219 | } | 4207 | } |
4220 | ASC_ASSERT(cplen < ASC_PRTBUF_SIZE); | 4208 | ASC_ASSERT(cplen < ASC_PRTBUF_SIZE); |
4221 | cnt = asc_proc_copy(advoffset, offset, curbuf, leftlen, cp, cplen); | 4209 | cnt = asc_proc_copy(advoffset, offset, curbuf, leftlen, cp, cplen); |