aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/meye.c
diff options
context:
space:
mode:
authorStefani Seibold <stefani@seibold.net>2009-12-21 17:37:27 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2009-12-22 17:17:56 -0500
commitc1e13f25674ed564948ecb7dfe5f83e578892896 (patch)
tree24fac07b3e2b66dff01c3127b34077de1de4c101 /drivers/media/video/meye.c
parent45465487897a1c6d508b14b904dc5777f7ec7e04 (diff)
kfifo: move out spinlock
Move the pointer to the spinlock out of struct kfifo. Most users in tree do not actually use a spinlock, so the few exceptions now have to call kfifo_{get,put}_locked, which takes an extra argument to a spinlock. Signed-off-by: Stefani Seibold <stefani@seibold.net> Acked-by: Greg Kroah-Hartman <gregkh@suse.de> Acked-by: Mauro Carvalho Chehab <mchehab@redhat.com> Acked-by: Andi Kleen <ak@linux.intel.com> Acked-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/media/video/meye.c')
-rw-r--r--drivers/media/video/meye.c35
1 files changed, 20 insertions, 15 deletions
diff --git a/drivers/media/video/meye.c b/drivers/media/video/meye.c
index dacbbb839b9e..38bcedfd9fec 100644
--- a/drivers/media/video/meye.c
+++ b/drivers/media/video/meye.c
@@ -800,8 +800,8 @@ again:
800 return IRQ_HANDLED; 800 return IRQ_HANDLED;
801 801
802 if (meye.mchip_mode == MCHIP_HIC_MODE_CONT_OUT) { 802 if (meye.mchip_mode == MCHIP_HIC_MODE_CONT_OUT) {
803 if (kfifo_get(&meye.grabq, (unsigned char *)&reqnr, 803 if (kfifo_get_locked(&meye.grabq, (unsigned char *)&reqnr,
804 sizeof(int)) != sizeof(int)) { 804 sizeof(int), &meye.grabq_lock) != sizeof(int)) {
805 mchip_free_frame(); 805 mchip_free_frame();
806 return IRQ_HANDLED; 806 return IRQ_HANDLED;
807 } 807 }
@@ -811,7 +811,8 @@ again:
811 meye.grab_buffer[reqnr].state = MEYE_BUF_DONE; 811 meye.grab_buffer[reqnr].state = MEYE_BUF_DONE;
812 do_gettimeofday(&meye.grab_buffer[reqnr].timestamp); 812 do_gettimeofday(&meye.grab_buffer[reqnr].timestamp);
813 meye.grab_buffer[reqnr].sequence = sequence++; 813 meye.grab_buffer[reqnr].sequence = sequence++;
814 kfifo_put(&meye.doneq, (unsigned char *)&reqnr, sizeof(int)); 814 kfifo_put_locked(&meye.doneq, (unsigned char *)&reqnr,
815 sizeof(int), &meye.doneq_lock);
815 wake_up_interruptible(&meye.proc_list); 816 wake_up_interruptible(&meye.proc_list);
816 } else { 817 } else {
817 int size; 818 int size;
@@ -820,8 +821,8 @@ again:
820 mchip_free_frame(); 821 mchip_free_frame();
821 goto again; 822 goto again;
822 } 823 }
823 if (kfifo_get(&meye.grabq, (unsigned char *)&reqnr, 824 if (kfifo_get_locked(&meye.grabq, (unsigned char *)&reqnr,
824 sizeof(int)) != sizeof(int)) { 825 sizeof(int), &meye.grabq_lock) != sizeof(int)) {
825 mchip_free_frame(); 826 mchip_free_frame();
826 goto again; 827 goto again;
827 } 828 }
@@ -831,7 +832,8 @@ again:
831 meye.grab_buffer[reqnr].state = MEYE_BUF_DONE; 832 meye.grab_buffer[reqnr].state = MEYE_BUF_DONE;
832 do_gettimeofday(&meye.grab_buffer[reqnr].timestamp); 833 do_gettimeofday(&meye.grab_buffer[reqnr].timestamp);
833 meye.grab_buffer[reqnr].sequence = sequence++; 834 meye.grab_buffer[reqnr].sequence = sequence++;
834 kfifo_put(&meye.doneq, (unsigned char *)&reqnr, sizeof(int)); 835 kfifo_put_locked(&meye.doneq, (unsigned char *)&reqnr,
836 sizeof(int), &meye.doneq_lock);
835 wake_up_interruptible(&meye.proc_list); 837 wake_up_interruptible(&meye.proc_list);
836 } 838 }
837 mchip_free_frame(); 839 mchip_free_frame();
@@ -933,7 +935,8 @@ static int meyeioc_qbuf_capt(int *nb)
933 mchip_cont_compression_start(); 935 mchip_cont_compression_start();
934 936
935 meye.grab_buffer[*nb].state = MEYE_BUF_USING; 937 meye.grab_buffer[*nb].state = MEYE_BUF_USING;
936 kfifo_put(&meye.grabq, (unsigned char *)nb, sizeof(int)); 938 kfifo_put_locked(&meye.grabq, (unsigned char *)nb, sizeof(int),
939 &meye.grabq_lock);
937 mutex_unlock(&meye.lock); 940 mutex_unlock(&meye.lock);
938 941
939 return 0; 942 return 0;
@@ -965,7 +968,8 @@ static int meyeioc_sync(struct file *file, void *fh, int *i)
965 /* fall through */ 968 /* fall through */
966 case MEYE_BUF_DONE: 969 case MEYE_BUF_DONE:
967 meye.grab_buffer[*i].state = MEYE_BUF_UNUSED; 970 meye.grab_buffer[*i].state = MEYE_BUF_UNUSED;
968 kfifo_get(&meye.doneq, (unsigned char *)&unused, sizeof(int)); 971 kfifo_get_locked(&meye.doneq, (unsigned char *)&unused,
972 sizeof(int), &meye.doneq_lock);
969 } 973 }
970 *i = meye.grab_buffer[*i].size; 974 *i = meye.grab_buffer[*i].size;
971 mutex_unlock(&meye.lock); 975 mutex_unlock(&meye.lock);
@@ -1452,7 +1456,8 @@ static int vidioc_qbuf(struct file *file, void *fh, struct v4l2_buffer *buf)
1452 buf->flags |= V4L2_BUF_FLAG_QUEUED; 1456 buf->flags |= V4L2_BUF_FLAG_QUEUED;
1453 buf->flags &= ~V4L2_BUF_FLAG_DONE; 1457 buf->flags &= ~V4L2_BUF_FLAG_DONE;
1454 meye.grab_buffer[buf->index].state = MEYE_BUF_USING; 1458 meye.grab_buffer[buf->index].state = MEYE_BUF_USING;
1455 kfifo_put(&meye.grabq, (unsigned char *)&buf->index, sizeof(int)); 1459 kfifo_put_locked(&meye.grabq, (unsigned char *)&buf->index,
1460 sizeof(int), &meye.grabq_lock);
1456 mutex_unlock(&meye.lock); 1461 mutex_unlock(&meye.lock);
1457 1462
1458 return 0; 1463 return 0;
@@ -1478,8 +1483,8 @@ static int vidioc_dqbuf(struct file *file, void *fh, struct v4l2_buffer *buf)
1478 return -EINTR; 1483 return -EINTR;
1479 } 1484 }
1480 1485
1481 if (!kfifo_get(&meye.doneq, (unsigned char *)&reqnr, 1486 if (!kfifo_get_locked(&meye.doneq, (unsigned char *)&reqnr,
1482 sizeof(int))) { 1487 sizeof(int), &meye.doneq_lock)) {
1483 mutex_unlock(&meye.lock); 1488 mutex_unlock(&meye.lock);
1484 return -EBUSY; 1489 return -EBUSY;
1485 } 1490 }
@@ -1745,14 +1750,14 @@ static int __devinit meye_probe(struct pci_dev *pcidev,
1745 } 1750 }
1746 1751
1747 spin_lock_init(&meye.grabq_lock); 1752 spin_lock_init(&meye.grabq_lock);
1748 if (kfifo_alloc(&meye.grabq, sizeof(int) * MEYE_MAX_BUFNBRS, GFP_KERNEL, 1753 if (kfifo_alloc(&meye.grabq, sizeof(int) * MEYE_MAX_BUFNBRS,
1749 &meye.grabq_lock)) { 1754 GFP_KERNEL)) {
1750 printk(KERN_ERR "meye: fifo allocation failed\n"); 1755 printk(KERN_ERR "meye: fifo allocation failed\n");
1751 goto outkfifoalloc1; 1756 goto outkfifoalloc1;
1752 } 1757 }
1753 spin_lock_init(&meye.doneq_lock); 1758 spin_lock_init(&meye.doneq_lock);
1754 if (kfifo_alloc(&meye.doneq, sizeof(int) * MEYE_MAX_BUFNBRS, GFP_KERNEL, 1759 if (kfifo_alloc(&meye.doneq, sizeof(int) * MEYE_MAX_BUFNBRS,
1755 &meye.doneq_lock)) { 1760 GFP_KERNEL)) {
1756 printk(KERN_ERR "meye: fifo allocation failed\n"); 1761 printk(KERN_ERR "meye: fifo allocation failed\n");
1757 goto outkfifoalloc2; 1762 goto outkfifoalloc2;
1758 } 1763 }