Commit 183e19f5 authored by Sean Young's avatar Sean Young Committed by Mauro Carvalho Chehab
Browse files

media: rc: Remove init_ir_raw_event and DEFINE_IR_RAW_EVENT macros

This can be done with c99 initializers, which makes the code cleaner
and more transparent. It does require gcc 4.6, because of this bug
in earlier versions:

	https://gcc.gnu.org/bugzilla/show_bug.cgi?id=10676



Since commit cafa0010 ("Raise the minimum required gcc version to
4.6"), this is the case.

Signed-off-by: default avatarSean Young <sean@mess.org>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
parent c5f14af0
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -45,7 +45,7 @@ int picolcd_raw_cir(struct picolcd_data *data,
{
	unsigned long flags;
	int i, w, sz;
	DEFINE_IR_RAW_EVENT(rawir);
	struct ir_raw_event rawir = {};

	/* ignore if rc_dev is NULL or status is shunned */
	spin_lock_irqsave(&data->lock, flags);
@@ -67,7 +67,6 @@ int picolcd_raw_cir(struct picolcd_data *data,
	 */
	sz = size > 0 ? min((int)raw_data[0], size-1) : 0;
	for (i = 0; i+1 < sz; i += 2) {
		init_ir_raw_event(&rawir);
		w = (raw_data[i] << 8) | (raw_data[i+1]);
		rawir.pulse = !!(w & 0x8000);
		rawir.duration = US_TO_NS(rawir.pulse ? (65536 - w) : w);
+4 −4
Original line number Diff line number Diff line
@@ -26,10 +26,10 @@ void sms_ir_event(struct smscore_device_t *coredev, const char *buf, int len)
	const s32 *samples = (const void *)buf;

	for (i = 0; i < len >> 2; i++) {
		DEFINE_IR_RAW_EVENT(ev);

		ev.duration = abs(samples[i]) * 1000; /* Convert to ns */
		ev.pulse = (samples[i] > 0) ? false : true;
		struct ir_raw_event ev = {
			.duration = abs(samples[i]) * 1000, /* Convert to ns */
			.pulse = (samples[i] > 0) ? false : true
		};

		ir_raw_event_store(coredev->ir.dev, &ev);
	}
+2 −4
Original line number Diff line number Diff line
@@ -701,10 +701,8 @@ static int cx25840_ir_rx_read(struct v4l2_subdev *sd, u8 *buf, size_t count,
		if (v > IR_MAX_DURATION)
			v = IR_MAX_DURATION;

		init_ir_raw_event(&p->ir_core_data);
		p->ir_core_data.pulse = u;
		p->ir_core_data.duration = v;
		p->ir_core_data.timeout = w;
		p->ir_core_data = (struct ir_raw_event)
			{ .pulse = u, .duration = v, .timeout = w };

		v4l2_dbg(2, ir_debug, sd, "rx read: %10u ns  %s  %s\n",
			 v, u ? "mark" : "space", w ? "(timed out)" : "");
+2 −4
Original line number Diff line number Diff line
@@ -696,10 +696,8 @@ static int cx23888_ir_rx_read(struct v4l2_subdev *sd, u8 *buf, size_t count,
		if (v > IR_MAX_DURATION)
			v = IR_MAX_DURATION;

		init_ir_raw_event(&p->ir_core_data);
		p->ir_core_data.pulse = u;
		p->ir_core_data.duration = v;
		p->ir_core_data.timeout = w;
		p->ir_core_data = (struct ir_raw_event)
			{ .pulse = u, .duration = v, .timeout = w };

		v4l2_dbg(2, ir_888_debug, sd, "rx read: %10u ns  %s  %s\n",
			 v, u ? "mark" : "space", w ? "(timed out)" : "");
+1 −2
Original line number Diff line number Diff line
@@ -535,7 +535,7 @@ void cx88_ir_irq(struct cx88_core *core)
	struct cx88_IR *ir = core->ir;
	u32 samples;
	unsigned int todo, bits;
	struct ir_raw_event ev;
	struct ir_raw_event ev = {};

	if (!ir || !ir->sampling)
		return;
@@ -550,7 +550,6 @@ void cx88_ir_irq(struct cx88_core *core)
	if (samples == 0xff && ir->dev->idle)
		return;

	init_ir_raw_event(&ev);
	for (todo = 32; todo > 0; todo -= bits) {
		ev.pulse = samples & 0x80000000 ? false : true;
		bits = min(todo, 32U - fls(ev.pulse ? samples : ~samples));
Loading