From: Baolin Wang <baolin.wang@linaro.org> To: ohad@wizery.com, bjorn.andersson@linaro.org Cc: linus.walleij@linaro.org, orsonzhai@gmail.com, zhang.lyra@gmail.com, baolin.wang@linaro.org, linux-arm-kernel@lists.infradead.org, linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/4] hwspinlock: Let the PM runtime can be optional Date: Mon, 14 Oct 2019 15:07:44 +0800 [thread overview] Message-ID: <6c03ca84b19f0e3a4bd60b4d5ea70fd801ed7555.1571036463.git.baolin.wang@linaro.org> (raw) In-Reply-To: <cover.1571036463.git.baolin.wang@linaro.org> In-Reply-To: <cover.1571036463.git.baolin.wang@linaro.org> Now some hwspinlock controllers did not have the requirement to implement the PM runtime, but drivers must enable the PM runtime to comply with the hwspinlock core. Thus we can change the PM runtime support to be optional by validating the -EACCES error number which means the PM runtime is not enabled, and removing the return value validating of pm_runtime_put(). So that we can remove some redundant PM runtime code in drivers. Signed-off-by: Baolin Wang <baolin.wang@linaro.org> --- drivers/hwspinlock/hwspinlock_core.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/hwspinlock/hwspinlock_core.c b/drivers/hwspinlock/hwspinlock_core.c index a22e252c..fd5f5c5 100644 --- a/drivers/hwspinlock/hwspinlock_core.c +++ b/drivers/hwspinlock/hwspinlock_core.c @@ -657,13 +657,15 @@ static int __hwspin_lock_request(struct hwspinlock *hwlock) /* notify PM core that power is now needed */ ret = pm_runtime_get_sync(dev); - if (ret < 0) { + if (ret < 0 && ret != -EACCES) { dev_err(dev, "%s: can't power on device\n", __func__); pm_runtime_put_noidle(dev); module_put(dev->driver->owner); return ret; } + ret = 0; + /* mark hwspinlock as used, should not fail */ tmp = radix_tree_tag_clear(&hwspinlock_tree, hwlock_to_id(hwlock), HWSPINLOCK_UNUSED); @@ -820,9 +822,7 @@ int hwspin_lock_free(struct hwspinlock *hwlock) } /* notify the underlying device that power is not needed */ - ret = pm_runtime_put(dev); - if (ret < 0) - goto out; + pm_runtime_put(dev); /* mark this hwspinlock as available */ tmp = radix_tree_tag_set(&hwspinlock_tree, hwlock_to_id(hwlock), -- 1.7.9.5
WARNING: multiple messages have this Message-ID (diff)
From: Baolin Wang <baolin.wang@linaro.org> To: ohad@wizery.com, bjorn.andersson@linaro.org Cc: baolin.wang@linaro.org, zhang.lyra@gmail.com, linus.walleij@linaro.org, linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org, orsonzhai@gmail.com, linux-arm-kernel@lists.infradead.org Subject: [PATCH 2/4] hwspinlock: Let the PM runtime can be optional Date: Mon, 14 Oct 2019 15:07:44 +0800 [thread overview] Message-ID: <6c03ca84b19f0e3a4bd60b4d5ea70fd801ed7555.1571036463.git.baolin.wang@linaro.org> (raw) In-Reply-To: <cover.1571036463.git.baolin.wang@linaro.org> In-Reply-To: <cover.1571036463.git.baolin.wang@linaro.org> Now some hwspinlock controllers did not have the requirement to implement the PM runtime, but drivers must enable the PM runtime to comply with the hwspinlock core. Thus we can change the PM runtime support to be optional by validating the -EACCES error number which means the PM runtime is not enabled, and removing the return value validating of pm_runtime_put(). So that we can remove some redundant PM runtime code in drivers. Signed-off-by: Baolin Wang <baolin.wang@linaro.org> --- drivers/hwspinlock/hwspinlock_core.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/hwspinlock/hwspinlock_core.c b/drivers/hwspinlock/hwspinlock_core.c index a22e252c..fd5f5c5 100644 --- a/drivers/hwspinlock/hwspinlock_core.c +++ b/drivers/hwspinlock/hwspinlock_core.c @@ -657,13 +657,15 @@ static int __hwspin_lock_request(struct hwspinlock *hwlock) /* notify PM core that power is now needed */ ret = pm_runtime_get_sync(dev); - if (ret < 0) { + if (ret < 0 && ret != -EACCES) { dev_err(dev, "%s: can't power on device\n", __func__); pm_runtime_put_noidle(dev); module_put(dev->driver->owner); return ret; } + ret = 0; + /* mark hwspinlock as used, should not fail */ tmp = radix_tree_tag_clear(&hwspinlock_tree, hwlock_to_id(hwlock), HWSPINLOCK_UNUSED); @@ -820,9 +822,7 @@ int hwspin_lock_free(struct hwspinlock *hwlock) } /* notify the underlying device that power is not needed */ - ret = pm_runtime_put(dev); - if (ret < 0) - goto out; + pm_runtime_put(dev); /* mark this hwspinlock as available */ tmp = radix_tree_tag_set(&hwspinlock_tree, hwlock_to_id(hwlock), -- 1.7.9.5 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2019-10-14 7:07 UTC|newest] Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-10-14 7:07 [PATCH 0/4] Some improvements for hwspinlock Baolin Wang 2019-10-14 7:07 ` Baolin Wang 2019-10-14 7:07 ` [PATCH 1/4] hwspinlock: Remove BUG_ON() from the hwspinlock core Baolin Wang 2019-10-14 7:07 ` Baolin Wang 2019-10-14 7:07 ` Baolin Wang [this message] 2019-10-14 7:07 ` [PATCH 2/4] hwspinlock: Let the PM runtime can be optional Baolin Wang 2019-10-14 7:07 ` [PATCH 3/4] hwspinlock: sprd: Remove redundant PM runtime implementation Baolin Wang 2019-10-14 7:07 ` Baolin Wang 2019-10-14 7:07 ` [PATCH 4/4] hwspinlock: u8500_hsem: " Baolin Wang 2019-10-14 7:07 ` Baolin Wang 2019-10-16 12:55 ` Linus Walleij 2019-10-16 12:55 ` Linus Walleij
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=6c03ca84b19f0e3a4bd60b4d5ea70fd801ed7555.1571036463.git.baolin.wang@linaro.org \ --to=baolin.wang@linaro.org \ --cc=bjorn.andersson@linaro.org \ --cc=linus.walleij@linaro.org \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-remoteproc@vger.kernel.org \ --cc=ohad@wizery.com \ --cc=orsonzhai@gmail.com \ --cc=zhang.lyra@gmail.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.