diff options
author | Hans Verkuil <hverkuil@xs4all.nl> | 2010-09-26 06:34:45 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2010-10-20 23:06:15 -0400 |
commit | 0499a5aa777f8e56e46df362f0bb9d9d116186f9 (patch) | |
tree | 6dedb60d835b832335b8f0a65f686cac8b9eb513 /drivers/media/video | |
parent | fedc6c81fa329281ab3e6b156bd7b75da33ed936 (diff) |
V4L/DVB: em28xx: remove BKL
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video')
-rw-r--r-- | drivers/media/video/em28xx/em28xx-video.c | 92 |
1 files changed, 10 insertions, 82 deletions
diff --git a/drivers/media/video/em28xx/em28xx-video.c b/drivers/media/video/em28xx/em28xx-video.c index a0627cdb706b..741c4fcf0d28 100644 --- a/drivers/media/video/em28xx/em28xx-video.c +++ b/drivers/media/video/em28xx/em28xx-video.c | |||
@@ -863,17 +863,14 @@ static int res_get(struct em28xx_fh *fh, unsigned int bit) | |||
863 | return 1; | 863 | return 1; |
864 | 864 | ||
865 | /* is it free? */ | 865 | /* is it free? */ |
866 | mutex_lock(&dev->lock); | ||
867 | if (dev->resources & bit) { | 866 | if (dev->resources & bit) { |
868 | /* no, someone else uses it */ | 867 | /* no, someone else uses it */ |
869 | mutex_unlock(&dev->lock); | ||
870 | return 0; | 868 | return 0; |
871 | } | 869 | } |
872 | /* it's free, grab it */ | 870 | /* it's free, grab it */ |
873 | fh->resources |= bit; | 871 | fh->resources |= bit; |
874 | dev->resources |= bit; | 872 | dev->resources |= bit; |
875 | em28xx_videodbg("res: get %d\n", bit); | 873 | em28xx_videodbg("res: get %d\n", bit); |
876 | mutex_unlock(&dev->lock); | ||
877 | return 1; | 874 | return 1; |
878 | } | 875 | } |
879 | 876 | ||
@@ -893,11 +890,9 @@ static void res_free(struct em28xx_fh *fh, unsigned int bits) | |||
893 | 890 | ||
894 | BUG_ON((fh->resources & bits) != bits); | 891 | BUG_ON((fh->resources & bits) != bits); |
895 | 892 | ||
896 | mutex_lock(&dev->lock); | ||
897 | fh->resources &= ~bits; | 893 | fh->resources &= ~bits; |
898 | dev->resources &= ~bits; | 894 | dev->resources &= ~bits; |
899 | em28xx_videodbg("res: put %d\n", bits); | 895 | em28xx_videodbg("res: put %d\n", bits); |
900 | mutex_unlock(&dev->lock); | ||
901 | } | 896 | } |
902 | 897 | ||
903 | static int get_ressource(struct em28xx_fh *fh) | 898 | static int get_ressource(struct em28xx_fh *fh) |
@@ -1024,8 +1019,6 @@ static int vidioc_g_fmt_vid_cap(struct file *file, void *priv, | |||
1024 | struct em28xx_fh *fh = priv; | 1019 | struct em28xx_fh *fh = priv; |
1025 | struct em28xx *dev = fh->dev; | 1020 | struct em28xx *dev = fh->dev; |
1026 | 1021 | ||
1027 | mutex_lock(&dev->lock); | ||
1028 | |||
1029 | f->fmt.pix.width = dev->width; | 1022 | f->fmt.pix.width = dev->width; |
1030 | f->fmt.pix.height = dev->height; | 1023 | f->fmt.pix.height = dev->height; |
1031 | f->fmt.pix.pixelformat = dev->format->fourcc; | 1024 | f->fmt.pix.pixelformat = dev->format->fourcc; |
@@ -1039,8 +1032,6 @@ static int vidioc_g_fmt_vid_cap(struct file *file, void *priv, | |||
1039 | else | 1032 | else |
1040 | f->fmt.pix.field = dev->interlaced ? | 1033 | f->fmt.pix.field = dev->interlaced ? |
1041 | V4L2_FIELD_INTERLACED : V4L2_FIELD_TOP; | 1034 | V4L2_FIELD_INTERLACED : V4L2_FIELD_TOP; |
1042 | |||
1043 | mutex_unlock(&dev->lock); | ||
1044 | return 0; | 1035 | return 0; |
1045 | } | 1036 | } |
1046 | 1037 | ||
@@ -1138,22 +1129,15 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv, | |||
1138 | if (rc < 0) | 1129 | if (rc < 0) |
1139 | return rc; | 1130 | return rc; |
1140 | 1131 | ||
1141 | mutex_lock(&dev->lock); | ||
1142 | |||
1143 | vidioc_try_fmt_vid_cap(file, priv, f); | 1132 | vidioc_try_fmt_vid_cap(file, priv, f); |
1144 | 1133 | ||
1145 | if (videobuf_queue_is_busy(&fh->vb_vidq)) { | 1134 | if (videobuf_queue_is_busy(&fh->vb_vidq)) { |
1146 | em28xx_errdev("%s queue busy\n", __func__); | 1135 | em28xx_errdev("%s queue busy\n", __func__); |
1147 | rc = -EBUSY; | 1136 | return -EBUSY; |
1148 | goto out; | ||
1149 | } | 1137 | } |
1150 | 1138 | ||
1151 | rc = em28xx_set_video_format(dev, f->fmt.pix.pixelformat, | 1139 | return em28xx_set_video_format(dev, f->fmt.pix.pixelformat, |
1152 | f->fmt.pix.width, f->fmt.pix.height); | 1140 | f->fmt.pix.width, f->fmt.pix.height); |
1153 | |||
1154 | out: | ||
1155 | mutex_unlock(&dev->lock); | ||
1156 | return rc; | ||
1157 | } | 1141 | } |
1158 | 1142 | ||
1159 | static int vidioc_g_std(struct file *file, void *priv, v4l2_std_id *norm) | 1143 | static int vidioc_g_std(struct file *file, void *priv, v4l2_std_id *norm) |
@@ -1182,7 +1166,6 @@ static int vidioc_s_std(struct file *file, void *priv, v4l2_std_id *norm) | |||
1182 | if (rc < 0) | 1166 | if (rc < 0) |
1183 | return rc; | 1167 | return rc; |
1184 | 1168 | ||
1185 | mutex_lock(&dev->lock); | ||
1186 | dev->norm = *norm; | 1169 | dev->norm = *norm; |
1187 | 1170 | ||
1188 | /* Adjusts width/height, if needed */ | 1171 | /* Adjusts width/height, if needed */ |
@@ -1198,7 +1181,6 @@ static int vidioc_s_std(struct file *file, void *priv, v4l2_std_id *norm) | |||
1198 | em28xx_resolution_set(dev); | 1181 | em28xx_resolution_set(dev); |
1199 | v4l2_device_call_all(&dev->v4l2_dev, 0, core, s_std, dev->norm); | 1182 | v4l2_device_call_all(&dev->v4l2_dev, 0, core, s_std, dev->norm); |
1200 | 1183 | ||
1201 | mutex_unlock(&dev->lock); | ||
1202 | return 0; | 1184 | return 0; |
1203 | } | 1185 | } |
1204 | 1186 | ||
@@ -1303,9 +1285,7 @@ static int vidioc_s_input(struct file *file, void *priv, unsigned int i) | |||
1303 | 1285 | ||
1304 | dev->ctl_input = i; | 1286 | dev->ctl_input = i; |
1305 | 1287 | ||
1306 | mutex_lock(&dev->lock); | ||
1307 | video_mux(dev, dev->ctl_input); | 1288 | video_mux(dev, dev->ctl_input); |
1308 | mutex_unlock(&dev->lock); | ||
1309 | return 0; | 1289 | return 0; |
1310 | } | 1290 | } |
1311 | 1291 | ||
@@ -1366,15 +1346,12 @@ static int vidioc_s_audio(struct file *file, void *priv, struct v4l2_audio *a) | |||
1366 | if (0 == INPUT(a->index)->type) | 1346 | if (0 == INPUT(a->index)->type) |
1367 | return -EINVAL; | 1347 | return -EINVAL; |
1368 | 1348 | ||
1369 | mutex_lock(&dev->lock); | ||
1370 | |||
1371 | dev->ctl_ainput = INPUT(a->index)->amux; | 1349 | dev->ctl_ainput = INPUT(a->index)->amux; |
1372 | dev->ctl_aoutput = INPUT(a->index)->aout; | 1350 | dev->ctl_aoutput = INPUT(a->index)->aout; |
1373 | 1351 | ||
1374 | if (!dev->ctl_aoutput) | 1352 | if (!dev->ctl_aoutput) |
1375 | dev->ctl_aoutput = EM28XX_AOUT_MASTER; | 1353 | dev->ctl_aoutput = EM28XX_AOUT_MASTER; |
1376 | 1354 | ||
1377 | mutex_unlock(&dev->lock); | ||
1378 | return 0; | 1355 | return 0; |
1379 | } | 1356 | } |
1380 | 1357 | ||
@@ -1394,17 +1371,15 @@ static int vidioc_queryctrl(struct file *file, void *priv, | |||
1394 | 1371 | ||
1395 | qc->id = id; | 1372 | qc->id = id; |
1396 | 1373 | ||
1397 | /* enumberate AC97 controls */ | 1374 | /* enumerate AC97 controls */ |
1398 | if (dev->audio_mode.ac97 != EM28XX_NO_AC97) { | 1375 | if (dev->audio_mode.ac97 != EM28XX_NO_AC97) { |
1399 | rc = ac97_queryctrl(qc); | 1376 | rc = ac97_queryctrl(qc); |
1400 | if (!rc) | 1377 | if (!rc) |
1401 | return 0; | 1378 | return 0; |
1402 | } | 1379 | } |
1403 | 1380 | ||
1404 | /* enumberate V4L2 device controls */ | 1381 | /* enumerate V4L2 device controls */ |
1405 | mutex_lock(&dev->lock); | ||
1406 | v4l2_device_call_all(&dev->v4l2_dev, 0, core, queryctrl, qc); | 1382 | v4l2_device_call_all(&dev->v4l2_dev, 0, core, queryctrl, qc); |
1407 | mutex_unlock(&dev->lock); | ||
1408 | 1383 | ||
1409 | if (qc->type) | 1384 | if (qc->type) |
1410 | return 0; | 1385 | return 0; |
@@ -1424,7 +1399,6 @@ static int vidioc_g_ctrl(struct file *file, void *priv, | |||
1424 | return rc; | 1399 | return rc; |
1425 | rc = 0; | 1400 | rc = 0; |
1426 | 1401 | ||
1427 | mutex_lock(&dev->lock); | ||
1428 | 1402 | ||
1429 | /* Set an AC97 control */ | 1403 | /* Set an AC97 control */ |
1430 | if (dev->audio_mode.ac97 != EM28XX_NO_AC97) | 1404 | if (dev->audio_mode.ac97 != EM28XX_NO_AC97) |
@@ -1438,7 +1412,6 @@ static int vidioc_g_ctrl(struct file *file, void *priv, | |||
1438 | rc = 0; | 1412 | rc = 0; |
1439 | } | 1413 | } |
1440 | 1414 | ||
1441 | mutex_unlock(&dev->lock); | ||
1442 | return rc; | 1415 | return rc; |
1443 | } | 1416 | } |
1444 | 1417 | ||
@@ -1453,8 +1426,6 @@ static int vidioc_s_ctrl(struct file *file, void *priv, | |||
1453 | if (rc < 0) | 1426 | if (rc < 0) |
1454 | return rc; | 1427 | return rc; |
1455 | 1428 | ||
1456 | mutex_lock(&dev->lock); | ||
1457 | |||
1458 | /* Set an AC97 control */ | 1429 | /* Set an AC97 control */ |
1459 | if (dev->audio_mode.ac97 != EM28XX_NO_AC97) | 1430 | if (dev->audio_mode.ac97 != EM28XX_NO_AC97) |
1460 | rc = ac97_set_ctrl(dev, ctrl); | 1431 | rc = ac97_set_ctrl(dev, ctrl); |
@@ -1481,8 +1452,6 @@ static int vidioc_s_ctrl(struct file *file, void *priv, | |||
1481 | rc = em28xx_audio_analog_set(dev); | 1452 | rc = em28xx_audio_analog_set(dev); |
1482 | } | 1453 | } |
1483 | } | 1454 | } |
1484 | |||
1485 | mutex_unlock(&dev->lock); | ||
1486 | return rc; | 1455 | return rc; |
1487 | } | 1456 | } |
1488 | 1457 | ||
@@ -1503,10 +1472,7 @@ static int vidioc_g_tuner(struct file *file, void *priv, | |||
1503 | strcpy(t->name, "Tuner"); | 1472 | strcpy(t->name, "Tuner"); |
1504 | t->type = V4L2_TUNER_ANALOG_TV; | 1473 | t->type = V4L2_TUNER_ANALOG_TV; |
1505 | 1474 | ||
1506 | mutex_lock(&dev->lock); | ||
1507 | v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, g_tuner, t); | 1475 | v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, g_tuner, t); |
1508 | mutex_unlock(&dev->lock); | ||
1509 | |||
1510 | return 0; | 1476 | return 0; |
1511 | } | 1477 | } |
1512 | 1478 | ||
@@ -1524,10 +1490,7 @@ static int vidioc_s_tuner(struct file *file, void *priv, | |||
1524 | if (0 != t->index) | 1490 | if (0 != t->index) |
1525 | return -EINVAL; | 1491 | return -EINVAL; |
1526 | 1492 | ||
1527 | mutex_lock(&dev->lock); | ||
1528 | v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, s_tuner, t); | 1493 | v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, s_tuner, t); |
1529 | mutex_unlock(&dev->lock); | ||
1530 | |||
1531 | return 0; | 1494 | return 0; |
1532 | } | 1495 | } |
1533 | 1496 | ||
@@ -1537,11 +1500,8 @@ static int vidioc_g_frequency(struct file *file, void *priv, | |||
1537 | struct em28xx_fh *fh = priv; | 1500 | struct em28xx_fh *fh = priv; |
1538 | struct em28xx *dev = fh->dev; | 1501 | struct em28xx *dev = fh->dev; |
1539 | 1502 | ||
1540 | mutex_lock(&dev->lock); | ||
1541 | f->type = fh->radio ? V4L2_TUNER_RADIO : V4L2_TUNER_ANALOG_TV; | 1503 | f->type = fh->radio ? V4L2_TUNER_RADIO : V4L2_TUNER_ANALOG_TV; |
1542 | f->frequency = dev->ctl_freq; | 1504 | f->frequency = dev->ctl_freq; |
1543 | mutex_unlock(&dev->lock); | ||
1544 | |||
1545 | return 0; | 1505 | return 0; |
1546 | } | 1506 | } |
1547 | 1507 | ||
@@ -1564,13 +1524,9 @@ static int vidioc_s_frequency(struct file *file, void *priv, | |||
1564 | if (unlikely(1 == fh->radio && f->type != V4L2_TUNER_RADIO)) | 1524 | if (unlikely(1 == fh->radio && f->type != V4L2_TUNER_RADIO)) |
1565 | return -EINVAL; | 1525 | return -EINVAL; |
1566 | 1526 | ||
1567 | mutex_lock(&dev->lock); | ||
1568 | |||
1569 | dev->ctl_freq = f->frequency; | 1527 | dev->ctl_freq = f->frequency; |
1570 | v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, s_frequency, f); | 1528 | v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, s_frequency, f); |
1571 | 1529 | ||
1572 | mutex_unlock(&dev->lock); | ||
1573 | |||
1574 | return 0; | 1530 | return 0; |
1575 | } | 1531 | } |
1576 | 1532 | ||
@@ -1611,9 +1567,7 @@ static int vidioc_g_register(struct file *file, void *priv, | |||
1611 | 1567 | ||
1612 | switch (reg->match.type) { | 1568 | switch (reg->match.type) { |
1613 | case V4L2_CHIP_MATCH_AC97: | 1569 | case V4L2_CHIP_MATCH_AC97: |
1614 | mutex_lock(&dev->lock); | ||
1615 | ret = em28xx_read_ac97(dev, reg->reg); | 1570 | ret = em28xx_read_ac97(dev, reg->reg); |
1616 | mutex_unlock(&dev->lock); | ||
1617 | if (ret < 0) | 1571 | if (ret < 0) |
1618 | return ret; | 1572 | return ret; |
1619 | 1573 | ||
@@ -1635,9 +1589,7 @@ static int vidioc_g_register(struct file *file, void *priv, | |||
1635 | /* Match host */ | 1589 | /* Match host */ |
1636 | reg->size = em28xx_reg_len(reg->reg); | 1590 | reg->size = em28xx_reg_len(reg->reg); |
1637 | if (reg->size == 1) { | 1591 | if (reg->size == 1) { |
1638 | mutex_lock(&dev->lock); | ||
1639 | ret = em28xx_read_reg(dev, reg->reg); | 1592 | ret = em28xx_read_reg(dev, reg->reg); |
1640 | mutex_unlock(&dev->lock); | ||
1641 | 1593 | ||
1642 | if (ret < 0) | 1594 | if (ret < 0) |
1643 | return ret; | 1595 | return ret; |
@@ -1645,10 +1597,8 @@ static int vidioc_g_register(struct file *file, void *priv, | |||
1645 | reg->val = ret; | 1597 | reg->val = ret; |
1646 | } else { | 1598 | } else { |
1647 | __le16 val = 0; | 1599 | __le16 val = 0; |
1648 | mutex_lock(&dev->lock); | ||
1649 | ret = em28xx_read_reg_req_len(dev, USB_REQ_GET_STATUS, | 1600 | ret = em28xx_read_reg_req_len(dev, USB_REQ_GET_STATUS, |
1650 | reg->reg, (char *)&val, 2); | 1601 | reg->reg, (char *)&val, 2); |
1651 | mutex_unlock(&dev->lock); | ||
1652 | if (ret < 0) | 1602 | if (ret < 0) |
1653 | return ret; | 1603 | return ret; |
1654 | 1604 | ||
@@ -1668,11 +1618,7 @@ static int vidioc_s_register(struct file *file, void *priv, | |||
1668 | 1618 | ||
1669 | switch (reg->match.type) { | 1619 | switch (reg->match.type) { |
1670 | case V4L2_CHIP_MATCH_AC97: | 1620 | case V4L2_CHIP_MATCH_AC97: |
1671 | mutex_lock(&dev->lock); | 1621 | return em28xx_write_ac97(dev, reg->reg, reg->val); |
1672 | rc = em28xx_write_ac97(dev, reg->reg, reg->val); | ||
1673 | mutex_unlock(&dev->lock); | ||
1674 | |||
1675 | return rc; | ||
1676 | case V4L2_CHIP_MATCH_I2C_DRIVER: | 1622 | case V4L2_CHIP_MATCH_I2C_DRIVER: |
1677 | v4l2_device_call_all(&dev->v4l2_dev, 0, core, s_register, reg); | 1623 | v4l2_device_call_all(&dev->v4l2_dev, 0, core, s_register, reg); |
1678 | return 0; | 1624 | return 0; |
@@ -1688,12 +1634,8 @@ static int vidioc_s_register(struct file *file, void *priv, | |||
1688 | /* Match host */ | 1634 | /* Match host */ |
1689 | buf = cpu_to_le16(reg->val); | 1635 | buf = cpu_to_le16(reg->val); |
1690 | 1636 | ||
1691 | mutex_lock(&dev->lock); | 1637 | return em28xx_write_regs(dev, reg->reg, (char *)&buf, |
1692 | rc = em28xx_write_regs(dev, reg->reg, (char *)&buf, | ||
1693 | em28xx_reg_len(reg->reg)); | 1638 | em28xx_reg_len(reg->reg)); |
1694 | mutex_unlock(&dev->lock); | ||
1695 | |||
1696 | return rc; | ||
1697 | } | 1639 | } |
1698 | #endif | 1640 | #endif |
1699 | 1641 | ||
@@ -1830,16 +1772,12 @@ static int vidioc_g_fmt_sliced_vbi_cap(struct file *file, void *priv, | |||
1830 | if (rc < 0) | 1772 | if (rc < 0) |
1831 | return rc; | 1773 | return rc; |
1832 | 1774 | ||
1833 | mutex_lock(&dev->lock); | ||
1834 | |||
1835 | f->fmt.sliced.service_set = 0; | 1775 | f->fmt.sliced.service_set = 0; |
1836 | v4l2_device_call_all(&dev->v4l2_dev, 0, vbi, g_sliced_fmt, &f->fmt.sliced); | 1776 | v4l2_device_call_all(&dev->v4l2_dev, 0, vbi, g_sliced_fmt, &f->fmt.sliced); |
1837 | 1777 | ||
1838 | if (f->fmt.sliced.service_set == 0) | 1778 | if (f->fmt.sliced.service_set == 0) |
1839 | rc = -EINVAL; | 1779 | rc = -EINVAL; |
1840 | 1780 | ||
1841 | mutex_unlock(&dev->lock); | ||
1842 | |||
1843 | return rc; | 1781 | return rc; |
1844 | } | 1782 | } |
1845 | 1783 | ||
@@ -1854,9 +1792,7 @@ static int vidioc_try_set_sliced_vbi_cap(struct file *file, void *priv, | |||
1854 | if (rc < 0) | 1792 | if (rc < 0) |
1855 | return rc; | 1793 | return rc; |
1856 | 1794 | ||
1857 | mutex_lock(&dev->lock); | ||
1858 | v4l2_device_call_all(&dev->v4l2_dev, 0, vbi, g_sliced_fmt, &f->fmt.sliced); | 1795 | v4l2_device_call_all(&dev->v4l2_dev, 0, vbi, g_sliced_fmt, &f->fmt.sliced); |
1859 | mutex_unlock(&dev->lock); | ||
1860 | 1796 | ||
1861 | if (f->fmt.sliced.service_set == 0) | 1797 | if (f->fmt.sliced.service_set == 0) |
1862 | return -EINVAL; | 1798 | return -EINVAL; |
@@ -2041,9 +1977,7 @@ static int radio_g_tuner(struct file *file, void *priv, | |||
2041 | strcpy(t->name, "Radio"); | 1977 | strcpy(t->name, "Radio"); |
2042 | t->type = V4L2_TUNER_RADIO; | 1978 | t->type = V4L2_TUNER_RADIO; |
2043 | 1979 | ||
2044 | mutex_lock(&dev->lock); | ||
2045 | v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, g_tuner, t); | 1980 | v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, g_tuner, t); |
2046 | mutex_unlock(&dev->lock); | ||
2047 | 1981 | ||
2048 | return 0; | 1982 | return 0; |
2049 | } | 1983 | } |
@@ -2076,9 +2010,7 @@ static int radio_s_tuner(struct file *file, void *priv, | |||
2076 | if (0 != t->index) | 2010 | if (0 != t->index) |
2077 | return -EINVAL; | 2011 | return -EINVAL; |
2078 | 2012 | ||
2079 | mutex_lock(&dev->lock); | ||
2080 | v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, s_tuner, t); | 2013 | v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, s_tuner, t); |
2081 | mutex_unlock(&dev->lock); | ||
2082 | 2014 | ||
2083 | return 0; | 2015 | return 0; |
2084 | } | 2016 | } |
@@ -2138,8 +2070,6 @@ static int em28xx_v4l2_open(struct file *filp) | |||
2138 | break; | 2070 | break; |
2139 | } | 2071 | } |
2140 | 2072 | ||
2141 | mutex_lock(&dev->lock); | ||
2142 | |||
2143 | em28xx_videodbg("open dev=%s type=%s users=%d\n", | 2073 | em28xx_videodbg("open dev=%s type=%s users=%d\n", |
2144 | video_device_node_name(vdev), v4l2_type_names[fh_type], | 2074 | video_device_node_name(vdev), v4l2_type_names[fh_type], |
2145 | dev->users); | 2075 | dev->users); |
@@ -2148,7 +2078,6 @@ static int em28xx_v4l2_open(struct file *filp) | |||
2148 | fh = kzalloc(sizeof(struct em28xx_fh), GFP_KERNEL); | 2078 | fh = kzalloc(sizeof(struct em28xx_fh), GFP_KERNEL); |
2149 | if (!fh) { | 2079 | if (!fh) { |
2150 | em28xx_errdev("em28xx-video.c: Out of memory?!\n"); | 2080 | em28xx_errdev("em28xx-video.c: Out of memory?!\n"); |
2151 | mutex_unlock(&dev->lock); | ||
2152 | return -ENOMEM; | 2081 | return -ENOMEM; |
2153 | } | 2082 | } |
2154 | fh->dev = dev; | 2083 | fh->dev = dev; |
@@ -2182,15 +2111,13 @@ static int em28xx_v4l2_open(struct file *filp) | |||
2182 | videobuf_queue_vmalloc_init(&fh->vb_vidq, &em28xx_video_qops, | 2111 | videobuf_queue_vmalloc_init(&fh->vb_vidq, &em28xx_video_qops, |
2183 | NULL, &dev->slock, | 2112 | NULL, &dev->slock, |
2184 | V4L2_BUF_TYPE_VIDEO_CAPTURE, field, | 2113 | V4L2_BUF_TYPE_VIDEO_CAPTURE, field, |
2185 | sizeof(struct em28xx_buffer), fh, NULL); | 2114 | sizeof(struct em28xx_buffer), fh, &dev->lock); |
2186 | 2115 | ||
2187 | videobuf_queue_vmalloc_init(&fh->vb_vbiq, &em28xx_vbi_qops, | 2116 | videobuf_queue_vmalloc_init(&fh->vb_vbiq, &em28xx_vbi_qops, |
2188 | NULL, &dev->slock, | 2117 | NULL, &dev->slock, |
2189 | V4L2_BUF_TYPE_VBI_CAPTURE, | 2118 | V4L2_BUF_TYPE_VBI_CAPTURE, |
2190 | V4L2_FIELD_SEQ_TB, | 2119 | V4L2_FIELD_SEQ_TB, |
2191 | sizeof(struct em28xx_buffer), fh, NULL); | 2120 | sizeof(struct em28xx_buffer), fh, &dev->lock); |
2192 | |||
2193 | mutex_unlock(&dev->lock); | ||
2194 | 2121 | ||
2195 | return errCode; | 2122 | return errCode; |
2196 | } | 2123 | } |
@@ -2389,7 +2316,7 @@ static const struct v4l2_file_operations em28xx_v4l_fops = { | |||
2389 | .read = em28xx_v4l2_read, | 2316 | .read = em28xx_v4l2_read, |
2390 | .poll = em28xx_v4l2_poll, | 2317 | .poll = em28xx_v4l2_poll, |
2391 | .mmap = em28xx_v4l2_mmap, | 2318 | .mmap = em28xx_v4l2_mmap, |
2392 | .ioctl = video_ioctl2, | 2319 | .unlocked_ioctl = video_ioctl2, |
2393 | }; | 2320 | }; |
2394 | 2321 | ||
2395 | static const struct v4l2_ioctl_ops video_ioctl_ops = { | 2322 | static const struct v4l2_ioctl_ops video_ioctl_ops = { |
@@ -2497,6 +2424,7 @@ static struct video_device *em28xx_vdev_init(struct em28xx *dev, | |||
2497 | vfd->v4l2_dev = &dev->v4l2_dev; | 2424 | vfd->v4l2_dev = &dev->v4l2_dev; |
2498 | vfd->release = video_device_release; | 2425 | vfd->release = video_device_release; |
2499 | vfd->debug = video_debug; | 2426 | vfd->debug = video_debug; |
2427 | vfd->lock = &dev->lock; | ||
2500 | 2428 | ||
2501 | snprintf(vfd->name, sizeof(vfd->name), "%s %s", | 2429 | snprintf(vfd->name, sizeof(vfd->name), "%s %s", |
2502 | dev->name, type_name); | 2430 | dev->name, type_name); |