aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/meye.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video/meye.c')
-rw-r--r--drivers/media/video/meye.c112
1 files changed, 56 insertions, 56 deletions
diff --git a/drivers/media/video/meye.c b/drivers/media/video/meye.c
index 2869464aee0..850bee97090 100644
--- a/drivers/media/video/meye.c
+++ b/drivers/media/video/meye.c
@@ -925,7 +925,7 @@ static int meye_do_ioctl(struct inode *inode, struct file *file,
925 return -EINVAL; 925 return -EINVAL;
926 if (p->palette != VIDEO_PALETTE_YUV422) 926 if (p->palette != VIDEO_PALETTE_YUV422)
927 return -EINVAL; 927 return -EINVAL;
928 down(&meye.lock); 928 mutex_lock(&meye.lock);
929 sonypi_camera_command(SONYPI_COMMAND_SETCAMERABRIGHTNESS, 929 sonypi_camera_command(SONYPI_COMMAND_SETCAMERABRIGHTNESS,
930 p->brightness >> 10); 930 p->brightness >> 10);
931 sonypi_camera_command(SONYPI_COMMAND_SETCAMERAHUE, 931 sonypi_camera_command(SONYPI_COMMAND_SETCAMERAHUE,
@@ -935,7 +935,7 @@ static int meye_do_ioctl(struct inode *inode, struct file *file,
935 sonypi_camera_command(SONYPI_COMMAND_SETCAMERACONTRAST, 935 sonypi_camera_command(SONYPI_COMMAND_SETCAMERACONTRAST,
936 p->contrast >> 10); 936 p->contrast >> 10);
937 meye.picture = *p; 937 meye.picture = *p;
938 up(&meye.lock); 938 mutex_unlock(&meye.lock);
939 break; 939 break;
940 } 940 }
941 941
@@ -946,21 +946,21 @@ static int meye_do_ioctl(struct inode *inode, struct file *file,
946 if (*i < 0 || *i >= gbuffers) 946 if (*i < 0 || *i >= gbuffers)
947 return -EINVAL; 947 return -EINVAL;
948 948
949 down(&meye.lock); 949 mutex_lock(&meye.lock);
950 950
951 switch (meye.grab_buffer[*i].state) { 951 switch (meye.grab_buffer[*i].state) {
952 952
953 case MEYE_BUF_UNUSED: 953 case MEYE_BUF_UNUSED:
954 up(&meye.lock); 954 mutex_unlock(&meye.lock);
955 return -EINVAL; 955 return -EINVAL;
956 case MEYE_BUF_USING: 956 case MEYE_BUF_USING:
957 if (file->f_flags & O_NONBLOCK) { 957 if (file->f_flags & O_NONBLOCK) {
958 up(&meye.lock); 958 mutex_unlock(&meye.lock);
959 return -EAGAIN; 959 return -EAGAIN;
960 } 960 }
961 if (wait_event_interruptible(meye.proc_list, 961 if (wait_event_interruptible(meye.proc_list,
962 (meye.grab_buffer[*i].state != MEYE_BUF_USING))) { 962 (meye.grab_buffer[*i].state != MEYE_BUF_USING))) {
963 up(&meye.lock); 963 mutex_unlock(&meye.lock);
964 return -EINTR; 964 return -EINTR;
965 } 965 }
966 /* fall through */ 966 /* fall through */
@@ -968,7 +968,7 @@ static int meye_do_ioctl(struct inode *inode, struct file *file,
968 meye.grab_buffer[*i].state = MEYE_BUF_UNUSED; 968 meye.grab_buffer[*i].state = MEYE_BUF_UNUSED;
969 kfifo_get(meye.doneq, (unsigned char *)&unused, sizeof(int)); 969 kfifo_get(meye.doneq, (unsigned char *)&unused, sizeof(int));
970 } 970 }
971 up(&meye.lock); 971 mutex_unlock(&meye.lock);
972 break; 972 break;
973 } 973 }
974 974
@@ -987,7 +987,7 @@ static int meye_do_ioctl(struct inode *inode, struct file *file,
987 if (meye.grab_buffer[vm->frame].state != MEYE_BUF_UNUSED) 987 if (meye.grab_buffer[vm->frame].state != MEYE_BUF_UNUSED)
988 return -EBUSY; 988 return -EBUSY;
989 989
990 down(&meye.lock); 990 mutex_lock(&meye.lock);
991 if (vm->width == 640 && vm->height == 480) { 991 if (vm->width == 640 && vm->height == 480) {
992 if (meye.params.subsample) { 992 if (meye.params.subsample) {
993 meye.params.subsample = 0; 993 meye.params.subsample = 0;
@@ -999,7 +999,7 @@ static int meye_do_ioctl(struct inode *inode, struct file *file,
999 restart = 1; 999 restart = 1;
1000 } 1000 }
1001 } else { 1001 } else {
1002 up(&meye.lock); 1002 mutex_unlock(&meye.lock);
1003 return -EINVAL; 1003 return -EINVAL;
1004 } 1004 }
1005 1005
@@ -1007,7 +1007,7 @@ static int meye_do_ioctl(struct inode *inode, struct file *file,
1007 mchip_continuous_start(); 1007 mchip_continuous_start();
1008 meye.grab_buffer[vm->frame].state = MEYE_BUF_USING; 1008 meye.grab_buffer[vm->frame].state = MEYE_BUF_USING;
1009 kfifo_put(meye.grabq, (unsigned char *)&vm->frame, sizeof(int)); 1009 kfifo_put(meye.grabq, (unsigned char *)&vm->frame, sizeof(int));
1010 up(&meye.lock); 1010 mutex_unlock(&meye.lock);
1011 break; 1011 break;
1012 } 1012 }
1013 1013
@@ -1039,7 +1039,7 @@ static int meye_do_ioctl(struct inode *inode, struct file *file,
1039 return -EINVAL; 1039 return -EINVAL;
1040 if (jp->framerate > 31) 1040 if (jp->framerate > 31)
1041 return -EINVAL; 1041 return -EINVAL;
1042 down(&meye.lock); 1042 mutex_lock(&meye.lock);
1043 if (meye.params.subsample != jp->subsample || 1043 if (meye.params.subsample != jp->subsample ||
1044 meye.params.quality != jp->quality) 1044 meye.params.quality != jp->quality)
1045 mchip_hic_stop(); /* need restart */ 1045 mchip_hic_stop(); /* need restart */
@@ -1050,7 +1050,7 @@ static int meye_do_ioctl(struct inode *inode, struct file *file,
1050 meye.params.agc); 1050 meye.params.agc);
1051 sonypi_camera_command(SONYPI_COMMAND_SETCAMERAPICTURE, 1051 sonypi_camera_command(SONYPI_COMMAND_SETCAMERAPICTURE,
1052 meye.params.picture); 1052 meye.params.picture);
1053 up(&meye.lock); 1053 mutex_unlock(&meye.lock);
1054 break; 1054 break;
1055 } 1055 }
1056 1056
@@ -1068,12 +1068,12 @@ static int meye_do_ioctl(struct inode *inode, struct file *file,
1068 } 1068 }
1069 if (meye.grab_buffer[*nb].state != MEYE_BUF_UNUSED) 1069 if (meye.grab_buffer[*nb].state != MEYE_BUF_UNUSED)
1070 return -EBUSY; 1070 return -EBUSY;
1071 down(&meye.lock); 1071 mutex_lock(&meye.lock);
1072 if (meye.mchip_mode != MCHIP_HIC_MODE_CONT_COMP) 1072 if (meye.mchip_mode != MCHIP_HIC_MODE_CONT_COMP)
1073 mchip_cont_compression_start(); 1073 mchip_cont_compression_start();
1074 meye.grab_buffer[*nb].state = MEYE_BUF_USING; 1074 meye.grab_buffer[*nb].state = MEYE_BUF_USING;
1075 kfifo_put(meye.grabq, (unsigned char *)nb, sizeof(int)); 1075 kfifo_put(meye.grabq, (unsigned char *)nb, sizeof(int));
1076 up(&meye.lock); 1076 mutex_unlock(&meye.lock);
1077 break; 1077 break;
1078 } 1078 }
1079 1079
@@ -1084,20 +1084,20 @@ static int meye_do_ioctl(struct inode *inode, struct file *file,
1084 if (*i < 0 || *i >= gbuffers) 1084 if (*i < 0 || *i >= gbuffers)
1085 return -EINVAL; 1085 return -EINVAL;
1086 1086
1087 down(&meye.lock); 1087 mutex_lock(&meye.lock);
1088 switch (meye.grab_buffer[*i].state) { 1088 switch (meye.grab_buffer[*i].state) {
1089 1089
1090 case MEYE_BUF_UNUSED: 1090 case MEYE_BUF_UNUSED:
1091 up(&meye.lock); 1091 mutex_unlock(&meye.lock);
1092 return -EINVAL; 1092 return -EINVAL;
1093 case MEYE_BUF_USING: 1093 case MEYE_BUF_USING:
1094 if (file->f_flags & O_NONBLOCK) { 1094 if (file->f_flags & O_NONBLOCK) {
1095 up(&meye.lock); 1095 mutex_unlock(&meye.lock);
1096 return -EAGAIN; 1096 return -EAGAIN;
1097 } 1097 }
1098 if (wait_event_interruptible(meye.proc_list, 1098 if (wait_event_interruptible(meye.proc_list,
1099 (meye.grab_buffer[*i].state != MEYE_BUF_USING))) { 1099 (meye.grab_buffer[*i].state != MEYE_BUF_USING))) {
1100 up(&meye.lock); 1100 mutex_unlock(&meye.lock);
1101 return -EINTR; 1101 return -EINTR;
1102 } 1102 }
1103 /* fall through */ 1103 /* fall through */
@@ -1106,7 +1106,7 @@ static int meye_do_ioctl(struct inode *inode, struct file *file,
1106 kfifo_get(meye.doneq, (unsigned char *)&unused, sizeof(int)); 1106 kfifo_get(meye.doneq, (unsigned char *)&unused, sizeof(int));
1107 } 1107 }
1108 *i = meye.grab_buffer[*i].size; 1108 *i = meye.grab_buffer[*i].size;
1109 up(&meye.lock); 1109 mutex_unlock(&meye.lock);
1110 break; 1110 break;
1111 } 1111 }
1112 1112
@@ -1116,14 +1116,14 @@ static int meye_do_ioctl(struct inode *inode, struct file *file,
1116 return -EINVAL; 1116 return -EINVAL;
1117 if (meye.grab_buffer[0].state != MEYE_BUF_UNUSED) 1117 if (meye.grab_buffer[0].state != MEYE_BUF_UNUSED)
1118 return -EBUSY; 1118 return -EBUSY;
1119 down(&meye.lock); 1119 mutex_lock(&meye.lock);
1120 meye.grab_buffer[0].state = MEYE_BUF_USING; 1120 meye.grab_buffer[0].state = MEYE_BUF_USING;
1121 mchip_take_picture(); 1121 mchip_take_picture();
1122 mchip_get_picture( 1122 mchip_get_picture(
1123 meye.grab_fbuffer, 1123 meye.grab_fbuffer,
1124 mchip_hsize() * mchip_vsize() * 2); 1124 mchip_hsize() * mchip_vsize() * 2);
1125 meye.grab_buffer[0].state = MEYE_BUF_DONE; 1125 meye.grab_buffer[0].state = MEYE_BUF_DONE;
1126 up(&meye.lock); 1126 mutex_unlock(&meye.lock);
1127 break; 1127 break;
1128 } 1128 }
1129 1129
@@ -1134,7 +1134,7 @@ static int meye_do_ioctl(struct inode *inode, struct file *file,
1134 return -EINVAL; 1134 return -EINVAL;
1135 if (meye.grab_buffer[0].state != MEYE_BUF_UNUSED) 1135 if (meye.grab_buffer[0].state != MEYE_BUF_UNUSED)
1136 return -EBUSY; 1136 return -EBUSY;
1137 down(&meye.lock); 1137 mutex_lock(&meye.lock);
1138 meye.grab_buffer[0].state = MEYE_BUF_USING; 1138 meye.grab_buffer[0].state = MEYE_BUF_USING;
1139 *len = -1; 1139 *len = -1;
1140 while (*len == -1) { 1140 while (*len == -1) {
@@ -1142,7 +1142,7 @@ static int meye_do_ioctl(struct inode *inode, struct file *file,
1142 *len = mchip_compress_frame(meye.grab_fbuffer, gbufsize); 1142 *len = mchip_compress_frame(meye.grab_fbuffer, gbufsize);
1143 } 1143 }
1144 meye.grab_buffer[0].state = MEYE_BUF_DONE; 1144 meye.grab_buffer[0].state = MEYE_BUF_DONE;
1145 up(&meye.lock); 1145 mutex_unlock(&meye.lock);
1146 break; 1146 break;
1147 } 1147 }
1148 1148
@@ -1285,7 +1285,7 @@ static int meye_do_ioctl(struct inode *inode, struct file *file,
1285 case VIDIOC_S_CTRL: { 1285 case VIDIOC_S_CTRL: {
1286 struct v4l2_control *c = arg; 1286 struct v4l2_control *c = arg;
1287 1287
1288 down(&meye.lock); 1288 mutex_lock(&meye.lock);
1289 switch (c->id) { 1289 switch (c->id) {
1290 case V4L2_CID_BRIGHTNESS: 1290 case V4L2_CID_BRIGHTNESS:
1291 sonypi_camera_command( 1291 sonypi_camera_command(
@@ -1329,17 +1329,17 @@ static int meye_do_ioctl(struct inode *inode, struct file *file,
1329 meye.params.framerate = c->value; 1329 meye.params.framerate = c->value;
1330 break; 1330 break;
1331 default: 1331 default:
1332 up(&meye.lock); 1332 mutex_unlock(&meye.lock);
1333 return -EINVAL; 1333 return -EINVAL;
1334 } 1334 }
1335 up(&meye.lock); 1335 mutex_unlock(&meye.lock);
1336 break; 1336 break;
1337 } 1337 }
1338 1338
1339 case VIDIOC_G_CTRL: { 1339 case VIDIOC_G_CTRL: {
1340 struct v4l2_control *c = arg; 1340 struct v4l2_control *c = arg;
1341 1341
1342 down(&meye.lock); 1342 mutex_lock(&meye.lock);
1343 switch (c->id) { 1343 switch (c->id) {
1344 case V4L2_CID_BRIGHTNESS: 1344 case V4L2_CID_BRIGHTNESS:
1345 c->value = meye.picture.brightness >> 10; 1345 c->value = meye.picture.brightness >> 10;
@@ -1369,10 +1369,10 @@ static int meye_do_ioctl(struct inode *inode, struct file *file,
1369 c->value = meye.params.framerate; 1369 c->value = meye.params.framerate;
1370 break; 1370 break;
1371 default: 1371 default:
1372 up(&meye.lock); 1372 mutex_unlock(&meye.lock);
1373 return -EINVAL; 1373 return -EINVAL;
1374 } 1374 }
1375 up(&meye.lock); 1375 mutex_unlock(&meye.lock);
1376 break; 1376 break;
1377 } 1377 }
1378 1378
@@ -1469,7 +1469,7 @@ static int meye_do_ioctl(struct inode *inode, struct file *file,
1469 f->fmt.pix.field != V4L2_FIELD_NONE) 1469 f->fmt.pix.field != V4L2_FIELD_NONE)
1470 return -EINVAL; 1470 return -EINVAL;
1471 f->fmt.pix.field = V4L2_FIELD_NONE; 1471 f->fmt.pix.field = V4L2_FIELD_NONE;
1472 down(&meye.lock); 1472 mutex_lock(&meye.lock);
1473 if (f->fmt.pix.width <= 320) { 1473 if (f->fmt.pix.width <= 320) {
1474 f->fmt.pix.width = 320; 1474 f->fmt.pix.width = 320;
1475 f->fmt.pix.height = 240; 1475 f->fmt.pix.height = 240;
@@ -1487,7 +1487,7 @@ static int meye_do_ioctl(struct inode *inode, struct file *file,
1487 meye.mchip_mode = MCHIP_HIC_MODE_CONT_COMP; 1487 meye.mchip_mode = MCHIP_HIC_MODE_CONT_COMP;
1488 break; 1488 break;
1489 } 1489 }
1490 up(&meye.lock); 1490 mutex_unlock(&meye.lock);
1491 f->fmt.pix.bytesperline = f->fmt.pix.width * 2; 1491 f->fmt.pix.bytesperline = f->fmt.pix.width * 2;
1492 f->fmt.pix.sizeimage = f->fmt.pix.height * 1492 f->fmt.pix.sizeimage = f->fmt.pix.height *
1493 f->fmt.pix.bytesperline; 1493 f->fmt.pix.bytesperline;
@@ -1509,11 +1509,11 @@ static int meye_do_ioctl(struct inode *inode, struct file *file,
1509 /* already allocated, no modifications */ 1509 /* already allocated, no modifications */
1510 break; 1510 break;
1511 } 1511 }
1512 down(&meye.lock); 1512 mutex_lock(&meye.lock);
1513 if (meye.grab_fbuffer) { 1513 if (meye.grab_fbuffer) {
1514 for (i = 0; i < gbuffers; i++) 1514 for (i = 0; i < gbuffers; i++)
1515 if (meye.vma_use_count[i]) { 1515 if (meye.vma_use_count[i]) {
1516 up(&meye.lock); 1516 mutex_unlock(&meye.lock);
1517 return -EINVAL; 1517 return -EINVAL;
1518 } 1518 }
1519 rvfree(meye.grab_fbuffer, gbuffers * gbufsize); 1519 rvfree(meye.grab_fbuffer, gbuffers * gbufsize);
@@ -1525,12 +1525,12 @@ static int meye_do_ioctl(struct inode *inode, struct file *file,
1525 if (!meye.grab_fbuffer) { 1525 if (!meye.grab_fbuffer) {
1526 printk(KERN_ERR "meye: v4l framebuffer allocation" 1526 printk(KERN_ERR "meye: v4l framebuffer allocation"
1527 " failed\n"); 1527 " failed\n");
1528 up(&meye.lock); 1528 mutex_unlock(&meye.lock);
1529 return -ENOMEM; 1529 return -ENOMEM;
1530 } 1530 }
1531 for (i = 0; i < gbuffers; i++) 1531 for (i = 0; i < gbuffers; i++)
1532 meye.vma_use_count[i] = 0; 1532 meye.vma_use_count[i] = 0;
1533 up(&meye.lock); 1533 mutex_unlock(&meye.lock);
1534 break; 1534 break;
1535 } 1535 }
1536 1536
@@ -1569,12 +1569,12 @@ static int meye_do_ioctl(struct inode *inode, struct file *file,
1569 return -EINVAL; 1569 return -EINVAL;
1570 if (meye.grab_buffer[buf->index].state != MEYE_BUF_UNUSED) 1570 if (meye.grab_buffer[buf->index].state != MEYE_BUF_UNUSED)
1571 return -EINVAL; 1571 return -EINVAL;
1572 down(&meye.lock); 1572 mutex_lock(&meye.lock);
1573 buf->flags |= V4L2_BUF_FLAG_QUEUED; 1573 buf->flags |= V4L2_BUF_FLAG_QUEUED;
1574 buf->flags &= ~V4L2_BUF_FLAG_DONE; 1574 buf->flags &= ~V4L2_BUF_FLAG_DONE;
1575 meye.grab_buffer[buf->index].state = MEYE_BUF_USING; 1575 meye.grab_buffer[buf->index].state = MEYE_BUF_USING;
1576 kfifo_put(meye.grabq, (unsigned char *)&buf->index, sizeof(int)); 1576 kfifo_put(meye.grabq, (unsigned char *)&buf->index, sizeof(int));
1577 up(&meye.lock); 1577 mutex_unlock(&meye.lock);
1578 break; 1578 break;
1579 } 1579 }
1580 1580
@@ -1587,23 +1587,23 @@ static int meye_do_ioctl(struct inode *inode, struct file *file,
1587 if (buf->memory != V4L2_MEMORY_MMAP) 1587 if (buf->memory != V4L2_MEMORY_MMAP)
1588 return -EINVAL; 1588 return -EINVAL;
1589 1589
1590 down(&meye.lock); 1590 mutex_lock(&meye.lock);
1591 if (kfifo_len(meye.doneq) == 0 && file->f_flags & O_NONBLOCK) { 1591 if (kfifo_len(meye.doneq) == 0 && file->f_flags & O_NONBLOCK) {
1592 up(&meye.lock); 1592 mutex_unlock(&meye.lock);
1593 return -EAGAIN; 1593 return -EAGAIN;
1594 } 1594 }
1595 if (wait_event_interruptible(meye.proc_list, 1595 if (wait_event_interruptible(meye.proc_list,
1596 kfifo_len(meye.doneq) != 0) < 0) { 1596 kfifo_len(meye.doneq) != 0) < 0) {
1597 up(&meye.lock); 1597 mutex_unlock(&meye.lock);
1598 return -EINTR; 1598 return -EINTR;
1599 } 1599 }
1600 if (!kfifo_get(meye.doneq, (unsigned char *)&reqnr, 1600 if (!kfifo_get(meye.doneq, (unsigned char *)&reqnr,
1601 sizeof(int))) { 1601 sizeof(int))) {
1602 up(&meye.lock); 1602 mutex_unlock(&meye.lock);
1603 return -EBUSY; 1603 return -EBUSY;
1604 } 1604 }
1605 if (meye.grab_buffer[reqnr].state != MEYE_BUF_DONE) { 1605 if (meye.grab_buffer[reqnr].state != MEYE_BUF_DONE) {
1606 up(&meye.lock); 1606 mutex_unlock(&meye.lock);
1607 return -EINVAL; 1607 return -EINVAL;
1608 } 1608 }
1609 buf->index = reqnr; 1609 buf->index = reqnr;
@@ -1616,12 +1616,12 @@ static int meye_do_ioctl(struct inode *inode, struct file *file,
1616 buf->m.offset = reqnr * gbufsize; 1616 buf->m.offset = reqnr * gbufsize;
1617 buf->length = gbufsize; 1617 buf->length = gbufsize;
1618 meye.grab_buffer[reqnr].state = MEYE_BUF_UNUSED; 1618 meye.grab_buffer[reqnr].state = MEYE_BUF_UNUSED;
1619 up(&meye.lock); 1619 mutex_unlock(&meye.lock);
1620 break; 1620 break;
1621 } 1621 }
1622 1622
1623 case VIDIOC_STREAMON: { 1623 case VIDIOC_STREAMON: {
1624 down(&meye.lock); 1624 mutex_lock(&meye.lock);
1625 switch (meye.mchip_mode) { 1625 switch (meye.mchip_mode) {
1626 case MCHIP_HIC_MODE_CONT_OUT: 1626 case MCHIP_HIC_MODE_CONT_OUT:
1627 mchip_continuous_start(); 1627 mchip_continuous_start();
@@ -1630,23 +1630,23 @@ static int meye_do_ioctl(struct inode *inode, struct file *file,
1630 mchip_cont_compression_start(); 1630 mchip_cont_compression_start();
1631 break; 1631 break;
1632 default: 1632 default:
1633 up(&meye.lock); 1633 mutex_unlock(&meye.lock);
1634 return -EINVAL; 1634 return -EINVAL;
1635 } 1635 }
1636 up(&meye.lock); 1636 mutex_unlock(&meye.lock);
1637 break; 1637 break;
1638 } 1638 }
1639 1639
1640 case VIDIOC_STREAMOFF: { 1640 case VIDIOC_STREAMOFF: {
1641 int i; 1641 int i;
1642 1642
1643 down(&meye.lock); 1643 mutex_lock(&meye.lock);
1644 mchip_hic_stop(); 1644 mchip_hic_stop();
1645 kfifo_reset(meye.grabq); 1645 kfifo_reset(meye.grabq);
1646 kfifo_reset(meye.doneq); 1646 kfifo_reset(meye.doneq);
1647 for (i = 0; i < MEYE_MAX_BUFNBRS; i++) 1647 for (i = 0; i < MEYE_MAX_BUFNBRS; i++)
1648 meye.grab_buffer[i].state = MEYE_BUF_UNUSED; 1648 meye.grab_buffer[i].state = MEYE_BUF_UNUSED;
1649 up(&meye.lock); 1649 mutex_unlock(&meye.lock);
1650 break; 1650 break;
1651 } 1651 }
1652 1652
@@ -1672,11 +1672,11 @@ static unsigned int meye_poll(struct file *file, poll_table *wait)
1672{ 1672{
1673 unsigned int res = 0; 1673 unsigned int res = 0;
1674 1674
1675 down(&meye.lock); 1675 mutex_lock(&meye.lock);
1676 poll_wait(file, &meye.proc_list, wait); 1676 poll_wait(file, &meye.proc_list, wait);
1677 if (kfifo_len(meye.doneq)) 1677 if (kfifo_len(meye.doneq))
1678 res = POLLIN | POLLRDNORM; 1678 res = POLLIN | POLLRDNORM;
1679 up(&meye.lock); 1679 mutex_unlock(&meye.lock);
1680 return res; 1680 return res;
1681} 1681}
1682 1682
@@ -1704,9 +1704,9 @@ static int meye_mmap(struct file *file, struct vm_area_struct *vma)
1704 unsigned long offset = vma->vm_pgoff << PAGE_SHIFT; 1704 unsigned long offset = vma->vm_pgoff << PAGE_SHIFT;
1705 unsigned long page, pos; 1705 unsigned long page, pos;
1706 1706
1707 down(&meye.lock); 1707 mutex_lock(&meye.lock);
1708 if (size > gbuffers * gbufsize) { 1708 if (size > gbuffers * gbufsize) {
1709 up(&meye.lock); 1709 mutex_unlock(&meye.lock);
1710 return -EINVAL; 1710 return -EINVAL;
1711 } 1711 }
1712 if (!meye.grab_fbuffer) { 1712 if (!meye.grab_fbuffer) {
@@ -1716,7 +1716,7 @@ static int meye_mmap(struct file *file, struct vm_area_struct *vma)
1716 meye.grab_fbuffer = rvmalloc(gbuffers*gbufsize); 1716 meye.grab_fbuffer = rvmalloc(gbuffers*gbufsize);
1717 if (!meye.grab_fbuffer) { 1717 if (!meye.grab_fbuffer) {
1718 printk(KERN_ERR "meye: v4l framebuffer allocation failed\n"); 1718 printk(KERN_ERR "meye: v4l framebuffer allocation failed\n");
1719 up(&meye.lock); 1719 mutex_unlock(&meye.lock);
1720 return -ENOMEM; 1720 return -ENOMEM;
1721 } 1721 }
1722 for (i = 0; i < gbuffers; i++) 1722 for (i = 0; i < gbuffers; i++)
@@ -1727,7 +1727,7 @@ static int meye_mmap(struct file *file, struct vm_area_struct *vma)
1727 while (size > 0) { 1727 while (size > 0) {
1728 page = vmalloc_to_pfn((void *)pos); 1728 page = vmalloc_to_pfn((void *)pos);
1729 if (remap_pfn_range(vma, start, page, PAGE_SIZE, PAGE_SHARED)) { 1729 if (remap_pfn_range(vma, start, page, PAGE_SIZE, PAGE_SHARED)) {
1730 up(&meye.lock); 1730 mutex_unlock(&meye.lock);
1731 return -EAGAIN; 1731 return -EAGAIN;
1732 } 1732 }
1733 start += PAGE_SIZE; 1733 start += PAGE_SIZE;
@@ -1744,7 +1744,7 @@ static int meye_mmap(struct file *file, struct vm_area_struct *vma)
1744 vma->vm_private_data = (void *) (offset / gbufsize); 1744 vma->vm_private_data = (void *) (offset / gbufsize);
1745 meye_vm_open(vma); 1745 meye_vm_open(vma);
1746 1746
1747 up(&meye.lock); 1747 mutex_unlock(&meye.lock);
1748 return 0; 1748 return 0;
1749} 1749}
1750 1750
@@ -1913,7 +1913,7 @@ static int __devinit meye_probe(struct pci_dev *pcidev,
1913 goto outvideoreg; 1913 goto outvideoreg;
1914 } 1914 }
1915 1915
1916 init_MUTEX(&meye.lock); 1916 mutex_init(&meye.lock);
1917 init_waitqueue_head(&meye.proc_list); 1917 init_waitqueue_head(&meye.proc_list);
1918 meye.picture.depth = 16; 1918 meye.picture.depth = 16;
1919 meye.picture.palette = VIDEO_PALETTE_YUV422; 1919 meye.picture.palette = VIDEO_PALETTE_YUV422;