aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/platform/soc_camera
diff options
context:
space:
mode:
authorGuennadi Liakhovetski <g.liakhovetski@gmx.de>2013-04-04 12:19:58 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2013-06-21 14:46:42 -0400
commita78fcc11264b824d9651b55abfeedd16d5cd8415 (patch)
tree695b7d7ca102d2f55b0ae1903506eaa598d06c2a /drivers/media/platform/soc_camera
parent0ff6a6e8fb6915e68b93ff169b1eb66c0ba15d56 (diff)
[media] soc-camera: make .clock_{start,stop} compulsory, .add / .remove optional
All existing soc-camera host drivers use .clock_start() and .clock_stop() callbacks to activate and deactivate their camera interfaces, whereas .add() and .remove() callbacks are usually dummy. Make the former two compulsory and the latter two optional. Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Acked-by: Hans Verkuil <hans.verkuil@cisco.com> Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/platform/soc_camera')
-rw-r--r--drivers/media/platform/soc_camera/soc_camera.c27
1 files changed, 13 insertions, 14 deletions
diff --git a/drivers/media/platform/soc_camera/soc_camera.c b/drivers/media/platform/soc_camera/soc_camera.c
index 3cc086036070..24393a14aaf6 100644
--- a/drivers/media/platform/soc_camera/soc_camera.c
+++ b/drivers/media/platform/soc_camera/soc_camera.c
@@ -512,23 +512,22 @@ static int soc_camera_add_device(struct soc_camera_device *icd)
512 if (ici->icd) 512 if (ici->icd)
513 return -EBUSY; 513 return -EBUSY;
514 514
515 if (ici->ops->clock_start) { 515 ret = ici->ops->clock_start(ici);
516 ret = ici->ops->clock_start(ici); 516 if (ret < 0)
517 return ret;
518
519 if (ici->ops->add) {
520 ret = ici->ops->add(icd);
517 if (ret < 0) 521 if (ret < 0)
518 return ret; 522 goto eadd;
519 } 523 }
520 524
521 ret = ici->ops->add(icd);
522 if (ret < 0)
523 goto eadd;
524
525 ici->icd = icd; 525 ici->icd = icd;
526 526
527 return 0; 527 return 0;
528 528
529eadd: 529eadd:
530 if (ici->ops->clock_stop) 530 ici->ops->clock_stop(ici);
531 ici->ops->clock_stop(ici);
532 return ret; 531 return ret;
533} 532}
534 533
@@ -539,9 +538,9 @@ static void soc_camera_remove_device(struct soc_camera_device *icd)
539 if (WARN_ON(icd != ici->icd)) 538 if (WARN_ON(icd != ici->icd))
540 return; 539 return;
541 540
542 ici->ops->remove(icd); 541 if (ici->ops->remove)
543 if (ici->ops->clock_stop) 542 ici->ops->remove(icd);
544 ici->ops->clock_stop(ici); 543 ici->ops->clock_stop(ici);
545 ici->icd = NULL; 544 ici->icd = NULL;
546} 545}
547 546
@@ -1383,8 +1382,8 @@ int soc_camera_host_register(struct soc_camera_host *ici)
1383 ((!ici->ops->init_videobuf || 1382 ((!ici->ops->init_videobuf ||
1384 !ici->ops->reqbufs) && 1383 !ici->ops->reqbufs) &&
1385 !ici->ops->init_videobuf2) || 1384 !ici->ops->init_videobuf2) ||
1386 !ici->ops->add || 1385 !ici->ops->clock_start ||
1387 !ici->ops->remove || 1386 !ici->ops->clock_stop ||
1388 !ici->ops->poll || 1387 !ici->ops->poll ||
1389 !ici->v4l2_dev.dev) 1388 !ici->v4l2_dev.dev)
1390 return -EINVAL; 1389 return -EINVAL;