From patchwork Thu Aug 8 14:52: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: 2841265 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 1C79B9F295 for ; Thu, 8 Aug 2013 14:56:35 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D3533204AB for ; Thu, 8 Aug 2013 14:56:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 940BB204F0 for ; Thu, 8 Aug 2013 14:56:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965321Ab3HHO4W (ORCPT ); Thu, 8 Aug 2013 10:56:22 -0400 Received: from moutng.kundenserver.de ([212.227.17.8]:61816 "EHLO moutng.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934272Ab3HHO4Q (ORCPT ); Thu, 8 Aug 2013 10:56:16 -0400 Received: from axis700.grange (dslb-094-221-101-140.pools.arcor-ip.net [94.221.101.140]) by mrelayeu.kundenserver.de (node=mreu2) with ESMTP (Nemesis) id 0MY28S-1VcGCs3Vw0-00VCO0; Thu, 08 Aug 2013 16:56:15 +0200 Received: from 6a.grange (6a.grange [192.168.1.11]) by axis700.grange (Postfix) with ESMTPS id 68FB240BB7; Thu, 8 Aug 2013 16:56:14 +0200 (CEST) Received: from lyakh by 6a.grange with local (Exim 4.72) (envelope-from ) id 1V7RdO-00065r-8J; Thu, 08 Aug 2013 16:56:14 +0200 From: Guennadi Liakhovetski To: linux-media@vger.kernel.org Cc: Guennadi Liakhovetski Subject: [PATCH 6/6] V4L2: mt9m111: switch to asynchronous subdevice probing Date: Thu, 8 Aug 2013 16:52:37 +0200 Message-Id: <1375973557-23333-7-git-send-email-g.liakhovetski@gmx.de> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: <1375973557-23333-1-git-send-email-g.liakhovetski@gmx.de> References: <1375973557-23333-1-git-send-email-g.liakhovetski@gmx.de> X-Provags-ID: V02:K0:olAmbR4iY6uFhGje2Sv1ztu1NplCQQRS5l4Q+BeqJkW Z+ji8zpaIzL2lo5iExJe9tJMMtGionqSGTaX8CawMQpdPqHj23 v5UaK/N4b1DrRK6DGWbITgxGbev7OMvdcVEtLG5kd4+VjXLxDK 4Avsv+sJNzufbh0b0yTx8ibq0vddhnld4jayygqksLRAeIUMwr HFou2evmi5QqilRFOVrLDjb9Nsf5ocmMMVeT+UktGRdTwRzjO6 VHp18jlCHdd41isAzZCD4d+EGu4ma1h2gydmv/c/7/hrj2jwSW A1RCK9bI1/Hf1WvlBtP/XjHlzH6RuO72ZwI2sA0EnKnlWosX+C VJ9eGInbSrcUVTe6rFDJXFvPseiC0p5iCleswkwIjlfVqNGtSg ecffcyeKmO2Nw== Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-6.9 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);