aboutsummaryrefslogtreecommitdiff
path: root/miscutils/hdparm.c
diff options
context:
space:
mode:
Diffstat (limited to 'miscutils/hdparm.c')
-rw-r--r--miscutils/hdparm.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/miscutils/hdparm.c b/miscutils/hdparm.c
index ea73701c3..55ed2f6ff 100644
--- a/miscutils/hdparm.c
+++ b/miscutils/hdparm.c
@@ -26,7 +26,6 @@
26#include <getopt.h> 26#include <getopt.h>
27#include <linux/types.h> 27#include <linux/types.h>
28#include <linux/hdreg.h> 28#include <linux/hdreg.h>
29#include <asm/byteorder.h>
30 29
31#if BB_BIG_ENDIAN && !defined(__USE_XOPEN) 30#if BB_BIG_ENDIAN && !defined(__USE_XOPEN)
32# define __USE_XOPEN 31# define __USE_XOPEN
@@ -2007,9 +2006,9 @@ static void process_dev(char *devname)
2007 args1[0] = WIN_IDENTIFY; 2006 args1[0] = WIN_IDENTIFY;
2008 args1[3] = 1; 2007 args1[3] = 1;
2009 if (!bb_ioctl_alt(fd, HDIO_DRIVE_CMD, args1, WIN_PIDENTIFY, "HDIO_DRIVE_CMD(identify)")) { 2008 if (!bb_ioctl_alt(fd, HDIO_DRIVE_CMD, args1, WIN_PIDENTIFY, "HDIO_DRIVE_CMD(identify)")) {
2010 for (i=0; i<(sizeof args1)/2; i+=2) 2009 uint16_t *ptr = (uint16_t *)args1;
2011 __le16_to_cpus((uint16_t *)(&args1[i])); 2010 for (i=0; i<sizeof(args1)/2; i++) ptr[i] = SWAP_LE16(ptr[i]);
2012 identify((void *)&args1[4]); 2011 identify((void *)(ptr+2));
2013 } 2012 }
2014 } 2013 }
2015#endif 2014#endif
@@ -2057,7 +2056,7 @@ static int fromhex(unsigned char c)
2057 2056
2058static void identify_from_stdin(void) 2057static void identify_from_stdin(void)
2059{ 2058{
2060 unsigned short sbuf[800]; 2059 uint16_t sbuf[800];
2061 unsigned char buf[1600], *b = (unsigned char *)buf; 2060 unsigned char buf[1600], *b = (unsigned char *)buf;
2062 int i, count = read(0, buf, 1280); 2061 int i, count = read(0, buf, 1280);
2063 2062
@@ -2066,8 +2065,7 @@ static void identify_from_stdin(void)
2066 2065
2067 for (i = 0; count >= 4; ++i) 2066 for (i = 0; count >= 4; ++i)
2068 { 2067 {
2069 sbuf[i] = (fromhex(b[0]) << 12) | (fromhex(b[1]) << 8) | (fromhex(b[2]) << 4) | fromhex(b[3]); 2068 sbuf[i] = SWAP_LE16((fromhex(b[0]) << 12) | (fromhex(b[1]) << 8) | (fromhex(b[2]) << 4) | fromhex(b[3]));
2070 __le16_to_cpus((uint16_t *)(&sbuf[i]));
2071 b += 5; 2069 b += 5;
2072 count -= 5; 2070 count -= 5;
2073 } 2071 }