aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/memstick
diff options
context:
space:
mode:
authorHarvey Harrison <harvey.harrison@gmail.com>2009-01-09 19:40:56 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2009-01-09 19:54:41 -0500
commit69347a236b22c3962ea812511495e502dedfd50c (patch)
tree9b609fe30cd1fe4e9e1b9f7e11493235ebfda6b8 /drivers/memstick
parentfe8e4e039dc3680681bf51af097af391f87038f8 (diff)
memstick: annotate endianness of attribute structs
The code was shifting the endianness appropriately everywhere, annotate the structs to avoid the sparse warnings when assigning the endian types to the struct members, or passing them to be[16|32]_to_cpu: drivers/memstick/core/mspro_block.c:331:4: warning: cast to restricted __be16 drivers/memstick/core/mspro_block.c:333:4: warning: cast to restricted __be16 drivers/memstick/core/mspro_block.c:335:4: warning: cast to restricted __be16 drivers/memstick/core/mspro_block.c:337:4: warning: cast to restricted __be16 drivers/memstick/core/mspro_block.c:341:4: warning: cast to restricted __be16 drivers/memstick/core/mspro_block.c:347:4: warning: cast to restricted __be32 drivers/memstick/core/mspro_block.c:356:4: warning: cast to restricted __be16 drivers/memstick/core/mspro_block.c:358:4: warning: cast to restricted __be16 drivers/memstick/core/mspro_block.c:364:4: warning: cast to restricted __be16 drivers/memstick/core/mspro_block.c:367:4: warning: cast to restricted __be16 drivers/memstick/core/mspro_block.c:369:4: warning: cast to restricted __be16 drivers/memstick/core/mspro_block.c:371:4: warning: cast to restricted __be16 drivers/memstick/core/mspro_block.c:377:4: warning: cast to restricted __be16 drivers/memstick/core/mspro_block.c:478:4: warning: cast to restricted __be16 drivers/memstick/core/mspro_block.c:480:4: warning: cast to restricted __be16 drivers/memstick/core/mspro_block.c:482:4: warning: cast to restricted __be16 drivers/memstick/core/mspro_block.c:484:4: warning: cast to restricted __be16 drivers/memstick/core/mspro_block.c:486:4: warning: cast to restricted __be16 drivers/memstick/core/mspro_block.c:689:22: expected unsigned int [unsigned] [assigned] data_address drivers/memstick/core/mspro_block.c:689:22: got restricted __be32 [usertype] <noident> drivers/memstick/core/mspro_block.c:697:3: warning: cast to restricted __be32 drivers/memstick/core/mspro_block.c:960:17: warning: incorrect type in initializer (different base types) drivers/memstick/core/mspro_block.c:960:17: expected unsigned short [unsigned] data_count drivers/memstick/core/mspro_block.c:960:17: got restricted __be16 [usertype] <noident> drivers/memstick/core/mspro_block.c:993:6: warning: cast to restricted __be16 drivers/memstick/core/mspro_block.c:995:28: warning: cast to restricted __be16 Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com> Cc: Alex Dubov <oakad@yahoo.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/memstick')
-rw-r--r--drivers/memstick/core/mspro_block.c43
1 files changed, 21 insertions, 22 deletions
diff --git a/drivers/memstick/core/mspro_block.c b/drivers/memstick/core/mspro_block.c
index 1f1e3982b1aa..de143deb06f0 100644
--- a/drivers/memstick/core/mspro_block.c
+++ b/drivers/memstick/core/mspro_block.c
@@ -52,14 +52,14 @@ struct mspro_sys_attr {
52}; 52};
53 53
54struct mspro_attr_entry { 54struct mspro_attr_entry {
55 unsigned int address; 55 __be32 address;
56 unsigned int size; 56 __be32 size;
57 unsigned char id; 57 unsigned char id;
58 unsigned char reserved[3]; 58 unsigned char reserved[3];
59} __attribute__((packed)); 59} __attribute__((packed));
60 60
61struct mspro_attribute { 61struct mspro_attribute {
62 unsigned short signature; 62 __be16 signature;
63 unsigned short version; 63 unsigned short version;
64 unsigned char count; 64 unsigned char count;
65 unsigned char reserved[11]; 65 unsigned char reserved[11];
@@ -69,28 +69,28 @@ struct mspro_attribute {
69struct mspro_sys_info { 69struct mspro_sys_info {
70 unsigned char class; 70 unsigned char class;
71 unsigned char reserved0; 71 unsigned char reserved0;
72 unsigned short block_size; 72 __be16 block_size;
73 unsigned short block_count; 73 __be16 block_count;
74 unsigned short user_block_count; 74 __be16 user_block_count;
75 unsigned short page_size; 75 __be16 page_size;
76 unsigned char reserved1[2]; 76 unsigned char reserved1[2];
77 unsigned char assembly_date[8]; 77 unsigned char assembly_date[8];
78 unsigned int serial_number; 78 __be32 serial_number;
79 unsigned char assembly_maker_code; 79 unsigned char assembly_maker_code;
80 unsigned char assembly_model_code[3]; 80 unsigned char assembly_model_code[3];
81 unsigned short memory_maker_code; 81 __be16 memory_maker_code;
82 unsigned short memory_model_code; 82 __be16 memory_model_code;
83 unsigned char reserved2[4]; 83 unsigned char reserved2[4];
84 unsigned char vcc; 84 unsigned char vcc;
85 unsigned char vpp; 85 unsigned char vpp;
86 unsigned short controller_number; 86 __be16 controller_number;
87 unsigned short controller_function; 87 __be16 controller_function;
88 unsigned short start_sector; 88 __be16 start_sector;
89 unsigned short unit_size; 89 __be16 unit_size;
90 unsigned char ms_sub_class; 90 unsigned char ms_sub_class;
91 unsigned char reserved3[4]; 91 unsigned char reserved3[4];
92 unsigned char interface_type; 92 unsigned char interface_type;
93 unsigned short controller_code; 93 __be16 controller_code;
94 unsigned char format_type; 94 unsigned char format_type;
95 unsigned char reserved4; 95 unsigned char reserved4;
96 unsigned char device_type; 96 unsigned char device_type;
@@ -124,11 +124,11 @@ struct mspro_specfile {
124} __attribute__((packed)); 124} __attribute__((packed));
125 125
126struct mspro_devinfo { 126struct mspro_devinfo {
127 unsigned short cylinders; 127 __be16 cylinders;
128 unsigned short heads; 128 __be16 heads;
129 unsigned short bytes_per_track; 129 __be16 bytes_per_track;
130 unsigned short bytes_per_sector; 130 __be16 bytes_per_sector;
131 unsigned short sectors_per_track; 131 __be16 sectors_per_track;
132 unsigned char reserved[6]; 132 unsigned char reserved[6];
133} __attribute__((packed)); 133} __attribute__((packed));
134 134
@@ -338,8 +338,7 @@ static ssize_t mspro_block_attr_show_sysinfo(struct device *dev,
338 rc += scnprintf(buffer + rc, PAGE_SIZE - rc, "assembly date: " 338 rc += scnprintf(buffer + rc, PAGE_SIZE - rc, "assembly date: "
339 "GMT%+d:%d %04u-%02u-%02u %02u:%02u:%02u\n", 339 "GMT%+d:%d %04u-%02u-%02u %02u:%02u:%02u\n",
340 date_tz, date_tz_f, 340 date_tz, date_tz_f,
341 be16_to_cpu(*(unsigned short *) 341 be16_to_cpup((__be16 *)&x_sys->assembly_date[1]),
342 &x_sys->assembly_date[1]),
343 x_sys->assembly_date[3], x_sys->assembly_date[4], 342 x_sys->assembly_date[3], x_sys->assembly_date[4],
344 x_sys->assembly_date[5], x_sys->assembly_date[6], 343 x_sys->assembly_date[5], x_sys->assembly_date[6],
345 x_sys->assembly_date[7]); 344 x_sys->assembly_date[7]);