From patchwork Sun May 9 11:33:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 12246353 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=-19.7 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,URIBL_BLOCKED,USER_AGENT_GIT 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 F163AC433B4 for ; Sun, 9 May 2021 11:37:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D049C6141D for ; Sun, 9 May 2021 11:37:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229614AbhEILiF (ORCPT ); Sun, 9 May 2021 07:38:05 -0400 Received: from mail.kernel.org ([198.145.29.99]:53528 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229618AbhEILiE (ORCPT ); Sun, 9 May 2021 07:38:04 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id B1B6C613F0; Sun, 9 May 2021 11:36:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1620560221; bh=9/fypVOuUPMlqQi8+HubR/7gSqQgko5wh+rE1ez/cFI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ELAxqBVYDuy+u1VXlOP/00EkxzLRrFoDF8DkIN12gner2k3q/GlZrtTEGEAC3hZFP JGevS6XjgdamATHznzX+Y/d+SQ5A1nWqVigtmdo2aiiyUakNh565Dr5V9a9kr8W/AO amZf884hVrFAGXZGJmMD+fyAdjdghAZb7S05HKbf3OsGw0+lvfvnPVJDi52Ny12EHP lmZthzqHkQhx/gtVXIpJccXg+x29zDi9Rg+JTIWbH1Ztk5WPk2uU7HosBKzuXKuqM0 b5vsY5/brEknFK4kEebjISuEHE+j8LGZRV90eNx4ZotxqY3i9rsywoVztNLem2UZMH 1DOKaw2kmK9bg== From: Jonathan Cameron To: linux-iio@vger.kernel.org Cc: Mauro Carvalho Chehab , Julia Lawall , "Rafael J . Wysocki" , Jonathan Cameron , Sean Nyekjaer Subject: [PATCH 05/28] iio: accel: mma8452: Balance runtime pm + use pm_runtime_resume_and_get() Date: Sun, 9 May 2021 12:33:31 +0100 Message-Id: <20210509113354.660190-6-jic23@kernel.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210509113354.660190-1-jic23@kernel.org> References: <20210509113354.660190-1-jic23@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org From: Jonathan Cameron Remove() callback calls pm_runtime_put_noidle() but there it is not balancing a get. No actual affect because the runtime pm core prevents the reference count going negative. Whilst here use pm_runtime_resume_and_get() rather than open coded version. Again, coccinelle script missed this one due to more complex code structure. Signed-off-by: Jonathan Cameron Cc: Sean Nyekjaer Reviewed-by: Mauro Carvalho Chehab --- drivers/iio/accel/mma8452.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/iio/accel/mma8452.c b/drivers/iio/accel/mma8452.c index 464a6bfe6746..715b8138fb71 100644 --- a/drivers/iio/accel/mma8452.c +++ b/drivers/iio/accel/mma8452.c @@ -221,7 +221,7 @@ static int mma8452_set_runtime_pm_state(struct i2c_client *client, bool on) int ret; if (on) { - ret = pm_runtime_get_sync(&client->dev); + ret = pm_runtime_resume_and_get(&client->dev); } else { pm_runtime_mark_last_busy(&client->dev); ret = pm_runtime_put_autosuspend(&client->dev); @@ -230,8 +230,6 @@ static int mma8452_set_runtime_pm_state(struct i2c_client *client, bool on) if (ret < 0) { dev_err(&client->dev, "failed to change power state to %d\n", on); - if (on) - pm_runtime_put_noidle(&client->dev); return ret; } @@ -1711,7 +1709,6 @@ static int mma8452_remove(struct i2c_client *client) pm_runtime_disable(&client->dev); pm_runtime_set_suspended(&client->dev); - pm_runtime_put_noidle(&client->dev); iio_triggered_buffer_cleanup(indio_dev); mma8452_trigger_cleanup(indio_dev);