diff options
-rw-r--r-- | drivers/scsi/libata-core.c | 6 | ||||
-rw-r--r-- | include/linux/ata.h | 10 |
2 files changed, 11 insertions, 5 deletions
diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c index 4df5024c3888..d87854e199f6 100644 --- a/drivers/scsi/libata-core.c +++ b/drivers/scsi/libata-core.c | |||
@@ -927,7 +927,6 @@ static void ata_dev_identify(struct ata_port *ap, unsigned int device) | |||
927 | { | 927 | { |
928 | struct ata_device *dev = &ap->device[device]; | 928 | struct ata_device *dev = &ap->device[device]; |
929 | unsigned int major_version; | 929 | unsigned int major_version; |
930 | u16 tmp; | ||
931 | unsigned long xfer_modes; | 930 | unsigned long xfer_modes; |
932 | unsigned int using_edd; | 931 | unsigned int using_edd; |
933 | struct ata_taskfile tf; | 932 | struct ata_taskfile tf; |
@@ -1030,10 +1029,7 @@ retry: | |||
1030 | goto err_out_nosup; | 1029 | goto err_out_nosup; |
1031 | 1030 | ||
1032 | /* get major version */ | 1031 | /* get major version */ |
1033 | tmp = dev->id[ATA_ID_MAJOR_VER]; | 1032 | major_version = ata_id_major_version(dev->id); |
1034 | for (major_version = 14; major_version >= 1; major_version--) | ||
1035 | if (tmp & (1 << major_version)) | ||
1036 | break; | ||
1037 | 1033 | ||
1038 | /* | 1034 | /* |
1039 | * The exact sequence expected by certain pre-ATA4 drives is: | 1035 | * The exact sequence expected by certain pre-ATA4 drives is: |
diff --git a/include/linux/ata.h b/include/linux/ata.h index a8155ca4947f..b02a16c435e7 100644 --- a/include/linux/ata.h +++ b/include/linux/ata.h | |||
@@ -267,6 +267,16 @@ struct ata_taskfile { | |||
267 | ((u64) (id)[(n) + 1] << 16) | \ | 267 | ((u64) (id)[(n) + 1] << 16) | \ |
268 | ((u64) (id)[(n) + 0]) ) | 268 | ((u64) (id)[(n) + 0]) ) |
269 | 269 | ||
270 | static inline unsigned int ata_id_major_version(const u16 *id) | ||
271 | { | ||
272 | unsigned int mver; | ||
273 | |||
274 | for (mver = 14; mver >= 1; mver--) | ||
275 | if (id[ATA_ID_MAJOR_VER] & (1 << mver)) | ||
276 | break; | ||
277 | return mver; | ||
278 | } | ||
279 | |||
270 | static inline int ata_id_current_chs_valid(const u16 *id) | 280 | static inline int ata_id_current_chs_valid(const u16 *id) |
271 | { | 281 | { |
272 | /* For ATA-1 devices, if the INITIALIZE DEVICE PARAMETERS command | 282 | /* For ATA-1 devices, if the INITIALIZE DEVICE PARAMETERS command |