From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_2 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 14E1DC433ED for ; Wed, 12 May 2021 13:44:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C73C8613DF for ; Wed, 12 May 2021 13:44:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230369AbhELNpo (ORCPT ); Wed, 12 May 2021 09:45:44 -0400 Received: from mail.kernel.org ([198.145.29.99]:49634 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230037AbhELNpn (ORCPT ); Wed, 12 May 2021 09:45:43 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id DC06F61007; Wed, 12 May 2021 13:44:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1620827075; bh=hP7Nejt/GkL9n1f1tZQ6HOVoNycomFL/+xlQo73ztEE=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=EGAGPy2xm0mxXFLYNNA1cV6bZGvvv3zB7LEMRTgYgW54KFMIw9orxHz+eWt1lTVvr TLljU/obeGyxPJrqDlHvECW2CmU76S3l3KKkVgvpzlFF6JQPp15kXpzRdN+yuG2PEC CiiE1nZqVsZlWSZVJP7ff5FFBQ2IRr80UQztLQVOpDrpNBljBz4WdROB2erKxqsdai Orab+y0BhciOpPNwYaRO3gSYgbS5lCtLh3qKXXwhfOCra93m5gR2eGqXzB7PE+WgRM 5wa7niqAXRH4jNupjj+1uwFy6Pzi5NI/RYUiFo+n1kJG+Lx023wQl9Kd4Z0GlgmdDQ vstw2vpYB+vzg== Date: Wed, 12 May 2021 15:44:30 +0200 From: Mauro Carvalho Chehab To: Jonathan Cameron Cc: linux-iio@vger.kernel.org, Julia Lawall , "Rafael J . Wysocki" , Jonathan Cameron , Srinivas Pandruvada Subject: Re: [PATCH 08/28] iio: hid: trigger: Balance runtime pm + use pm_runtime_resume_and_get() Message-ID: <20210512154430.36edf9b7@coco.lan> In-Reply-To: <20210509113354.660190-9-jic23@kernel.org> References: <20210509113354.660190-1-jic23@kernel.org> <20210509113354.660190-9-jic23@kernel.org> X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.33; x86_64-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org Em Sun, 9 May 2021 12:33:34 +0100 Jonathan Cameron escreveu: > From: Jonathan Cameron > > The call to pm_runtime_put_noidle() in remove() callback is not > balanced by any gets > > Note this doesn't cause any problems beyond reader confusion as the runtime > pm core protects against the reference counter going negative. > > Whilst here, use pm_runtiem_resume_and_get() to simplify code a little. > > Signed-off-by: Jonathan Cameron > Cc: Srinivas Pandruvada RPM get/put logic LGTM. Reviewed-by: Mauro Carvalho Chehab > --- > drivers/iio/common/hid-sensors/hid-sensor-trigger.c | 8 ++------ > 1 file changed, 2 insertions(+), 6 deletions(-) > > diff --git a/drivers/iio/common/hid-sensors/hid-sensor-trigger.c b/drivers/iio/common/hid-sensors/hid-sensor-trigger.c > index 5a7b3e253e58..c06537e106e9 100644 > --- a/drivers/iio/common/hid-sensors/hid-sensor-trigger.c > +++ b/drivers/iio/common/hid-sensors/hid-sensor-trigger.c > @@ -163,18 +163,15 @@ int hid_sensor_power_state(struct hid_sensor_common *st, bool state) > > if (state) { > atomic_inc(&st->user_requested_state); > - ret = pm_runtime_get_sync(&st->pdev->dev); > + ret = pm_runtime_resume_and_get(&st->pdev->dev); > } else { > atomic_dec(&st->user_requested_state); > pm_runtime_mark_last_busy(&st->pdev->dev); > pm_runtime_use_autosuspend(&st->pdev->dev); > ret = pm_runtime_put_autosuspend(&st->pdev->dev); > } > - if (ret < 0) { > - if (state) > - pm_runtime_put_noidle(&st->pdev->dev); > + if (ret < 0) > return ret; > - } > > return 0; > #else > @@ -222,7 +219,6 @@ void hid_sensor_remove_trigger(struct iio_dev *indio_dev, > pm_runtime_disable(&attrb->pdev->dev); > > pm_runtime_set_suspended(&attrb->pdev->dev); > - pm_runtime_put_noidle(&attrb->pdev->dev); > > cancel_work_sync(&attrb->work); > iio_trigger_unregister(attrb->trigger); Thanks, Mauro