Received: by 2002:a05:6a10:a841:0:0:0:0 with SMTP id d1csp1945719pxy; Fri, 23 Apr 2021 23:56:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxtz50cj3YoidxYLqQDj3CyuECNxmhmUOQ/4u5P4JndJMa5xYKCbBluWdPVP7vVyeRNslq5 X-Received: by 2002:a17:906:4913:: with SMTP id b19mr8054567ejq.439.1619247402646; Fri, 23 Apr 2021 23:56:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619247402; cv=none; d=google.com; s=arc-20160816; b=HL76rZ5FCTHaITuQIe6JO0yrHjEwsPG/QNc1lAqUlqWw1+szRl+o6/q81EhuBO7Wgn pAN6GGBEAu/D/zAbyg6j3HUVGo2GKLZ5yntXuu190AWkH0fv5vocYA7Cd80icgk0LJSk NyRyO4imHb2Malqs3VVhCugI4eaJcshnzpIHhAzPy6pfaB1ucTVB97QVuHhvBl1Dilzp n0gw/0TS0EXqHh5FSomSVdoIuZvIVXNWrcSo+6h0PGZish9QaLwsc8Loo1vlrPHBJ10R H6sFODhMwIiKb0FOob9NM5Ls+C5uryOhUoqKRGNlvydXMBy4W56tBk+5U7ZxCGu4Z5w0 W3Yg== 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=MemQBCMDmE92SA4Dh34kjM0Xf+mWVXaAaIa5OPfJXiE=; b=1COgSlrHgefmVJHS8SWvTmN1eWlGLf+eUJg1Jjf8OuZ2ehWMuwsVVOxEzlMJnuji9d JOC5lVb6PoJxZcRjdlSiwAsB4/f5NNBKRTrCLAZNifzEvO92PKR0o+8G0tcpu7fuHOBk s6X8P5y23EkNA4VfqBIqNA4fEzGl2VgYvK7b0vuwHixiv08aNagwEU33g11HvDIuVEFl KuBs+9Xk1FGLN/6LZKkfVPC88nBANNEyncA9MpvJLKfRgw+D2AwoWAO87doBNPH6WdDq q6KjOwj2woOap9UjgHiMJenY4wE0Fh+c3Io0lhHLAhD40JNIBVdSyraWPbp3QXx7QrGW 9Dgg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@kernel.org header.s=k20201202 header.b=p3FCt65E; 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 d11si7447201ejm.20.2021.04.23.23.56.17; Fri, 23 Apr 2021 23:56:42 -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=p3FCt65E; 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 S244906AbhDXGzI (ORCPT + 99 others); Sat, 24 Apr 2021 02:55:08 -0400 Received: from mail.kernel.org ([198.145.29.99]:35760 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234271AbhDXGqo (ORCPT ); Sat, 24 Apr 2021 02:46:44 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id ECCF361956; 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=1619246734; bh=nHZL/8LfEY59F+jSTZXbI5IsJhAvjS0xN6pbKcv/Zf0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=p3FCt65EqeoPSaD+kt8ogwoRrahw1L4N8vCiYmQD4nSwkhczASeHhEePlcE79t2P3 /oSX0uaRz7VJB+ekcY1pGCRBIDo1IIMtrX1t5ObNvVwlsN39EbfZIfb7tBb4NOBx1f KjaXCyEb92oNBDVmmmNO9qsfSEG90IMwwzBgT8zr/0EJryHTZ/dqnIscPi0HS4OqjO 1ugJjuDw1qUACFpAk+Zkkd2NsLTsl9Ys1qqix4aWxjJMp8Hzs9kGWcIfwpVoFQNoXY desYTduiJLYiiwrh5V9gMH1qnJYncp5cBEami5y+JIrSbZx8hKCTsXedZ4mjtGPoP8 /CvDtF4aGzF6g== Received: by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1laC2m-004JgH-Dg; Sat, 24 Apr 2021 08:45:32 +0200 From: Mauro Carvalho Chehab Cc: linuxarm@huawei.com, mauro.chehab@huawei.com, Mauro Carvalho Chehab , "Gustavo A. R. Silva" , Chuhong Yuan , Hans Verkuil , Jacopo Mondi , Krzysztof Kozlowski , Marco Felsch , Mauro Carvalho Chehab , Sakari Ailus , linux-kernel@vger.kernel.org, linux-media@vger.kernel.org Subject: [PATCH 53/78] media: i2c: tvp5150: use pm_runtime_resume_and_get() Date: Sat, 24 Apr 2021 08:45:03 +0200 Message-Id: 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/tvp5150.c | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/drivers/media/i2c/tvp5150.c b/drivers/media/i2c/tvp5150.c index e26e3f544054..374a9da75e4d 100644 --- a/drivers/media/i2c/tvp5150.c +++ b/drivers/media/i2c/tvp5150.c @@ -1448,11 +1448,9 @@ static int tvp5150_s_stream(struct v4l2_subdev *sd, int enable) TVP5150_MISC_CTL_CLOCK_OE; if (enable) { - ret = pm_runtime_get_sync(sd->dev); - if (ret < 0) { - pm_runtime_put_noidle(sd->dev); + ret = pm_runtime_resume_and_get(sd->dev); + if (ret < 0) return ret; - } tvp5150_enable(sd); @@ -1675,15 +1673,7 @@ static int tvp5150_registered(struct v4l2_subdev *sd) static int tvp5150_open(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh) { - int ret; - - ret = pm_runtime_get_sync(sd->dev); - if (ret < 0) { - pm_runtime_put_noidle(sd->dev); - return ret; - } - - return 0; + return pm_runtime_resume_and_get(sd->dev); } static int tvp5150_close(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh) -- 2.30.2