Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 7709
b: refs/heads/master
c: 84743bb
h: refs/heads/master
i:
  7707: df98ee0
v: v3
  • Loading branch information
James Bottomley authored and James Bottomley committed Aug 28, 2005
1 parent e327db0 commit b2ead3a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 22 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 820732b501a5bbdd3bde1263f391891e21b5ed8c
refs/heads/master: 84743bbcf9fc3767aa33f769898432538281e6dc
38 changes: 17 additions & 21 deletions trunk/drivers/scsi/ch.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
#include <scsi/scsi_ioctl.h>
#include <scsi/scsi_host.h>
#include <scsi/scsi_device.h>
#include <scsi/scsi_request.h>
#include <scsi/scsi_eh.h>
#include <scsi/scsi_dbg.h>

#define CH_DT_MAX 16
Expand Down Expand Up @@ -180,17 +180,17 @@ static struct {

/* ------------------------------------------------------------------- */

static int ch_find_errno(unsigned char *sense_buffer)
static int ch_find_errno(struct scsi_sense_hdr *sshdr)
{
int i,errno = 0;

/* Check to see if additional sense information is available */
if (sense_buffer[7] > 5 &&
sense_buffer[12] != 0) {
if (scsi_sense_valid(sshdr) &&
sshdr->asc != 0) {
for (i = 0; err[i].errno != 0; i++) {
if (err[i].sense == sense_buffer[ 2] &&
err[i].asc == sense_buffer[12] &&
err[i].ascq == sense_buffer[13]) {
if (err[i].sense == sshdr->sense_key &&
err[i].asc == sshdr->asc &&
err[i].ascq == sshdr->ascq) {
errno = -err[i].errno;
break;
}
Expand All @@ -206,13 +206,9 @@ ch_do_scsi(scsi_changer *ch, unsigned char *cmd,
void *buffer, unsigned buflength,
enum dma_data_direction direction)
{
int errno, retries = 0, timeout;
struct scsi_request *sr;
int errno, retries = 0, timeout, result;
struct scsi_sense_hdr sshdr;

sr = scsi_allocate_request(ch->device, GFP_KERNEL);
if (NULL == sr)
return -ENOMEM;

timeout = (cmd[0] == INITIALIZE_ELEMENT_STATUS)
? timeout_init : timeout_move;

Expand All @@ -223,24 +219,24 @@ ch_do_scsi(scsi_changer *ch, unsigned char *cmd,
__scsi_print_command(cmd);
}

scsi_wait_req(sr, cmd, buffer, buflength,
timeout * HZ, MAX_RETRIES);
result = scsi_execute_req(ch->device, cmd, direction, buffer,
buflength, &sshdr, timeout * HZ,
MAX_RETRIES);

dprintk("result: 0x%x\n",sr->sr_result);
if (driver_byte(sr->sr_result) & DRIVER_SENSE) {
dprintk("result: 0x%x\n",result);
if (driver_byte(result) & DRIVER_SENSE) {
if (debug)
scsi_print_req_sense(ch->name, sr);
errno = ch_find_errno(sr->sr_sense_buffer);
scsi_print_sense_hdr(ch->name, &sshdr);
errno = ch_find_errno(&sshdr);

switch(sr->sr_sense_buffer[2] & 0xf) {
switch(sshdr.sense_key) {
case UNIT_ATTENTION:
ch->unit_attention = 1;
if (retries++ < 3)
goto retry;
break;
}
}
scsi_release_request(sr);
return errno;
}

Expand Down

0 comments on commit b2ead3a

Please sign in to comment.