Received: by 2002:a05:6a10:a841:0:0:0:0 with SMTP id d1csp1942733pxy; Fri, 23 Apr 2021 23:49:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyXx5trDYzsE9g10oIwePp7dW7ijx8ppYmqywVeyy6olFUekkKzasT+4wXHsd8+Uc9sRsbQ X-Received: by 2002:a05:6402:31a8:: with SMTP id dj8mr8821784edb.316.1619246985184; Fri, 23 Apr 2021 23:49:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619246985; cv=none; d=google.com; s=arc-20160816; b=h8V3qaITcvHpTZkhX9yS3YKpOCpYtLRlHFSYJ39cO7agWmbEl85CpWAiEb7de1y4x+ +mVTvU5+BXJwGGq0SRIQkzt1Uy0zM2KXFSQFb7AwU+qu88COT6h9QR8A2D5jM43EuZHn 6DQmwJF9S9G8/DQbQXJ70WHnoNduSge+XyRZXitm9PzQPHiqzJJ98t3opBwB4Juv9bvO BpBFfLPJs8dYWUVUW2a5CGlB2DYYVXvUl/FCqoYb0rXrWkxbXjCuX8bSQQZ4cmLYq0Yc xEIlHRAXiKYjmmkMspOOhlZcq6MA3l/3aeLzssOAE4MkBEkAMD5O4/Of/yqP7HG4nrbp /N5g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:from :dkim-signature; bh=UjsYSMuzLPFH4lSShxqME3l9tUnqU+P7+GCgLEzExgc=; b=QX0GiuEZu2rju80Sc0j8gaiuLHfQarG8bxcW1tYOrcMjZ/g3eRSJEzw0B/5W+5LzZU wGTo7SKzBAHO+yXEuAJwcPwTxJf8f8VRfChK2NGLYsTIJQ35enFcIuNdm8+DJvQ1OJYR azWSqxpihyHIwpXFgieE1Bq5x8H9uBWliB5evc0Q1uwCeM1pLj0W7jOCP+0J2QJlkVZZ tst6yRqeDLImDb9DDdBlmq5IdLToRbVblxo9zAROENJnOGZjlb5nDTmkf2I+1zbMtwMI R08mjPfmMLbnukFG3ILjC6J+FnnXrcrwzvQsTGbQEQwfu/AGkvjZwgkehEQKoRo1RfjC orGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@kernel.org header.s=k20201202 header.b=p1kFI7dN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id mp1si7212819ejc.457.2021.04.23.23.49.21; Fri, 23 Apr 2021 23:49:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@kernel.org header.s=k20201202 header.b=p1kFI7dN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244265AbhDXGsT (ORCPT + 99 others); Sat, 24 Apr 2021 02:48:19 -0400 Received: from mail.kernel.org ([198.145.29.99]:35962 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232714AbhDXGqN (ORCPT ); Sat, 24 Apr 2021 02:46:13 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 5E59561628; Sat, 24 Apr 2021 06:45:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619246733; bh=asptFjthmpMSH40y9mihi2F9WNWJSxY/te/hCXNd4N0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=p1kFI7dNHSXKbUgS80WMhQC6LqhkxbCf1jUIwAk/BCInO9XdY17uh1tZzGG+5RGsG I+a31BBjJzYlzijfv46g/nFcAuuPmaQnKqrjQlQrMxfhAkesYKbvFZFDC/vszGKDFn 0rTLsDcs1b1LR3Uf8Y58LCFpXj06icDaMYG+f1MRPe3V7rsdvY6h462w+k8sQzejnd axVbg69mhPmjdR0+Io8erfCNUUDL7lgs3yW5MTiswR5+dLbQlaeFBM8iUarHwE2SsU xy/NS5a4F++w80OLthwDrlq/NnSIrj3TAuSfkiEON4OPTBZb5NoNNruz6MPXQD6Xwe /gmw5dQdzB0PQ== Received: by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1laC2l-004Jev-Jd; Sat, 24 Apr 2021 08:45:31 +0200 From: Mauro Carvalho Chehab Cc: linuxarm@huawei.com, mauro.chehab@huawei.com, Mauro Carvalho Chehab , Mauro Carvalho Chehab , Sakari Ailus , linux-kernel@vger.kernel.org, linux-media@vger.kernel.org Subject: [PATCH 25/78] media: i2c: ccs-core: use pm_runtime_resume_and_get() Date: Sat, 24 Apr 2021 08:44:35 +0200 Message-Id: <34da940f76da6c1d61a193409164070f47243b64.1619191723.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: Mauro Carvalho Chehab To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit dd8088d5a896 ("PM: runtime: Add pm_runtime_resume_and_get to deal with usage counter") added pm_runtime_resume_and_get() in order to automatically handle dev->power.usage_count decrement on errors. Use the new API, in order to cleanup the error check logic. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/i2c/ccs/ccs-core.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/media/i2c/ccs/ccs-core.c b/drivers/media/i2c/ccs/ccs-core.c index 9dc3f45da3dc..1441ddcc9b35 100644 --- a/drivers/media/i2c/ccs/ccs-core.c +++ b/drivers/media/i2c/ccs/ccs-core.c @@ -1880,12 +1880,11 @@ static int ccs_pm_get_init(struct ccs_sensor *sensor) struct i2c_client *client = v4l2_get_subdevdata(&sensor->src->sd); int rval; - rval = pm_runtime_get_sync(&client->dev); - if (rval < 0) { - pm_runtime_put_noidle(&client->dev); - + rval = pm_runtime_resume_and_get(&client->dev); + if (rval < 0) return rval; - } else if (!rval) { + + if (!rval) { rval = v4l2_ctrl_handler_setup(&sensor->pixel_array-> ctrl_handler); if (rval) @@ -3089,7 +3088,7 @@ static int __maybe_unused ccs_suspend(struct device *dev) bool streaming = sensor->streaming; int rval; - rval = pm_runtime_get_sync(dev); + rval = pm_runtime_resume_and_get(dev); if (rval < 0) { pm_runtime_put_noidle(dev); -- 2.30.2