Commit 93734a234447a3c091f76d76f7351af9d4dde518

Authored by Bartlomiej Zolnierkiewicz
1 parent 718c72e83d

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>

Showing 2 changed files with 22 additions and 21 deletions Side-by-side Diff

... ... @@ -509,26 +509,6 @@
509 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 512 static int ide_get_identity_ioctl(ide_drive_t *drive, unsigned int cmd,
533 513 unsigned long arg)
534 514 {
... ... @@ -548,7 +528,7 @@
548 528 }
549 529  
550 530 memcpy(id, drive->id, size);
551   - ide_id_to_hd_driveid(id);
  531 + ata_id_to_hd_driveid(id);
552 532  
553 533 if (copy_to_user((void __user *)arg, id, size))
554 534 rc = -EFAULT;
... ... @@ -30,6 +30,7 @@
30 30 #define __LINUX_ATA_H__
31 31  
32 32 #include <linux/types.h>
  33 +#include <asm/byteorder.h>
33 34  
34 35 /* defines only for the constants which don't work well as enums */
35 36 #define ATA_DMA_BOUNDARY 0xffffUL
... ... @@ -779,6 +780,26 @@
779 780 static inline int atapi_id_dmadir(const u16 *dev_id)
780 781 {
781 782 return ata_id_major_version(dev_id) >= 7 && (dev_id[62] & 0x8000);
  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
782 803 }
783 804  
784 805 static inline int is_multi_taskfile(struct ata_taskfile *tf)