aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/libata-zpodd.c
diff options
context:
space:
mode:
authorSergei Shtylyov <sergei.shtylyov@cogentembedded.com>2013-06-23 15:25:04 -0400
committerTejun Heo <tj@kernel.org>2013-06-24 18:45:28 -0400
commitd0887c43f51c308b01605346e55d906ba858a6f9 (patch)
tree3a8a73f1b10ef05984f55e09e6e9f0569eb80e97 /drivers/ata/libata-zpodd.c
parent78062c50d15d6a0adfa09f6e35a6c52abcc9a32d (diff)
libata-zpodd: must use ata_tf_init()
There are some SATA controllers which have both devices 0 and 1 but this module just zeroes out taskfile and sets then ATA_TFLAG_DEVICE (not sure that's needed) which could lead to a wrong device being selected just before issuing command. Thus we should call ata_tf_init() which sets up the device register value properly, like all other users of ata_exec_internal() do... Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> Signed-off-by: Tejun Heo <tj@kernel.org> Cc: stable@vger.kernel.org
Diffstat (limited to 'drivers/ata/libata-zpodd.c')
-rw-r--r--drivers/ata/libata-zpodd.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/ata/libata-zpodd.c b/drivers/ata/libata-zpodd.c
index 90b159b740b3..cd8daf47188b 100644
--- a/drivers/ata/libata-zpodd.c
+++ b/drivers/ata/libata-zpodd.c
@@ -32,13 +32,14 @@ struct zpodd {
32 32
33static int eject_tray(struct ata_device *dev) 33static int eject_tray(struct ata_device *dev)
34{ 34{
35 struct ata_taskfile tf = {}; 35 struct ata_taskfile tf;
36 const char cdb[] = { GPCMD_START_STOP_UNIT, 36 const char cdb[] = { GPCMD_START_STOP_UNIT,
37 0, 0, 0, 37 0, 0, 0,
38 0x02, /* LoEj */ 38 0x02, /* LoEj */
39 0, 0, 0, 0, 0, 0, 0, 39 0, 0, 0, 0, 0, 0, 0,
40 }; 40 };
41 41
42 ata_tf_init(dev, &tf);
42 tf.flags = ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE; 43 tf.flags = ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE;
43 tf.command = ATA_CMD_PACKET; 44 tf.command = ATA_CMD_PACKET;
44 tf.protocol = ATAPI_PROT_NODATA; 45 tf.protocol = ATAPI_PROT_NODATA;
@@ -52,8 +53,7 @@ static enum odd_mech_type zpodd_get_mech_type(struct ata_device *dev)
52 char buf[16]; 53 char buf[16];
53 unsigned int ret; 54 unsigned int ret;
54 struct rm_feature_desc *desc = (void *)(buf + 8); 55 struct rm_feature_desc *desc = (void *)(buf + 8);
55 struct ata_taskfile tf = {}; 56 struct ata_taskfile tf;
56
57 char cdb[] = { GPCMD_GET_CONFIGURATION, 57 char cdb[] = { GPCMD_GET_CONFIGURATION,
58 2, /* only 1 feature descriptor requested */ 58 2, /* only 1 feature descriptor requested */
59 0, 3, /* 3, removable medium feature */ 59 0, 3, /* 3, removable medium feature */
@@ -62,6 +62,7 @@ static enum odd_mech_type zpodd_get_mech_type(struct ata_device *dev)
62 0, 0, 0, 62 0, 0, 0,
63 }; 63 };
64 64
65 ata_tf_init(dev, &tf);
65 tf.flags = ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE; 66 tf.flags = ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE;
66 tf.command = ATA_CMD_PACKET; 67 tf.command = ATA_CMD_PACKET;
67 tf.protocol = ATAPI_PROT_PIO; 68 tf.protocol = ATAPI_PROT_PIO;