Re: [PATCH 1/2] ide: Add tx4939ide driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello, I wrote:

+static void mm_insw_swap(unsigned long port, void *addr, u32 count)
+{
+    unsigned short *ptr = addr;
+    unsigned long size = count * 2;
+    port &= ~1;
+    while (count--)
+        *ptr++ = le16_to_cpu(__raw_readw((void __iomem *)port));
+    __ide_flush_dcache_range((unsigned long)addr, size);
+}
+static void mm_outsw_swap(unsigned long port, void *addr, u32 count)
+{
+    unsigned short *ptr = addr;
+    unsigned long size = count * 2;
+    port &= ~1;
+    while (count--) {
+        __raw_writew(cpu_to_le16(*ptr), (void __iomem *)port);
+        ptr++;
+    }
+    __ide_flush_dcache_range((unsigned long)addr, size);
+}

Hum... but is it really correct to convert from/to LE order above? I'm prett sure that data is expected in LE order -- look ar ide_fix_driveid() for example...


Assuming that the IDE data words' MSB appears at offset 6 and LSB at offset 7 (which would seem logical), the data is actually in BE (CPU) orger, so
mm_insw_swap() should use cpu_to_le16() and mm_outsw_swap() le16_to_cpu()...

MBR, Sergei


--
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Filesystems]     [Linux SCSI]     [Linux RAID]     [Git]     [Kernel Newbies]     [Linux Newbie]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Samba]     [Device Mapper]

  Powered by Linux