Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 97738
b: refs/heads/master
c: f34ec12
h: refs/heads/master
v: v3
  • Loading branch information
Al Viro authored and Mauro Carvalho Chehab committed Jun 5, 2008
1 parent bb752d4 commit 2c1cb68
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 23 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 39028ec69b13712ec1dcd9aa14844bf60f19cb20
refs/heads/master: f34ec12a17984d7df784bf49caf64f5f743e5e10
46 changes: 24 additions & 22 deletions trunk/drivers/media/dvb/cinergyT2/cinergyT2.c
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down Expand Up @@ -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;
Expand All @@ -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
};
Expand All @@ -160,7 +161,7 @@ enum {

struct cinergyt2_rc_event {
char type;
uint32_t value;
__le32 value;
} __attribute__((packed));

static const uint32_t rc_keys[] = {
Expand Down Expand Up @@ -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 (mutex_lock_interruptible(&cinergyt2->sem))
return -ERESTARTSYS;
unc_count = cinergyt2->uncorrected_block_count;
cinergyt2->uncorrected_block_count = 0;
mutex_unlock(&cinergyt2->sem);

/* UNC are already converted to host byte order... */
return put_user(unc_count,(__u32 __user *) arg);
Expand Down Expand Up @@ -769,7 +773,7 @@ static void cinergyt2_query_rc (struct work_struct *work)
input_sync(cinergyt2->rc_input_dev);
cinergyt2->rc_input_event = KEY_MAX;
}
cinergyt2->rc_last_code = ~0;
cinergyt2->rc_last_code = cpu_to_le32(~0);
}
goto out;
}
Expand All @@ -780,7 +784,7 @@ static void cinergyt2_query_rc (struct work_struct *work)
n, le32_to_cpu(rc_events[n].value), rc_events[n].type);

if (rc_events[n].type == CINERGYT2_RC_EVENT_TYPE_NEC &&
rc_events[n].value == ~0) {
rc_events[n].value == cpu_to_le32(~0)) {
/* keyrepeat bit -> just repeat last rc_input_event */
} else {
cinergyt2->rc_input_event = KEY_MAX;
Expand All @@ -795,7 +799,7 @@ static void cinergyt2_query_rc (struct work_struct *work)

if (cinergyt2->rc_input_event != KEY_MAX) {
if (rc_events[n].value == cinergyt2->rc_last_code &&
cinergyt2->rc_last_code != ~0) {
cinergyt2->rc_last_code != cpu_to_le32(~0)) {
/* emit a key-up so the double event is recognized */
dprintk(1, "rc_input_event=%d UP\n", cinergyt2->rc_input_event);
input_report_key(cinergyt2->rc_input_dev,
Expand Down Expand Up @@ -829,7 +833,7 @@ static int cinergyt2_register_rc(struct cinergyt2 *cinergyt2)
usb_make_path(cinergyt2->udev, cinergyt2->phys, sizeof(cinergyt2->phys));
strlcat(cinergyt2->phys, "/input0", sizeof(cinergyt2->phys));
cinergyt2->rc_input_event = KEY_MAX;
cinergyt2->rc_last_code = ~0;
cinergyt2->rc_last_code = cpu_to_le32(~0);
INIT_DELAYED_WORK(&cinergyt2->rc_query_work, cinergyt2_query_rc);

input_dev->name = DRIVER_NAME " remote control";
Expand All @@ -840,8 +844,8 @@ static int cinergyt2_register_rc(struct cinergyt2 *cinergyt2)
input_dev->keycodesize = 0;
input_dev->keycodemax = 0;
input_dev->id.bustype = BUS_USB;
input_dev->id.vendor = cinergyt2->udev->descriptor.idVendor;
input_dev->id.product = cinergyt2->udev->descriptor.idProduct;
input_dev->id.vendor = le16_to_cpu(cinergyt2->udev->descriptor.idVendor);
input_dev->id.product = le16_to_cpu(cinergyt2->udev->descriptor.idProduct);
input_dev->id.version = 1;
input_dev->dev.parent = &cinergyt2->udev->dev;

Expand Down Expand Up @@ -889,18 +893,16 @@ static void cinergyt2_query (struct work_struct *work)
char cmd [] = { CINERGYT2_EP1_GET_TUNER_STATUS };
struct dvbt_get_status_msg *s = &cinergyt2->status;
uint8_t lock_bits;
uint32_t unc;

if (cinergyt2->disconnect_pending || mutex_lock_interruptible(&cinergyt2->sem))
return;

unc = s->uncorrected_block_count;
lock_bits = s->lock_bits;

cinergyt2_command(cinergyt2, cmd, sizeof(cmd), (char *) s, sizeof(*s));

unc += le32_to_cpu(s->uncorrected_block_count);
s->uncorrected_block_count = unc;
cinergyt2->uncorrected_block_count +=
le32_to_cpu(s->uncorrected_block_count);

if (lock_bits != s->lock_bits) {
wake_up_interruptible(&cinergyt2->poll_wq);
Expand Down

0 comments on commit 2c1cb68

Please sign in to comment.