Received: by 2002:a05:6a10:a841:0:0:0:0 with SMTP id d1csp1988291pxy; Sat, 24 Apr 2021 01:31:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxij3UcGZ9/h6z61mhY8gMyLVtBWvhQA0bV0yvHdwlSe9Nrbha64tRwzx1QJBFiynuNOxjs X-Received: by 2002:a63:f056:: with SMTP id s22mr7509140pgj.369.1619253098003; Sat, 24 Apr 2021 01:31:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619253097; cv=none; d=google.com; s=arc-20160816; b=WxDSzKpfxsN1uEBD0fMMOm5/fepG5dxB5tYlnR+NG1JPnkfoxIVr6uOv9I7sq8Nzfz qq8+irN49zUvNvtN+A+vx3XN6LpywMgSq2DFpDGv4IE6y1j9nFizeQ/h+KiXERlfYe8j iSvvbjBRawWhTYW/67TSuuPa7RqkGPB7LDT7N6kmzcS8QtKUUolo0yHz362ieL5FTCXw 2bPEipOy5B60uPZDo63PxpeTM5fFkOa7A7R/rkK8CxOPFLucahyEDbT2TYGqWGO6vjKb OgVxaVN3e2CCUyat8ObdVKmzluZXDwd7ktFOhdvm9yhMCePWjRS6gdW10EnRXgzWhT0s 18Vw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=wUWLDzCyb0s6LYqLgUD5n6zgZeB5/6FFZNspxtmkv4Q=; b=woFwgwt+PNHtGFKIR+8tcbhu+SVf/sx2RhiwqeJuPuc/YXJR//cv5lMADjRqZYJfr4 peTvB8IyRLQhsxXTUlbCNW8hPPjCcqXB4W+7G7W3olXpIeB0uHTcOX+6weEG3jDmKO5y oPUg1WzP6xTL4lkYfhxzIag4s+xi+WDBC1g5xv2j5sggAlDHt1qJXqQJLcWVeGFBY0Cd Cl2txgwc6gxDpOo2qBcOp6SaKa1h+4V3GHEUIsjf2NARZCaQR/lnHAyM93T/fYO20ZhA mwNRhU/GP5Y5JR7cM+5yjZvcvk6hNp4QunDurS869WBUnsRMr6EhnQm/DLSH2iGQ/iLg V3FQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id lx6si13549502pjb.138.2021.04.24.01.31.25; Sat, 24 Apr 2021 01:31:37 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233881AbhDXIbP (ORCPT + 99 others); Sat, 24 Apr 2021 04:31:15 -0400 Received: from relay2-d.mail.gandi.net ([217.70.183.194]:53249 "EHLO relay2-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233104AbhDXIae (ORCPT ); Sat, 24 Apr 2021 04:30:34 -0400 X-Originating-IP: 93.61.96.190 Received: from uno.localdomain (93-61-96-190.ip145.fastwebnet.it [93.61.96.190]) (Authenticated sender: jacopo@jmondi.org) by relay2-d.mail.gandi.net (Postfix) with ESMTPSA id 1578740007; Sat, 24 Apr 2021 08:29:53 +0000 (UTC) Date: Sat, 24 Apr 2021 10:30:35 +0200 From: Jacopo Mondi To: Mauro Carvalho Chehab Cc: linuxarm@huawei.com, mauro.chehab@huawei.com, Dave Stevenson , Mauro Carvalho Chehab , linux-kernel@vger.kernel.org, linux-media@vger.kernel.org Subject: Re: [PATCH 44/78] media: i2c: ov5647: use pm_runtime_resume_and_get() Message-ID: <20210424083035.d4wdzlntgeqxku4q@uno.localdomain> References: <9713ae015dd9c8b8d65fa5baaaa2cd02ceb89a27.1619191723.git.mchehab+huawei@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <9713ae015dd9c8b8d65fa5baaaa2cd02ceb89a27.1619191723.git.mchehab+huawei@kernel.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Mauro, On Sat, Apr 24, 2021 at 08:44:54AM +0200, Mauro Carvalho Chehab wrote: > 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 Looks good, thanks! Acked-by: Jacopo Mondi > --- > drivers/media/i2c/ov5647.c | 9 +++++---- > 1 file changed, 5 insertions(+), 4 deletions(-) > > diff --git a/drivers/media/i2c/ov5647.c b/drivers/media/i2c/ov5647.c > index 1cefa15729ce..38faa74755e3 100644 > --- a/drivers/media/i2c/ov5647.c > +++ b/drivers/media/i2c/ov5647.c > @@ -882,20 +882,20 @@ static int ov5647_s_stream(struct v4l2_subdev *sd, int enable) > } > > if (enable) { > - ret = pm_runtime_get_sync(&client->dev); > + ret = pm_runtime_resume_and_get(&client->dev); > if (ret < 0) > goto error_unlock; > > ret = ov5647_stream_on(sd); > if (ret < 0) { > dev_err(&client->dev, "stream start failed: %d\n", ret); > - goto error_unlock; > + goto error_pm; > } > } else { > ret = ov5647_stream_off(sd); > if (ret < 0) { > dev_err(&client->dev, "stream stop failed: %d\n", ret); > - goto error_unlock; > + goto error_pm; > } > pm_runtime_put(&client->dev); > } > @@ -905,8 +905,9 @@ static int ov5647_s_stream(struct v4l2_subdev *sd, int enable) > > return 0; > > +error_pm: > + pm_runtime_put(&client->dev); > error_unlock: > - pm_runtime_put(&client->dev); > mutex_unlock(&sensor->lock); > > return ret; > -- > 2.30.2 >