Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp239704ybi; Wed, 29 May 2019 20:25:59 -0700 (PDT) X-Google-Smtp-Source: APXvYqwky4Tx57tkX9Ny6QtHz50lEAhoej1/PJDaMYaSSwoOVtJQe4XkLnMVdANi7g4FwOFzLMep X-Received: by 2002:a17:90a:1b0b:: with SMTP id q11mr1372787pjq.80.1559186759350; Wed, 29 May 2019 20:25:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559186759; cv=none; d=google.com; s=arc-20160816; b=qOlnEz+plvrHNhzlBKSEU/JvVnMzvHcL3x3bhAmKO1v27YcHSnt5Id98uboOYYNfn3 /Pbp4wFeP1uTwmAgPoRmD7Ahu6MKiF72l9h5VpQUkVYo9IPA9TAATXsNdTTZsc8DKZDz gbwx40AQzmn2OtW337/R/OifpTho+TShLYPn374JRFWbpG9WKPaopUo5ujSqS2JCP1mh MZ9hSiU8ivTb/nhfeWHVMacD4SRVosTDn7LVaoyVYjbdp64dn33cTKLTJIBsBGD83GJf +ZV63m0+FGBKx1WeFz6YordZlmRlJ2iNMcUz+rr+MYn+IlTIFq1J3y9s/mWJqwGGr6h3 0AlA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Vjculs9pJ46mWNIoUJmDoLGujuhV2Nd9LtZneWlJx2Y=; b=ygbuqr1L9wwk4ZNWXwwiNz5qf0mku9zXCPih9UqrI5VSQWJRZDcRNIgvCIB6mQA+h2 aHZ6EubYurOvW3TrcsEXaoNfAjKHrh30QSmUAbUYcgTzu5oKAVG0huYCKz5Wyh274k9L wsblho4f3W1zDHE9anxwPl+/lJIEYGWcO20qMNj5/jqYScjMdr7B3TfZCm9Y5hxpj0kM sG2g5GuMorR4o+vl2g3PBiG4S1HBw6Q9xTISchCIlL6b7OIoEyDlrCyw6eUddWVikhkY tGr7wiK1N7YbCHif/5DjGQmoUKHCTtjBEdB7EeQtWBOu5ucnj64zhx89oHA/quU/b4kA VvMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ysNAgWw5; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q19si1812338pls.124.2019.05.29.20.25.43; Wed, 29 May 2019 20:25:59 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ysNAgWw5; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732936AbfE3DWu (ORCPT + 99 others); Wed, 29 May 2019 23:22:50 -0400 Received: from mail.kernel.org ([198.145.29.99]:45058 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730916AbfE3DRG (ORCPT ); Wed, 29 May 2019 23:17:06 -0400 Received: from localhost (ip67-88-213-2.z213-88-67.customer.algx.net [67.88.213.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 26DCC24645; Thu, 30 May 2019 03:17:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1559186226; bh=nS35q5ZtSkjydaFaSZdC+7DVr5rLGA87nEzC1ozr+zY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ysNAgWw5YNudvx5l+VNelUmXzV0tjK9IRKRtIPLSFOuJHXdoVblambZdV42BKKXPu pTb9yYhwCDYByF6NA68wO1P9yN8mKx58ZrT7oTj9TYVmEH4dIM1nF6CwDv5UyDPlEF gwNW9NkqKm8aPALlc0xQsAhuA6deXMZWo70EpEIQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Janusz Krzysztofik , Sakari Ailus , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 4.19 122/276] media: ov6650: Move v4l2_clk_get() to ov6650_video_probe() helper Date: Wed, 29 May 2019 20:04:40 -0700 Message-Id: <20190530030533.485905476@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190530030523.133519668@linuxfoundation.org> References: <20190530030523.133519668@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ Upstream commit ccdd85d518d8b9320ace1d87271f0ba2175f21fa ] In preparation for adding asynchronous subdevice support to the driver, don't acquire v4l2_clk from the driver .probe() callback as that may fail if the clock is provided by a bridge driver which may be not yet initialized. Move the v4l2_clk_get() to ov6650_video_probe() helper which is going to be converted to v4l2_subdev_internal_ops.registered() callback, executed only when the bridge driver is ready. Signed-off-by: Janusz Krzysztofik Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/media/i2c/ov6650.c | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/drivers/media/i2c/ov6650.c b/drivers/media/i2c/ov6650.c index a9264d515e546..edded869d7920 100644 --- a/drivers/media/i2c/ov6650.c +++ b/drivers/media/i2c/ov6650.c @@ -811,9 +811,16 @@ static int ov6650_video_probe(struct i2c_client *client) u8 pidh, pidl, midh, midl; int ret; + priv->clk = v4l2_clk_get(&client->dev, NULL); + if (IS_ERR(priv->clk)) { + ret = PTR_ERR(priv->clk); + dev_err(&client->dev, "v4l2_clk request err: %d\n", ret); + return ret; + } + ret = ov6650_s_power(&priv->subdev, 1); if (ret < 0) - return ret; + goto eclkput; msleep(20); @@ -850,6 +857,11 @@ static int ov6650_video_probe(struct i2c_client *client) done: ov6650_s_power(&priv->subdev, 0); + if (!ret) + return 0; +eclkput: + v4l2_clk_put(priv->clk); + return ret; } @@ -992,18 +1004,9 @@ static int ov6650_probe(struct i2c_client *client, priv->code = MEDIA_BUS_FMT_YUYV8_2X8; priv->colorspace = V4L2_COLORSPACE_JPEG; - priv->clk = v4l2_clk_get(&client->dev, NULL); - if (IS_ERR(priv->clk)) { - ret = PTR_ERR(priv->clk); - goto eclkget; - } - ret = ov6650_video_probe(client); - if (ret) { - v4l2_clk_put(priv->clk); -eclkget: + if (ret) v4l2_ctrl_handler_free(&priv->hdl); - } return ret; } -- 2.20.1