From: Mark Brown <broonie@kernel.org>
To: Baolin Wang <baolin.wang@linaro.org>
Cc: gregkh@linuxfoundation.org, lee.jones@linaro.org, arnd@arndb.de,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] regmap: Add hardware spinlock support
Date: Tue, 31 Oct 2017 10:38:30 +0000 [thread overview]
Message-ID: <20171031103830.qdtudo2uwsc2ssp3@sirena.co.uk> (raw)
In-Reply-To: <bf9fd59f32f5c093598d5078d681967626ee9fd0.1509425993.git.baolin.wang@linaro.org>
[-- Attachment #1: Type: text/plain, Size: 1523 bytes --]
On Tue, Oct 31, 2017 at 02:35:55PM +0800, Baolin Wang wrote:
This looks mostly good, a few small things:
> +static void regmap_lock_hwlock(void *__map)
> +{
> + struct regmap *map = __map;
> + int ret;
> +
> + if (map->hwlock_timeout)
> + ret = hwspin_lock_timeout(map->hwlock, map->hwlock_timeout);
> + else
> + ret = hwspin_trylock(map->hwlock);
> +
> + if (ret)
> + dev_err(map->dev, "Failed to get hwlock %d\n", ret);
> +}
Given that we have no error handling path on the locks should we be
supporting timeout mode at all? Otherwise we should probably add a
set of error handling paths whenever we take the lock...
> + if (config->hwlock_mode == HWLOCK_IRQSTATE) {
> + map->lock = regmap_lock_hwlock_irqsave;
> + map->unlock = regmap_unlock_hwlock_irqrestore;
> + } else if (config->hwlock_mode == HWLOCK_IRQ) {
> + map->lock = regmap_lock_hwlock_irq;
> + map->unlock = regmap_unlock_hwlock_irq;
> + } else {
> + map->lock = regmap_lock_hwlock;
> + map->unlock = regmap_unlock_hwlock;
> + }
This should be a switch statement.
> --- a/include/linux/regmap.h
> +++ b/include/linux/regmap.h
> @@ -19,6 +19,7 @@
> #include <linux/err.h>
> #include <linux/bug.h>
> #include <linux/lockdep.h>
> +#include <linux/hwspinlock.h>
We don't actually use hwspinlock.h in the header (the config options are
all just unsigned ints) so this could be moved to regmap.c with a
forward declaration of the struct in internal.h. That way we don't
force a rebuild of every regmap user when hwspinlock changes.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2017-10-31 10:38 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-31 6:35 [PATCH 1/2] regmap: Add hardware spinlock support Baolin Wang
2017-10-31 6:35 ` [PATCH 2/2] mfd: syscon: " Baolin Wang
2017-10-31 10:38 ` Mark Brown [this message]
2017-10-31 11:31 ` [PATCH 1/2] regmap: " Baolin Wang
2017-10-31 11:37 ` Mark Brown
2017-10-31 11:47 ` Baolin Wang
2017-10-31 19:43 ` Mark Brown
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=20171031103830.qdtudo2uwsc2ssp3@sirena.co.uk \
--to=broonie@kernel.org \
--cc=arnd@arndb.de \
--cc=baolin.wang@linaro.org \
--cc=gregkh@linuxfoundation.org \
--cc=lee.jones@linaro.org \
--cc=linux-kernel@vger.kernel.org \
/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: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).