Skip to content

Commit

Permalink
[SCSI] aic7xxx: Remove slave_destroy
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Hannes Reinecke authored and James Bottomley committed Oct 25, 2006
1 parent 843822a commit 9080063
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 78 deletions.
1 change: 1 addition & 0 deletions drivers/scsi/aic7xxx/aic7xxx.h
Original file line number Diff line number Diff line change
Expand Up @@ -1279,6 +1279,7 @@ typedef enum {
} ahc_queue_alg;

void ahc_set_tags(struct ahc_softc *ahc,
struct scsi_cmnd *cmd,
struct ahc_devinfo *devinfo,
ahc_queue_alg alg);

Expand Down
22 changes: 12 additions & 10 deletions drivers/scsi/aic7xxx/aic7xxx_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1986,7 +1986,7 @@ ahc_set_syncrate(struct ahc_softc *ahc, struct ahc_devinfo *devinfo,
tinfo->curr.ppr_options = ppr_options;

ahc_send_async(ahc, devinfo->channel, devinfo->target,
CAM_LUN_WILDCARD, AC_TRANSFER_NEG, NULL);
CAM_LUN_WILDCARD, AC_TRANSFER_NEG);
if (bootverbose) {
if (offset != 0) {
printf("%s: target %d synchronous at %sMHz%s, "
Expand Down Expand Up @@ -2056,7 +2056,7 @@ ahc_set_width(struct ahc_softc *ahc, struct ahc_devinfo *devinfo,
tinfo->curr.width = width;

ahc_send_async(ahc, devinfo->channel, devinfo->target,
CAM_LUN_WILDCARD, AC_TRANSFER_NEG, NULL);
CAM_LUN_WILDCARD, AC_TRANSFER_NEG);
if (bootverbose) {
printf("%s: target %d using %dbit transfers\n",
ahc_name(ahc), devinfo->target,
Expand All @@ -2074,12 +2074,14 @@ ahc_set_width(struct ahc_softc *ahc, struct ahc_devinfo *devinfo,
* Update the current state of tagged queuing for a given target.
*/
void
ahc_set_tags(struct ahc_softc *ahc, struct ahc_devinfo *devinfo,
ahc_queue_alg alg)
ahc_set_tags(struct ahc_softc *ahc, struct scsi_cmnd *cmd,
struct ahc_devinfo *devinfo, ahc_queue_alg alg)
{
ahc_platform_set_tags(ahc, devinfo, alg);
struct scsi_device *sdev = cmd->device;

ahc_platform_set_tags(ahc, sdev, devinfo, alg);
ahc_send_async(ahc, devinfo->channel, devinfo->target,
devinfo->lun, AC_TRANSFER_NEG, &alg);
devinfo->lun, AC_TRANSFER_NEG);
}

/*
Expand Down Expand Up @@ -3489,15 +3491,15 @@ ahc_handle_msg_reject(struct ahc_softc *ahc, struct ahc_devinfo *devinfo)
printf("(%s:%c:%d:%d): refuses tagged commands. "
"Performing non-tagged I/O\n", ahc_name(ahc),
devinfo->channel, devinfo->target, devinfo->lun);
ahc_set_tags(ahc, devinfo, AHC_QUEUE_NONE);
ahc_set_tags(ahc, scb->io_ctx, devinfo, AHC_QUEUE_NONE);
mask = ~0x23;
} else {
printf("(%s:%c:%d:%d): refuses %s tagged commands. "
"Performing simple queue tagged I/O only\n",
ahc_name(ahc), devinfo->channel, devinfo->target,
devinfo->lun, tag_type == MSG_ORDERED_TASK
? "ordered" : "head of queue");
ahc_set_tags(ahc, devinfo, AHC_QUEUE_BASIC);
ahc_set_tags(ahc, scb->io_ctx, devinfo, AHC_QUEUE_BASIC);
mask = ~0x03;
}

Expand Down Expand Up @@ -3763,7 +3765,7 @@ ahc_handle_devreset(struct ahc_softc *ahc, struct ahc_devinfo *devinfo,

if (status != CAM_SEL_TIMEOUT)
ahc_send_async(ahc, devinfo->channel, devinfo->target,
CAM_LUN_WILDCARD, AC_SENT_BDR, NULL);
CAM_LUN_WILDCARD, AC_SENT_BDR);

if (message != NULL
&& (verbose_level <= bootverbose))
Expand Down Expand Up @@ -6018,7 +6020,7 @@ ahc_reset_channel(struct ahc_softc *ahc, char channel, int initiate_reset)
#endif
/* Notify the XPT that a bus reset occurred */
ahc_send_async(ahc, devinfo.channel, CAM_TARGET_WILDCARD,
CAM_LUN_WILDCARD, AC_BUS_RESET, NULL);
CAM_LUN_WILDCARD, AC_BUS_RESET);

/*
* Revert to async/narrow transfers until we renegotiate.
Expand Down
65 changes: 12 additions & 53 deletions drivers/scsi/aic7xxx/aic7xxx_osm.c
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,6 @@ ahc_linux_target_alloc(struct scsi_target *starget)
struct seeprom_config *sc = ahc->seep_config;
unsigned long flags;
struct scsi_target **ahc_targp = ahc_linux_target_in_softc(starget);
struct ahc_linux_target *targ = scsi_transport_target_data(starget);
unsigned short scsirate;
struct ahc_devinfo devinfo;
struct ahc_initiator_tinfo *tinfo;
Expand All @@ -533,7 +532,6 @@ ahc_linux_target_alloc(struct scsi_target *starget)
BUG_ON(*ahc_targp != NULL);

*ahc_targp = starget;
memset(targ, 0, sizeof(*targ));

if (sc) {
int maxsync = AHC_SYNCRATE_DT;
Expand Down Expand Up @@ -594,14 +592,11 @@ ahc_linux_slave_alloc(struct scsi_device *sdev)
struct ahc_softc *ahc =
*((struct ahc_softc **)sdev->host->hostdata);
struct scsi_target *starget = sdev->sdev_target;
struct ahc_linux_target *targ = scsi_transport_target_data(starget);
struct ahc_linux_device *dev;

if (bootverbose)
printf("%s: Slave Alloc %d\n", ahc_name(ahc), sdev->id);

BUG_ON(targ->sdev[sdev->lun] != NULL);

dev = scsi_transport_device_data(sdev);
memset(dev, 0, sizeof(*dev));

Expand All @@ -618,8 +613,6 @@ ahc_linux_slave_alloc(struct scsi_device *sdev)
*/
dev->maxtags = 0;

targ->sdev[sdev->lun] = sdev;

spi_period(starget) = 0;

return 0;
Expand All @@ -644,22 +637,6 @@ ahc_linux_slave_configure(struct scsi_device *sdev)
return 0;
}

static void
ahc_linux_slave_destroy(struct scsi_device *sdev)
{
struct ahc_softc *ahc;
struct ahc_linux_device *dev = scsi_transport_device_data(sdev);
struct ahc_linux_target *targ = scsi_transport_target_data(sdev->sdev_target);

ahc = *((struct ahc_softc **)sdev->host->hostdata);
if (bootverbose)
printf("%s: Slave Destroy %d\n", ahc_name(ahc), sdev->id);

BUG_ON(dev->active);

targ->sdev[sdev->lun] = NULL;
}

#if defined(__i386__)
/*
* Return the disk geometry for the given SCSI device.
Expand Down Expand Up @@ -782,7 +759,6 @@ struct scsi_host_template aic7xxx_driver_template = {
.use_clustering = ENABLE_CLUSTERING,
.slave_alloc = ahc_linux_slave_alloc,
.slave_configure = ahc_linux_slave_configure,
.slave_destroy = ahc_linux_slave_destroy,
.target_alloc = ahc_linux_target_alloc,
.target_destroy = ahc_linux_target_destroy,
};
Expand Down Expand Up @@ -1204,21 +1180,13 @@ void
ahc_platform_free(struct ahc_softc *ahc)
{
struct scsi_target *starget;
int i, j;
int i;

if (ahc->platform_data != NULL) {
/* destroy all of the device and target objects */
for (i = 0; i < AHC_NUM_TARGETS; i++) {
starget = ahc->platform_data->starget[i];
if (starget != NULL) {
for (j = 0; j < AHC_NUM_LUNS; j++) {
struct ahc_linux_target *targ =
scsi_transport_target_data(starget);

if (targ->sdev[j] == NULL)
continue;
targ->sdev[j] = NULL;
}
ahc->platform_data->starget[i] = NULL;
}
}
Expand Down Expand Up @@ -1252,24 +1220,13 @@ ahc_platform_freeze_devq(struct ahc_softc *ahc, struct scb *scb)
}

void
ahc_platform_set_tags(struct ahc_softc *ahc, struct ahc_devinfo *devinfo,
ahc_queue_alg alg)
ahc_platform_set_tags(struct ahc_softc *ahc, struct scsi_device *sdev,
struct ahc_devinfo *devinfo, ahc_queue_alg alg)
{
struct scsi_target *starget;
struct ahc_linux_target *targ;
struct ahc_linux_device *dev;
struct scsi_device *sdev;
u_int target_offset;
int was_queuing;
int now_queuing;

target_offset = devinfo->target;
if (devinfo->channel != 'A')
target_offset += 8;
starget = ahc->platform_data->starget[target_offset];
targ = scsi_transport_target_data(starget);
BUG_ON(targ == NULL);
sdev = targ->sdev[devinfo->lun];
if (sdev == NULL)
return;
dev = scsi_transport_device_data(sdev);
Expand Down Expand Up @@ -1402,11 +1359,15 @@ ahc_linux_device_queue_depth(struct scsi_device *sdev)
tags = ahc_linux_user_tagdepth(ahc, &devinfo);
if (tags != 0 && sdev->tagged_supported != 0) {

ahc_set_tags(ahc, &devinfo, AHC_QUEUE_TAGGED);
ahc_platform_set_tags(ahc, sdev, &devinfo, AHC_QUEUE_TAGGED);
ahc_send_async(ahc, devinfo.channel, devinfo.target,
devinfo.lun, AC_TRANSFER_NEG);
ahc_print_devinfo(ahc, &devinfo);
printf("Tagged Queuing enabled. Depth %d\n", tags);
} else {
ahc_set_tags(ahc, &devinfo, AHC_QUEUE_NONE);
ahc_platform_set_tags(ahc, sdev, &devinfo, AHC_QUEUE_NONE);
ahc_send_async(ahc, devinfo.channel, devinfo.target,
devinfo.lun, AC_TRANSFER_NEG);
}
}

Expand Down Expand Up @@ -1630,7 +1591,7 @@ ahc_platform_flushwork(struct ahc_softc *ahc)

void
ahc_send_async(struct ahc_softc *ahc, char channel,
u_int target, u_int lun, ac_code code, void *arg)
u_int target, u_int lun, ac_code code)
{
switch (code) {
case AC_TRANSFER_NEG:
Expand Down Expand Up @@ -1947,7 +1908,7 @@ ahc_linux_handle_scsi_status(struct ahc_softc *ahc,
}
ahc_set_transaction_status(scb, CAM_REQUEUE_REQ);
ahc_set_scsi_status(scb, SCSI_STATUS_OK);
ahc_platform_set_tags(ahc, &devinfo,
ahc_platform_set_tags(ahc, sdev, &devinfo,
(dev->flags & AHC_DEV_Q_BASIC)
? AHC_QUEUE_BASIC : AHC_QUEUE_TAGGED);
break;
Expand All @@ -1958,7 +1919,7 @@ ahc_linux_handle_scsi_status(struct ahc_softc *ahc,
*/
dev->openings = 1;
ahc_set_scsi_status(scb, SCSI_STATUS_BUSY);
ahc_platform_set_tags(ahc, &devinfo,
ahc_platform_set_tags(ahc, sdev, &devinfo,
(dev->flags & AHC_DEV_Q_BASIC)
? AHC_QUEUE_BASIC : AHC_QUEUE_TAGGED);
break;
Expand Down Expand Up @@ -2600,8 +2561,6 @@ ahc_linux_init(void)
if (!ahc_linux_transport_template)
return -ENODEV;

scsi_transport_reserve_target(ahc_linux_transport_template,
sizeof(struct ahc_linux_target));
scsi_transport_reserve_device(ahc_linux_transport_template,
sizeof(struct ahc_linux_device));

Expand Down
11 changes: 2 additions & 9 deletions drivers/scsi/aic7xxx/aic7xxx_osm.h
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,6 @@ typedef enum {
AHC_DEV_PERIODIC_OTAG = 0x40, /* Send OTAG to prevent starvation */
} ahc_linux_dev_flags;

struct ahc_linux_target;
struct ahc_linux_device {
/*
* The number of transactions currently
Expand Down Expand Up @@ -329,12 +328,6 @@ struct ahc_linux_device {
#define AHC_OTAG_THRESH 500
};

struct ahc_linux_target {
struct scsi_device *sdev[AHC_NUM_LUNS];
struct ahc_transinfo last_tinfo;
struct ahc_softc *ahc;
};

/********************* Definitions Required by the Core ***********************/
/*
* Number of SG segments we require. So long as the S/G segments for
Expand Down Expand Up @@ -822,7 +815,7 @@ ahc_freeze_scb(struct scb *scb)
}
}

void ahc_platform_set_tags(struct ahc_softc *ahc,
void ahc_platform_set_tags(struct ahc_softc *ahc, struct scsi_device *sdev,
struct ahc_devinfo *devinfo, ahc_queue_alg);
int ahc_platform_abort_scbs(struct ahc_softc *ahc, int target,
char channel, int lun, u_int tag,
Expand All @@ -832,7 +825,7 @@ irqreturn_t
void ahc_platform_flushwork(struct ahc_softc *ahc);
void ahc_done(struct ahc_softc*, struct scb*);
void ahc_send_async(struct ahc_softc *, char channel,
u_int target, u_int lun, ac_code, void *);
u_int target, u_int lun, ac_code);
void ahc_print_path(struct ahc_softc *, struct scb *);
void ahc_platform_dump_card_state(struct ahc_softc *ahc);

Expand Down
10 changes: 4 additions & 6 deletions drivers/scsi/aic7xxx/aic7xxx_proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,6 @@ ahc_dump_target_state(struct ahc_softc *ahc, struct info_str *info,
u_int our_id, char channel, u_int target_id,
u_int target_offset)
{
struct ahc_linux_target *targ;
struct scsi_target *starget;
struct ahc_initiator_tinfo *tinfo;
struct ahc_tmode_tstate *tstate;
Expand All @@ -198,7 +197,6 @@ ahc_dump_target_state(struct ahc_softc *ahc, struct info_str *info,
starget = ahc->platform_data->starget[target_offset];
if (!starget)
return;
targ = scsi_transport_target_data(starget);

copy_info(info, "\tGoal: ");
ahc_format_transinfo(info, &tinfo->goal);
Expand All @@ -208,7 +206,7 @@ ahc_dump_target_state(struct ahc_softc *ahc, struct info_str *info,
for (lun = 0; lun < AHC_NUM_LUNS; lun++) {
struct scsi_device *sdev;

sdev = targ->sdev[lun];
sdev = scsi_device_lookup_by_target(starget, lun);

if (sdev == NULL)
continue;
Expand Down Expand Up @@ -383,11 +381,11 @@ ahc_linux_proc_info(struct Scsi_Host *shost, char *buffer, char **start,
}
copy_info(&info, "\n");

max_targ = 15;
max_targ = 16;
if ((ahc->features & (AHC_WIDE|AHC_TWIN)) == 0)
max_targ = 7;
max_targ = 8;

for (i = 0; i <= max_targ; i++) {
for (i = 0; i < max_targ; i++) {
u_int our_id;
u_int target_id;
char channel;
Expand Down

0 comments on commit 9080063

Please sign in to comment.