From patchwork Tue Jul 30 12:25: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: 2835604 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 62F04C0319 for ; Tue, 30 Jul 2013 12:26:58 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2592220306 for ; Tue, 30 Jul 2013 12:26:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 79FD520303 for ; Tue, 30 Jul 2013 12:26:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751894Ab3G3M00 (ORCPT ); Tue, 30 Jul 2013 08:26:26 -0400 Received: from moutng.kundenserver.de ([212.227.17.9]:64921 "EHLO moutng.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753410Ab3G3MZk (ORCPT ); Tue, 30 Jul 2013 08:25:40 -0400 Received: from axis700.grange (dslb-094-220-155-198.pools.arcor-ip.net [94.220.155.198]) by mrelayeu.kundenserver.de (node=mreu1) with ESMTP (Nemesis) id 0MWfQV-1UakYa0uq3-00Xf8t; Tue, 30 Jul 2013 14:25:39 +0200 Received: from 6a.grange (6a.grange [192.168.1.11]) by axis700.grange (Postfix) with ESMTPS id 4696C40BB8 for ; Tue, 30 Jul 2013 14:25:38 +0200 (CEST) Received: from lyakh by 6a.grange with local (Exim 4.72) (envelope-from ) id 1V48zi-0003vO-0Q for linux-media@vger.kernel.org; Tue, 30 Jul 2013 14:25:38 +0200 From: Guennadi Liakhovetski To: linux-media@vger.kernel.org Subject: [PATCH 5/6] V4L2: mt9m111: switch to asynchronous subdevice probing Date: Tue, 30 Jul 2013 14:25:37 +0200 Message-Id: <1375187137-15045-7-git-send-email-g.liakhovetski@gmx.de> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: <1375187137-15045-1-git-send-email-g.liakhovetski@gmx.de> References: <1375187137-15045-1-git-send-email-g.liakhovetski@gmx.de> X-Provags-ID: V02:K0:6AQ+pl8bvx0cGj/HZlbbfZeh91cBrUPImMYO5qNMXtc o3RU/K6L8zLtVF8YpizvE5zylnZMGE5+N5wFbcI1Ndp3K8nn4r YSml4do/yZ6ydyFNDSc1lDyBo1DXse79cy4S2Ld/J+B5ED7gGI Q3wCE2sWTkyWgl4OWOF9YlSzZtxAl8BMlpxSQEExrZDxDFKCB7 ie9dszbWBU/QzWtaUUqwNnIfMEsLDxTe5TZ9+e/GCzFrJjtq3a cDO6NREf67Etf37SX/e1hdIAksK5h61m/soFINE64+aRD3Eykv TAwRznM1IqBt3BaWakfKkfykhxVINQUV72fbMfHXzPr4cRjLnU LpLCZT5cMkIwrzCqoBX8URQN2aUwBAvzmkQ9gRqjuZhO9ROrY1 cnwgdw1iYZpFw== Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-8.4 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham 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 Convert the mt9m111 driver to asynchronous subdevice probing. Synchronous probing is also still possible. Signed-off-by: Guennadi Liakhovetski --- drivers/media/i2c/soc_camera/mt9m111.c | 38 +++++++++++++++++++++---------- 1 files changed, 26 insertions(+), 12 deletions(-) diff --git a/drivers/media/i2c/soc_camera/mt9m111.c b/drivers/media/i2c/soc_camera/mt9m111.c index de3605d..6f40566 100644 --- a/drivers/media/i2c/soc_camera/mt9m111.c +++ b/drivers/media/i2c/soc_camera/mt9m111.c @@ -946,6 +946,10 @@ static int mt9m111_probe(struct i2c_client *client, if (!mt9m111) return -ENOMEM; + mt9m111->clk = v4l2_clk_get(&client->dev, "mclk"); + if (IS_ERR(mt9m111->clk)) + return -EPROBE_DEFER; + /* Default HIGHPOWER context */ mt9m111->ctx = &context_b; @@ -963,8 +967,10 @@ static int mt9m111_probe(struct i2c_client *client, &mt9m111_ctrl_ops, V4L2_CID_EXPOSURE_AUTO, 1, 0, V4L2_EXPOSURE_AUTO); mt9m111->subdev.ctrl_handler = &mt9m111->hdl; - if (mt9m111->hdl.error) - return mt9m111->hdl.error; + if (mt9m111->hdl.error) { + ret = mt9m111->hdl.error; + goto out_clkput; + } /* Second stage probe - when a capture adapter is there */ mt9m111->rect.left = MT9M111_MIN_DARK_COLS; @@ -975,18 +981,25 @@ static int mt9m111_probe(struct i2c_client *client, mt9m111->lastpage = -1; mutex_init(&mt9m111->power_lock); - mt9m111->clk = v4l2_clk_get(&client->dev, "mclk"); - if (IS_ERR(mt9m111->clk)) { - ret = PTR_ERR(mt9m111->clk); - goto eclkget; - } + ret = soc_camera_power_init(&client->dev, ssdd); + if (ret < 0) + goto out_hdlfree; ret = mt9m111_video_probe(client); - if (ret) { - v4l2_clk_put(mt9m111->clk); -eclkget: - v4l2_ctrl_handler_free(&mt9m111->hdl); - } + if (ret < 0) + goto out_hdlfree; + + mt9m111->subdev.dev = &client->dev; + ret = v4l2_async_register_subdev(&mt9m111->subdev); + if (ret < 0) + goto out_hdlfree; + + return 0; + +out_hdlfree: + v4l2_ctrl_handler_free(&mt9m111->hdl); +out_clkput: + v4l2_clk_put(mt9m111->clk); return ret; } @@ -995,6 +1008,7 @@ static int mt9m111_remove(struct i2c_client *client) { struct mt9m111 *mt9m111 = to_mt9m111(client); + v4l2_async_unregister_subdev(&mt9m111->subdev); v4l2_clk_put(mt9m111->clk); v4l2_device_unregister_subdev(&mt9m111->subdev); v4l2_ctrl_handler_free(&mt9m111->hdl);