diff options
author | Takashi Iwai <tiwai@suse.de> | 2009-12-25 08:15:31 -0500 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2009-12-25 08:15:31 -0500 |
commit | 52e04ea89da57274f0313d2bd73ba02f686cfdeb (patch) | |
tree | 6ce5d086bcaea4cb534b3fcf6ba736eb48d582a4 /drivers/media/video/meye.c | |
parent | 41116e926cb92292fa4fcbe888ae8133fa0038e6 (diff) | |
parent | 8b90ca08821fee79e181bfcbc3bbd41ef5637136 (diff) |
Merge branch 'fix/misc' into topic/misc
Diffstat (limited to 'drivers/media/video/meye.c')
-rw-r--r-- | drivers/media/video/meye.c | 60 |
1 files changed, 32 insertions, 28 deletions
diff --git a/drivers/media/video/meye.c b/drivers/media/video/meye.c index 6ffa64cd1c6d..b421858ccf90 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_out_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_in_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_out_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_in_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(); |
@@ -859,8 +861,8 @@ static int meye_open(struct file *file) | |||
859 | 861 | ||
860 | for (i = 0; i < MEYE_MAX_BUFNBRS; i++) | 862 | for (i = 0; i < MEYE_MAX_BUFNBRS; i++) |
861 | meye.grab_buffer[i].state = MEYE_BUF_UNUSED; | 863 | meye.grab_buffer[i].state = MEYE_BUF_UNUSED; |
862 | kfifo_reset(meye.grabq); | 864 | kfifo_reset(&meye.grabq); |
863 | kfifo_reset(meye.doneq); | 865 | kfifo_reset(&meye.doneq); |
864 | return 0; | 866 | return 0; |
865 | } | 867 | } |
866 | 868 | ||
@@ -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_in_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,9 @@ 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 | if (kfifo_out_locked(&meye.doneq, (unsigned char *)&unused, |
972 | sizeof(int), &meye.doneq_lock) != sizeof(int)) | ||
973 | break; | ||
969 | } | 974 | } |
970 | *i = meye.grab_buffer[*i].size; | 975 | *i = meye.grab_buffer[*i].size; |
971 | mutex_unlock(&meye.lock); | 976 | mutex_unlock(&meye.lock); |
@@ -1452,7 +1457,8 @@ static int vidioc_qbuf(struct file *file, void *fh, struct v4l2_buffer *buf) | |||
1452 | buf->flags |= V4L2_BUF_FLAG_QUEUED; | 1457 | buf->flags |= V4L2_BUF_FLAG_QUEUED; |
1453 | buf->flags &= ~V4L2_BUF_FLAG_DONE; | 1458 | buf->flags &= ~V4L2_BUF_FLAG_DONE; |
1454 | meye.grab_buffer[buf->index].state = MEYE_BUF_USING; | 1459 | meye.grab_buffer[buf->index].state = MEYE_BUF_USING; |
1455 | kfifo_put(meye.grabq, (unsigned char *)&buf->index, sizeof(int)); | 1460 | kfifo_in_locked(&meye.grabq, (unsigned char *)&buf->index, |
1461 | sizeof(int), &meye.grabq_lock); | ||
1456 | mutex_unlock(&meye.lock); | 1462 | mutex_unlock(&meye.lock); |
1457 | 1463 | ||
1458 | return 0; | 1464 | return 0; |
@@ -1467,19 +1473,19 @@ static int vidioc_dqbuf(struct file *file, void *fh, struct v4l2_buffer *buf) | |||
1467 | 1473 | ||
1468 | mutex_lock(&meye.lock); | 1474 | mutex_lock(&meye.lock); |
1469 | 1475 | ||
1470 | if (kfifo_len(meye.doneq) == 0 && file->f_flags & O_NONBLOCK) { | 1476 | if (kfifo_len(&meye.doneq) == 0 && file->f_flags & O_NONBLOCK) { |
1471 | mutex_unlock(&meye.lock); | 1477 | mutex_unlock(&meye.lock); |
1472 | return -EAGAIN; | 1478 | return -EAGAIN; |
1473 | } | 1479 | } |
1474 | 1480 | ||
1475 | if (wait_event_interruptible(meye.proc_list, | 1481 | if (wait_event_interruptible(meye.proc_list, |
1476 | kfifo_len(meye.doneq) != 0) < 0) { | 1482 | kfifo_len(&meye.doneq) != 0) < 0) { |
1477 | mutex_unlock(&meye.lock); | 1483 | mutex_unlock(&meye.lock); |
1478 | return -EINTR; | 1484 | return -EINTR; |
1479 | } | 1485 | } |
1480 | 1486 | ||
1481 | if (!kfifo_get(meye.doneq, (unsigned char *)&reqnr, | 1487 | if (!kfifo_out_locked(&meye.doneq, (unsigned char *)&reqnr, |
1482 | sizeof(int))) { | 1488 | sizeof(int), &meye.doneq_lock)) { |
1483 | mutex_unlock(&meye.lock); | 1489 | mutex_unlock(&meye.lock); |
1484 | return -EBUSY; | 1490 | return -EBUSY; |
1485 | } | 1491 | } |
@@ -1529,8 +1535,8 @@ static int vidioc_streamoff(struct file *file, void *fh, enum v4l2_buf_type i) | |||
1529 | { | 1535 | { |
1530 | mutex_lock(&meye.lock); | 1536 | mutex_lock(&meye.lock); |
1531 | mchip_hic_stop(); | 1537 | mchip_hic_stop(); |
1532 | kfifo_reset(meye.grabq); | 1538 | kfifo_reset(&meye.grabq); |
1533 | kfifo_reset(meye.doneq); | 1539 | kfifo_reset(&meye.doneq); |
1534 | 1540 | ||
1535 | for (i = 0; i < MEYE_MAX_BUFNBRS; i++) | 1541 | for (i = 0; i < MEYE_MAX_BUFNBRS; i++) |
1536 | meye.grab_buffer[i].state = MEYE_BUF_UNUSED; | 1542 | meye.grab_buffer[i].state = MEYE_BUF_UNUSED; |
@@ -1572,7 +1578,7 @@ static unsigned int meye_poll(struct file *file, poll_table *wait) | |||
1572 | 1578 | ||
1573 | mutex_lock(&meye.lock); | 1579 | mutex_lock(&meye.lock); |
1574 | poll_wait(file, &meye.proc_list, wait); | 1580 | poll_wait(file, &meye.proc_list, wait); |
1575 | if (kfifo_len(meye.doneq)) | 1581 | if (kfifo_len(&meye.doneq)) |
1576 | res = POLLIN | POLLRDNORM; | 1582 | res = POLLIN | POLLRDNORM; |
1577 | mutex_unlock(&meye.lock); | 1583 | mutex_unlock(&meye.lock); |
1578 | return res; | 1584 | return res; |
@@ -1745,16 +1751,14 @@ static int __devinit meye_probe(struct pci_dev *pcidev, | |||
1745 | } | 1751 | } |
1746 | 1752 | ||
1747 | spin_lock_init(&meye.grabq_lock); | 1753 | spin_lock_init(&meye.grabq_lock); |
1748 | meye.grabq = kfifo_alloc(sizeof(int) * MEYE_MAX_BUFNBRS, GFP_KERNEL, | 1754 | if (kfifo_alloc(&meye.grabq, sizeof(int) * MEYE_MAX_BUFNBRS, |
1749 | &meye.grabq_lock); | 1755 | GFP_KERNEL)) { |
1750 | if (IS_ERR(meye.grabq)) { | ||
1751 | printk(KERN_ERR "meye: fifo allocation failed\n"); | 1756 | printk(KERN_ERR "meye: fifo allocation failed\n"); |
1752 | goto outkfifoalloc1; | 1757 | goto outkfifoalloc1; |
1753 | } | 1758 | } |
1754 | spin_lock_init(&meye.doneq_lock); | 1759 | spin_lock_init(&meye.doneq_lock); |
1755 | meye.doneq = kfifo_alloc(sizeof(int) * MEYE_MAX_BUFNBRS, GFP_KERNEL, | 1760 | if (kfifo_alloc(&meye.doneq, sizeof(int) * MEYE_MAX_BUFNBRS, |
1756 | &meye.doneq_lock); | 1761 | GFP_KERNEL)) { |
1757 | if (IS_ERR(meye.doneq)) { | ||
1758 | printk(KERN_ERR "meye: fifo allocation failed\n"); | 1762 | printk(KERN_ERR "meye: fifo allocation failed\n"); |
1759 | goto outkfifoalloc2; | 1763 | goto outkfifoalloc2; |
1760 | } | 1764 | } |
@@ -1868,9 +1872,9 @@ outregions: | |||
1868 | outenabledev: | 1872 | outenabledev: |
1869 | sony_pic_camera_command(SONY_PIC_COMMAND_SETCAMERA, 0); | 1873 | sony_pic_camera_command(SONY_PIC_COMMAND_SETCAMERA, 0); |
1870 | outsonypienable: | 1874 | outsonypienable: |
1871 | kfifo_free(meye.doneq); | 1875 | kfifo_free(&meye.doneq); |
1872 | outkfifoalloc2: | 1876 | outkfifoalloc2: |
1873 | kfifo_free(meye.grabq); | 1877 | kfifo_free(&meye.grabq); |
1874 | outkfifoalloc1: | 1878 | outkfifoalloc1: |
1875 | vfree(meye.grab_temp); | 1879 | vfree(meye.grab_temp); |
1876 | outvmalloc: | 1880 | outvmalloc: |
@@ -1901,8 +1905,8 @@ static void __devexit meye_remove(struct pci_dev *pcidev) | |||
1901 | 1905 | ||
1902 | sony_pic_camera_command(SONY_PIC_COMMAND_SETCAMERA, 0); | 1906 | sony_pic_camera_command(SONY_PIC_COMMAND_SETCAMERA, 0); |
1903 | 1907 | ||
1904 | kfifo_free(meye.doneq); | 1908 | kfifo_free(&meye.doneq); |
1905 | kfifo_free(meye.grabq); | 1909 | kfifo_free(&meye.grabq); |
1906 | 1910 | ||
1907 | vfree(meye.grab_temp); | 1911 | vfree(meye.grab_temp); |
1908 | 1912 | ||