aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/aic7xxx
diff options
context:
space:
mode:
authorHannes Reinecke <hare@suse.de>2006-10-23 09:25:36 -0400
committerJames Bottomley <jejb@mulgrave.il.steeleye.com>2006-10-25 18:14:46 -0400
commit9080063f523b09af63234a21816c825133d48c44 (patch)
treebd4256a6e8e800950b9dc9eed82d7a29fad98b03 /drivers/scsi/aic7xxx
parent843822ad631889596d67716e6edbcde608aeba81 (diff)
[SCSI] aic7xxx: Remove slave_destroy
This is a cross-port from aic79xx; we still hit the occasional BUG_ON in slave_destroy. And again we don't really need the slave_destroy callback nor the ahc_linux_target structure at all. Signed-off-by: Hannes Reinecke <hare@suse.de> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/scsi/aic7xxx')
-rw-r--r--drivers/scsi/aic7xxx/aic7xxx.h1
-rw-r--r--drivers/scsi/aic7xxx/aic7xxx_core.c22
-rw-r--r--drivers/scsi/aic7xxx/aic7xxx_osm.c65
-rw-r--r--drivers/scsi/aic7xxx/aic7xxx_osm.h11
-rw-r--r--drivers/scsi/aic7xxx/aic7xxx_proc.c10
5 files changed, 31 insertions, 78 deletions
diff --git a/drivers/scsi/aic7xxx/aic7xxx.h b/drivers/scsi/aic7xxx/aic7xxx.h
index 5802f33324ce..954c7c24501d 100644
--- a/drivers/scsi/aic7xxx/aic7xxx.h
+++ b/drivers/scsi/aic7xxx/aic7xxx.h
@@ -1279,6 +1279,7 @@ typedef enum {
1279} ahc_queue_alg; 1279} ahc_queue_alg;
1280 1280
1281void ahc_set_tags(struct ahc_softc *ahc, 1281void ahc_set_tags(struct ahc_softc *ahc,
1282 struct scsi_cmnd *cmd,
1282 struct ahc_devinfo *devinfo, 1283 struct ahc_devinfo *devinfo,
1283 ahc_queue_alg alg); 1284 ahc_queue_alg alg);
1284 1285
diff --git a/drivers/scsi/aic7xxx/aic7xxx_core.c b/drivers/scsi/aic7xxx/aic7xxx_core.c
index 46bd7bc2fa4d..50ef785224de 100644
--- a/drivers/scsi/aic7xxx/aic7xxx_core.c
+++ b/drivers/scsi/aic7xxx/aic7xxx_core.c
@@ -1986,7 +1986,7 @@ ahc_set_syncrate(struct ahc_softc *ahc, struct ahc_devinfo *devinfo,
1986 tinfo->curr.ppr_options = ppr_options; 1986 tinfo->curr.ppr_options = ppr_options;
1987 1987
1988 ahc_send_async(ahc, devinfo->channel, devinfo->target, 1988 ahc_send_async(ahc, devinfo->channel, devinfo->target,
1989 CAM_LUN_WILDCARD, AC_TRANSFER_NEG, NULL); 1989 CAM_LUN_WILDCARD, AC_TRANSFER_NEG);
1990 if (bootverbose) { 1990 if (bootverbose) {
1991 if (offset != 0) { 1991 if (offset != 0) {
1992 printf("%s: target %d synchronous at %sMHz%s, " 1992 printf("%s: target %d synchronous at %sMHz%s, "
@@ -2056,7 +2056,7 @@ ahc_set_width(struct ahc_softc *ahc, struct ahc_devinfo *devinfo,
2056 tinfo->curr.width = width; 2056 tinfo->curr.width = width;
2057 2057
2058 ahc_send_async(ahc, devinfo->channel, devinfo->target, 2058 ahc_send_async(ahc, devinfo->channel, devinfo->target,
2059 CAM_LUN_WILDCARD, AC_TRANSFER_NEG, NULL); 2059 CAM_LUN_WILDCARD, AC_TRANSFER_NEG);
2060 if (bootverbose) { 2060 if (bootverbose) {
2061 printf("%s: target %d using %dbit transfers\n", 2061 printf("%s: target %d using %dbit transfers\n",
2062 ahc_name(ahc), devinfo->target, 2062 ahc_name(ahc), devinfo->target,
@@ -2074,12 +2074,14 @@ ahc_set_width(struct ahc_softc *ahc, struct ahc_devinfo *devinfo,
2074 * Update the current state of tagged queuing for a given target. 2074 * Update the current state of tagged queuing for a given target.
2075 */ 2075 */
2076void 2076void
2077ahc_set_tags(struct ahc_softc *ahc, struct ahc_devinfo *devinfo, 2077ahc_set_tags(struct ahc_softc *ahc, struct scsi_cmnd *cmd,
2078 ahc_queue_alg alg) 2078 struct ahc_devinfo *devinfo, ahc_queue_alg alg)
2079{ 2079{
2080 ahc_platform_set_tags(ahc, devinfo, alg); 2080 struct scsi_device *sdev = cmd->device;
2081
2082 ahc_platform_set_tags(ahc, sdev, devinfo, alg);
2081 ahc_send_async(ahc, devinfo->channel, devinfo->target, 2083 ahc_send_async(ahc, devinfo->channel, devinfo->target,
2082 devinfo->lun, AC_TRANSFER_NEG, &alg); 2084 devinfo->lun, AC_TRANSFER_NEG);
2083} 2085}
2084 2086
2085/* 2087/*
@@ -3489,7 +3491,7 @@ ahc_handle_msg_reject(struct ahc_softc *ahc, struct ahc_devinfo *devinfo)
3489 printf("(%s:%c:%d:%d): refuses tagged commands. " 3491 printf("(%s:%c:%d:%d): refuses tagged commands. "
3490 "Performing non-tagged I/O\n", ahc_name(ahc), 3492 "Performing non-tagged I/O\n", ahc_name(ahc),
3491 devinfo->channel, devinfo->target, devinfo->lun); 3493 devinfo->channel, devinfo->target, devinfo->lun);
3492 ahc_set_tags(ahc, devinfo, AHC_QUEUE_NONE); 3494 ahc_set_tags(ahc, scb->io_ctx, devinfo, AHC_QUEUE_NONE);
3493 mask = ~0x23; 3495 mask = ~0x23;
3494 } else { 3496 } else {
3495 printf("(%s:%c:%d:%d): refuses %s tagged commands. " 3497 printf("(%s:%c:%d:%d): refuses %s tagged commands. "
@@ -3497,7 +3499,7 @@ ahc_handle_msg_reject(struct ahc_softc *ahc, struct ahc_devinfo *devinfo)
3497 ahc_name(ahc), devinfo->channel, devinfo->target, 3499 ahc_name(ahc), devinfo->channel, devinfo->target,
3498 devinfo->lun, tag_type == MSG_ORDERED_TASK 3500 devinfo->lun, tag_type == MSG_ORDERED_TASK
3499 ? "ordered" : "head of queue"); 3501 ? "ordered" : "head of queue");
3500 ahc_set_tags(ahc, devinfo, AHC_QUEUE_BASIC); 3502 ahc_set_tags(ahc, scb->io_ctx, devinfo, AHC_QUEUE_BASIC);
3501 mask = ~0x03; 3503 mask = ~0x03;
3502 } 3504 }
3503 3505
@@ -3763,7 +3765,7 @@ ahc_handle_devreset(struct ahc_softc *ahc, struct ahc_devinfo *devinfo,
3763 3765
3764 if (status != CAM_SEL_TIMEOUT) 3766 if (status != CAM_SEL_TIMEOUT)
3765 ahc_send_async(ahc, devinfo->channel, devinfo->target, 3767 ahc_send_async(ahc, devinfo->channel, devinfo->target,
3766 CAM_LUN_WILDCARD, AC_SENT_BDR, NULL); 3768 CAM_LUN_WILDCARD, AC_SENT_BDR);
3767 3769
3768 if (message != NULL 3770 if (message != NULL
3769 && (verbose_level <= bootverbose)) 3771 && (verbose_level <= bootverbose))
@@ -6018,7 +6020,7 @@ ahc_reset_channel(struct ahc_softc *ahc, char channel, int initiate_reset)
6018#endif 6020#endif
6019 /* Notify the XPT that a bus reset occurred */ 6021 /* Notify the XPT that a bus reset occurred */
6020 ahc_send_async(ahc, devinfo.channel, CAM_TARGET_WILDCARD, 6022 ahc_send_async(ahc, devinfo.channel, CAM_TARGET_WILDCARD,
6021 CAM_LUN_WILDCARD, AC_BUS_RESET, NULL); 6023 CAM_LUN_WILDCARD, AC_BUS_RESET);
6022 6024
6023 /* 6025 /*
6024 * Revert to async/narrow transfers until we renegotiate. 6026 * Revert to async/narrow transfers until we renegotiate.
diff --git a/drivers/scsi/aic7xxx/aic7xxx_osm.c b/drivers/scsi/aic7xxx/aic7xxx_osm.c
index ed85057152d5..660f26e23a38 100644
--- a/drivers/scsi/aic7xxx/aic7xxx_osm.c
+++ b/drivers/scsi/aic7xxx/aic7xxx_osm.c
@@ -512,7 +512,6 @@ ahc_linux_target_alloc(struct scsi_target *starget)
512 struct seeprom_config *sc = ahc->seep_config; 512 struct seeprom_config *sc = ahc->seep_config;
513 unsigned long flags; 513 unsigned long flags;
514 struct scsi_target **ahc_targp = ahc_linux_target_in_softc(starget); 514 struct scsi_target **ahc_targp = ahc_linux_target_in_softc(starget);
515 struct ahc_linux_target *targ = scsi_transport_target_data(starget);
516 unsigned short scsirate; 515 unsigned short scsirate;
517 struct ahc_devinfo devinfo; 516 struct ahc_devinfo devinfo;
518 struct ahc_initiator_tinfo *tinfo; 517 struct ahc_initiator_tinfo *tinfo;
@@ -533,7 +532,6 @@ ahc_linux_target_alloc(struct scsi_target *starget)
533 BUG_ON(*ahc_targp != NULL); 532 BUG_ON(*ahc_targp != NULL);
534 533
535 *ahc_targp = starget; 534 *ahc_targp = starget;
536 memset(targ, 0, sizeof(*targ));
537 535
538 if (sc) { 536 if (sc) {
539 int maxsync = AHC_SYNCRATE_DT; 537 int maxsync = AHC_SYNCRATE_DT;
@@ -594,14 +592,11 @@ ahc_linux_slave_alloc(struct scsi_device *sdev)
594 struct ahc_softc *ahc = 592 struct ahc_softc *ahc =
595 *((struct ahc_softc **)sdev->host->hostdata); 593 *((struct ahc_softc **)sdev->host->hostdata);
596 struct scsi_target *starget = sdev->sdev_target; 594 struct scsi_target *starget = sdev->sdev_target;
597 struct ahc_linux_target *targ = scsi_transport_target_data(starget);
598 struct ahc_linux_device *dev; 595 struct ahc_linux_device *dev;
599 596
600 if (bootverbose) 597 if (bootverbose)
601 printf("%s: Slave Alloc %d\n", ahc_name(ahc), sdev->id); 598 printf("%s: Slave Alloc %d\n", ahc_name(ahc), sdev->id);
602 599
603 BUG_ON(targ->sdev[sdev->lun] != NULL);
604
605 dev = scsi_transport_device_data(sdev); 600 dev = scsi_transport_device_data(sdev);
606 memset(dev, 0, sizeof(*dev)); 601 memset(dev, 0, sizeof(*dev));
607 602
@@ -618,8 +613,6 @@ ahc_linux_slave_alloc(struct scsi_device *sdev)
618 */ 613 */
619 dev->maxtags = 0; 614 dev->maxtags = 0;
620 615
621 targ->sdev[sdev->lun] = sdev;
622
623 spi_period(starget) = 0; 616 spi_period(starget) = 0;
624 617
625 return 0; 618 return 0;
@@ -644,22 +637,6 @@ ahc_linux_slave_configure(struct scsi_device *sdev)
644 return 0; 637 return 0;
645} 638}
646 639
647static void
648ahc_linux_slave_destroy(struct scsi_device *sdev)
649{
650 struct ahc_softc *ahc;
651 struct ahc_linux_device *dev = scsi_transport_device_data(sdev);
652 struct ahc_linux_target *targ = scsi_transport_target_data(sdev->sdev_target);
653
654 ahc = *((struct ahc_softc **)sdev->host->hostdata);
655 if (bootverbose)
656 printf("%s: Slave Destroy %d\n", ahc_name(ahc), sdev->id);
657
658 BUG_ON(dev->active);
659
660 targ->sdev[sdev->lun] = NULL;
661}
662
663#if defined(__i386__) 640#if defined(__i386__)
664/* 641/*
665 * Return the disk geometry for the given SCSI device. 642 * Return the disk geometry for the given SCSI device.
@@ -782,7 +759,6 @@ struct scsi_host_template aic7xxx_driver_template = {
782 .use_clustering = ENABLE_CLUSTERING, 759 .use_clustering = ENABLE_CLUSTERING,
783 .slave_alloc = ahc_linux_slave_alloc, 760 .slave_alloc = ahc_linux_slave_alloc,
784 .slave_configure = ahc_linux_slave_configure, 761 .slave_configure = ahc_linux_slave_configure,
785 .slave_destroy = ahc_linux_slave_destroy,
786 .target_alloc = ahc_linux_target_alloc, 762 .target_alloc = ahc_linux_target_alloc,
787 .target_destroy = ahc_linux_target_destroy, 763 .target_destroy = ahc_linux_target_destroy,
788}; 764};
@@ -1204,21 +1180,13 @@ void
1204ahc_platform_free(struct ahc_softc *ahc) 1180ahc_platform_free(struct ahc_softc *ahc)
1205{ 1181{
1206 struct scsi_target *starget; 1182 struct scsi_target *starget;
1207 int i, j; 1183 int i;
1208 1184
1209 if (ahc->platform_data != NULL) { 1185 if (ahc->platform_data != NULL) {
1210 /* destroy all of the device and target objects */ 1186 /* destroy all of the device and target objects */
1211 for (i = 0; i < AHC_NUM_TARGETS; i++) { 1187 for (i = 0; i < AHC_NUM_TARGETS; i++) {
1212 starget = ahc->platform_data->starget[i]; 1188 starget = ahc->platform_data->starget[i];
1213 if (starget != NULL) { 1189 if (starget != NULL) {
1214 for (j = 0; j < AHC_NUM_LUNS; j++) {
1215 struct ahc_linux_target *targ =
1216 scsi_transport_target_data(starget);
1217
1218 if (targ->sdev[j] == NULL)
1219 continue;
1220 targ->sdev[j] = NULL;
1221 }
1222 ahc->platform_data->starget[i] = NULL; 1190 ahc->platform_data->starget[i] = NULL;
1223 } 1191 }
1224 } 1192 }
@@ -1252,24 +1220,13 @@ ahc_platform_freeze_devq(struct ahc_softc *ahc, struct scb *scb)
1252} 1220}
1253 1221
1254void 1222void
1255ahc_platform_set_tags(struct ahc_softc *ahc, struct ahc_devinfo *devinfo, 1223ahc_platform_set_tags(struct ahc_softc *ahc, struct scsi_device *sdev,
1256 ahc_queue_alg alg) 1224 struct ahc_devinfo *devinfo, ahc_queue_alg alg)
1257{ 1225{
1258 struct scsi_target *starget;
1259 struct ahc_linux_target *targ;
1260 struct ahc_linux_device *dev; 1226 struct ahc_linux_device *dev;
1261 struct scsi_device *sdev;
1262 u_int target_offset;
1263 int was_queuing; 1227 int was_queuing;
1264 int now_queuing; 1228 int now_queuing;
1265 1229
1266 target_offset = devinfo->target;
1267 if (devinfo->channel != 'A')
1268 target_offset += 8;
1269 starget = ahc->platform_data->starget[target_offset];
1270 targ = scsi_transport_target_data(starget);
1271 BUG_ON(targ == NULL);
1272 sdev = targ->sdev[devinfo->lun];
1273 if (sdev == NULL) 1230 if (sdev == NULL)
1274 return; 1231 return;
1275 dev = scsi_transport_device_data(sdev); 1232 dev = scsi_transport_device_data(sdev);
@@ -1402,11 +1359,15 @@ ahc_linux_device_queue_depth(struct scsi_device *sdev)
1402 tags = ahc_linux_user_tagdepth(ahc, &devinfo); 1359 tags = ahc_linux_user_tagdepth(ahc, &devinfo);
1403 if (tags != 0 && sdev->tagged_supported != 0) { 1360 if (tags != 0 && sdev->tagged_supported != 0) {
1404 1361
1405 ahc_set_tags(ahc, &devinfo, AHC_QUEUE_TAGGED); 1362 ahc_platform_set_tags(ahc, sdev, &devinfo, AHC_QUEUE_TAGGED);
1363 ahc_send_async(ahc, devinfo.channel, devinfo.target,
1364 devinfo.lun, AC_TRANSFER_NEG);
1406 ahc_print_devinfo(ahc, &devinfo); 1365 ahc_print_devinfo(ahc, &devinfo);
1407 printf("Tagged Queuing enabled. Depth %d\n", tags); 1366 printf("Tagged Queuing enabled. Depth %d\n", tags);
1408 } else { 1367 } else {
1409 ahc_set_tags(ahc, &devinfo, AHC_QUEUE_NONE); 1368 ahc_platform_set_tags(ahc, sdev, &devinfo, AHC_QUEUE_NONE);
1369 ahc_send_async(ahc, devinfo.channel, devinfo.target,
1370 devinfo.lun, AC_TRANSFER_NEG);
1410 } 1371 }
1411} 1372}
1412 1373
@@ -1630,7 +1591,7 @@ ahc_platform_flushwork(struct ahc_softc *ahc)
1630 1591
1631void 1592void
1632ahc_send_async(struct ahc_softc *ahc, char channel, 1593ahc_send_async(struct ahc_softc *ahc, char channel,
1633 u_int target, u_int lun, ac_code code, void *arg) 1594 u_int target, u_int lun, ac_code code)
1634{ 1595{
1635 switch (code) { 1596 switch (code) {
1636 case AC_TRANSFER_NEG: 1597 case AC_TRANSFER_NEG:
@@ -1947,7 +1908,7 @@ ahc_linux_handle_scsi_status(struct ahc_softc *ahc,
1947 } 1908 }
1948 ahc_set_transaction_status(scb, CAM_REQUEUE_REQ); 1909 ahc_set_transaction_status(scb, CAM_REQUEUE_REQ);
1949 ahc_set_scsi_status(scb, SCSI_STATUS_OK); 1910 ahc_set_scsi_status(scb, SCSI_STATUS_OK);
1950 ahc_platform_set_tags(ahc, &devinfo, 1911 ahc_platform_set_tags(ahc, sdev, &devinfo,
1951 (dev->flags & AHC_DEV_Q_BASIC) 1912 (dev->flags & AHC_DEV_Q_BASIC)
1952 ? AHC_QUEUE_BASIC : AHC_QUEUE_TAGGED); 1913 ? AHC_QUEUE_BASIC : AHC_QUEUE_TAGGED);
1953 break; 1914 break;
@@ -1958,7 +1919,7 @@ ahc_linux_handle_scsi_status(struct ahc_softc *ahc,
1958 */ 1919 */
1959 dev->openings = 1; 1920 dev->openings = 1;
1960 ahc_set_scsi_status(scb, SCSI_STATUS_BUSY); 1921 ahc_set_scsi_status(scb, SCSI_STATUS_BUSY);
1961 ahc_platform_set_tags(ahc, &devinfo, 1922 ahc_platform_set_tags(ahc, sdev, &devinfo,
1962 (dev->flags & AHC_DEV_Q_BASIC) 1923 (dev->flags & AHC_DEV_Q_BASIC)
1963 ? AHC_QUEUE_BASIC : AHC_QUEUE_TAGGED); 1924 ? AHC_QUEUE_BASIC : AHC_QUEUE_TAGGED);
1964 break; 1925 break;
@@ -2600,8 +2561,6 @@ ahc_linux_init(void)
2600 if (!ahc_linux_transport_template) 2561 if (!ahc_linux_transport_template)
2601 return -ENODEV; 2562 return -ENODEV;
2602 2563
2603 scsi_transport_reserve_target(ahc_linux_transport_template,
2604 sizeof(struct ahc_linux_target));
2605 scsi_transport_reserve_device(ahc_linux_transport_template, 2564 scsi_transport_reserve_device(ahc_linux_transport_template,
2606 sizeof(struct ahc_linux_device)); 2565 sizeof(struct ahc_linux_device));
2607 2566
diff --git a/drivers/scsi/aic7xxx/aic7xxx_osm.h b/drivers/scsi/aic7xxx/aic7xxx_osm.h
index a36b33868e0e..85ae5d836fa4 100644
--- a/drivers/scsi/aic7xxx/aic7xxx_osm.h
+++ b/drivers/scsi/aic7xxx/aic7xxx_osm.h
@@ -256,7 +256,6 @@ typedef enum {
256 AHC_DEV_PERIODIC_OTAG = 0x40, /* Send OTAG to prevent starvation */ 256 AHC_DEV_PERIODIC_OTAG = 0x40, /* Send OTAG to prevent starvation */
257} ahc_linux_dev_flags; 257} ahc_linux_dev_flags;
258 258
259struct ahc_linux_target;
260struct ahc_linux_device { 259struct ahc_linux_device {
261 /* 260 /*
262 * The number of transactions currently 261 * The number of transactions currently
@@ -329,12 +328,6 @@ struct ahc_linux_device {
329#define AHC_OTAG_THRESH 500 328#define AHC_OTAG_THRESH 500
330}; 329};
331 330
332struct ahc_linux_target {
333 struct scsi_device *sdev[AHC_NUM_LUNS];
334 struct ahc_transinfo last_tinfo;
335 struct ahc_softc *ahc;
336};
337
338/********************* Definitions Required by the Core ***********************/ 331/********************* Definitions Required by the Core ***********************/
339/* 332/*
340 * Number of SG segments we require. So long as the S/G segments for 333 * Number of SG segments we require. So long as the S/G segments for
@@ -822,7 +815,7 @@ ahc_freeze_scb(struct scb *scb)
822 } 815 }
823} 816}
824 817
825void ahc_platform_set_tags(struct ahc_softc *ahc, 818void ahc_platform_set_tags(struct ahc_softc *ahc, struct scsi_device *sdev,
826 struct ahc_devinfo *devinfo, ahc_queue_alg); 819 struct ahc_devinfo *devinfo, ahc_queue_alg);
827int ahc_platform_abort_scbs(struct ahc_softc *ahc, int target, 820int ahc_platform_abort_scbs(struct ahc_softc *ahc, int target,
828 char channel, int lun, u_int tag, 821 char channel, int lun, u_int tag,
@@ -832,7 +825,7 @@ irqreturn_t
832void ahc_platform_flushwork(struct ahc_softc *ahc); 825void ahc_platform_flushwork(struct ahc_softc *ahc);
833void ahc_done(struct ahc_softc*, struct scb*); 826void ahc_done(struct ahc_softc*, struct scb*);
834void ahc_send_async(struct ahc_softc *, char channel, 827void ahc_send_async(struct ahc_softc *, char channel,
835 u_int target, u_int lun, ac_code, void *); 828 u_int target, u_int lun, ac_code);
836void ahc_print_path(struct ahc_softc *, struct scb *); 829void ahc_print_path(struct ahc_softc *, struct scb *);
837void ahc_platform_dump_card_state(struct ahc_softc *ahc); 830void ahc_platform_dump_card_state(struct ahc_softc *ahc);
838 831
diff --git a/drivers/scsi/aic7xxx/aic7xxx_proc.c b/drivers/scsi/aic7xxx/aic7xxx_proc.c
index 5914b4aa4a8f..99e5443e7535 100644
--- a/drivers/scsi/aic7xxx/aic7xxx_proc.c
+++ b/drivers/scsi/aic7xxx/aic7xxx_proc.c
@@ -182,7 +182,6 @@ ahc_dump_target_state(struct ahc_softc *ahc, struct info_str *info,
182 u_int our_id, char channel, u_int target_id, 182 u_int our_id, char channel, u_int target_id,
183 u_int target_offset) 183 u_int target_offset)
184{ 184{
185 struct ahc_linux_target *targ;
186 struct scsi_target *starget; 185 struct scsi_target *starget;
187 struct ahc_initiator_tinfo *tinfo; 186 struct ahc_initiator_tinfo *tinfo;
188 struct ahc_tmode_tstate *tstate; 187 struct ahc_tmode_tstate *tstate;
@@ -198,7 +197,6 @@ ahc_dump_target_state(struct ahc_softc *ahc, struct info_str *info,
198 starget = ahc->platform_data->starget[target_offset]; 197 starget = ahc->platform_data->starget[target_offset];
199 if (!starget) 198 if (!starget)
200 return; 199 return;
201 targ = scsi_transport_target_data(starget);
202 200
203 copy_info(info, "\tGoal: "); 201 copy_info(info, "\tGoal: ");
204 ahc_format_transinfo(info, &tinfo->goal); 202 ahc_format_transinfo(info, &tinfo->goal);
@@ -208,7 +206,7 @@ ahc_dump_target_state(struct ahc_softc *ahc, struct info_str *info,
208 for (lun = 0; lun < AHC_NUM_LUNS; lun++) { 206 for (lun = 0; lun < AHC_NUM_LUNS; lun++) {
209 struct scsi_device *sdev; 207 struct scsi_device *sdev;
210 208
211 sdev = targ->sdev[lun]; 209 sdev = scsi_device_lookup_by_target(starget, lun);
212 210
213 if (sdev == NULL) 211 if (sdev == NULL)
214 continue; 212 continue;
@@ -383,11 +381,11 @@ ahc_linux_proc_info(struct Scsi_Host *shost, char *buffer, char **start,
383 } 381 }
384 copy_info(&info, "\n"); 382 copy_info(&info, "\n");
385 383
386 max_targ = 15; 384 max_targ = 16;
387 if ((ahc->features & (AHC_WIDE|AHC_TWIN)) == 0) 385 if ((ahc->features & (AHC_WIDE|AHC_TWIN)) == 0)
388 max_targ = 7; 386 max_targ = 8;
389 387
390 for (i = 0; i <= max_targ; i++) { 388 for (i = 0; i < max_targ; i++) {
391 u_int our_id; 389 u_int our_id;
392 u_int target_id; 390 u_int target_id;
393 char channel; 391 char channel;