aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/rc/rc-loopback.c
diff options
context:
space:
mode:
authorDavid Härdeman <david@hardeman.nu>2011-04-28 11:13:58 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2011-07-27 16:52:59 -0400
commit5588dc2b025fd8b2188142b8d59efe562bd57d80 (patch)
treed8ee1ff6a70569424d5553a003f05cc50c5f4b96 /drivers/media/rc/rc-loopback.c
parent8a8cc952d3fe0eca3ded22a01d4f7e642d676be0 (diff)
[media] rc-core: lirc use unsigned int
Durations can never be negative, so it makes sense to consistently use unsigned int for LIRC transmission. Contrary to the initial impression, this shouldn't actually change the userspace API. Signed-off-by: David Härdeman <david@hardeman.nu> 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.c13
1 files changed, 3 insertions, 10 deletions
diff --git a/drivers/media/rc/rc-loopback.c b/drivers/media/rc/rc-loopback.c
index cc846b2619c..efc6a514348 100644
--- a/drivers/media/rc/rc-loopback.c
+++ b/drivers/media/rc/rc-loopback.c
@@ -101,21 +101,14 @@ static int loop_set_rx_carrier_range(struct rc_dev *dev, u32 min, u32 max)
101 return 0; 101 return 0;
102} 102}
103 103
104static int loop_tx_ir(struct rc_dev *dev, int *txbuf, u32 n) 104static 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 count;
109 unsigned total_duration = 0; 108 unsigned total_duration = 0;
110 unsigned i; 109 unsigned i;
111 DEFINE_IR_RAW_EVENT(rawir); 110 DEFINE_IR_RAW_EVENT(rawir);
112 111
113 if (n == 0 || n % sizeof(int)) {
114 dprintk("invalid tx buffer size\n");
115 return -EINVAL;
116 }
117
118 count = n / sizeof(int);
119 for (i = 0; i < count; i++) 112 for (i = 0; i < count; i++)
120 total_duration += abs(txbuf[i]); 113 total_duration += abs(txbuf[i]);
121 114
@@ -142,7 +135,7 @@ static int loop_tx_ir(struct rc_dev *dev, int *txbuf, u32 n)
142 135
143 for (i = 0; i < count; i++) { 136 for (i = 0; i < count; i++) {
144 rawir.pulse = i % 2 ? false : true; 137 rawir.pulse = i % 2 ? false : true;
145 rawir.duration = abs(txbuf[i]) * 1000; 138 rawir.duration = txbuf[i] * 1000;
146 if (rawir.duration) 139 if (rawir.duration)
147 ir_raw_event_store_with_filter(dev, &rawir); 140 ir_raw_event_store_with_filter(dev, &rawir);
148 } 141 }
@@ -158,7 +151,7 @@ out:
158 /* Lirc expects this function to take as long as the total duration */ 151 /* Lirc expects this function to take as long as the total duration */
159 set_current_state(TASK_INTERRUPTIBLE); 152 set_current_state(TASK_INTERRUPTIBLE);
160 schedule_timeout(usecs_to_jiffies(total_duration)); 153 schedule_timeout(usecs_to_jiffies(total_duration));
161 return n; 154 return count;
162} 155}
163 156
164static void loop_set_idle(struct rc_dev *dev, bool enable) 157static void loop_set_idle(struct rc_dev *dev, bool enable)