diff options
author | Andy Walls <awalls@md.metrocast.net> | 2011-01-27 00:34:13 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2011-03-22 18:23:55 -0400 |
commit | 8152b760effbff11cb4eef6292ae3b47719ee792 (patch) | |
tree | 8cb13e50cafaa6503e8860cfa4f20fe80ce3701d /drivers | |
parent | 915e54733de4a36742ab78b4768750ce72662f85 (diff) |
[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: Andy Walls <awalls@md.metrocast.net>
Signed-off-by: Jarod Wilson <jarod@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/staging/lirc/lirc_zilog.c | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/drivers/staging/lirc/lirc_zilog.c b/drivers/staging/lirc/lirc_zilog.c index 695c3df93ca8..a62b94bf6a1a 100644 --- a/drivers/staging/lirc/lirc_zilog.c +++ b/drivers/staging/lirc/lirc_zilog.c | |||
@@ -67,9 +67,8 @@ struct IR_rx { | |||
67 | /* RX device */ | 67 | /* RX device */ |
68 | struct i2c_client *c; | 68 | struct i2c_client *c; |
69 | 69 | ||
70 | /* RX device buffer & lock */ | 70 | /* RX device buffer */ |
71 | struct lirc_buffer buf; | 71 | struct lirc_buffer buf; |
72 | struct mutex buf_lock; | ||
73 | 72 | ||
74 | /* RX polling thread data */ | 73 | /* RX polling thread data */ |
75 | struct task_struct *task; | 74 | struct task_struct *task; |
@@ -718,18 +717,15 @@ static ssize_t read(struct file *filep, char *outbuf, size_t n, loff_t *ppos) | |||
718 | struct IR *ir = filep->private_data; | 717 | struct IR *ir = filep->private_data; |
719 | struct IR_rx *rx = ir->rx; | 718 | struct IR_rx *rx = ir->rx; |
720 | int ret = 0, written = 0; | 719 | int ret = 0, written = 0; |
720 | unsigned int m; | ||
721 | DECLARE_WAITQUEUE(wait, current); | 721 | DECLARE_WAITQUEUE(wait, current); |
722 | 722 | ||
723 | dprintk("read called\n"); | 723 | dprintk("read called\n"); |
724 | if (rx == NULL) | 724 | if (rx == NULL) |
725 | return -ENODEV; | 725 | return -ENODEV; |
726 | 726 | ||
727 | if (mutex_lock_interruptible(&rx->buf_lock)) | ||
728 | return -ERESTARTSYS; | ||
729 | |||
730 | if (n % rx->buf.chunk_size) { | 727 | if (n % rx->buf.chunk_size) { |
731 | dprintk("read result = -EINVAL\n"); | 728 | dprintk("read result = -EINVAL\n"); |
732 | mutex_unlock(&rx->buf_lock); | ||
733 | return -EINVAL; | 729 | return -EINVAL; |
734 | } | 730 | } |
735 | 731 | ||
@@ -767,19 +763,19 @@ static ssize_t read(struct file *filep, char *outbuf, size_t n, loff_t *ppos) | |||
767 | set_current_state(TASK_INTERRUPTIBLE); | 763 | set_current_state(TASK_INTERRUPTIBLE); |
768 | } else { | 764 | } else { |
769 | unsigned char buf[rx->buf.chunk_size]; | 765 | unsigned char buf[rx->buf.chunk_size]; |
770 | lirc_buffer_read(&rx->buf, buf); | 766 | m = lirc_buffer_read(&rx->buf, buf); |
771 | ret = copy_to_user((void *)outbuf+written, buf, | 767 | if (m == rx->buf.chunk_size) { |
772 | rx->buf.chunk_size); | 768 | ret = copy_to_user((void *)outbuf+written, buf, |
773 | written += rx->buf.chunk_size; | 769 | rx->buf.chunk_size); |
770 | written += rx->buf.chunk_size; | ||
771 | } | ||
774 | } | 772 | } |
775 | } | 773 | } |
776 | 774 | ||
777 | remove_wait_queue(&rx->buf.wait_poll, &wait); | 775 | remove_wait_queue(&rx->buf.wait_poll, &wait); |
778 | set_current_state(TASK_RUNNING); | 776 | set_current_state(TASK_RUNNING); |
779 | mutex_unlock(&rx->buf_lock); | ||
780 | 777 | ||
781 | dprintk("read result = %s (%d)\n", | 778 | dprintk("read result = %d (%s)\n", ret, ret ? "Error" : "OK"); |
782 | ret ? "-EFAULT" : "OK", ret); | ||
783 | 779 | ||
784 | return ret ? ret : written; | 780 | return ret ? ret : written; |
785 | } | 781 | } |
@@ -1327,7 +1323,6 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id) | |||
1327 | if (ret) | 1323 | if (ret) |
1328 | goto out_free_xx; | 1324 | goto out_free_xx; |
1329 | 1325 | ||
1330 | mutex_init(&ir->rx->buf_lock); | ||
1331 | ir->rx->c = client; | 1326 | ir->rx->c = client; |
1332 | ir->rx->hdpvr_data_fmt = | 1327 | ir->rx->hdpvr_data_fmt = |
1333 | (id->driver_data & ID_FLAG_HDPVR) ? true : false; | 1328 | (id->driver_data & ID_FLAG_HDPVR) ? true : false; |