Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8152b760 authored by Andy Walls's avatar Andy Walls Committed by Mauro Carvalho Chehab
Browse files

[media] lirc_zilog: Remove unneeded rx->buf_lock



Remove the rx->buf_lock that protected the rx->buf lirc_buffer.  The
underlying operations on the objects within the lirc_buffer are already
protected by spinlocks, or the objects are constant (e.g. chunk_size).

Signed-off-by: default avatarAndy Walls <awalls@md.metrocast.net>
Signed-off-by: default avatarJarod Wilson <jarod@redhat.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 915e5473
Loading
Loading
Loading
Loading
+9 −14
Original line number Original line Diff line number Diff line
@@ -67,9 +67,8 @@ struct IR_rx {
	/* RX device */
	/* RX device */
	struct i2c_client *c;
	struct i2c_client *c;


	/* RX device buffer & lock */
	/* RX device buffer */
	struct lirc_buffer buf;
	struct lirc_buffer buf;
	struct mutex buf_lock;


	/* RX polling thread data */
	/* RX polling thread data */
	struct task_struct *task;
	struct task_struct *task;
@@ -718,18 +717,15 @@ static ssize_t read(struct file *filep, char *outbuf, size_t n, loff_t *ppos)
	struct IR *ir = filep->private_data;
	struct IR *ir = filep->private_data;
	struct IR_rx *rx = ir->rx;
	struct IR_rx *rx = ir->rx;
	int ret = 0, written = 0;
	int ret = 0, written = 0;
	unsigned int m;
	DECLARE_WAITQUEUE(wait, current);
	DECLARE_WAITQUEUE(wait, current);


	dprintk("read called\n");
	dprintk("read called\n");
	if (rx == NULL)
	if (rx == NULL)
		return -ENODEV;
		return -ENODEV;


	if (mutex_lock_interruptible(&rx->buf_lock))
		return -ERESTARTSYS;

	if (n % rx->buf.chunk_size) {
	if (n % rx->buf.chunk_size) {
		dprintk("read result = -EINVAL\n");
		dprintk("read result = -EINVAL\n");
		mutex_unlock(&rx->buf_lock);
		return -EINVAL;
		return -EINVAL;
	}
	}


@@ -767,19 +763,19 @@ static ssize_t read(struct file *filep, char *outbuf, size_t n, loff_t *ppos)
			set_current_state(TASK_INTERRUPTIBLE);
			set_current_state(TASK_INTERRUPTIBLE);
		} else {
		} else {
			unsigned char buf[rx->buf.chunk_size];
			unsigned char buf[rx->buf.chunk_size];
			lirc_buffer_read(&rx->buf, buf);
			m = lirc_buffer_read(&rx->buf, buf);
			if (m == rx->buf.chunk_size) {
				ret = copy_to_user((void *)outbuf+written, buf,
				ret = copy_to_user((void *)outbuf+written, buf,
						   rx->buf.chunk_size);
						   rx->buf.chunk_size);
				written += rx->buf.chunk_size;
				written += rx->buf.chunk_size;
			}
			}
		}
		}
	}


	remove_wait_queue(&rx->buf.wait_poll, &wait);
	remove_wait_queue(&rx->buf.wait_poll, &wait);
	set_current_state(TASK_RUNNING);
	set_current_state(TASK_RUNNING);
	mutex_unlock(&rx->buf_lock);


	dprintk("read result = %s (%d)\n",
	dprintk("read result = %d (%s)\n", ret, ret ? "Error" : "OK");
		ret ? "-EFAULT" : "OK", ret);


	return ret ? ret : written;
	return ret ? ret : written;
}
}
@@ -1327,7 +1323,6 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id)
		if (ret)
		if (ret)
			goto out_free_xx;
			goto out_free_xx;


		mutex_init(&ir->rx->buf_lock);
		ir->rx->c = client;
		ir->rx->c = client;
		ir->rx->hdpvr_data_fmt =
		ir->rx->hdpvr_data_fmt =
			       (id->driver_data & ID_FLAG_HDPVR) ? true : false;
			       (id->driver_data & ID_FLAG_HDPVR) ? true : false;