<commit_before>/* ir-raw-event.c - handle IR Pulse/Space event
 *
 * Copyright (C) 2010 by <NAME> <<EMAIL>>
 *
 * This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation version 2 of the License.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 */

#include <linux/workqueue.h>
#include <linux/spinlock.h>
#include <linux/sched.h>
#include "ir-core-priv.h"

/* Define the max number of pulse/space transitions to buffer */
#define MAX_IR_EVENT_SIZE      512

/* Used to handle IR raw handler extensions */
static LIST_HEAD(ir_raw_handler_list);
static DEFINE_SPINLOCK(ir_raw_handler_lock);

/**
 * RUN_DECODER()	- runs an operation on all IR decoders
 * @ops:	IR raw handler operation to be called
 * @arg:	arguments to be passed to the callback
 *
 * Calls ir_raw_handler::ops for all registered IR handlers. It prevents
 * new decode addition/removal while running, by locking ir_raw_handler_lock
 * mutex. If an error occurs, it stops the ops. Otherwise, it returns a sum
 * of the return codes.
 */
#define RUN_DECODER(ops, ...) ({					    \
	struct ir_raw_handler		*_ir_raw_handler;		    \
	int _sumrc = 0, _rc;						    \
	spin_lock(&ir_raw_handler_lock);				    \
	list_for_each_entry(_ir_raw_handler, &ir_raw_handler_list, list) {  \
		if (_ir_raw_handler->ops) {				    \
			_rc = _ir_raw_handler->ops(__VA_ARGS__);	    \
			if (_rc < 0)					    \
				break;					    \
			_sumrc += _rc;					    \
		}							    \
	}								    \
	spin_unlock(&ir_raw_handler_lock);				    \
	_sumrc;								    \
})

#ifdef MODULE
/* Used to load the decoders */
static struct work_struct wq_load;
#endif
<commit_msg>V4L/DVB: IR: let all protocol decoders have a go at raw data<commit_after>/* ir-raw-event.c - handle IR Pulse/Space event
 *
 * Copyright (C) 2010 by <NAME> <<EMAIL>>
 *
 * This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation version 2 of the License.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 */

#include <linux/workqueue.h>
#include <linux/spinlock.h>
#include <linux/sched.h>
#include "ir-core-priv.h"

/* Define the max number of pulse/space transitions to buffer */
#define MAX_IR_EVENT_SIZE      512

/* Used to handle IR raw handler extensions */
static LIST_HEAD(ir_raw_handler_list);
static DEFINE_SPINLOCK(ir_raw_handler_lock);

/**
 * RUN_DECODER()	- runs an operation on all IR decoders
 * @ops:	IR raw handler operation to be called
 * @arg:	arguments to be passed to the callback
 *
 * Calls ir_raw_handler::ops for all registered IR handlers. It prevents
 * new decode addition/removal while running, by locking ir_raw_handler_lock
 * mutex. If an error occurs, we keep going, as in the decode case, each
 * decoder must have a crack at decoding the data. We return a sum of the
 * return codes, which will be either 0 or negative for current callers.
 */
#define RUN_DECODER(ops, ...) ({					    \
	struct ir_raw_handler		*_ir_raw_handler;		    \
	int _sumrc = 0, _rc;						    \
	spin_lock(&ir_raw_handler_lock);				    \
	list_for_each_entry(_ir_raw_handler, &ir_raw_handler_list, list) {  \
		if (_ir_raw_handler->ops) {				    \
			_rc = _ir_raw_handler->ops(__VA_ARGS__);	    \
			_sumrc += _rc;					    \
		}							    \
	}								    \
	spin_unlock(&ir_raw_handler_lock);				    \
	_sumrc;								    \
})

#ifdef MODULE
/* Used to load the decoders */
static struct work_struct wq_load;
#endif

{'fraction_non_alphanumeric': 0.08881083793276467, 'fraction_numerical': 0.0052684395383843455, 'mean_word_length': 3.076687116564417, 'pattern_counts': {'":': 0, '<': 16, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1661980', 'n_tokens_mistral': 1406, 'n_tokens_neox': 1272, 'n_words': 450}