From patchwork Tue Jun 11 08:23:37 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guennadi Liakhovetski X-Patchwork-Id: 2700831 Return-Path: X-Original-To: patchwork-linux-sh@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 83066DF23A for ; Tue, 11 Jun 2013 09:27:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753250Ab3FKJ1l (ORCPT ); Tue, 11 Jun 2013 05:27:41 -0400 Received: from moutng.kundenserver.de ([212.227.126.187]:54049 "EHLO moutng.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753253Ab3FKJ1e (ORCPT ); Tue, 11 Jun 2013 05:27:34 -0400 Received: from axis700.grange (dslb-178-001-148-081.pools.arcor-ip.net [178.1.148.81]) by mrelayeu.kundenserver.de (node=mrbap2) with ESMTP (Nemesis) id 0Mhf9f-1UzD0K1VzP-00MYe1; Tue, 11 Jun 2013 11:27:16 +0200 Received: from 6a.grange (unknown [192.168.1.11]) by axis700.grange (Postfix) with ESMTPS id 2608E40BC9; Tue, 11 Jun 2013 10:24:05 +0200 (CEST) Received: from lyakh by 6a.grange with local (Exim 4.72) (envelope-from ) id 1UmJs4-0002Bd-Ld; Tue, 11 Jun 2013 10:24:04 +0200 From: Guennadi Liakhovetski To: linux-media@vger.kernel.org Cc: Laurent Pinchart , Sylwester Nawrocki , Hans Verkuil , linux-sh@vger.kernel.org, Magnus Damm , Sakari Ailus , Prabhakar Lad , Sascha Hauer , Guennadi Liakhovetski Subject: [PATCH v10 10/21] soc-camera: make .clock_{start, stop} compulsory, .add / .remove optional Date: Tue, 11 Jun 2013 10:23:37 +0200 Message-Id: <1370939028-8352-11-git-send-email-g.liakhovetski@gmx.de> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: <1370939028-8352-1-git-send-email-g.liakhovetski@gmx.de> References: <1370939028-8352-1-git-send-email-g.liakhovetski@gmx.de> X-Provags-ID: V02:K0:VYjarZJ2YFn/uDjBHWjeqeEhmAxq8xo84WHEHRggL5O QcKv9F6Zzxjf4b+xV7HiVwuqo7zNXes3Ve2f91xu+iPuZSnLpd RBFa5Zapg4m33iEwX1GDYe/zzwB15EXToWDKtZlw5A8XnoGNCd hLZtBDj5uzn80U3vfp9XE0jA/T9I/UZO5w/u6UFAxv6acnv1pk Zqn22rp/ytyeZg329WxvGa/DXfyzJ4hW/3pR1VRiep8JPxnff+ grplvZZjOuRl9ktshUsSevY60KHBjgy+aoGZcGaZQLtB9Y6ROc S39OwMVVFI0V8VeApwMfBaSlIxRz4a1T20YQDnzsoTLjJXyUQ6 opsIsKOaXk0SyLOFp+4ghTAc3e4lzl38IvkEQl7vgWGz2yau4T p3V/1HPqJj1iA== Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org 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 --- drivers/media/platform/soc_camera/soc_camera.c | 27 +++++++++++------------ 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 df90565..e503f03 100644 --- a/drivers/media/platform/soc_camera/soc_camera.c +++ b/drivers/media/platform/soc_camera/soc_camera.c @@ -513,23 +513,22 @@ static int soc_camera_add_device(struct soc_camera_device *icd) if (ici->icd) return -EBUSY; - if (ici->ops->clock_start) { - ret = ici->ops->clock_start(ici); + ret = ici->ops->clock_start(ici); + if (ret < 0) + return ret; + + if (ici->ops->add) { + ret = ici->ops->add(icd); if (ret < 0) - return ret; + goto eadd; } - ret = ici->ops->add(icd); - if (ret < 0) - goto eadd; - ici->icd = icd; return 0; eadd: - if (ici->ops->clock_stop) - ici->ops->clock_stop(ici); + ici->ops->clock_stop(ici); return ret; } @@ -540,9 +539,9 @@ static void soc_camera_remove_device(struct soc_camera_device *icd) if (WARN_ON(icd != ici->icd)) return; - ici->ops->remove(icd); - if (ici->ops->clock_stop) - ici->ops->clock_stop(ici); + if (ici->ops->remove) + ici->ops->remove(icd); + ici->ops->clock_stop(ici); ici->icd = NULL; } @@ -1413,8 +1412,8 @@ int soc_camera_host_register(struct soc_camera_host *ici) ((!ici->ops->init_videobuf || !ici->ops->reqbufs) && !ici->ops->init_videobuf2) || - !ici->ops->add || - !ici->ops->remove || + !ici->ops->clock_start || + !ici->ops->clock_stop || !ici->ops->poll || !ici->v4l2_dev.dev) return -EINVAL;