aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/rc/rc-loopback.c
diff options
context:
space:
mode:
authorDavid Härdeman <david@hardeman.nu>2011-04-28 10:14:03 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-08-13 18:59:41 -0400
commitf8e00d5fa86fbc4462647da162152d4e74db784c (patch)
tree142c42d64707914aea0b6194322c3cd6db47c9c3 /drivers/media/rc/rc-loopback.c
parent0a67fe458471cc13adeb0e10694e10674bf383eb (diff)
[media] rc-core: move timeout and checks to lirc
The lirc TX functionality expects the process which writes (TX) data to the lirc dev to sleep until the actual data has been transmitted by the hardware. Since the same timeout calculation is duplicated in more than one driver (and would have to be duplicated in even more drivers as they gain TX support), it makes sense to move this timeout calculation to the lirc layer instead. At the same time, centralize some of the sanity checks. Signed-off-by: David Härdeman <david@hardeman.nu> Cc: Jarod Wilson <jwilson@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/rc/rc-loopback.c')
-rw-r--r--drivers/media/rc/rc-loopback.c12
1 files changed, 0 insertions, 12 deletions
diff --git a/drivers/media/rc/rc-loopback.c b/drivers/media/rc/rc-loopback.c
index fae1615e0ff2..f9be68132c67 100644
--- a/drivers/media/rc/rc-loopback.c
+++ b/drivers/media/rc/rc-loopback.c
@@ -105,18 +105,9 @@ static int loop_tx_ir(struct rc_dev *dev, unsigned *txbuf, unsigned count)
105{ 105{
106 struct loopback_dev *lodev = dev->priv; 106 struct loopback_dev *lodev = dev->priv;
107 u32 rxmask; 107 u32 rxmask;
108 unsigned total_duration = 0;
109 unsigned i; 108 unsigned i;
110 DEFINE_IR_RAW_EVENT(rawir); 109 DEFINE_IR_RAW_EVENT(rawir);
111 110
112 for (i = 0; i < count; i++)
113 total_duration += abs(txbuf[i]);
114
115 if (total_duration == 0) {
116 dprintk("invalid tx data, total duration zero\n");
117 return -EINVAL;
118 }
119
120 if (lodev->txcarrier < lodev->rxcarriermin || 111 if (lodev->txcarrier < lodev->rxcarriermin ||
121 lodev->txcarrier > lodev->rxcarriermax) { 112 lodev->txcarrier > lodev->rxcarriermax) {
122 dprintk("ignoring tx, carrier out of range\n"); 113 dprintk("ignoring tx, carrier out of range\n");
@@ -148,9 +139,6 @@ static int loop_tx_ir(struct rc_dev *dev, unsigned *txbuf, unsigned count)
148 ir_raw_event_handle(dev); 139 ir_raw_event_handle(dev);
149 140
150out: 141out:
151 /* Lirc expects this function to take as long as the total duration */
152 set_current_state(TASK_INTERRUPTIBLE);
153 schedule_timeout(usecs_to_jiffies(total_duration));
154 return count; 142 return count;
155} 143}
156 144