diff options
author | Mauro Carvalho Chehab <mchehab@redhat.com> | 2010-04-04 09:44:51 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2010-05-19 11:56:57 -0400 |
commit | 587835a4b0ada7d78c4f3300e3ab26b7b2495705 (patch) | |
tree | ad22f6a0e603f19450227b0cb260b5bb5960dfd5 /drivers/media/IR/ir-raw-event.c | |
parent | 26d5683d36729f11f5764909ae37c69488596d36 (diff) |
V4L-DVB: ir-core: remove the ancillary buffer
Now that the decoders are state machine, there's no need to create
an ancillary buffer while decoding the protocol. Just call the decoders
code directly, event by event.
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/IR/ir-raw-event.c')
-rw-r--r-- | drivers/media/IR/ir-raw-event.c | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/drivers/media/IR/ir-raw-event.c b/drivers/media/IR/ir-raw-event.c index 617e437e2beb..57990a337922 100644 --- a/drivers/media/IR/ir-raw-event.c +++ b/drivers/media/IR/ir-raw-event.c | |||
@@ -138,37 +138,33 @@ int ir_raw_event_handle(struct input_dev *input_dev) | |||
138 | { | 138 | { |
139 | struct ir_input_dev *ir = input_get_drvdata(input_dev); | 139 | struct ir_input_dev *ir = input_get_drvdata(input_dev); |
140 | int rc; | 140 | int rc; |
141 | struct ir_raw_event *evs; | 141 | struct ir_raw_event ev; |
142 | int len, i; | 142 | int len, i; |
143 | 143 | ||
144 | /* | 144 | /* |
145 | * Store the events into a temporary buffer. This allows calling more than | 145 | * Store the events into a temporary buffer. This allows calling more than |
146 | * one decoder to deal with the received data | 146 | * one decoder to deal with the received data |
147 | */ | 147 | */ |
148 | len = kfifo_len(&ir->raw->kfifo) / sizeof(*evs); | 148 | len = kfifo_len(&ir->raw->kfifo) / sizeof(ev); |
149 | if (!len) | 149 | if (!len) |
150 | return 0; | 150 | return 0; |
151 | evs = kmalloc(len * sizeof(*evs), GFP_ATOMIC); | ||
152 | 151 | ||
153 | for (i = 0; i < len; i++) { | 152 | for (i = 0; i < len; i++) { |
154 | rc = kfifo_out(&ir->raw->kfifo, &evs[i], sizeof(*evs)); | 153 | rc = kfifo_out(&ir->raw->kfifo, &ev, sizeof(ev)); |
155 | if (rc != sizeof(*evs)) { | 154 | if (rc != sizeof(ev)) { |
156 | IR_dprintk(1, "overflow error: received %d instead of %zd\n", | 155 | IR_dprintk(1, "overflow error: received %d instead of %zd\n", |
157 | rc, sizeof(*evs)); | 156 | rc, sizeof(ev)); |
158 | return -EINVAL; | 157 | return -EINVAL; |
159 | } | 158 | } |
160 | IR_dprintk(2, "event type %d, time before event: %07luus\n", | 159 | IR_dprintk(2, "event type %d, time before event: %07luus\n", |
161 | evs[i].type, (evs[i].delta.tv_nsec + 500) / 1000); | 160 | ev.type, (ev.delta.tv_nsec + 500) / 1000); |
161 | rc = RUN_DECODER(decode, input_dev, &ev); | ||
162 | } | 162 | } |
163 | 163 | ||
164 | /* | 164 | /* |
165 | * Call all ir decoders. This allows decoding the same event with | 165 | * Call all ir decoders. This allows decoding the same event with |
166 | * more than one protocol handler. It returns the number of keystrokes | 166 | * more than one protocol handler. |
167 | * sent to the event interface | ||
168 | */ | 167 | */ |
169 | rc = RUN_DECODER(decode, input_dev, evs, len); | ||
170 | |||
171 | kfree(evs); | ||
172 | 168 | ||
173 | return rc; | 169 | return rc; |
174 | } | 170 | } |