aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorAlbert Lee <albertcc@tw.ibm.com>2006-03-27 03:39:18 -0500
committerJeff Garzik <jeff@garzik.org>2006-03-29 19:30:28 -0500
commit00b6f5e9e04b2186a71a5892640bb2d8e09a030e (patch)
treef486ef99a0a7e5db563176eda559a8a332297df1 /drivers
parent17efc5f7237995295cbe008828788d187fea3c88 (diff)
[PATCH] libata: ata_dev_init_params() fixes
ata_dev_init_params() fixes: - Get the "heads" and "sectors" parameters from caller instead of implicitly from dev->id[]. - Return AC_ERR_INVALID instead of 0 if an invalid parameter is found Signed-off-by: Albert Lee <albertcc@tw.ibm.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/scsi/libata-core.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c
index ac19505f7f1f..21b0ed583b8a 100644
--- a/drivers/scsi/libata-core.c
+++ b/drivers/scsi/libata-core.c
@@ -62,7 +62,9 @@
62#include "libata.h" 62#include "libata.h"
63 63
64static unsigned int ata_dev_init_params(struct ata_port *ap, 64static unsigned int ata_dev_init_params(struct ata_port *ap,
65 struct ata_device *dev); 65 struct ata_device *dev,
66 u16 heads,
67 u16 sectors);
66static void ata_set_mode(struct ata_port *ap); 68static void ata_set_mode(struct ata_port *ap);
67static unsigned int ata_dev_set_xfermode(struct ata_port *ap, 69static unsigned int ata_dev_set_xfermode(struct ata_port *ap,
68 struct ata_device *dev); 70 struct ata_device *dev);
@@ -1156,7 +1158,7 @@ static int ata_dev_read_id(struct ata_port *ap, struct ata_device *dev,
1156 * Some drives were very specific about that exact sequence. 1158 * Some drives were very specific about that exact sequence.
1157 */ 1159 */
1158 if (ata_id_major_version(id) < 4 || !ata_id_has_lba(id)) { 1160 if (ata_id_major_version(id) < 4 || !ata_id_has_lba(id)) {
1159 err_mask = ata_dev_init_params(ap, dev); 1161 err_mask = ata_dev_init_params(ap, dev, id[3], id[6]);
1160 if (err_mask) { 1162 if (err_mask) {
1161 rc = -EIO; 1163 rc = -EIO;
1162 reason = "INIT_DEV_PARAMS failed"; 1164 reason = "INIT_DEV_PARAMS failed";
@@ -2748,16 +2750,16 @@ static unsigned int ata_dev_set_xfermode(struct ata_port *ap,
2748 */ 2750 */
2749 2751
2750static unsigned int ata_dev_init_params(struct ata_port *ap, 2752static unsigned int ata_dev_init_params(struct ata_port *ap,
2751 struct ata_device *dev) 2753 struct ata_device *dev,
2754 u16 heads,
2755 u16 sectors)
2752{ 2756{
2753 struct ata_taskfile tf; 2757 struct ata_taskfile tf;
2754 unsigned int err_mask; 2758 unsigned int err_mask;
2755 u16 sectors = dev->id[6];
2756 u16 heads = dev->id[3];
2757 2759
2758 /* Number of sectors per track 1-255. Number of heads 1-16 */ 2760 /* Number of sectors per track 1-255. Number of heads 1-16 */
2759 if (sectors < 1 || sectors > 255 || heads < 1 || heads > 16) 2761 if (sectors < 1 || sectors > 255 || heads < 1 || heads > 16)
2760 return 0; 2762 return AC_ERR_INVALID;
2761 2763
2762 /* set up init dev params taskfile */ 2764 /* set up init dev params taskfile */
2763 DPRINTK("init dev params \n"); 2765 DPRINTK("init dev params \n");