aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/aic7xxx/aic7xxx_proc.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/aic7xxx/aic7xxx_proc.c')
-rw-r--r--drivers/scsi/aic7xxx/aic7xxx_proc.c31
1 files changed, 14 insertions, 17 deletions
diff --git a/drivers/scsi/aic7xxx/aic7xxx_proc.c b/drivers/scsi/aic7xxx/aic7xxx_proc.c
index 5fece859fbd9..ab4469d83fb1 100644
--- a/drivers/scsi/aic7xxx/aic7xxx_proc.c
+++ b/drivers/scsi/aic7xxx/aic7xxx_proc.c
@@ -50,7 +50,7 @@ static void ahc_dump_target_state(struct ahc_softc *ahc,
50 u_int our_id, char channel, 50 u_int our_id, char channel,
51 u_int target_id, u_int target_offset); 51 u_int target_id, u_int target_offset);
52static void ahc_dump_device_state(struct info_str *info, 52static void ahc_dump_device_state(struct info_str *info,
53 struct ahc_linux_device *dev); 53 struct scsi_device *dev);
54static int ahc_proc_write_seeprom(struct ahc_softc *ahc, 54static int ahc_proc_write_seeprom(struct ahc_softc *ahc,
55 char *buffer, int length); 55 char *buffer, int length);
56 56
@@ -142,6 +142,7 @@ ahc_dump_target_state(struct ahc_softc *ahc, struct info_str *info,
142 u_int target_offset) 142 u_int target_offset)
143{ 143{
144 struct ahc_linux_target *targ; 144 struct ahc_linux_target *targ;
145 struct scsi_target *starget;
145 struct ahc_initiator_tinfo *tinfo; 146 struct ahc_initiator_tinfo *tinfo;
146 struct ahc_tmode_tstate *tstate; 147 struct ahc_tmode_tstate *tstate;
147 int lun; 148 int lun;
@@ -153,7 +154,8 @@ ahc_dump_target_state(struct ahc_softc *ahc, struct info_str *info,
153 copy_info(info, "Target %d Negotiation Settings\n", target_id); 154 copy_info(info, "Target %d Negotiation Settings\n", target_id);
154 copy_info(info, "\tUser: "); 155 copy_info(info, "\tUser: ");
155 ahc_format_transinfo(info, &tinfo->user); 156 ahc_format_transinfo(info, &tinfo->user);
156 targ = ahc->platform_data->targets[target_offset]; 157 starget = ahc->platform_data->starget[target_offset];
158 targ = scsi_transport_target_data(starget);
157 if (targ == NULL) 159 if (targ == NULL)
158 return; 160 return;
159 161
@@ -163,22 +165,25 @@ ahc_dump_target_state(struct ahc_softc *ahc, struct info_str *info,
163 ahc_format_transinfo(info, &tinfo->curr); 165 ahc_format_transinfo(info, &tinfo->curr);
164 166
165 for (lun = 0; lun < AHC_NUM_LUNS; lun++) { 167 for (lun = 0; lun < AHC_NUM_LUNS; lun++) {
166 struct ahc_linux_device *dev; 168 struct scsi_device *sdev;
167 169
168 dev = targ->devices[lun]; 170 sdev = targ->sdev[lun];
169 171
170 if (dev == NULL) 172 if (sdev == NULL)
171 continue; 173 continue;
172 174
173 ahc_dump_device_state(info, dev); 175 ahc_dump_device_state(info, sdev);
174 } 176 }
175} 177}
176 178
177static void 179static void
178ahc_dump_device_state(struct info_str *info, struct ahc_linux_device *dev) 180ahc_dump_device_state(struct info_str *info, struct scsi_device *sdev)
179{ 181{
182 struct ahc_linux_device *dev = scsi_transport_device_data(sdev);
183
180 copy_info(info, "\tChannel %c Target %d Lun %d Settings\n", 184 copy_info(info, "\tChannel %c Target %d Lun %d Settings\n",
181 dev->target->channel + 'A', dev->target->target, dev->lun); 185 sdev->sdev_target->channel + 'A',
186 sdev->sdev_target->id, sdev->lun);
182 187
183 copy_info(info, "\t\tCommands Queued %ld\n", dev->commands_issued); 188 copy_info(info, "\t\tCommands Queued %ld\n", dev->commands_issued);
184 copy_info(info, "\t\tCommands Active %d\n", dev->active); 189 copy_info(info, "\t\tCommands Active %d\n", dev->active);
@@ -292,20 +297,13 @@ int
292ahc_linux_proc_info(struct Scsi_Host *shost, char *buffer, char **start, 297ahc_linux_proc_info(struct Scsi_Host *shost, char *buffer, char **start,
293 off_t offset, int length, int inout) 298 off_t offset, int length, int inout)
294{ 299{
295 struct ahc_softc *ahc; 300 struct ahc_softc *ahc = *(struct ahc_softc **)shost->hostdata;
296 struct info_str info; 301 struct info_str info;
297 char ahc_info[256]; 302 char ahc_info[256];
298 u_long s;
299 u_int max_targ; 303 u_int max_targ;
300 u_int i; 304 u_int i;
301 int retval; 305 int retval;
302 306
303 retval = -EINVAL;
304 ahc_list_lock(&s);
305 ahc = ahc_find_softc(*(struct ahc_softc **)shost->hostdata);
306 if (ahc == NULL)
307 goto done;
308
309 /* Has data been written to the file? */ 307 /* Has data been written to the file? */
310 if (inout == TRUE) { 308 if (inout == TRUE) {
311 retval = ahc_proc_write_seeprom(ahc, buffer, length); 309 retval = ahc_proc_write_seeprom(ahc, buffer, length);
@@ -367,6 +365,5 @@ ahc_linux_proc_info(struct Scsi_Host *shost, char *buffer, char **start,
367 } 365 }
368 retval = info.pos > info.offset ? info.pos - info.offset : 0; 366 retval = info.pos > info.offset ? info.pos - info.offset : 0;
369done: 367done:
370 ahc_list_unlock(&s);
371 return (retval); 368 return (retval);
372} 369}