From patchwork Fri Jun 14 19:08:20 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guennadi Liakhovetski X-Patchwork-Id: 2723151 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 10438C0AB1 for ; Fri, 14 Jun 2013 19:09:09 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 36D9A20367 for ; Fri, 14 Jun 2013 19:09:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E197120369 for ; Fri, 14 Jun 2013 19:09:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753529Ab3FNTJE (ORCPT ); Fri, 14 Jun 2013 15:09:04 -0400 Received: from moutng.kundenserver.de ([212.227.17.9]:58676 "EHLO moutng.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752931Ab3FNTJD (ORCPT ); Fri, 14 Jun 2013 15:09:03 -0400 Received: from axis700.grange (dslb-188-109-039-013.pools.arcor-ip.net [188.109.39.13]) by mrelayeu.kundenserver.de (node=mrbap4) with ESMTP (Nemesis) id 0Lkgke-1UFc7f0dOO-00ar4E; Fri, 14 Jun 2013 21:08:47 +0200 Received: from 6a.grange (6a.grange [192.168.1.11]) by axis700.grange (Postfix) with ESMTPS id DD34C40BC6; Fri, 14 Jun 2013 21:08:45 +0200 (CEST) Received: from lyakh by 6a.grange with local (Exim 4.72) (envelope-from ) id 1UnZMb-0003wx-P2; Fri, 14 Jun 2013 21:08:45 +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 v11 10/21] soc-camera: make .clock_{start, stop} compulsory, .add / .remove optional Date: Fri, 14 Jun 2013 21:08:20 +0200 Message-Id: <1371236911-15131-11-git-send-email-g.liakhovetski@gmx.de> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: <1371236911-15131-1-git-send-email-g.liakhovetski@gmx.de> References: <1371236911-15131-1-git-send-email-g.liakhovetski@gmx.de> X-Provags-ID: V02:K0:uTv9NYskUutFuCO3s7uUfD2d8+IRlpijCrlWCsBTgcs mcH2Q5wVYvRivO3cl2NYZxXK2Mv6rkoOQDAjozQJiayriQTt9w Y473xsXAkAo0RNy1b9TD06lt6ur+ooKc0Iuxw1RKsN9RVNl+uz FRWTRZPHcTVYt2ZmtrM2F2f2NkLATKkolzMB9mFSp1rm7xFaLm wo/0wjZZCIgbz8/6Bn1hIecYrrQI6exxbrrXzaiHZ29Wc5Eg3i VXpbMYSCkjHFIRqfF/jo/LCl5sy9RLZ3vcy8AbS9migB2PFYxe pteVr9qZjqsu5YcbpV+ETHCiq5FCwPa/IsCAZ+q2Mnhc/ykqnh BSTe/ZIE08isc6mMr9huUDsH5iorit90K+xXFhYaXsmQhoVuU0 r11IUPcANEd57tOSYtxkfx6K5lSSU/gDiM= Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-7.2 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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;