[PATCH] cinergyT2: endianness annotations, endianness and race fixes

Previous thread: [patch 2.6.26-rc3] gpio: build fixes (mostly potential) by David Brownell on Tuesday, May 20, 2008 - 4:17 pm. (1 message)

Next thread: [PATCH] fix the roothole in av7110_av.c by Al Viro on Tuesday, May 20, 2008 - 5:30 pm. (1 message)
From: Al Viro
Date: Tuesday, May 20, 2008 - 5:30 pm

Endianness annotations and fixes + fixing the handling of
->uncorrected_block_count

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
---
 drivers/media/dvb/cinergyT2/cinergyT2.c |   46 ++++++++++++++++---------------
 1 files changed, 24 insertions(+), 22 deletions(-)

diff --git a/drivers/media/dvb/cinergyT2/cinergyT2.c b/drivers/media/dvb/cinergyT2/cinergyT2.c
index f5010e8..a824f37 100644
--- a/drivers/media/dvb/cinergyT2/cinergyT2.c
+++ b/drivers/media/dvb/cinergyT2/cinergyT2.c
@@ -82,22 +82,22 @@ enum cinergyt2_ep1_cmd {
 
 struct dvbt_set_parameters_msg {
 	uint8_t cmd;
-	uint32_t freq;
+	__le32 freq;
 	uint8_t bandwidth;
-	uint16_t tps;
+	__le16 tps;
 	uint8_t flags;
 } __attribute__((packed));
 
 struct dvbt_get_status_msg {
-	uint32_t freq;
+	__le32 freq;
 	uint8_t bandwidth;
-	uint16_t tps;
+	__le16 tps;
 	uint8_t flags;
-	uint16_t gain;
+	__le16 gain;
 	uint8_t snr;
-	uint32_t viterbi_error_rate;
-	uint32_t rs_error_rate;
-	uint32_t uncorrected_block_count;
+	__le32 viterbi_error_rate;
+	__le32 rs_error_rate;
+	__le32 uncorrected_block_count;
 	uint8_t lock_bits;
 	uint8_t prev_lock_bits;
 } __attribute__((packed));
@@ -136,6 +136,7 @@ struct cinergyt2 {
 	wait_queue_head_t poll_wq;
 	int pending_fe_events;
 	int disconnect_pending;
+	unsigned int uncorrected_block_count;
 	atomic_t inuse;
 
 	void *streambuf;
@@ -147,7 +148,7 @@ struct cinergyt2 {
 	char phys[64];
 	struct delayed_work rc_query_work;
 	int rc_input_event;
-	u32 rc_last_code;
+	__le32 rc_last_code;
 	unsigned long last_event_jiffies;
 #endif
 };
@@ -160,7 +161,7 @@ enum {
 
 struct cinergyt2_rc_event {
 	char type;
-	uint32_t value;
+	__le32 value;
 } __attribute__((packed));
 
 static const uint32_t rc_keys[] = {
@@ -619,8 +620,11 @@ static int cinergyt2_ioctl (struct inode *inode, struct file *file,
 	{
 		uint32_t unc_count;
 
-		unc_count = stat->uncorrected_block_count;
-		stat->uncorrected_block_count = 0;
+		if ...
Previous thread: [patch 2.6.26-rc3] gpio: build fixes (mostly potential) by David Brownell on Tuesday, May 20, 2008 - 4:17 pm. (1 message)

Next thread: [PATCH] fix the roothole in av7110_av.c by Al Viro on Tuesday, May 20, 2008 - 5:30 pm. (1 message)