Commit abf9d005 authored by Gianluca Gennari's avatar Gianluca Gennari Committed by Mauro Carvalho Chehab

[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: default avatarGianluca Gennari <gennarone@gmail.com>
Signed-off-by: default avatarRyley Angus <rangus@student.unimelb.edu.au>
Cc: stable@kernel.org # for v3.3
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 962f8f67
...@@ -29,7 +29,7 @@ struct as10x_fw_pkt_t { ...@@ -29,7 +29,7 @@ struct as10x_fw_pkt_t {
union { union {
unsigned char request[2]; unsigned char request[2];
unsigned char length[2]; unsigned char length[2];
} u; } __packed u;
struct as10x_raw_fw_pkt raw; struct as10x_raw_fw_pkt raw;
} __packed; } __packed;
......
...@@ -99,14 +99,14 @@ union as10x_turn_on { ...@@ -99,14 +99,14 @@ union as10x_turn_on {
struct { struct {
/* request identifier */ /* request identifier */
uint16_t proc_id; uint16_t proc_id;
} req; } __packed req;
/* response */ /* response */
struct { struct {
/* response identifier */ /* response identifier */
uint16_t proc_id; uint16_t proc_id;
/* error */ /* error */
uint8_t error; uint8_t error;
} rsp; } __packed rsp;
} __packed; } __packed;
union as10x_turn_off { union as10x_turn_off {
...@@ -114,14 +114,14 @@ union as10x_turn_off { ...@@ -114,14 +114,14 @@ union as10x_turn_off {
struct { struct {
/* request identifier */ /* request identifier */
uint16_t proc_id; uint16_t proc_id;
} req; } __packed req;
/* response */ /* response */
struct { struct {
/* response identifier */ /* response identifier */
uint16_t proc_id; uint16_t proc_id;
/* error */ /* error */
uint8_t err; uint8_t err;
} rsp; } __packed rsp;
} __packed; } __packed;
union as10x_set_tune { union as10x_set_tune {
...@@ -131,14 +131,14 @@ union as10x_set_tune { ...@@ -131,14 +131,14 @@ union as10x_set_tune {
uint16_t proc_id; uint16_t proc_id;
/* tune params */ /* tune params */
struct as10x_tune_args args; struct as10x_tune_args args;
} req; } __packed req;
/* response */ /* response */
struct { struct {
/* response identifier */ /* response identifier */
uint16_t proc_id; uint16_t proc_id;
/* response error */ /* response error */
uint8_t error; uint8_t error;
} rsp; } __packed rsp;
} __packed; } __packed;
union as10x_get_tune_status { union as10x_get_tune_status {
...@@ -146,7 +146,7 @@ union as10x_get_tune_status { ...@@ -146,7 +146,7 @@ union as10x_get_tune_status {
struct { struct {
/* request identifier */ /* request identifier */
uint16_t proc_id; uint16_t proc_id;
} req; } __packed req;
/* response */ /* response */
struct { struct {
/* response identifier */ /* response identifier */
...@@ -155,7 +155,7 @@ union as10x_get_tune_status { ...@@ -155,7 +155,7 @@ union as10x_get_tune_status {
uint8_t error; uint8_t error;
/* tune status */ /* tune status */
struct as10x_tune_status sts; struct as10x_tune_status sts;
} rsp; } __packed rsp;
} __packed; } __packed;
union as10x_get_tps { union as10x_get_tps {
...@@ -163,7 +163,7 @@ union as10x_get_tps { ...@@ -163,7 +163,7 @@ union as10x_get_tps {
struct { struct {
/* request identifier */ /* request identifier */
uint16_t proc_id; uint16_t proc_id;
} req; } __packed req;
/* response */ /* response */
struct { struct {
/* response identifier */ /* response identifier */
...@@ -172,7 +172,7 @@ union as10x_get_tps { ...@@ -172,7 +172,7 @@ union as10x_get_tps {
uint8_t error; uint8_t error;
/* tps details */ /* tps details */
struct as10x_tps tps; struct as10x_tps tps;
} rsp; } __packed rsp;
} __packed; } __packed;
union as10x_common { union as10x_common {
...@@ -180,14 +180,14 @@ union as10x_common { ...@@ -180,14 +180,14 @@ union as10x_common {
struct { struct {
/* request identifier */ /* request identifier */
uint16_t proc_id; uint16_t proc_id;
} req; } __packed req;
/* response */ /* response */
struct { struct {
/* response identifier */ /* response identifier */
uint16_t proc_id; uint16_t proc_id;
/* response error */ /* response error */
uint8_t error; uint8_t error;
} rsp; } __packed rsp;
} __packed; } __packed;
union as10x_add_pid_filter { union as10x_add_pid_filter {
...@@ -201,7 +201,7 @@ union as10x_add_pid_filter { ...@@ -201,7 +201,7 @@ union as10x_add_pid_filter {
uint8_t stream_type; uint8_t stream_type;
/* PID index in filter table */ /* PID index in filter table */
uint8_t idx; uint8_t idx;
} req; } __packed req;
/* response */ /* response */
struct { struct {
/* response identifier */ /* response identifier */
...@@ -210,7 +210,7 @@ union as10x_add_pid_filter { ...@@ -210,7 +210,7 @@ union as10x_add_pid_filter {
uint8_t error; uint8_t error;
/* Filter id */ /* Filter id */
uint8_t filter_id; uint8_t filter_id;
} rsp; } __packed rsp;
} __packed; } __packed;
union as10x_del_pid_filter { union as10x_del_pid_filter {
...@@ -220,14 +220,14 @@ union as10x_del_pid_filter { ...@@ -220,14 +220,14 @@ union as10x_del_pid_filter {
uint16_t proc_id; uint16_t proc_id;
/* PID to remove */ /* PID to remove */
uint16_t pid; uint16_t pid;
} req; } __packed req;
/* response */ /* response */
struct { struct {
/* response identifier */ /* response identifier */
uint16_t proc_id; uint16_t proc_id;
/* response error */ /* response error */
uint8_t error; uint8_t error;
} rsp; } __packed rsp;
} __packed; } __packed;
union as10x_start_streaming { union as10x_start_streaming {
...@@ -235,14 +235,14 @@ union as10x_start_streaming { ...@@ -235,14 +235,14 @@ union as10x_start_streaming {
struct { struct {
/* request identifier */ /* request identifier */
uint16_t proc_id; uint16_t proc_id;
} req; } __packed req;
/* response */ /* response */
struct { struct {
/* response identifier */ /* response identifier */
uint16_t proc_id; uint16_t proc_id;
/* error */ /* error */
uint8_t error; uint8_t error;
} rsp; } __packed rsp;
} __packed; } __packed;
union as10x_stop_streaming { union as10x_stop_streaming {
...@@ -250,14 +250,14 @@ union as10x_stop_streaming { ...@@ -250,14 +250,14 @@ union as10x_stop_streaming {
struct { struct {
/* request identifier */ /* request identifier */
uint16_t proc_id; uint16_t proc_id;
} req; } __packed req;
/* response */ /* response */
struct { struct {
/* response identifier */ /* response identifier */
uint16_t proc_id; uint16_t proc_id;
/* error */ /* error */
uint8_t error; uint8_t error;
} rsp; } __packed rsp;
} __packed; } __packed;
union as10x_get_demod_stats { union as10x_get_demod_stats {
...@@ -265,7 +265,7 @@ union as10x_get_demod_stats { ...@@ -265,7 +265,7 @@ union as10x_get_demod_stats {
struct { struct {
/* request identifier */ /* request identifier */
uint16_t proc_id; uint16_t proc_id;
} req; } __packed req;
/* response */ /* response */
struct { struct {
/* response identifier */ /* response identifier */
...@@ -274,7 +274,7 @@ union as10x_get_demod_stats { ...@@ -274,7 +274,7 @@ union as10x_get_demod_stats {
uint8_t error; uint8_t error;
/* demod stats */ /* demod stats */
struct as10x_demod_stats stats; struct as10x_demod_stats stats;
} rsp; } __packed rsp;
} __packed; } __packed;
union as10x_get_impulse_resp { union as10x_get_impulse_resp {
...@@ -282,7 +282,7 @@ union as10x_get_impulse_resp { ...@@ -282,7 +282,7 @@ union as10x_get_impulse_resp {
struct { struct {
/* request identifier */ /* request identifier */
uint16_t proc_id; uint16_t proc_id;
} req; } __packed req;
/* response */ /* response */
struct { struct {
/* response identifier */ /* response identifier */
...@@ -291,7 +291,7 @@ union as10x_get_impulse_resp { ...@@ -291,7 +291,7 @@ union as10x_get_impulse_resp {
uint8_t error; uint8_t error;
/* impulse response ready */ /* impulse response ready */
uint8_t is_ready; uint8_t is_ready;
} rsp; } __packed rsp;
} __packed; } __packed;
union as10x_fw_context { union as10x_fw_context {
...@@ -305,7 +305,7 @@ union as10x_fw_context { ...@@ -305,7 +305,7 @@ union as10x_fw_context {
uint16_t tag; uint16_t tag;
/* context request type */ /* context request type */
uint16_t type; uint16_t type;
} req; } __packed req;
/* response */ /* response */
struct { struct {
/* response identifier */ /* response identifier */
...@@ -316,7 +316,7 @@ union as10x_fw_context { ...@@ -316,7 +316,7 @@ union as10x_fw_context {
uint16_t type; uint16_t type;
/* error */ /* error */
uint8_t error; uint8_t error;
} rsp; } __packed rsp;
} __packed; } __packed;
union as10x_set_register { union as10x_set_register {
...@@ -328,14 +328,14 @@ union as10x_set_register { ...@@ -328,14 +328,14 @@ union as10x_set_register {
struct as10x_register_addr reg_addr; struct as10x_register_addr reg_addr;
/* register content */ /* register content */
struct as10x_register_value reg_val; struct as10x_register_value reg_val;
} req; } __packed req;
/* response */ /* response */
struct { struct {
/* response identifier */ /* response identifier */
uint16_t proc_id; uint16_t proc_id;
/* error */ /* error */
uint8_t error; uint8_t error;
} rsp; } __packed rsp;
} __packed; } __packed;
union as10x_get_register { union as10x_get_register {
...@@ -345,7 +345,7 @@ union as10x_get_register { ...@@ -345,7 +345,7 @@ union as10x_get_register {
uint16_t proc_id; uint16_t proc_id;
/* register description */ /* register description */
struct as10x_register_addr reg_addr; struct as10x_register_addr reg_addr;
} req; } __packed req;
/* response */ /* response */
struct { struct {
/* response identifier */ /* response identifier */
...@@ -354,7 +354,7 @@ union as10x_get_register { ...@@ -354,7 +354,7 @@ union as10x_get_register {
uint8_t error; uint8_t error;
/* register content */ /* register content */
struct as10x_register_value reg_val; struct as10x_register_value reg_val;
} rsp; } __packed rsp;
} __packed; } __packed;
union as10x_cfg_change_mode { union as10x_cfg_change_mode {
...@@ -364,14 +364,14 @@ union as10x_cfg_change_mode { ...@@ -364,14 +364,14 @@ union as10x_cfg_change_mode {
uint16_t proc_id; uint16_t proc_id;
/* mode */ /* mode */
uint8_t mode; uint8_t mode;
} req; } __packed req;
/* response */ /* response */
struct { struct {
/* response identifier */ /* response identifier */
uint16_t proc_id; uint16_t proc_id;
/* error */ /* error */
uint8_t error; uint8_t error;
} rsp; } __packed rsp;
} __packed; } __packed;
struct as10x_cmd_header_t { struct as10x_cmd_header_t {
...@@ -394,7 +394,7 @@ union as10x_dump_memory { ...@@ -394,7 +394,7 @@ union as10x_dump_memory {
struct as10x_register_addr reg_addr; struct as10x_register_addr reg_addr;
/* nb blocks to read */ /* nb blocks to read */
uint16_t num_blocks; uint16_t num_blocks;
} req; } __packed req;
/* response */ /* response */
struct { struct {
/* response identifier */ /* response identifier */
...@@ -408,8 +408,8 @@ union as10x_dump_memory { ...@@ -408,8 +408,8 @@ union as10x_dump_memory {
uint8_t data8[DUMP_BLOCK_SIZE]; uint8_t data8[DUMP_BLOCK_SIZE];
uint16_t data16[DUMP_BLOCK_SIZE / sizeof(uint16_t)]; uint16_t data16[DUMP_BLOCK_SIZE / sizeof(uint16_t)];
uint32_t data32[DUMP_BLOCK_SIZE / sizeof(uint32_t)]; uint32_t data32[DUMP_BLOCK_SIZE / sizeof(uint32_t)];
} u; } __packed u;
} rsp; } __packed rsp;
} __packed; } __packed;
union as10x_dumplog_memory { union as10x_dumplog_memory {
...@@ -418,7 +418,7 @@ union as10x_dumplog_memory { ...@@ -418,7 +418,7 @@ union as10x_dumplog_memory {
uint16_t proc_id; uint16_t proc_id;
/* dump memory type request */ /* dump memory type request */
uint8_t dump_req; uint8_t dump_req;
} req; } __packed req;
struct { struct {
/* request identifier */ /* request identifier */
uint16_t proc_id; uint16_t proc_id;
...@@ -428,7 +428,7 @@ union as10x_dumplog_memory { ...@@ -428,7 +428,7 @@ union as10x_dumplog_memory {
uint8_t dump_rsp; uint8_t dump_rsp;
/* dump data */ /* dump data */
uint8_t data[DUMP_BLOCK_SIZE]; uint8_t data[DUMP_BLOCK_SIZE];
} rsp; } __packed rsp;
} __packed; } __packed;
union as10x_raw_data { union as10x_raw_data {
...@@ -437,14 +437,14 @@ union as10x_raw_data { ...@@ -437,14 +437,14 @@ union as10x_raw_data {
uint16_t proc_id; uint16_t proc_id;
uint8_t data[64 - sizeof(struct as10x_cmd_header_t) uint8_t data[64 - sizeof(struct as10x_cmd_header_t)
- 2 /* proc_id */]; - 2 /* proc_id */];
} req; } __packed req;
/* response */ /* response */
struct { struct {
uint16_t proc_id; uint16_t proc_id;
uint8_t error; uint8_t error;
uint8_t data[64 - sizeof(struct as10x_cmd_header_t) uint8_t data[64 - sizeof(struct as10x_cmd_header_t)
- 2 /* proc_id */ - 1 /* rc */]; - 2 /* proc_id */ - 1 /* rc */];
} rsp; } __packed rsp;
} __packed; } __packed;
struct as10x_cmd_t { struct as10x_cmd_t {
...@@ -469,7 +469,7 @@ struct as10x_cmd_t { ...@@ -469,7 +469,7 @@ struct as10x_cmd_t {
union as10x_dump_memory dump_memory; union as10x_dump_memory dump_memory;
union as10x_dumplog_memory dumplog_memory; union as10x_dumplog_memory dumplog_memory;
union as10x_raw_data raw_data; union as10x_raw_data raw_data;
} body; } __packed body;
} __packed; } __packed;
struct as10x_token_cmd_t { struct as10x_token_cmd_t {
......
...@@ -181,7 +181,7 @@ struct as10x_register_value { ...@@ -181,7 +181,7 @@ struct as10x_register_value {
uint8_t value8; /* 8 bit value */ uint8_t value8; /* 8 bit value */
uint16_t value16; /* 16 bit value */ uint16_t value16; /* 16 bit value */
uint32_t value32; /* 32 bit value */ uint32_t value32; /* 32 bit value */
} u; } __packed u;
} __packed; } __packed;
struct as10x_register_addr { struct as10x_register_addr {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment