#include <linux/export.h>
#include <linux/kthread.h>
#include "rc-core-priv.h"
static LIST_HEAD(ir_raw_client_list);
DEFINE_MUTEX(ir_raw_handler_lock);
static LIST_HEAD(ir_raw_handler_list);
static atomic64_t available_protocols = ATOMIC64_INIT(0);
static int ir_raw_event_thread(void *data)
struct ir_raw_handler *handler;
struct ir_raw_event_ctrl *raw = data;
struct rc_dev *dev = raw->dev;
mutex_lock(&ir_raw_handler_lock);
while (kfifo_out(&raw->kfifo, &ev, 1)) {
if (is_timing_event(ev)) {
dev_warn_once(&dev->dev, "nonsensical timing event of duration 0");
if (is_timing_event(raw->prev_ev) &&
!is_transition(&ev, &raw->prev_ev))
dev_warn_once(&dev->dev, "two consecutive events of type %s",
if (raw->prev_ev.reset && ev.pulse == 0)
dev_warn_once(&dev->dev, "timing event after reset should be pulse");
list_for_each_entry(handler, &ir_raw_handler_list, list)
if (dev->enabled_protocols &
handler->protocols || !handler->protocols)
handler->decode(dev, ev);
ir_lirc_raw_event(dev, ev);
mutex_unlock(&ir_raw_handler_lock);
set_current_state(TASK_INTERRUPTIBLE);
if (kthread_should_stop()) {
__set_current_state(TASK_RUNNING);
} else if (!kfifo_is_empty(&raw->kfifo))
set_current_state(TASK_RUNNING);