From b83bfd1b0127b0963fcac39280280e365e7e04d8 Mon Sep 17 00:00:00 2001 From: Sean Young Date: Mon, 13 Aug 2012 08:59:47 -0300 Subject: [media] rc: do not wake up rc thread unless there is something to do The TechnoTrend USB IR Receiver sends 125 ISO URBs per second, even when there is no IR activity. Reduce the number of wake ups from the other drivers too. This saves about 0.25ms/s on a 2.4GHz Core 2 according to powertop. Signed-off-by: Sean Young Signed-off-by: Mauro Carvalho Chehab --- drivers/media/rc/ttusbir.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'drivers/media/rc/ttusbir.c') diff --git a/drivers/media/rc/ttusbir.c b/drivers/media/rc/ttusbir.c index 71f03acabac8..1aee57fd2f32 100644 --- a/drivers/media/rc/ttusbir.c +++ b/drivers/media/rc/ttusbir.c @@ -121,8 +121,9 @@ static void ttusbir_bulk_complete(struct urb *urb) */ static void ttusbir_process_ir_data(struct ttusbir *tt, uint8_t *buf) { + struct ir_raw_event rawir; unsigned i, v, b; - DEFINE_IR_RAW_EVENT(rawir); + bool event = false; init_ir_raw_event(&rawir); @@ -132,12 +133,14 @@ static void ttusbir_process_ir_data(struct ttusbir *tt, uint8_t *buf) case 0xfe: rawir.pulse = false; rawir.duration = NS_PER_BYTE; - ir_raw_event_store_with_filter(tt->rc, &rawir); + if (ir_raw_event_store_with_filter(tt->rc, &rawir)) + event = true; break; case 0: rawir.pulse = true; rawir.duration = NS_PER_BYTE; - ir_raw_event_store_with_filter(tt->rc, &rawir); + if (ir_raw_event_store_with_filter(tt->rc, &rawir)) + event = true; break; default: /* one edge per byte */ @@ -150,16 +153,20 @@ static void ttusbir_process_ir_data(struct ttusbir *tt, uint8_t *buf) } rawir.duration = NS_PER_BIT * (8 - b); - ir_raw_event_store_with_filter(tt->rc, &rawir); + if (ir_raw_event_store_with_filter(tt->rc, &rawir)) + event = true; rawir.pulse = !rawir.pulse; rawir.duration = NS_PER_BIT * b; - ir_raw_event_store_with_filter(tt->rc, &rawir); + if (ir_raw_event_store_with_filter(tt->rc, &rawir)) + event = true; break; } } - ir_raw_event_handle(tt->rc); + /* don't wakeup when there's nothing to do */ + if (event) + ir_raw_event_handle(tt->rc); } static void ttusbir_urb_complete(struct urb *urb) -- cgit v1.2.3