From: Mark Brown <broonie@kernel.org>
To: Chen-Yu Tsai <wens@csie.org>
Cc: Mark Brown <broonie@kernel.org>, Mark Brown <broonie@kernel.org>,
Maxime Ripard <maxime.ripard@free-electrons.com>,
David Airlie <airlied@linux.ie>,
Michael Turquette <mturquette@baylibre.com>,
Stephen Boyd <sboyd@codeaurora.org>,
Rob Herring <robh+dt@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
dri-devel@lists.freedesktop.org,
linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-sunxi@googlegroups.com, linux-kernel@vger.kernel.org
Subject: Applied "regmap: add iopoll-like polling macro for regmap_field" to the regmap tree
Date: Wed, 04 Oct 2017 12:28:57 +0100 [thread overview]
Message-ID: <E1dzhrF-0004Tf-A0@debutante> (raw)
In-Reply-To: <20170926065919.24446-9-wens@csie.org>
The patch
regmap: add iopoll-like polling macro for regmap_field
has been applied to the regmap tree at
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap.git
All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying
to this mail.
Thanks,
Mark
>From 667063acb81931e2f8fd0cb91df9fcccad131d9a Mon Sep 17 00:00:00 2001
From: Chen-Yu Tsai <wens@csie.org>
Date: Fri, 29 Sep 2017 16:23:01 +0800
Subject: [PATCH] regmap: add iopoll-like polling macro for regmap_field
This patch adds a macro regmap_field_read_poll_timeout that works
similar to the readx_poll_timeout defined in linux/iopoll.h, except
that this can also return the error value returned by a failed
regmap_field_read.
Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
include/linux/regmap.h | 39 +++++++++++++++++++++++++++++++++++++++
1 file changed, 39 insertions(+)
diff --git a/include/linux/regmap.h b/include/linux/regmap.h
index 978abfbac617..93a4663d7acb 100644
--- a/include/linux/regmap.h
+++ b/include/linux/regmap.h
@@ -139,6 +139,45 @@ struct reg_sequence {
pollret ?: ((cond) ? 0 : -ETIMEDOUT); \
})
+/**
+ * regmap_field_read_poll_timeout - Poll until a condition is met or timeout
+ *
+ * @field: Regmap field to read from
+ * @val: Unsigned integer variable to read the value into
+ * @cond: Break condition (usually involving @val)
+ * @sleep_us: Maximum time to sleep between reads in us (0
+ * tight-loops). Should be less than ~20ms since usleep_range
+ * is used (see Documentation/timers/timers-howto.txt).
+ * @timeout_us: Timeout in us, 0 means never timeout
+ *
+ * Returns 0 on success and -ETIMEDOUT upon a timeout or the regmap_field_read
+ * error return value in case of a error read. In the two former cases,
+ * the last read value at @addr is stored in @val. Must not be called
+ * from atomic context if sleep_us or timeout_us are used.
+ *
+ * This is modelled after the readx_poll_timeout macros in linux/iopoll.h.
+ */
+#define regmap_field_read_poll_timeout(field, val, cond, sleep_us, timeout_us) \
+({ \
+ ktime_t timeout = ktime_add_us(ktime_get(), timeout_us); \
+ int pollret; \
+ might_sleep_if(sleep_us); \
+ for (;;) { \
+ pollret = regmap_field_read((field), &(val)); \
+ if (pollret) \
+ break; \
+ if (cond) \
+ break; \
+ if (timeout_us && ktime_compare(ktime_get(), timeout) > 0) { \
+ pollret = regmap_field_read((field), &(val)); \
+ break; \
+ } \
+ if (sleep_us) \
+ usleep_range((sleep_us >> 2) + 1, sleep_us); \
+ } \
+ pollret ?: ((cond) ? 0 : -ETIMEDOUT); \
+})
+
#ifdef CONFIG_REGMAP
enum regmap_endian {
--
2.14.1
WARNING: multiple messages have this Message-ID (diff)
From: Mark Brown <broonie@kernel.org>
To: Chen-Yu Tsai <wens@csie.org>
Cc: Mark Rutland <mark.rutland@arm.com>,
devicetree@vger.kernel.org,
Michael Turquette <mturquette@baylibre.com>,
Stephen Boyd <sboyd@codeaurora.org>,
linux-kernel@vger.kernel.org, Rob Herring <robh+dt@kernel.org>,
linux-sunxi@googlegroups.com, Mark Brown <broonie@kernel.org>,
dri-devel@lists.freedesktop.org,
Maxime Ripard <maxime.ripard@free-electrons.com>,
linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org
Subject: Applied "regmap: add iopoll-like polling macro for regmap_field" to the regmap tree
Date: Wed, 04 Oct 2017 12:28:57 +0100 [thread overview]
Message-ID: <E1dzhrF-0004Tf-A0@debutante> (raw)
In-Reply-To: <20170926065919.24446-9-wens@csie.org>
The patch
regmap: add iopoll-like polling macro for regmap_field
has been applied to the regmap tree at
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap.git
All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying
to this mail.
Thanks,
Mark
From 667063acb81931e2f8fd0cb91df9fcccad131d9a Mon Sep 17 00:00:00 2001
From: Chen-Yu Tsai <wens@csie.org>
Date: Fri, 29 Sep 2017 16:23:01 +0800
Subject: [PATCH] regmap: add iopoll-like polling macro for regmap_field
This patch adds a macro regmap_field_read_poll_timeout that works
similar to the readx_poll_timeout defined in linux/iopoll.h, except
that this can also return the error value returned by a failed
regmap_field_read.
Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
include/linux/regmap.h | 39 +++++++++++++++++++++++++++++++++++++++
1 file changed, 39 insertions(+)
diff --git a/include/linux/regmap.h b/include/linux/regmap.h
index 978abfbac617..93a4663d7acb 100644
--- a/include/linux/regmap.h
+++ b/include/linux/regmap.h
@@ -139,6 +139,45 @@ struct reg_sequence {
pollret ?: ((cond) ? 0 : -ETIMEDOUT); \
})
+/**
+ * regmap_field_read_poll_timeout - Poll until a condition is met or timeout
+ *
+ * @field: Regmap field to read from
+ * @val: Unsigned integer variable to read the value into
+ * @cond: Break condition (usually involving @val)
+ * @sleep_us: Maximum time to sleep between reads in us (0
+ * tight-loops). Should be less than ~20ms since usleep_range
+ * is used (see Documentation/timers/timers-howto.txt).
+ * @timeout_us: Timeout in us, 0 means never timeout
+ *
+ * Returns 0 on success and -ETIMEDOUT upon a timeout or the regmap_field_read
+ * error return value in case of a error read. In the two former cases,
+ * the last read value at @addr is stored in @val. Must not be called
+ * from atomic context if sleep_us or timeout_us are used.
+ *
+ * This is modelled after the readx_poll_timeout macros in linux/iopoll.h.
+ */
+#define regmap_field_read_poll_timeout(field, val, cond, sleep_us, timeout_us) \
+({ \
+ ktime_t timeout = ktime_add_us(ktime_get(), timeout_us); \
+ int pollret; \
+ might_sleep_if(sleep_us); \
+ for (;;) { \
+ pollret = regmap_field_read((field), &(val)); \
+ if (pollret) \
+ break; \
+ if (cond) \
+ break; \
+ if (timeout_us && ktime_compare(ktime_get(), timeout) > 0) { \
+ pollret = regmap_field_read((field), &(val)); \
+ break; \
+ } \
+ if (sleep_us) \
+ usleep_range((sleep_us >> 2) + 1, sleep_us); \
+ } \
+ pollret ?: ((cond) ? 0 : -ETIMEDOUT); \
+})
+
#ifdef CONFIG_REGMAP
enum regmap_endian {
--
2.14.1
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
WARNING: multiple messages have this Message-ID (diff)
From: broonie@kernel.org (Mark Brown)
To: linux-arm-kernel@lists.infradead.org
Subject: Applied "regmap: add iopoll-like polling macro for regmap_field" to the regmap tree
Date: Wed, 04 Oct 2017 12:28:57 +0100 [thread overview]
Message-ID: <E1dzhrF-0004Tf-A0@debutante> (raw)
In-Reply-To: <20170926065919.24446-9-wens@csie.org>
The patch
regmap: add iopoll-like polling macro for regmap_field
has been applied to the regmap tree at
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap.git
All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying
to this mail.
Thanks,
Mark
>From 667063acb81931e2f8fd0cb91df9fcccad131d9a Mon Sep 17 00:00:00 2001
From: Chen-Yu Tsai <wens@csie.org>
Date: Fri, 29 Sep 2017 16:23:01 +0800
Subject: [PATCH] regmap: add iopoll-like polling macro for regmap_field
This patch adds a macro regmap_field_read_poll_timeout that works
similar to the readx_poll_timeout defined in linux/iopoll.h, except
that this can also return the error value returned by a failed
regmap_field_read.
Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
include/linux/regmap.h | 39 +++++++++++++++++++++++++++++++++++++++
1 file changed, 39 insertions(+)
diff --git a/include/linux/regmap.h b/include/linux/regmap.h
index 978abfbac617..93a4663d7acb 100644
--- a/include/linux/regmap.h
+++ b/include/linux/regmap.h
@@ -139,6 +139,45 @@ struct reg_sequence {
pollret ?: ((cond) ? 0 : -ETIMEDOUT); \
})
+/**
+ * regmap_field_read_poll_timeout - Poll until a condition is met or timeout
+ *
+ * @field: Regmap field to read from
+ * @val: Unsigned integer variable to read the value into
+ * @cond: Break condition (usually involving @val)
+ * @sleep_us: Maximum time to sleep between reads in us (0
+ * tight-loops). Should be less than ~20ms since usleep_range
+ * is used (see Documentation/timers/timers-howto.txt).
+ * @timeout_us: Timeout in us, 0 means never timeout
+ *
+ * Returns 0 on success and -ETIMEDOUT upon a timeout or the regmap_field_read
+ * error return value in case of a error read. In the two former cases,
+ * the last read value at @addr is stored in @val. Must not be called
+ * from atomic context if sleep_us or timeout_us are used.
+ *
+ * This is modelled after the readx_poll_timeout macros in linux/iopoll.h.
+ */
+#define regmap_field_read_poll_timeout(field, val, cond, sleep_us, timeout_us) \
+({ \
+ ktime_t timeout = ktime_add_us(ktime_get(), timeout_us); \
+ int pollret; \
+ might_sleep_if(sleep_us); \
+ for (;;) { \
+ pollret = regmap_field_read((field), &(val)); \
+ if (pollret) \
+ break; \
+ if (cond) \
+ break; \
+ if (timeout_us && ktime_compare(ktime_get(), timeout) > 0) { \
+ pollret = regmap_field_read((field), &(val)); \
+ break; \
+ } \
+ if (sleep_us) \
+ usleep_range((sleep_us >> 2) + 1, sleep_us); \
+ } \
+ pollret ?: ((cond) ? 0 : -ETIMEDOUT); \
+})
+
#ifdef CONFIG_REGMAP
enum regmap_endian {
--
2.14.1
next prev parent reply other threads:[~2017-10-04 11:29 UTC|newest]
Thread overview: 74+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-26 6:59 [PATCH v2 00/13] drm/sun4i: hdmi: Support HDMI controller on A31 Chen-Yu Tsai
2017-09-26 6:59 ` Chen-Yu Tsai
2017-09-26 6:59 ` Chen-Yu Tsai
2017-09-26 6:59 ` [PATCH v2 01/13] clk: sunxi-ng: sun6i: Export video PLLs Chen-Yu Tsai
2017-09-26 6:59 ` Chen-Yu Tsai
2017-09-26 9:24 ` Maxime Ripard
2017-09-26 9:24 ` Maxime Ripard
2017-09-26 9:24 ` Maxime Ripard
2017-09-26 6:59 ` [PATCH v2 02/13] clk: sunxi-ng: sun6i: Rename HDMI DDC clock to avoid name collision Chen-Yu Tsai
2017-09-26 6:59 ` Chen-Yu Tsai
2017-09-26 6:59 ` Chen-Yu Tsai
2017-09-26 9:32 ` Maxime Ripard
2017-09-26 9:32 ` Maxime Ripard
2017-09-26 9:32 ` Maxime Ripard
2017-09-27 3:45 ` Chen-Yu Tsai
2017-09-27 3:45 ` Chen-Yu Tsai
2017-09-26 6:59 ` [PATCH v2 03/13] drm/sun4i: tcon: Add support for demuxing TCON output on A31 Chen-Yu Tsai
2017-09-26 6:59 ` Chen-Yu Tsai
2017-09-26 6:59 ` Chen-Yu Tsai
2017-09-26 9:56 ` Maxime Ripard
2017-09-26 9:56 ` Maxime Ripard
2017-09-26 9:56 ` Maxime Ripard
2017-09-27 4:03 ` Chen-Yu Tsai
2017-09-27 4:03 ` Chen-Yu Tsai
2017-09-27 4:03 ` Chen-Yu Tsai
2017-09-26 6:59 ` [PATCH v2 04/13] drm/sun4i: hdmi: Disable clks in bind function error path and unbind function Chen-Yu Tsai
2017-09-26 6:59 ` Chen-Yu Tsai
2017-09-26 9:56 ` Maxime Ripard
2017-09-26 9:56 ` Maxime Ripard
2017-09-26 9:56 ` Maxime Ripard
2017-09-26 6:59 ` [PATCH v2 05/13] drm/sun4i: hdmi: create a regmap for later use Chen-Yu Tsai
2017-09-26 6:59 ` Chen-Yu Tsai
2017-09-26 6:59 ` Chen-Yu Tsai
2017-09-26 9:56 ` Maxime Ripard
2017-09-26 9:56 ` Maxime Ripard
2017-09-26 9:56 ` Maxime Ripard
2017-09-26 6:59 ` [PATCH v2 06/13] drm/sun4i: hdmi: Allow using second PLL as TMDS clk parent Chen-Yu Tsai
2017-09-26 6:59 ` Chen-Yu Tsai
2017-09-26 6:59 ` Chen-Yu Tsai
2017-09-26 9:58 ` Maxime Ripard
2017-09-26 9:58 ` Maxime Ripard
2017-09-26 9:58 ` Maxime Ripard
2017-09-26 6:59 ` [PATCH v2 07/13] dt-bindings: display: sun4i: Add binding for A31 HDMI controller Chen-Yu Tsai
2017-09-26 6:59 ` Chen-Yu Tsai
2017-09-26 6:59 ` Chen-Yu Tsai
2017-09-26 6:59 ` [PATCH v2 08/13] regmap: add iopoll-like polling macro for regmap_field Chen-Yu Tsai
2017-09-26 6:59 ` Chen-Yu Tsai
2017-09-26 6:59 ` Chen-Yu Tsai
2017-10-04 11:28 ` Mark Brown [this message]
2017-10-04 11:28 ` Applied "regmap: add iopoll-like polling macro for regmap_field" to the regmap tree Mark Brown
2017-10-04 11:28 ` Mark Brown
2017-09-26 6:59 ` [PATCH v2 09/13] drm/sun4i: hdmi: Add support for controller hardware variants Chen-Yu Tsai
2017-09-26 6:59 ` Chen-Yu Tsai
2017-09-26 6:59 ` Chen-Yu Tsai
2017-09-26 10:01 ` Maxime Ripard
2017-09-26 10:01 ` Maxime Ripard
2017-09-26 10:01 ` Maxime Ripard
2017-09-26 6:59 ` [PATCH v2 10/13] drm/sun4i: hdmi: Add A31 specific DDC register definitions Chen-Yu Tsai
2017-09-26 6:59 ` Chen-Yu Tsai
2017-09-26 6:59 ` Chen-Yu Tsai
2017-09-26 10:02 ` Maxime Ripard
2017-09-26 10:02 ` Maxime Ripard
2017-09-26 10:02 ` Maxime Ripard
2017-09-26 6:59 ` [PATCH v2 11/13] drm/sun4i: hdmi: Add support for A31's HDMI controller Chen-Yu Tsai
2017-09-26 6:59 ` Chen-Yu Tsai
2017-09-26 6:59 ` Chen-Yu Tsai
2017-09-26 10:02 ` Maxime Ripard
2017-09-26 10:02 ` Maxime Ripard
2017-09-26 6:59 ` [PATCH v2 12/13] ARM: dts: sun6i: Add device node for " Chen-Yu Tsai
2017-09-26 6:59 ` Chen-Yu Tsai
2017-09-26 6:59 ` Chen-Yu Tsai
2017-09-26 6:59 ` [PATCH v2 13/13] ARM: dts: sun6i: Enable HDMI support on some A31/A31s devices Chen-Yu Tsai
2017-09-26 6:59 ` Chen-Yu Tsai
2017-09-26 6:59 ` Chen-Yu Tsai
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=E1dzhrF-0004Tf-A0@debutante \
--to=broonie@kernel.org \
--cc=airlied@linux.ie \
--cc=devicetree@vger.kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sunxi@googlegroups.com \
--cc=mark.rutland@arm.com \
--cc=maxime.ripard@free-electrons.com \
--cc=mturquette@baylibre.com \
--cc=robh+dt@kernel.org \
--cc=sboyd@codeaurora.org \
--cc=wens@csie.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 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.