aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-05-14 14:23:37 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-05-14 14:23:37 -0400
commitb6255ee3d82798eb1eee9fb1cca713317b5afae8 (patch)
tree5b34f32a965dc772a99188293387022d21c5532e /drivers/media
parentd69c5c2cf21e734210029afd803a96a942084af3 (diff)
parent788ab1bb03d304232711b6ca9718534f588ee9fc (diff)
Merge branch 'v4l_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media
Pull media fixes from Mauro Carvalho Chehab: "For a some fix patches for v3.4, including a regression fix at DVB core" Fix up trivial conflicts in Documentation/feature-removal-schedule.txt * 'v4l_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media: [media] gspca - sonixj: Fix a zero divide in isoc interrupt [media] media: videobuf2-dma-contig: include header for exported symbols [media] media: videobuf2-dma-contig: quiet sparse noise about plain integer as NULL pointer [media] media: vb2-memops: Export vb2_get_vma symbol [media] s5p-fimc: Correct memory allocation for VIDIOC_CREATE_BUFS [media] s5p-fimc: Fix locking in subdev set_crop op [media] dvb_frontend: fix a regression with DVB-S zig-zag [media] fintek-cir: change || to && [media] V4L: Schedule V4L2_CID_HCENTER, V4L2_CID_VCENTER controls for removal [media] rc: Postpone ISR registration [media] marvell-cam: fix an ARM build error [media] V4L: soc-camera: protect hosts during probing from overzealous user-space
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/dvb/dvb-core/dvb_frontend.c4
-rw-r--r--drivers/media/rc/ene_ir.c32
-rw-r--r--drivers/media/rc/fintek-cir.c22
-rw-r--r--drivers/media/rc/ite-cir.c20
-rw-r--r--drivers/media/rc/nuvoton-cir.c36
-rw-r--r--drivers/media/rc/winbond-cir.c78
-rw-r--r--drivers/media/video/gspca/sonixj.c8
-rw-r--r--drivers/media/video/marvell-ccic/mmp-driver.c1
-rw-r--r--drivers/media/video/s5p-fimc/fimc-capture.c33
-rw-r--r--drivers/media/video/s5p-fimc/fimc-core.c4
-rw-r--r--drivers/media/video/s5p-fimc/fimc-core.h2
-rw-r--r--drivers/media/video/soc_camera.c8
-rw-r--r--drivers/media/video/videobuf2-dma-contig.c3
-rw-r--r--drivers/media/video/videobuf2-memops.c1
14 files changed, 135 insertions, 117 deletions
diff --git a/drivers/media/dvb/dvb-core/dvb_frontend.c b/drivers/media/dvb/dvb-core/dvb_frontend.c
index 0f64d7182657..cb888d835a89 100644
--- a/drivers/media/dvb/dvb-core/dvb_frontend.c
+++ b/drivers/media/dvb/dvb-core/dvb_frontend.c
@@ -1921,6 +1921,10 @@ static int dtv_set_frontend(struct dvb_frontend *fe)
1921 } else { 1921 } else {
1922 /* default values */ 1922 /* default values */
1923 switch (c->delivery_system) { 1923 switch (c->delivery_system) {
1924 case SYS_DVBS:
1925 case SYS_DVBS2:
1926 case SYS_ISDBS:
1927 case SYS_TURBO:
1924 case SYS_DVBC_ANNEX_A: 1928 case SYS_DVBC_ANNEX_A:
1925 case SYS_DVBC_ANNEX_C: 1929 case SYS_DVBC_ANNEX_C:
1926 fepriv->min_delay = HZ / 20; 1930 fepriv->min_delay = HZ / 20;
diff --git a/drivers/media/rc/ene_ir.c b/drivers/media/rc/ene_ir.c
index 860c112e0fd2..bef5296173c9 100644
--- a/drivers/media/rc/ene_ir.c
+++ b/drivers/media/rc/ene_ir.c
@@ -1018,22 +1018,6 @@ static int ene_probe(struct pnp_dev *pnp_dev, const struct pnp_device_id *id)
1018 1018
1019 spin_lock_init(&dev->hw_lock); 1019 spin_lock_init(&dev->hw_lock);
1020 1020
1021 /* claim the resources */
1022 error = -EBUSY;
1023 dev->hw_io = pnp_port_start(pnp_dev, 0);
1024 if (!request_region(dev->hw_io, ENE_IO_SIZE, ENE_DRIVER_NAME)) {
1025 dev->hw_io = -1;
1026 dev->irq = -1;
1027 goto error;
1028 }
1029
1030 dev->irq = pnp_irq(pnp_dev, 0);
1031 if (request_irq(dev->irq, ene_isr,
1032 IRQF_SHARED, ENE_DRIVER_NAME, (void *)dev)) {
1033 dev->irq = -1;
1034 goto error;
1035 }
1036
1037 pnp_set_drvdata(pnp_dev, dev); 1021 pnp_set_drvdata(pnp_dev, dev);
1038 dev->pnp_dev = pnp_dev; 1022 dev->pnp_dev = pnp_dev;
1039 1023
@@ -1086,6 +1070,22 @@ static int ene_probe(struct pnp_dev *pnp_dev, const struct pnp_device_id *id)
1086 device_set_wakeup_capable(&pnp_dev->dev, true); 1070 device_set_wakeup_capable(&pnp_dev->dev, true);
1087 device_set_wakeup_enable(&pnp_dev->dev, true); 1071 device_set_wakeup_enable(&pnp_dev->dev, true);
1088 1072
1073 /* claim the resources */
1074 error = -EBUSY;
1075 dev->hw_io = pnp_port_start(pnp_dev, 0);
1076 if (!request_region(dev->hw_io, ENE_IO_SIZE, ENE_DRIVER_NAME)) {
1077 dev->hw_io = -1;
1078 dev->irq = -1;
1079 goto error;
1080 }
1081
1082 dev->irq = pnp_irq(pnp_dev, 0);
1083 if (request_irq(dev->irq, ene_isr,
1084 IRQF_SHARED, ENE_DRIVER_NAME, (void *)dev)) {
1085 dev->irq = -1;
1086 goto error;
1087 }
1088
1089 error = rc_register_device(rdev); 1089 error = rc_register_device(rdev);
1090 if (error < 0) 1090 if (error < 0)
1091 goto error; 1091 goto error;
diff --git a/drivers/media/rc/fintek-cir.c b/drivers/media/rc/fintek-cir.c
index 392d4be91f8f..4a3a238bcfbc 100644
--- a/drivers/media/rc/fintek-cir.c
+++ b/drivers/media/rc/fintek-cir.c
@@ -197,7 +197,7 @@ static int fintek_hw_detect(struct fintek_dev *fintek)
197 /* 197 /*
198 * Newer reviews of this chipset uses port 8 instead of 5 198 * Newer reviews of this chipset uses port 8 instead of 5
199 */ 199 */
200 if ((chip != 0x0408) || (chip != 0x0804)) 200 if ((chip != 0x0408) && (chip != 0x0804))
201 fintek->logical_dev_cir = LOGICAL_DEV_CIR_REV2; 201 fintek->logical_dev_cir = LOGICAL_DEV_CIR_REV2;
202 else 202 else
203 fintek->logical_dev_cir = LOGICAL_DEV_CIR_REV1; 203 fintek->logical_dev_cir = LOGICAL_DEV_CIR_REV1;
@@ -514,16 +514,6 @@ static int fintek_probe(struct pnp_dev *pdev, const struct pnp_device_id *dev_id
514 514
515 spin_lock_init(&fintek->fintek_lock); 515 spin_lock_init(&fintek->fintek_lock);
516 516
517 ret = -EBUSY;
518 /* now claim resources */
519 if (!request_region(fintek->cir_addr,
520 fintek->cir_port_len, FINTEK_DRIVER_NAME))
521 goto failure;
522
523 if (request_irq(fintek->cir_irq, fintek_cir_isr, IRQF_SHARED,
524 FINTEK_DRIVER_NAME, (void *)fintek))
525 goto failure;
526
527 pnp_set_drvdata(pdev, fintek); 517 pnp_set_drvdata(pdev, fintek);
528 fintek->pdev = pdev; 518 fintek->pdev = pdev;
529 519
@@ -558,6 +548,16 @@ static int fintek_probe(struct pnp_dev *pdev, const struct pnp_device_id *dev_id
558 /* rx resolution is hardwired to 50us atm, 1, 25, 100 also possible */ 548 /* rx resolution is hardwired to 50us atm, 1, 25, 100 also possible */
559 rdev->rx_resolution = US_TO_NS(CIR_SAMPLE_PERIOD); 549 rdev->rx_resolution = US_TO_NS(CIR_SAMPLE_PERIOD);
560 550
551 ret = -EBUSY;
552 /* now claim resources */
553 if (!request_region(fintek->cir_addr,
554 fintek->cir_port_len, FINTEK_DRIVER_NAME))
555 goto failure;
556
557 if (request_irq(fintek->cir_irq, fintek_cir_isr, IRQF_SHARED,
558 FINTEK_DRIVER_NAME, (void *)fintek))
559 goto failure;
560
561 ret = rc_register_device(rdev); 561 ret = rc_register_device(rdev);
562 if (ret) 562 if (ret)
563 goto failure; 563 goto failure;
diff --git a/drivers/media/rc/ite-cir.c b/drivers/media/rc/ite-cir.c
index 682009d76cdf..0e49c99abf68 100644
--- a/drivers/media/rc/ite-cir.c
+++ b/drivers/media/rc/ite-cir.c
@@ -1515,16 +1515,6 @@ static int ite_probe(struct pnp_dev *pdev, const struct pnp_device_id
1515 /* initialize raw event */ 1515 /* initialize raw event */
1516 init_ir_raw_event(&itdev->rawir); 1516 init_ir_raw_event(&itdev->rawir);
1517 1517
1518 ret = -EBUSY;
1519 /* now claim resources */
1520 if (!request_region(itdev->cir_addr,
1521 dev_desc->io_region_size, ITE_DRIVER_NAME))
1522 goto failure;
1523
1524 if (request_irq(itdev->cir_irq, ite_cir_isr, IRQF_SHARED,
1525 ITE_DRIVER_NAME, (void *)itdev))
1526 goto failure;
1527
1528 /* set driver data into the pnp device */ 1518 /* set driver data into the pnp device */
1529 pnp_set_drvdata(pdev, itdev); 1519 pnp_set_drvdata(pdev, itdev);
1530 itdev->pdev = pdev; 1520 itdev->pdev = pdev;
@@ -1600,6 +1590,16 @@ static int ite_probe(struct pnp_dev *pdev, const struct pnp_device_id
1600 rdev->driver_name = ITE_DRIVER_NAME; 1590 rdev->driver_name = ITE_DRIVER_NAME;
1601 rdev->map_name = RC_MAP_RC6_MCE; 1591 rdev->map_name = RC_MAP_RC6_MCE;
1602 1592
1593 ret = -EBUSY;
1594 /* now claim resources */
1595 if (!request_region(itdev->cir_addr,
1596 dev_desc->io_region_size, ITE_DRIVER_NAME))
1597 goto failure;
1598
1599 if (request_irq(itdev->cir_irq, ite_cir_isr, IRQF_SHARED,
1600 ITE_DRIVER_NAME, (void *)itdev))
1601 goto failure;
1602
1603 ret = rc_register_device(rdev); 1603 ret = rc_register_device(rdev);
1604 if (ret) 1604 if (ret)
1605 goto failure; 1605 goto failure;
diff --git a/drivers/media/rc/nuvoton-cir.c b/drivers/media/rc/nuvoton-cir.c
index 144f3f55d765..8b2c071ac0ab 100644
--- a/drivers/media/rc/nuvoton-cir.c
+++ b/drivers/media/rc/nuvoton-cir.c
@@ -1021,24 +1021,6 @@ static int nvt_probe(struct pnp_dev *pdev, const struct pnp_device_id *dev_id)
1021 spin_lock_init(&nvt->nvt_lock); 1021 spin_lock_init(&nvt->nvt_lock);
1022 spin_lock_init(&nvt->tx.lock); 1022 spin_lock_init(&nvt->tx.lock);
1023 1023
1024 ret = -EBUSY;
1025 /* now claim resources */
1026 if (!request_region(nvt->cir_addr,
1027 CIR_IOREG_LENGTH, NVT_DRIVER_NAME))
1028 goto failure;
1029
1030 if (request_irq(nvt->cir_irq, nvt_cir_isr, IRQF_SHARED,
1031 NVT_DRIVER_NAME, (void *)nvt))
1032 goto failure;
1033
1034 if (!request_region(nvt->cir_wake_addr,
1035 CIR_IOREG_LENGTH, NVT_DRIVER_NAME))
1036 goto failure;
1037
1038 if (request_irq(nvt->cir_wake_irq, nvt_cir_wake_isr, IRQF_SHARED,
1039 NVT_DRIVER_NAME, (void *)nvt))
1040 goto failure;
1041
1042 pnp_set_drvdata(pdev, nvt); 1024 pnp_set_drvdata(pdev, nvt);
1043 nvt->pdev = pdev; 1025 nvt->pdev = pdev;
1044 1026
@@ -1085,6 +1067,24 @@ static int nvt_probe(struct pnp_dev *pdev, const struct pnp_device_id *dev_id)
1085 rdev->tx_resolution = XYZ; 1067 rdev->tx_resolution = XYZ;
1086#endif 1068#endif
1087 1069
1070 ret = -EBUSY;
1071 /* now claim resources */
1072 if (!request_region(nvt->cir_addr,
1073 CIR_IOREG_LENGTH, NVT_DRIVER_NAME))
1074 goto failure;
1075
1076 if (request_irq(nvt->cir_irq, nvt_cir_isr, IRQF_SHARED,
1077 NVT_DRIVER_NAME, (void *)nvt))
1078 goto failure;
1079
1080 if (!request_region(nvt->cir_wake_addr,
1081 CIR_IOREG_LENGTH, NVT_DRIVER_NAME))
1082 goto failure;
1083
1084 if (request_irq(nvt->cir_wake_irq, nvt_cir_wake_isr, IRQF_SHARED,
1085 NVT_DRIVER_NAME, (void *)nvt))
1086 goto failure;
1087
1088 ret = rc_register_device(rdev); 1088 ret = rc_register_device(rdev);
1089 if (ret) 1089 if (ret)
1090 goto failure; 1090 goto failure;
diff --git a/drivers/media/rc/winbond-cir.c b/drivers/media/rc/winbond-cir.c
index af526586fa26..342c2c8c1ddf 100644
--- a/drivers/media/rc/winbond-cir.c
+++ b/drivers/media/rc/winbond-cir.c
@@ -991,39 +991,10 @@ wbcir_probe(struct pnp_dev *device, const struct pnp_device_id *dev_id)
991 "(w: 0x%lX, e: 0x%lX, s: 0x%lX, i: %u)\n", 991 "(w: 0x%lX, e: 0x%lX, s: 0x%lX, i: %u)\n",
992 data->wbase, data->ebase, data->sbase, data->irq); 992 data->wbase, data->ebase, data->sbase, data->irq);
993 993
994 if (!request_region(data->wbase, WAKEUP_IOMEM_LEN, DRVNAME)) {
995 dev_err(dev, "Region 0x%lx-0x%lx already in use!\n",
996 data->wbase, data->wbase + WAKEUP_IOMEM_LEN - 1);
997 err = -EBUSY;
998 goto exit_free_data;
999 }
1000
1001 if (!request_region(data->ebase, EHFUNC_IOMEM_LEN, DRVNAME)) {
1002 dev_err(dev, "Region 0x%lx-0x%lx already in use!\n",
1003 data->ebase, data->ebase + EHFUNC_IOMEM_LEN - 1);
1004 err = -EBUSY;
1005 goto exit_release_wbase;
1006 }
1007
1008 if (!request_region(data->sbase, SP_IOMEM_LEN, DRVNAME)) {
1009 dev_err(dev, "Region 0x%lx-0x%lx already in use!\n",
1010 data->sbase, data->sbase + SP_IOMEM_LEN - 1);
1011 err = -EBUSY;
1012 goto exit_release_ebase;
1013 }
1014
1015 err = request_irq(data->irq, wbcir_irq_handler,
1016 IRQF_DISABLED, DRVNAME, device);
1017 if (err) {
1018 dev_err(dev, "Failed to claim IRQ %u\n", data->irq);
1019 err = -EBUSY;
1020 goto exit_release_sbase;
1021 }
1022
1023 led_trigger_register_simple("cir-tx", &data->txtrigger); 994 led_trigger_register_simple("cir-tx", &data->txtrigger);
1024 if (!data->txtrigger) { 995 if (!data->txtrigger) {
1025 err = -ENOMEM; 996 err = -ENOMEM;
1026 goto exit_free_irq; 997 goto exit_free_data;
1027 } 998 }
1028 999
1029 led_trigger_register_simple("cir-rx", &data->rxtrigger); 1000 led_trigger_register_simple("cir-rx", &data->rxtrigger);
@@ -1062,9 +1033,38 @@ wbcir_probe(struct pnp_dev *device, const struct pnp_device_id *dev_id)
1062 data->dev->priv = data; 1033 data->dev->priv = data;
1063 data->dev->dev.parent = &device->dev; 1034 data->dev->dev.parent = &device->dev;
1064 1035
1036 if (!request_region(data->wbase, WAKEUP_IOMEM_LEN, DRVNAME)) {
1037 dev_err(dev, "Region 0x%lx-0x%lx already in use!\n",
1038 data->wbase, data->wbase + WAKEUP_IOMEM_LEN - 1);
1039 err = -EBUSY;
1040 goto exit_free_rc;
1041 }
1042
1043 if (!request_region(data->ebase, EHFUNC_IOMEM_LEN, DRVNAME)) {
1044 dev_err(dev, "Region 0x%lx-0x%lx already in use!\n",
1045 data->ebase, data->ebase + EHFUNC_IOMEM_LEN - 1);
1046 err = -EBUSY;
1047 goto exit_release_wbase;
1048 }
1049
1050 if (!request_region(data->sbase, SP_IOMEM_LEN, DRVNAME)) {
1051 dev_err(dev, "Region 0x%lx-0x%lx already in use!\n",
1052 data->sbase, data->sbase + SP_IOMEM_LEN - 1);
1053 err = -EBUSY;
1054 goto exit_release_ebase;
1055 }
1056
1057 err = request_irq(data->irq, wbcir_irq_handler,
1058 IRQF_DISABLED, DRVNAME, device);
1059 if (err) {
1060 dev_err(dev, "Failed to claim IRQ %u\n", data->irq);
1061 err = -EBUSY;
1062 goto exit_release_sbase;
1063 }
1064
1065 err = rc_register_device(data->dev); 1065 err = rc_register_device(data->dev);
1066 if (err) 1066 if (err)
1067 goto exit_free_rc; 1067 goto exit_free_irq;
1068 1068
1069 device_init_wakeup(&device->dev, 1); 1069 device_init_wakeup(&device->dev, 1);
1070 1070
@@ -1072,14 +1072,6 @@ wbcir_probe(struct pnp_dev *device, const struct pnp_device_id *dev_id)
1072 1072
1073 return 0; 1073 return 0;
1074 1074
1075exit_free_rc:
1076 rc_free_device(data->dev);
1077exit_unregister_led:
1078 led_classdev_unregister(&data->led);
1079exit_unregister_rxtrigger:
1080 led_trigger_unregister_simple(data->rxtrigger);
1081exit_unregister_txtrigger:
1082 led_trigger_unregister_simple(data->txtrigger);
1083exit_free_irq: 1075exit_free_irq:
1084 free_irq(data->irq, device); 1076 free_irq(data->irq, device);
1085exit_release_sbase: 1077exit_release_sbase:
@@ -1088,6 +1080,14 @@ exit_release_ebase:
1088 release_region(data->ebase, EHFUNC_IOMEM_LEN); 1080 release_region(data->ebase, EHFUNC_IOMEM_LEN);
1089exit_release_wbase: 1081exit_release_wbase:
1090 release_region(data->wbase, WAKEUP_IOMEM_LEN); 1082 release_region(data->wbase, WAKEUP_IOMEM_LEN);
1083exit_free_rc:
1084 rc_free_device(data->dev);
1085exit_unregister_led:
1086 led_classdev_unregister(&data->led);
1087exit_unregister_rxtrigger:
1088 led_trigger_unregister_simple(data->rxtrigger);
1089exit_unregister_txtrigger:
1090 led_trigger_unregister_simple(data->txtrigger);
1091exit_free_data: 1091exit_free_data:
1092 kfree(data); 1092 kfree(data);
1093 pnp_set_drvdata(device, NULL); 1093 pnp_set_drvdata(device, NULL);
diff --git a/drivers/media/video/gspca/sonixj.c b/drivers/media/video/gspca/sonixj.c
index db8e5084df06..863c755dd2b7 100644
--- a/drivers/media/video/gspca/sonixj.c
+++ b/drivers/media/video/gspca/sonixj.c
@@ -2923,6 +2923,10 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev,
2923 * not the JPEG end of frame ('ff d9'). 2923 * not the JPEG end of frame ('ff d9').
2924 */ 2924 */
2925 2925
2926 /* count the packets and their size */
2927 sd->npkt++;
2928 sd->pktsz += len;
2929
2926/*fixme: assumption about the following code: 2930/*fixme: assumption about the following code:
2927 * - there can be only one marker in a packet 2931 * - there can be only one marker in a packet
2928 */ 2932 */
@@ -2945,10 +2949,6 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev,
2945 data += i; 2949 data += i;
2946 } 2950 }
2947 2951
2948 /* count the packets and their size */
2949 sd->npkt++;
2950 sd->pktsz += len;
2951
2952 /* search backwards if there is a marker in the packet */ 2952 /* search backwards if there is a marker in the packet */
2953 for (i = len - 1; --i >= 0; ) { 2953 for (i = len - 1; --i >= 0; ) {
2954 if (data[i] != 0xff) { 2954 if (data[i] != 0xff) {
diff --git a/drivers/media/video/marvell-ccic/mmp-driver.c b/drivers/media/video/marvell-ccic/mmp-driver.c
index d23552323f45..c4c17fe76c0d 100644
--- a/drivers/media/video/marvell-ccic/mmp-driver.c
+++ b/drivers/media/video/marvell-ccic/mmp-driver.c
@@ -181,7 +181,6 @@ static int mmpcam_probe(struct platform_device *pdev)
181 INIT_LIST_HEAD(&cam->devlist); 181 INIT_LIST_HEAD(&cam->devlist);
182 182
183 mcam = &cam->mcam; 183 mcam = &cam->mcam;
184 mcam->platform = MHP_Armada610;
185 mcam->plat_power_up = mmpcam_power_up; 184 mcam->plat_power_up = mmpcam_power_up;
186 mcam->plat_power_down = mmpcam_power_down; 185 mcam->plat_power_down = mmpcam_power_down;
187 mcam->dev = &pdev->dev; 186 mcam->dev = &pdev->dev;
diff --git a/drivers/media/video/s5p-fimc/fimc-capture.c b/drivers/media/video/s5p-fimc/fimc-capture.c
index b06efd208328..7e9b2c612b03 100644
--- a/drivers/media/video/s5p-fimc/fimc-capture.c
+++ b/drivers/media/video/s5p-fimc/fimc-capture.c
@@ -246,28 +246,37 @@ int fimc_capture_resume(struct fimc_dev *fimc)
246 246
247} 247}
248 248
249static unsigned int get_plane_size(struct fimc_frame *fr, unsigned int plane) 249static int queue_setup(struct vb2_queue *vq, const struct v4l2_format *pfmt,
250{
251 if (!fr || plane >= fr->fmt->memplanes)
252 return 0;
253 return fr->f_width * fr->f_height * fr->fmt->depth[plane] / 8;
254}
255
256static int queue_setup(struct vb2_queue *vq, const struct v4l2_format *pfmt,
257 unsigned int *num_buffers, unsigned int *num_planes, 250 unsigned int *num_buffers, unsigned int *num_planes,
258 unsigned int sizes[], void *allocators[]) 251 unsigned int sizes[], void *allocators[])
259{ 252{
253 const struct v4l2_pix_format_mplane *pixm = NULL;
260 struct fimc_ctx *ctx = vq->drv_priv; 254 struct fimc_ctx *ctx = vq->drv_priv;
261 struct fimc_fmt *fmt = ctx->d_frame.fmt; 255 struct fimc_frame *frame = &ctx->d_frame;
256 struct fimc_fmt *fmt = frame->fmt;
257 unsigned long wh;
262 int i; 258 int i;
263 259
264 if (!fmt) 260 if (pfmt) {
261 pixm = &pfmt->fmt.pix_mp;
262 fmt = fimc_find_format(&pixm->pixelformat, NULL,
263 FMT_FLAGS_CAM | FMT_FLAGS_M2M, -1);
264 wh = pixm->width * pixm->height;
265 } else {
266 wh = frame->f_width * frame->f_height;
267 }
268
269 if (fmt == NULL)
265 return -EINVAL; 270 return -EINVAL;
266 271
267 *num_planes = fmt->memplanes; 272 *num_planes = fmt->memplanes;
268 273
269 for (i = 0; i < fmt->memplanes; i++) { 274 for (i = 0; i < fmt->memplanes; i++) {
270 sizes[i] = get_plane_size(&ctx->d_frame, i); 275 unsigned int size = (wh * fmt->depth[i]) / 8;
276 if (pixm)
277 sizes[i] = max(size, pixm->plane_fmt[i].sizeimage);
278 else
279 sizes[i] = size;
271 allocators[i] = ctx->fimc_dev->alloc_ctx; 280 allocators[i] = ctx->fimc_dev->alloc_ctx;
272 } 281 }
273 282
@@ -1383,7 +1392,7 @@ static int fimc_subdev_set_crop(struct v4l2_subdev *sd,
1383 fimc_capture_try_crop(ctx, r, crop->pad); 1392 fimc_capture_try_crop(ctx, r, crop->pad);
1384 1393
1385 if (crop->which == V4L2_SUBDEV_FORMAT_TRY) { 1394 if (crop->which == V4L2_SUBDEV_FORMAT_TRY) {
1386 mutex_lock(&fimc->lock); 1395 mutex_unlock(&fimc->lock);
1387 *v4l2_subdev_get_try_crop(fh, crop->pad) = *r; 1396 *v4l2_subdev_get_try_crop(fh, crop->pad) = *r;
1388 return 0; 1397 return 0;
1389 } 1398 }
diff --git a/drivers/media/video/s5p-fimc/fimc-core.c b/drivers/media/video/s5p-fimc/fimc-core.c
index e184e650022a..e09ba7b0076e 100644
--- a/drivers/media/video/s5p-fimc/fimc-core.c
+++ b/drivers/media/video/s5p-fimc/fimc-core.c
@@ -1048,14 +1048,14 @@ static int fimc_m2m_g_fmt_mplane(struct file *file, void *fh,
1048 * @mask: the color flags to match 1048 * @mask: the color flags to match
1049 * @index: offset in the fimc_formats array, ignored if negative 1049 * @index: offset in the fimc_formats array, ignored if negative
1050 */ 1050 */
1051struct fimc_fmt *fimc_find_format(u32 *pixelformat, u32 *mbus_code, 1051struct fimc_fmt *fimc_find_format(const u32 *pixelformat, const u32 *mbus_code,
1052 unsigned int mask, int index) 1052 unsigned int mask, int index)
1053{ 1053{
1054 struct fimc_fmt *fmt, *def_fmt = NULL; 1054 struct fimc_fmt *fmt, *def_fmt = NULL;
1055 unsigned int i; 1055 unsigned int i;
1056 int id = 0; 1056 int id = 0;
1057 1057
1058 if (index >= ARRAY_SIZE(fimc_formats)) 1058 if (index >= (int)ARRAY_SIZE(fimc_formats))
1059 return NULL; 1059 return NULL;
1060 1060
1061 for (i = 0; i < ARRAY_SIZE(fimc_formats); ++i) { 1061 for (i = 0; i < ARRAY_SIZE(fimc_formats); ++i) {
diff --git a/drivers/media/video/s5p-fimc/fimc-core.h b/drivers/media/video/s5p-fimc/fimc-core.h
index a18291e648e2..84fd83550bd7 100644
--- a/drivers/media/video/s5p-fimc/fimc-core.h
+++ b/drivers/media/video/s5p-fimc/fimc-core.h
@@ -718,7 +718,7 @@ void fimc_alpha_ctrl_update(struct fimc_ctx *ctx);
718int fimc_fill_format(struct fimc_frame *frame, struct v4l2_format *f); 718int fimc_fill_format(struct fimc_frame *frame, struct v4l2_format *f);
719void fimc_adjust_mplane_format(struct fimc_fmt *fmt, u32 width, u32 height, 719void fimc_adjust_mplane_format(struct fimc_fmt *fmt, u32 width, u32 height,
720 struct v4l2_pix_format_mplane *pix); 720 struct v4l2_pix_format_mplane *pix);
721struct fimc_fmt *fimc_find_format(u32 *pixelformat, u32 *mbus_code, 721struct fimc_fmt *fimc_find_format(const u32 *pixelformat, const u32 *mbus_code,
722 unsigned int mask, int index); 722 unsigned int mask, int index);
723 723
724int fimc_check_scaler_ratio(struct fimc_ctx *ctx, int sw, int sh, 724int fimc_check_scaler_ratio(struct fimc_ctx *ctx, int sw, int sh,
diff --git a/drivers/media/video/soc_camera.c b/drivers/media/video/soc_camera.c
index eb25756a07af..aedb970d13f6 100644
--- a/drivers/media/video/soc_camera.c
+++ b/drivers/media/video/soc_camera.c
@@ -530,7 +530,10 @@ static int soc_camera_open(struct file *file)
530 if (icl->reset) 530 if (icl->reset)
531 icl->reset(icd->pdev); 531 icl->reset(icd->pdev);
532 532
533 /* Don't mess with the host during probe */
534 mutex_lock(&ici->host_lock);
533 ret = ici->ops->add(icd); 535 ret = ici->ops->add(icd);
536 mutex_unlock(&ici->host_lock);
534 if (ret < 0) { 537 if (ret < 0) {
535 dev_err(icd->pdev, "Couldn't activate the camera: %d\n", ret); 538 dev_err(icd->pdev, "Couldn't activate the camera: %d\n", ret);
536 goto eiciadd; 539 goto eiciadd;
@@ -956,7 +959,7 @@ static void scan_add_host(struct soc_camera_host *ici)
956{ 959{
957 struct soc_camera_device *icd; 960 struct soc_camera_device *icd;
958 961
959 mutex_lock(&list_lock); 962 mutex_lock(&ici->host_lock);
960 963
961 list_for_each_entry(icd, &devices, list) { 964 list_for_each_entry(icd, &devices, list) {
962 if (icd->iface == ici->nr) { 965 if (icd->iface == ici->nr) {
@@ -967,7 +970,7 @@ static void scan_add_host(struct soc_camera_host *ici)
967 } 970 }
968 } 971 }
969 972
970 mutex_unlock(&list_lock); 973 mutex_unlock(&ici->host_lock);
971} 974}
972 975
973#ifdef CONFIG_I2C_BOARDINFO 976#ifdef CONFIG_I2C_BOARDINFO
@@ -1313,6 +1316,7 @@ int soc_camera_host_register(struct soc_camera_host *ici)
1313 list_add_tail(&ici->list, &hosts); 1316 list_add_tail(&ici->list, &hosts);
1314 mutex_unlock(&list_lock); 1317 mutex_unlock(&list_lock);
1315 1318
1319 mutex_init(&ici->host_lock);
1316 scan_add_host(ici); 1320 scan_add_host(ici);
1317 1321
1318 return 0; 1322 return 0;
diff --git a/drivers/media/video/videobuf2-dma-contig.c b/drivers/media/video/videobuf2-dma-contig.c
index f17ad98fcc5f..4b7132660a93 100644
--- a/drivers/media/video/videobuf2-dma-contig.c
+++ b/drivers/media/video/videobuf2-dma-contig.c
@@ -15,6 +15,7 @@
15#include <linux/dma-mapping.h> 15#include <linux/dma-mapping.h>
16 16
17#include <media/videobuf2-core.h> 17#include <media/videobuf2-core.h>
18#include <media/videobuf2-dma-contig.h>
18#include <media/videobuf2-memops.h> 19#include <media/videobuf2-memops.h>
19 20
20struct vb2_dc_conf { 21struct vb2_dc_conf {
@@ -85,7 +86,7 @@ static void *vb2_dma_contig_vaddr(void *buf_priv)
85{ 86{
86 struct vb2_dc_buf *buf = buf_priv; 87 struct vb2_dc_buf *buf = buf_priv;
87 if (!buf) 88 if (!buf)
88 return 0; 89 return NULL;
89 90
90 return buf->vaddr; 91 return buf->vaddr;
91} 92}
diff --git a/drivers/media/video/videobuf2-memops.c b/drivers/media/video/videobuf2-memops.c
index c41cb60245d6..504cd4cbe29e 100644
--- a/drivers/media/video/videobuf2-memops.c
+++ b/drivers/media/video/videobuf2-memops.c
@@ -55,6 +55,7 @@ struct vm_area_struct *vb2_get_vma(struct vm_area_struct *vma)
55 55
56 return vma_copy; 56 return vma_copy;
57} 57}
58EXPORT_SYMBOL_GPL(vb2_get_vma);
58 59
59/** 60/**
60 * vb2_put_userptr() - release a userspace virtual memory area 61 * vb2_put_userptr() - release a userspace virtual memory area