diff options
author | Gianluca Gennari <gennarone@gmail.com> | 2012-03-06 07:47:45 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2012-03-19 13:26:02 -0400 |
commit | abf9d005375d6c6160cc9c17e5dcac32e412c8dc (patch) | |
tree | fee45be75c90d5c101c1338dd97e084e272fec72 /drivers/staging | |
parent | 962f8f67e48693d110c26d06089406dd9931474d (diff) |
[media] as102: add __packed attribute to structs defined inside packed structs
This patch fixes a regression in kernel 3.3 due to this patch:
http://patchwork.linuxtv.org/patch/8332/
That patch changes "#pragma pack(1)" with "__packed" attributes, but it is not
complete. In fact, in the as102 driver there are a lot of structs/unions
defined inside other structs/unions.
When the "__packed" attribute is applied only on the external struct, it will
not affect the internal struct definitions.
So the regression is fixed by specifiying the "__packed" attribute also on the
internal structs.
This patch should go into 3.3, as it fixes a regression introduced in the new
kernel version.
Signed-off-by: Gianluca Gennari <gennarone@gmail.com>
Signed-off-by: Ryley Angus <rangus@student.unimelb.edu.au>
Cc: stable@kernel.org # for v3.3
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/staging')
-rw-r--r-- | drivers/staging/media/as102/as102_fw.h | 2 | ||||
-rw-r--r-- | drivers/staging/media/as102/as10x_cmd.h | 80 | ||||
-rw-r--r-- | drivers/staging/media/as102/as10x_types.h | 2 |
3 files changed, 42 insertions, 42 deletions
diff --git a/drivers/staging/media/as102/as102_fw.h b/drivers/staging/media/as102/as102_fw.h index bd21f0554392..4bfc6849d95a 100644 --- a/drivers/staging/media/as102/as102_fw.h +++ b/drivers/staging/media/as102/as102_fw.h | |||
@@ -29,7 +29,7 @@ struct as10x_fw_pkt_t { | |||
29 | union { | 29 | union { |
30 | unsigned char request[2]; | 30 | unsigned char request[2]; |
31 | unsigned char length[2]; | 31 | unsigned char length[2]; |
32 | } u; | 32 | } __packed u; |
33 | struct as10x_raw_fw_pkt raw; | 33 | struct as10x_raw_fw_pkt raw; |
34 | } __packed; | 34 | } __packed; |
35 | 35 | ||
diff --git a/drivers/staging/media/as102/as10x_cmd.h b/drivers/staging/media/as102/as10x_cmd.h index 4ea249e7adab..e21ec6c702a9 100644 --- a/drivers/staging/media/as102/as10x_cmd.h +++ b/drivers/staging/media/as102/as10x_cmd.h | |||
@@ -99,14 +99,14 @@ union as10x_turn_on { | |||
99 | struct { | 99 | struct { |
100 | /* request identifier */ | 100 | /* request identifier */ |
101 | uint16_t proc_id; | 101 | uint16_t proc_id; |
102 | } req; | 102 | } __packed req; |
103 | /* response */ | 103 | /* response */ |
104 | struct { | 104 | struct { |
105 | /* response identifier */ | 105 | /* response identifier */ |
106 | uint16_t proc_id; | 106 | uint16_t proc_id; |
107 | /* error */ | 107 | /* error */ |
108 | uint8_t error; | 108 | uint8_t error; |
109 | } rsp; | 109 | } __packed rsp; |
110 | } __packed; | 110 | } __packed; |
111 | 111 | ||
112 | union as10x_turn_off { | 112 | union as10x_turn_off { |
@@ -114,14 +114,14 @@ union as10x_turn_off { | |||
114 | struct { | 114 | struct { |
115 | /* request identifier */ | 115 | /* request identifier */ |
116 | uint16_t proc_id; | 116 | uint16_t proc_id; |
117 | } req; | 117 | } __packed req; |
118 | /* response */ | 118 | /* response */ |
119 | struct { | 119 | struct { |
120 | /* response identifier */ | 120 | /* response identifier */ |
121 | uint16_t proc_id; | 121 | uint16_t proc_id; |
122 | /* error */ | 122 | /* error */ |
123 | uint8_t err; | 123 | uint8_t err; |
124 | } rsp; | 124 | } __packed rsp; |
125 | } __packed; | 125 | } __packed; |
126 | 126 | ||
127 | union as10x_set_tune { | 127 | union as10x_set_tune { |
@@ -131,14 +131,14 @@ union as10x_set_tune { | |||
131 | uint16_t proc_id; | 131 | uint16_t proc_id; |
132 | /* tune params */ | 132 | /* tune params */ |
133 | struct as10x_tune_args args; | 133 | struct as10x_tune_args args; |
134 | } req; | 134 | } __packed req; |
135 | /* response */ | 135 | /* response */ |
136 | struct { | 136 | struct { |
137 | /* response identifier */ | 137 | /* response identifier */ |
138 | uint16_t proc_id; | 138 | uint16_t proc_id; |
139 | /* response error */ | 139 | /* response error */ |
140 | uint8_t error; | 140 | uint8_t error; |
141 | } rsp; | 141 | } __packed rsp; |
142 | } __packed; | 142 | } __packed; |
143 | 143 | ||
144 | union as10x_get_tune_status { | 144 | union as10x_get_tune_status { |
@@ -146,7 +146,7 @@ union as10x_get_tune_status { | |||
146 | struct { | 146 | struct { |
147 | /* request identifier */ | 147 | /* request identifier */ |
148 | uint16_t proc_id; | 148 | uint16_t proc_id; |
149 | } req; | 149 | } __packed req; |
150 | /* response */ | 150 | /* response */ |
151 | struct { | 151 | struct { |
152 | /* response identifier */ | 152 | /* response identifier */ |
@@ -155,7 +155,7 @@ union as10x_get_tune_status { | |||
155 | uint8_t error; | 155 | uint8_t error; |
156 | /* tune status */ | 156 | /* tune status */ |
157 | struct as10x_tune_status sts; | 157 | struct as10x_tune_status sts; |
158 | } rsp; | 158 | } __packed rsp; |
159 | } __packed; | 159 | } __packed; |
160 | 160 | ||
161 | union as10x_get_tps { | 161 | union as10x_get_tps { |
@@ -163,7 +163,7 @@ union as10x_get_tps { | |||
163 | struct { | 163 | struct { |
164 | /* request identifier */ | 164 | /* request identifier */ |
165 | uint16_t proc_id; | 165 | uint16_t proc_id; |
166 | } req; | 166 | } __packed req; |
167 | /* response */ | 167 | /* response */ |
168 | struct { | 168 | struct { |
169 | /* response identifier */ | 169 | /* response identifier */ |
@@ -172,7 +172,7 @@ union as10x_get_tps { | |||
172 | uint8_t error; | 172 | uint8_t error; |
173 | /* tps details */ | 173 | /* tps details */ |
174 | struct as10x_tps tps; | 174 | struct as10x_tps tps; |
175 | } rsp; | 175 | } __packed rsp; |
176 | } __packed; | 176 | } __packed; |
177 | 177 | ||
178 | union as10x_common { | 178 | union as10x_common { |
@@ -180,14 +180,14 @@ union as10x_common { | |||
180 | struct { | 180 | struct { |
181 | /* request identifier */ | 181 | /* request identifier */ |
182 | uint16_t proc_id; | 182 | uint16_t proc_id; |
183 | } req; | 183 | } __packed req; |
184 | /* response */ | 184 | /* response */ |
185 | struct { | 185 | struct { |
186 | /* response identifier */ | 186 | /* response identifier */ |
187 | uint16_t proc_id; | 187 | uint16_t proc_id; |
188 | /* response error */ | 188 | /* response error */ |
189 | uint8_t error; | 189 | uint8_t error; |
190 | } rsp; | 190 | } __packed rsp; |
191 | } __packed; | 191 | } __packed; |
192 | 192 | ||
193 | union as10x_add_pid_filter { | 193 | union as10x_add_pid_filter { |
@@ -201,7 +201,7 @@ union as10x_add_pid_filter { | |||
201 | uint8_t stream_type; | 201 | uint8_t stream_type; |
202 | /* PID index in filter table */ | 202 | /* PID index in filter table */ |
203 | uint8_t idx; | 203 | uint8_t idx; |
204 | } req; | 204 | } __packed req; |
205 | /* response */ | 205 | /* response */ |
206 | struct { | 206 | struct { |
207 | /* response identifier */ | 207 | /* response identifier */ |
@@ -210,7 +210,7 @@ union as10x_add_pid_filter { | |||
210 | uint8_t error; | 210 | uint8_t error; |
211 | /* Filter id */ | 211 | /* Filter id */ |
212 | uint8_t filter_id; | 212 | uint8_t filter_id; |
213 | } rsp; | 213 | } __packed rsp; |
214 | } __packed; | 214 | } __packed; |
215 | 215 | ||
216 | union as10x_del_pid_filter { | 216 | union as10x_del_pid_filter { |
@@ -220,14 +220,14 @@ union as10x_del_pid_filter { | |||
220 | uint16_t proc_id; | 220 | uint16_t proc_id; |
221 | /* PID to remove */ | 221 | /* PID to remove */ |
222 | uint16_t pid; | 222 | uint16_t pid; |
223 | } req; | 223 | } __packed req; |
224 | /* response */ | 224 | /* response */ |
225 | struct { | 225 | struct { |
226 | /* response identifier */ | 226 | /* response identifier */ |
227 | uint16_t proc_id; | 227 | uint16_t proc_id; |
228 | /* response error */ | 228 | /* response error */ |
229 | uint8_t error; | 229 | uint8_t error; |
230 | } rsp; | 230 | } __packed rsp; |
231 | } __packed; | 231 | } __packed; |
232 | 232 | ||
233 | union as10x_start_streaming { | 233 | union as10x_start_streaming { |
@@ -235,14 +235,14 @@ union as10x_start_streaming { | |||
235 | struct { | 235 | struct { |
236 | /* request identifier */ | 236 | /* request identifier */ |
237 | uint16_t proc_id; | 237 | uint16_t proc_id; |
238 | } req; | 238 | } __packed req; |
239 | /* response */ | 239 | /* response */ |
240 | struct { | 240 | struct { |
241 | /* response identifier */ | 241 | /* response identifier */ |
242 | uint16_t proc_id; | 242 | uint16_t proc_id; |
243 | /* error */ | 243 | /* error */ |
244 | uint8_t error; | 244 | uint8_t error; |
245 | } rsp; | 245 | } __packed rsp; |
246 | } __packed; | 246 | } __packed; |
247 | 247 | ||
248 | union as10x_stop_streaming { | 248 | union as10x_stop_streaming { |
@@ -250,14 +250,14 @@ union as10x_stop_streaming { | |||
250 | struct { | 250 | struct { |
251 | /* request identifier */ | 251 | /* request identifier */ |
252 | uint16_t proc_id; | 252 | uint16_t proc_id; |
253 | } req; | 253 | } __packed req; |
254 | /* response */ | 254 | /* response */ |
255 | struct { | 255 | struct { |
256 | /* response identifier */ | 256 | /* response identifier */ |
257 | uint16_t proc_id; | 257 | uint16_t proc_id; |
258 | /* error */ | 258 | /* error */ |
259 | uint8_t error; | 259 | uint8_t error; |
260 | } rsp; | 260 | } __packed rsp; |
261 | } __packed; | 261 | } __packed; |
262 | 262 | ||
263 | union as10x_get_demod_stats { | 263 | union as10x_get_demod_stats { |
@@ -265,7 +265,7 @@ union as10x_get_demod_stats { | |||
265 | struct { | 265 | struct { |
266 | /* request identifier */ | 266 | /* request identifier */ |
267 | uint16_t proc_id; | 267 | uint16_t proc_id; |
268 | } req; | 268 | } __packed req; |
269 | /* response */ | 269 | /* response */ |
270 | struct { | 270 | struct { |
271 | /* response identifier */ | 271 | /* response identifier */ |
@@ -274,7 +274,7 @@ union as10x_get_demod_stats { | |||
274 | uint8_t error; | 274 | uint8_t error; |
275 | /* demod stats */ | 275 | /* demod stats */ |
276 | struct as10x_demod_stats stats; | 276 | struct as10x_demod_stats stats; |
277 | } rsp; | 277 | } __packed rsp; |
278 | } __packed; | 278 | } __packed; |
279 | 279 | ||
280 | union as10x_get_impulse_resp { | 280 | union as10x_get_impulse_resp { |
@@ -282,7 +282,7 @@ union as10x_get_impulse_resp { | |||
282 | struct { | 282 | struct { |
283 | /* request identifier */ | 283 | /* request identifier */ |
284 | uint16_t proc_id; | 284 | uint16_t proc_id; |
285 | } req; | 285 | } __packed req; |
286 | /* response */ | 286 | /* response */ |
287 | struct { | 287 | struct { |
288 | /* response identifier */ | 288 | /* response identifier */ |
@@ -291,7 +291,7 @@ union as10x_get_impulse_resp { | |||
291 | uint8_t error; | 291 | uint8_t error; |
292 | /* impulse response ready */ | 292 | /* impulse response ready */ |
293 | uint8_t is_ready; | 293 | uint8_t is_ready; |
294 | } rsp; | 294 | } __packed rsp; |
295 | } __packed; | 295 | } __packed; |
296 | 296 | ||
297 | union as10x_fw_context { | 297 | union as10x_fw_context { |
@@ -305,7 +305,7 @@ union as10x_fw_context { | |||
305 | uint16_t tag; | 305 | uint16_t tag; |
306 | /* context request type */ | 306 | /* context request type */ |
307 | uint16_t type; | 307 | uint16_t type; |
308 | } req; | 308 | } __packed req; |
309 | /* response */ | 309 | /* response */ |
310 | struct { | 310 | struct { |
311 | /* response identifier */ | 311 | /* response identifier */ |
@@ -316,7 +316,7 @@ union as10x_fw_context { | |||
316 | uint16_t type; | 316 | uint16_t type; |
317 | /* error */ | 317 | /* error */ |
318 | uint8_t error; | 318 | uint8_t error; |
319 | } rsp; | 319 | } __packed rsp; |
320 | } __packed; | 320 | } __packed; |
321 | 321 | ||
322 | union as10x_set_register { | 322 | union as10x_set_register { |
@@ -328,14 +328,14 @@ union as10x_set_register { | |||
328 | struct as10x_register_addr reg_addr; | 328 | struct as10x_register_addr reg_addr; |
329 | /* register content */ | 329 | /* register content */ |
330 | struct as10x_register_value reg_val; | 330 | struct as10x_register_value reg_val; |
331 | } req; | 331 | } __packed req; |
332 | /* response */ | 332 | /* response */ |
333 | struct { | 333 | struct { |
334 | /* response identifier */ | 334 | /* response identifier */ |
335 | uint16_t proc_id; | 335 | uint16_t proc_id; |
336 | /* error */ | 336 | /* error */ |
337 | uint8_t error; | 337 | uint8_t error; |
338 | } rsp; | 338 | } __packed rsp; |
339 | } __packed; | 339 | } __packed; |
340 | 340 | ||
341 | union as10x_get_register { | 341 | union as10x_get_register { |
@@ -345,7 +345,7 @@ union as10x_get_register { | |||
345 | uint16_t proc_id; | 345 | uint16_t proc_id; |
346 | /* register description */ | 346 | /* register description */ |
347 | struct as10x_register_addr reg_addr; | 347 | struct as10x_register_addr reg_addr; |
348 | } req; | 348 | } __packed req; |
349 | /* response */ | 349 | /* response */ |
350 | struct { | 350 | struct { |
351 | /* response identifier */ | 351 | /* response identifier */ |
@@ -354,7 +354,7 @@ union as10x_get_register { | |||
354 | uint8_t error; | 354 | uint8_t error; |
355 | /* register content */ | 355 | /* register content */ |
356 | struct as10x_register_value reg_val; | 356 | struct as10x_register_value reg_val; |
357 | } rsp; | 357 | } __packed rsp; |
358 | } __packed; | 358 | } __packed; |
359 | 359 | ||
360 | union as10x_cfg_change_mode { | 360 | union as10x_cfg_change_mode { |
@@ -364,14 +364,14 @@ union as10x_cfg_change_mode { | |||
364 | uint16_t proc_id; | 364 | uint16_t proc_id; |
365 | /* mode */ | 365 | /* mode */ |
366 | uint8_t mode; | 366 | uint8_t mode; |
367 | } req; | 367 | } __packed req; |
368 | /* response */ | 368 | /* response */ |
369 | struct { | 369 | struct { |
370 | /* response identifier */ | 370 | /* response identifier */ |
371 | uint16_t proc_id; | 371 | uint16_t proc_id; |
372 | /* error */ | 372 | /* error */ |
373 | uint8_t error; | 373 | uint8_t error; |
374 | } rsp; | 374 | } __packed rsp; |
375 | } __packed; | 375 | } __packed; |
376 | 376 | ||
377 | struct as10x_cmd_header_t { | 377 | struct as10x_cmd_header_t { |
@@ -394,7 +394,7 @@ union as10x_dump_memory { | |||
394 | struct as10x_register_addr reg_addr; | 394 | struct as10x_register_addr reg_addr; |
395 | /* nb blocks to read */ | 395 | /* nb blocks to read */ |
396 | uint16_t num_blocks; | 396 | uint16_t num_blocks; |
397 | } req; | 397 | } __packed req; |
398 | /* response */ | 398 | /* response */ |
399 | struct { | 399 | struct { |
400 | /* response identifier */ | 400 | /* response identifier */ |
@@ -408,8 +408,8 @@ union as10x_dump_memory { | |||
408 | uint8_t data8[DUMP_BLOCK_SIZE]; | 408 | uint8_t data8[DUMP_BLOCK_SIZE]; |
409 | uint16_t data16[DUMP_BLOCK_SIZE / sizeof(uint16_t)]; | 409 | uint16_t data16[DUMP_BLOCK_SIZE / sizeof(uint16_t)]; |
410 | uint32_t data32[DUMP_BLOCK_SIZE / sizeof(uint32_t)]; | 410 | uint32_t data32[DUMP_BLOCK_SIZE / sizeof(uint32_t)]; |
411 | } u; | 411 | } __packed u; |
412 | } rsp; | 412 | } __packed rsp; |
413 | } __packed; | 413 | } __packed; |
414 | 414 | ||
415 | union as10x_dumplog_memory { | 415 | union as10x_dumplog_memory { |
@@ -418,7 +418,7 @@ union as10x_dumplog_memory { | |||
418 | uint16_t proc_id; | 418 | uint16_t proc_id; |
419 | /* dump memory type request */ | 419 | /* dump memory type request */ |
420 | uint8_t dump_req; | 420 | uint8_t dump_req; |
421 | } req; | 421 | } __packed req; |
422 | struct { | 422 | struct { |
423 | /* request identifier */ | 423 | /* request identifier */ |
424 | uint16_t proc_id; | 424 | uint16_t proc_id; |
@@ -428,7 +428,7 @@ union as10x_dumplog_memory { | |||
428 | uint8_t dump_rsp; | 428 | uint8_t dump_rsp; |
429 | /* dump data */ | 429 | /* dump data */ |
430 | uint8_t data[DUMP_BLOCK_SIZE]; | 430 | uint8_t data[DUMP_BLOCK_SIZE]; |
431 | } rsp; | 431 | } __packed rsp; |
432 | } __packed; | 432 | } __packed; |
433 | 433 | ||
434 | union as10x_raw_data { | 434 | union as10x_raw_data { |
@@ -437,14 +437,14 @@ union as10x_raw_data { | |||
437 | uint16_t proc_id; | 437 | uint16_t proc_id; |
438 | uint8_t data[64 - sizeof(struct as10x_cmd_header_t) | 438 | uint8_t data[64 - sizeof(struct as10x_cmd_header_t) |
439 | - 2 /* proc_id */]; | 439 | - 2 /* proc_id */]; |
440 | } req; | 440 | } __packed req; |
441 | /* response */ | 441 | /* response */ |
442 | struct { | 442 | struct { |
443 | uint16_t proc_id; | 443 | uint16_t proc_id; |
444 | uint8_t error; | 444 | uint8_t error; |
445 | uint8_t data[64 - sizeof(struct as10x_cmd_header_t) | 445 | uint8_t data[64 - sizeof(struct as10x_cmd_header_t) |
446 | - 2 /* proc_id */ - 1 /* rc */]; | 446 | - 2 /* proc_id */ - 1 /* rc */]; |
447 | } rsp; | 447 | } __packed rsp; |
448 | } __packed; | 448 | } __packed; |
449 | 449 | ||
450 | struct as10x_cmd_t { | 450 | struct as10x_cmd_t { |
@@ -469,7 +469,7 @@ struct as10x_cmd_t { | |||
469 | union as10x_dump_memory dump_memory; | 469 | union as10x_dump_memory dump_memory; |
470 | union as10x_dumplog_memory dumplog_memory; | 470 | union as10x_dumplog_memory dumplog_memory; |
471 | union as10x_raw_data raw_data; | 471 | union as10x_raw_data raw_data; |
472 | } body; | 472 | } __packed body; |
473 | } __packed; | 473 | } __packed; |
474 | 474 | ||
475 | struct as10x_token_cmd_t { | 475 | struct as10x_token_cmd_t { |
diff --git a/drivers/staging/media/as102/as10x_types.h b/drivers/staging/media/as102/as10x_types.h index fde8140ae88b..af26e057d9a2 100644 --- a/drivers/staging/media/as102/as10x_types.h +++ b/drivers/staging/media/as102/as10x_types.h | |||
@@ -181,7 +181,7 @@ struct as10x_register_value { | |||
181 | uint8_t value8; /* 8 bit value */ | 181 | uint8_t value8; /* 8 bit value */ |
182 | uint16_t value16; /* 16 bit value */ | 182 | uint16_t value16; /* 16 bit value */ |
183 | uint32_t value32; /* 32 bit value */ | 183 | uint32_t value32; /* 32 bit value */ |
184 | } u; | 184 | } __packed u; |
185 | } __packed; | 185 | } __packed; |
186 | 186 | ||
187 | struct as10x_register_addr { | 187 | struct as10x_register_addr { |