diff options
Diffstat (limited to 'drivers/media/platform/soc_camera/soc_camera.c')
-rw-r--r-- | drivers/media/platform/soc_camera/soc_camera.c | 40 |
1 files changed, 9 insertions, 31 deletions
diff --git a/drivers/media/platform/soc_camera/soc_camera.c b/drivers/media/platform/soc_camera/soc_camera.c index 3be92944f8e7..d3f0b84e2d70 100644 --- a/drivers/media/platform/soc_camera/soc_camera.c +++ b/drivers/media/platform/soc_camera/soc_camera.c | |||
@@ -950,11 +950,11 @@ static int soc_camera_s_selection(struct file *file, void *fh, | |||
950 | 950 | ||
951 | /* In all these cases cropping emulation will not help */ | 951 | /* In all these cases cropping emulation will not help */ |
952 | if (s->type != V4L2_BUF_TYPE_VIDEO_CAPTURE || | 952 | if (s->type != V4L2_BUF_TYPE_VIDEO_CAPTURE || |
953 | (s->target != V4L2_SEL_TGT_COMPOSE_ACTIVE && | 953 | (s->target != V4L2_SEL_TGT_COMPOSE && |
954 | s->target != V4L2_SEL_TGT_CROP_ACTIVE)) | 954 | s->target != V4L2_SEL_TGT_CROP)) |
955 | return -EINVAL; | 955 | return -EINVAL; |
956 | 956 | ||
957 | if (s->target == V4L2_SEL_TGT_COMPOSE_ACTIVE) { | 957 | if (s->target == V4L2_SEL_TGT_COMPOSE) { |
958 | /* No output size change during a running capture! */ | 958 | /* No output size change during a running capture! */ |
959 | if (is_streaming(ici, icd) && | 959 | if (is_streaming(ici, icd) && |
960 | (icd->user_width != s->r.width || | 960 | (icd->user_width != s->r.width || |
@@ -974,7 +974,7 @@ static int soc_camera_s_selection(struct file *file, void *fh, | |||
974 | 974 | ||
975 | ret = ici->ops->set_selection(icd, s); | 975 | ret = ici->ops->set_selection(icd, s); |
976 | if (!ret && | 976 | if (!ret && |
977 | s->target == V4L2_SEL_TGT_COMPOSE_ACTIVE) { | 977 | s->target == V4L2_SEL_TGT_COMPOSE) { |
978 | icd->user_width = s->r.width; | 978 | icd->user_width = s->r.width; |
979 | icd->user_height = s->r.height; | 979 | icd->user_height = s->r.height; |
980 | if (!icd->streamer) | 980 | if (!icd->streamer) |
@@ -1184,7 +1184,8 @@ static int soc_camera_probe(struct soc_camera_device *icd) | |||
1184 | sd->grp_id = soc_camera_grp_id(icd); | 1184 | sd->grp_id = soc_camera_grp_id(icd); |
1185 | v4l2_set_subdev_hostdata(sd, icd); | 1185 | v4l2_set_subdev_hostdata(sd, icd); |
1186 | 1186 | ||
1187 | if (v4l2_ctrl_add_handler(&icd->ctrl_handler, sd->ctrl_handler, NULL)) | 1187 | ret = v4l2_ctrl_add_handler(&icd->ctrl_handler, sd->ctrl_handler, NULL); |
1188 | if (ret < 0) | ||
1188 | goto ectrl; | 1189 | goto ectrl; |
1189 | 1190 | ||
1190 | /* At this point client .probe() should have run already */ | 1191 | /* At this point client .probe() should have run already */ |
@@ -1529,12 +1530,11 @@ static int __devinit soc_camera_pdrv_probe(struct platform_device *pdev) | |||
1529 | { | 1530 | { |
1530 | struct soc_camera_link *icl = pdev->dev.platform_data; | 1531 | struct soc_camera_link *icl = pdev->dev.platform_data; |
1531 | struct soc_camera_device *icd; | 1532 | struct soc_camera_device *icd; |
1532 | int ret; | ||
1533 | 1533 | ||
1534 | if (!icl) | 1534 | if (!icl) |
1535 | return -EINVAL; | 1535 | return -EINVAL; |
1536 | 1536 | ||
1537 | icd = kzalloc(sizeof(*icd), GFP_KERNEL); | 1537 | icd = devm_kzalloc(&pdev->dev, sizeof(*icd), GFP_KERNEL); |
1538 | if (!icd) | 1538 | if (!icd) |
1539 | return -ENOMEM; | 1539 | return -ENOMEM; |
1540 | 1540 | ||
@@ -1543,19 +1543,10 @@ static int __devinit soc_camera_pdrv_probe(struct platform_device *pdev) | |||
1543 | icd->pdev = &pdev->dev; | 1543 | icd->pdev = &pdev->dev; |
1544 | platform_set_drvdata(pdev, icd); | 1544 | platform_set_drvdata(pdev, icd); |
1545 | 1545 | ||
1546 | ret = soc_camera_device_register(icd); | ||
1547 | if (ret < 0) | ||
1548 | goto escdevreg; | ||
1549 | |||
1550 | icd->user_width = DEFAULT_WIDTH; | 1546 | icd->user_width = DEFAULT_WIDTH; |
1551 | icd->user_height = DEFAULT_HEIGHT; | 1547 | icd->user_height = DEFAULT_HEIGHT; |
1552 | 1548 | ||
1553 | return 0; | 1549 | return soc_camera_device_register(icd); |
1554 | |||
1555 | escdevreg: | ||
1556 | kfree(icd); | ||
1557 | |||
1558 | return ret; | ||
1559 | } | 1550 | } |
1560 | 1551 | ||
1561 | /* | 1552 | /* |
@@ -1572,8 +1563,6 @@ static int __devexit soc_camera_pdrv_remove(struct platform_device *pdev) | |||
1572 | 1563 | ||
1573 | list_del(&icd->list); | 1564 | list_del(&icd->list); |
1574 | 1565 | ||
1575 | kfree(icd); | ||
1576 | |||
1577 | return 0; | 1566 | return 0; |
1578 | } | 1567 | } |
1579 | 1568 | ||
@@ -1586,18 +1575,7 @@ static struct platform_driver __refdata soc_camera_pdrv = { | |||
1586 | }, | 1575 | }, |
1587 | }; | 1576 | }; |
1588 | 1577 | ||
1589 | static int __init soc_camera_init(void) | 1578 | module_platform_driver(soc_camera_pdrv); |
1590 | { | ||
1591 | return platform_driver_register(&soc_camera_pdrv); | ||
1592 | } | ||
1593 | |||
1594 | static void __exit soc_camera_exit(void) | ||
1595 | { | ||
1596 | platform_driver_unregister(&soc_camera_pdrv); | ||
1597 | } | ||
1598 | |||
1599 | module_init(soc_camera_init); | ||
1600 | module_exit(soc_camera_exit); | ||
1601 | 1579 | ||
1602 | MODULE_DESCRIPTION("Image capture bus driver"); | 1580 | MODULE_DESCRIPTION("Image capture bus driver"); |
1603 | MODULE_AUTHOR("Guennadi Liakhovetski <kernel@pengutronix.de>"); | 1581 | MODULE_AUTHOR("Guennadi Liakhovetski <kernel@pengutronix.de>"); |