diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-10-10 16:39:31 -0400 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-10-10 16:39:31 -0400 |
commit | 93734a234447a3c091f76d76f7351af9d4dde518 (patch) | |
tree | e133b68a95c54a84fa637893800d6e62b64a48fb | |
parent | 718c72e83da295efc9c8625b6f380ef10352d955 (diff) |
ide: ide_id_to_hd_driveid() -> ata_id_to_hd_driveid()
Rename ide_id_to_hd_driveid() to ata_id_to_hd_driveid()
and move it to <linux/ata.h>.
Cc: Jeff Garzik <jgarzik@pobox.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
-rw-r--r-- | drivers/ide/ide.c | 22 | ||||
-rw-r--r-- | include/linux/ata.h | 21 |
2 files changed, 22 insertions, 21 deletions
diff --git a/drivers/ide/ide.c b/drivers/ide/ide.c index 12618d2aed2c..f42de5fe9bc2 100644 --- a/drivers/ide/ide.c +++ b/drivers/ide/ide.c | |||
@@ -509,26 +509,6 @@ static int generic_drive_reset(ide_drive_t *drive) | |||
509 | return ret; | 509 | return ret; |
510 | } | 510 | } |
511 | 511 | ||
512 | static inline void ide_id_to_hd_driveid(u16 *id) | ||
513 | { | ||
514 | #ifdef __BIG_ENDIAN | ||
515 | /* accessed in struct hd_driveid as 8-bit values */ | ||
516 | id[ATA_ID_MAX_MULTSECT] = __cpu_to_le16(id[ATA_ID_MAX_MULTSECT]); | ||
517 | id[ATA_ID_CAPABILITY] = __cpu_to_le16(id[ATA_ID_CAPABILITY]); | ||
518 | id[ATA_ID_OLD_PIO_MODES] = __cpu_to_le16(id[ATA_ID_OLD_PIO_MODES]); | ||
519 | id[ATA_ID_OLD_DMA_MODES] = __cpu_to_le16(id[ATA_ID_OLD_DMA_MODES]); | ||
520 | id[ATA_ID_MULTSECT] = __cpu_to_le16(id[ATA_ID_MULTSECT]); | ||
521 | |||
522 | /* as 32-bit values */ | ||
523 | *(u32 *)&id[ATA_ID_LBA_CAPACITY] = ata_id_u32(id, ATA_ID_LBA_CAPACITY); | ||
524 | *(u32 *)&id[ATA_ID_SPG] = ata_id_u32(id, ATA_ID_SPG); | ||
525 | |||
526 | /* as 64-bit value */ | ||
527 | *(u64 *)&id[ATA_ID_LBA_CAPACITY_2] = | ||
528 | ata_id_u64(id, ATA_ID_LBA_CAPACITY_2); | ||
529 | #endif | ||
530 | } | ||
531 | |||
532 | static int ide_get_identity_ioctl(ide_drive_t *drive, unsigned int cmd, | 512 | static int ide_get_identity_ioctl(ide_drive_t *drive, unsigned int cmd, |
533 | unsigned long arg) | 513 | unsigned long arg) |
534 | { | 514 | { |
@@ -548,7 +528,7 @@ static int ide_get_identity_ioctl(ide_drive_t *drive, unsigned int cmd, | |||
548 | } | 528 | } |
549 | 529 | ||
550 | memcpy(id, drive->id, size); | 530 | memcpy(id, drive->id, size); |
551 | ide_id_to_hd_driveid(id); | 531 | ata_id_to_hd_driveid(id); |
552 | 532 | ||
553 | if (copy_to_user((void __user *)arg, id, size)) | 533 | if (copy_to_user((void __user *)arg, id, size)) |
554 | rc = -EFAULT; | 534 | rc = -EFAULT; |
diff --git a/include/linux/ata.h b/include/linux/ata.h index 81d9adeb819e..4c3f50070033 100644 --- a/include/linux/ata.h +++ b/include/linux/ata.h | |||
@@ -30,6 +30,7 @@ | |||
30 | #define __LINUX_ATA_H__ | 30 | #define __LINUX_ATA_H__ |
31 | 31 | ||
32 | #include <linux/types.h> | 32 | #include <linux/types.h> |
33 | #include <asm/byteorder.h> | ||
33 | 34 | ||
34 | /* defines only for the constants which don't work well as enums */ | 35 | /* defines only for the constants which don't work well as enums */ |
35 | #define ATA_DMA_BOUNDARY 0xffffUL | 36 | #define ATA_DMA_BOUNDARY 0xffffUL |
@@ -781,6 +782,26 @@ static inline int atapi_id_dmadir(const u16 *dev_id) | |||
781 | return ata_id_major_version(dev_id) >= 7 && (dev_id[62] & 0x8000); | 782 | return ata_id_major_version(dev_id) >= 7 && (dev_id[62] & 0x8000); |
782 | } | 783 | } |
783 | 784 | ||
785 | static inline void ata_id_to_hd_driveid(u16 *id) | ||
786 | { | ||
787 | #ifdef __BIG_ENDIAN | ||
788 | /* accessed in struct hd_driveid as 8-bit values */ | ||
789 | id[ATA_ID_MAX_MULTSECT] = __cpu_to_le16(id[ATA_ID_MAX_MULTSECT]); | ||
790 | id[ATA_ID_CAPABILITY] = __cpu_to_le16(id[ATA_ID_CAPABILITY]); | ||
791 | id[ATA_ID_OLD_PIO_MODES] = __cpu_to_le16(id[ATA_ID_OLD_PIO_MODES]); | ||
792 | id[ATA_ID_OLD_DMA_MODES] = __cpu_to_le16(id[ATA_ID_OLD_DMA_MODES]); | ||
793 | id[ATA_ID_MULTSECT] = __cpu_to_le16(id[ATA_ID_MULTSECT]); | ||
794 | |||
795 | /* as 32-bit values */ | ||
796 | *(u32 *)&id[ATA_ID_LBA_CAPACITY] = ata_id_u32(id, ATA_ID_LBA_CAPACITY); | ||
797 | *(u32 *)&id[ATA_ID_SPG] = ata_id_u32(id, ATA_ID_SPG); | ||
798 | |||
799 | /* as 64-bit value */ | ||
800 | *(u64 *)&id[ATA_ID_LBA_CAPACITY_2] = | ||
801 | ata_id_u64(id, ATA_ID_LBA_CAPACITY_2); | ||
802 | #endif | ||
803 | } | ||
804 | |||
784 | static inline int is_multi_taskfile(struct ata_taskfile *tf) | 805 | static inline int is_multi_taskfile(struct ata_taskfile *tf) |
785 | { | 806 | { |
786 | return (tf->command == ATA_CMD_READ_MULTI) || | 807 | return (tf->command == ATA_CMD_READ_MULTI) || |