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>

authored by

Harvey Harrison and committed by
Linus Torvalds
69347a23 fe8e4e03

+23 -24
+21 -22
drivers/memstick/core/mspro_block.c
··· 52 52 }; 53 53 54 54 struct mspro_attr_entry { 55 - unsigned int address; 56 - unsigned int size; 55 + __be32 address; 56 + __be32 size; 57 57 unsigned char id; 58 58 unsigned char reserved[3]; 59 59 } __attribute__((packed)); 60 60 61 61 struct mspro_attribute { 62 - unsigned short signature; 62 + __be16 signature; 63 63 unsigned short version; 64 64 unsigned char count; 65 65 unsigned char reserved[11]; ··· 69 69 struct mspro_sys_info { 70 70 unsigned char class; 71 71 unsigned char reserved0; 72 - unsigned short block_size; 73 - unsigned short block_count; 74 - unsigned short user_block_count; 75 - unsigned short page_size; 72 + __be16 block_size; 73 + __be16 block_count; 74 + __be16 user_block_count; 75 + __be16 page_size; 76 76 unsigned char reserved1[2]; 77 77 unsigned char assembly_date[8]; 78 - unsigned int serial_number; 78 + __be32 serial_number; 79 79 unsigned char assembly_maker_code; 80 80 unsigned char assembly_model_code[3]; 81 - unsigned short memory_maker_code; 82 - unsigned short memory_model_code; 81 + __be16 memory_maker_code; 82 + __be16 memory_model_code; 83 83 unsigned char reserved2[4]; 84 84 unsigned char vcc; 85 85 unsigned char vpp; 86 - unsigned short controller_number; 87 - unsigned short controller_function; 88 - unsigned short start_sector; 89 - unsigned short unit_size; 86 + __be16 controller_number; 87 + __be16 controller_function; 88 + __be16 start_sector; 89 + __be16 unit_size; 90 90 unsigned char ms_sub_class; 91 91 unsigned char reserved3[4]; 92 92 unsigned char interface_type; 93 - unsigned short controller_code; 93 + __be16 controller_code; 94 94 unsigned char format_type; 95 95 unsigned char reserved4; 96 96 unsigned char device_type; ··· 124 124 } __attribute__((packed)); 125 125 126 126 struct mspro_devinfo { 127 - unsigned short cylinders; 128 - unsigned short heads; 129 - unsigned short bytes_per_track; 130 - unsigned short bytes_per_sector; 131 - unsigned short sectors_per_track; 127 + __be16 cylinders; 128 + __be16 heads; 129 + __be16 bytes_per_track; 130 + __be16 bytes_per_sector; 131 + __be16 sectors_per_track; 132 132 unsigned char reserved[6]; 133 133 } __attribute__((packed)); 134 134 ··· 338 338 rc += scnprintf(buffer + rc, PAGE_SIZE - rc, "assembly date: " 339 339 "GMT%+d:%d %04u-%02u-%02u %02u:%02u:%02u\n", 340 340 date_tz, date_tz_f, 341 - be16_to_cpu(*(unsigned short *) 342 - &x_sys->assembly_date[1]), 341 + be16_to_cpup((__be16 *)&x_sys->assembly_date[1]), 343 342 x_sys->assembly_date[3], x_sys->assembly_date[4], 344 343 x_sys->assembly_date[5], x_sys->assembly_date[6], 345 344 x_sys->assembly_date[7]);
+2 -2
include/linux/memstick.h
··· 100 100 #define MEMSTICK_SYS_PAR8 0x40 101 101 #define MEMSTICK_SYS_SERIAL 0x80 102 102 103 - unsigned short data_count; 104 - unsigned int data_address; 103 + __be16 data_count; 104 + __be32 data_address; 105 105 unsigned char tpc_param; 106 106 } __attribute__((packed)); 107 107