Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 13961
b: refs/heads/master
c: 85837eb
h: refs/heads/master
i:
  13959: 0fe7b51
v: v3
  • Loading branch information
Mike Christie authored and Linus Torvalds committed Nov 11, 2005
1 parent 8de5222 commit eae3827
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 30 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: 39990b5eb93c624abc345f81c30f1a9c7f2ec3f3
refs/heads/master: 85837ebdd7bb3e96a60e9b4c6af6c60d1273bc67
40 changes: 11 additions & 29 deletions trunk/drivers/scsi/libata-scsi.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
#include <linux/spinlock.h>
#include <scsi/scsi.h>
#include <scsi/scsi_host.h>
#include <scsi/scsi_eh.h>
#include <scsi/scsi_device.h>
#include <scsi/scsi_request.h>
#include <linux/libata.h>
Expand Down Expand Up @@ -147,18 +148,15 @@ int ata_cmd_ioctl(struct scsi_device *scsidev, void __user *arg)
u8 scsi_cmd[MAX_COMMAND_SIZE];
u8 args[4], *argbuf = NULL;
int argsize = 0;
struct scsi_request *sreq;
struct scsi_sense_hdr sshdr;
enum dma_data_direction data_dir;

if (NULL == (void *)arg)
return -EINVAL;

if (copy_from_user(args, arg, sizeof(args)))
return -EFAULT;

sreq = scsi_allocate_request(scsidev, GFP_KERNEL);
if (!sreq)
return -EINTR;

memset(scsi_cmd, 0, sizeof(scsi_cmd));

if (args[3]) {
Expand All @@ -172,11 +170,11 @@ int ata_cmd_ioctl(struct scsi_device *scsidev, void __user *arg)
scsi_cmd[1] = (4 << 1); /* PIO Data-in */
scsi_cmd[2] = 0x0e; /* no off.line or cc, read from dev,
block count in sector count field */
sreq->sr_data_direction = DMA_FROM_DEVICE;
data_dir = DMA_FROM_DEVICE;
} else {
scsi_cmd[1] = (3 << 1); /* Non-data */
/* scsi_cmd[2] is already 0 -- no off.line, cc, or data xfer */
sreq->sr_data_direction = DMA_NONE;
data_dir = DMA_NONE;
}

scsi_cmd[0] = ATA_16;
Expand All @@ -194,9 +192,8 @@ int ata_cmd_ioctl(struct scsi_device *scsidev, void __user *arg)

/* Good values for timeout and retries? Values below
from scsi_ioctl_send_command() for default case... */
scsi_wait_req(sreq, scsi_cmd, argbuf, argsize, (10*HZ), 5);

if (sreq->sr_result) {
if (scsi_execute_req(scsidev, scsi_cmd, data_dir, argbuf, argsize,
&sshdr, (10*HZ), 5)) {
rc = -EIO;
goto error;
}
Expand All @@ -207,8 +204,6 @@ int ata_cmd_ioctl(struct scsi_device *scsidev, void __user *arg)
&& copy_to_user((void *)(arg + sizeof(args)), argbuf, argsize))
rc = -EFAULT;
error:
scsi_release_request(sreq);

if (argbuf)
kfree(argbuf);

Expand All @@ -231,7 +226,7 @@ int ata_task_ioctl(struct scsi_device *scsidev, void __user *arg)
int rc = 0;
u8 scsi_cmd[MAX_COMMAND_SIZE];
u8 args[7];
struct scsi_request *sreq;
struct scsi_sense_hdr sshdr;

if (NULL == (void *)arg)
return -EINVAL;
Expand All @@ -250,26 +245,13 @@ int ata_task_ioctl(struct scsi_device *scsidev, void __user *arg)
scsi_cmd[12] = args[5];
scsi_cmd[14] = args[0];

sreq = scsi_allocate_request(scsidev, GFP_KERNEL);
if (!sreq) {
rc = -EINTR;
goto error;
}

sreq->sr_data_direction = DMA_NONE;
/* Good values for timeout and retries? Values below
from scsi_ioctl_send_command() for default case... */
scsi_wait_req(sreq, scsi_cmd, NULL, 0, (10*HZ), 5);

if (sreq->sr_result) {
from scsi_ioctl_send_command() for default case... */
if (scsi_execute_req(scsidev, scsi_cmd, DMA_NONE, NULL, 0, &sshdr,
(10*HZ), 5))
rc = -EIO;
goto error;
}

/* Need code to retrieve data from check condition? */

error:
scsi_release_request(sreq);
return rc;
}

Expand Down

0 comments on commit eae3827

Please sign in to comment.