* [PATCH 0/2] Avoid namespace collision within macros
@ 2016-10-27 9:33 Ramesh Shanmugasundaram
2016-10-27 9:33 ` [PATCH 1/2] iopoll: " Ramesh Shanmugasundaram
2016-10-27 9:33 ` [PATCH 2/2] regmap: Avoid namespace collision within macro Ramesh Shanmugasundaram
0 siblings, 2 replies; 5+ messages in thread
From: Ramesh Shanmugasundaram @ 2016-10-27 9:33 UTC (permalink / raw)
To: mattw, mitchelh, broonie, linux-kernel
Cc: linux-renesas-soc, chris.paterson2, Ramesh Shanmugasundaram
Hi All,
The readx_poll_timeout & similar macros defines "ktime timeout" local
variable. Fixed this potential namespace collision issue.
This patchset is based on top of latest linux repo
commit 9fe68cad6e74967b88d0c6aeca7d9cd6b6e91942
Thanks,
Ramesh
Ramesh Shanmugasundaram (2):
iopoll: Avoid namespace collision within macros
regmap: Avoid namespace collision within macro
include/linux/iopoll.h | 8 ++++----
include/linux/regmap.h | 4 ++--
2 files changed, 6 insertions(+), 6 deletions(-)
--
1.9.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/2] iopoll: Avoid namespace collision within macros
2016-10-27 9:33 [PATCH 0/2] Avoid namespace collision within macros Ramesh Shanmugasundaram
@ 2016-10-27 9:33 ` Ramesh Shanmugasundaram
2016-10-27 9:33 ` [PATCH 2/2] regmap: Avoid namespace collision within macro Ramesh Shanmugasundaram
1 sibling, 0 replies; 5+ messages in thread
From: Ramesh Shanmugasundaram @ 2016-10-27 9:33 UTC (permalink / raw)
To: mattw, mitchelh, broonie, linux-kernel
Cc: linux-renesas-soc, chris.paterson2, Ramesh Shanmugasundaram
Renamed variable "timeout" to "__timeout" to avoid namespace collision.
Signed-off-by: Ramesh Shanmugasundaram <ramesh.shanmugasundaram@bp.renesas.com>
---
include/linux/iopoll.h | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/include/linux/iopoll.h b/include/linux/iopoll.h
index 1c30014..e237d01 100644
--- a/include/linux/iopoll.h
+++ b/include/linux/iopoll.h
@@ -42,13 +42,13 @@
*/
#define readx_poll_timeout(op, addr, val, cond, sleep_us, timeout_us) \
({ \
- ktime_t timeout = ktime_add_us(ktime_get(), timeout_us); \
+ ktime_t __timeout = ktime_add_us(ktime_get(), timeout_us); \
might_sleep_if(sleep_us); \
for (;;) { \
(val) = op(addr); \
if (cond) \
break; \
- if (timeout_us && ktime_compare(ktime_get(), timeout) > 0) { \
+ if (timeout_us && ktime_compare(ktime_get(), __timeout) > 0) { \
(val) = op(addr); \
break; \
} \
@@ -77,12 +77,12 @@
*/
#define readx_poll_timeout_atomic(op, addr, val, cond, delay_us, timeout_us) \
({ \
- ktime_t timeout = ktime_add_us(ktime_get(), timeout_us); \
+ ktime_t __timeout = ktime_add_us(ktime_get(), timeout_us); \
for (;;) { \
(val) = op(addr); \
if (cond) \
break; \
- if (timeout_us && ktime_compare(ktime_get(), timeout) > 0) { \
+ if (timeout_us && ktime_compare(ktime_get(), __timeout) > 0) { \
(val) = op(addr); \
break; \
} \
--
1.9.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/2] regmap: Avoid namespace collision within macro
2016-10-27 9:33 [PATCH 0/2] Avoid namespace collision within macros Ramesh Shanmugasundaram
2016-10-27 9:33 ` [PATCH 1/2] iopoll: " Ramesh Shanmugasundaram
@ 2016-10-27 9:33 ` Ramesh Shanmugasundaram
2016-10-27 10:15 ` Mark Brown
1 sibling, 1 reply; 5+ messages in thread
From: Ramesh Shanmugasundaram @ 2016-10-27 9:33 UTC (permalink / raw)
To: mattw, mitchelh, broonie, linux-kernel
Cc: linux-renesas-soc, chris.paterson2, Ramesh Shanmugasundaram
Renamed variable "timeout" to "__timeout" to avoid namespace collision.
Signed-off-by: Ramesh Shanmugasundaram <ramesh.shanmugasundaram@bp.renesas.com>
---
include/linux/regmap.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/include/linux/regmap.h b/include/linux/regmap.h
index 9adc7b2..32f339a 100644
--- a/include/linux/regmap.h
+++ b/include/linux/regmap.h
@@ -115,7 +115,7 @@ struct reg_sequence {
*/
#define regmap_read_poll_timeout(map, addr, val, cond, sleep_us, timeout_us) \
({ \
- ktime_t timeout = ktime_add_us(ktime_get(), timeout_us); \
+ ktime_t __timeout = ktime_add_us(ktime_get(), timeout_us); \
int ret; \
might_sleep_if(sleep_us); \
for (;;) { \
@@ -124,7 +124,7 @@ struct reg_sequence {
break; \
if (cond) \
break; \
- if (timeout_us && ktime_compare(ktime_get(), timeout) > 0) { \
+ if (timeout_us && ktime_compare(ktime_get(), __timeout) > 0) { \
ret = regmap_read((map), (addr), &(val)); \
break; \
} \
--
1.9.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2] regmap: Avoid namespace collision within macro
2016-10-27 9:33 ` [PATCH 2/2] regmap: Avoid namespace collision within macro Ramesh Shanmugasundaram
@ 2016-10-27 10:15 ` Mark Brown
2016-10-27 10:22 ` Ramesh Shanmugasundaram
0 siblings, 1 reply; 5+ messages in thread
From: Mark Brown @ 2016-10-27 10:15 UTC (permalink / raw)
To: Ramesh Shanmugasundaram
Cc: mattw, mitchelh, linux-kernel, linux-renesas-soc, chris.paterson2
[-- Attachment #1: Type: text/plain, Size: 345 bytes --]
On Thu, Oct 27, 2016 at 10:33:19AM +0100, Ramesh Shanmugasundaram wrote:
> #define regmap_read_poll_timeout(map, addr, val, cond, sleep_us, timeout_us) \
> ({ \
> - ktime_t timeout = ktime_add_us(ktime_get(), timeout_us); \
> + ktime_t __timeout = ktime_add_us(ktime_get(), timeout_us); \
> int ret; \
Why is timeout an issue and not ret?
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 473 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: [PATCH 2/2] regmap: Avoid namespace collision within macro
2016-10-27 10:15 ` Mark Brown
@ 2016-10-27 10:22 ` Ramesh Shanmugasundaram
0 siblings, 0 replies; 5+ messages in thread
From: Ramesh Shanmugasundaram @ 2016-10-27 10:22 UTC (permalink / raw)
To: Mark Brown
Cc: mattw, mitchelh, linux-kernel, linux-renesas-soc, Chris Paterson
> On Thu, Oct 27, 2016 at 10:33:19AM +0100, Ramesh Shanmugasundaram wrote:
>
> > #define regmap_read_poll_timeout(map, addr, val, cond, sleep_us,
> > timeout_us) \ ({ \
> > - ktime_t timeout = ktime_add_us(ktime_get(), timeout_us); \
> > + ktime_t __timeout = ktime_add_us(ktime_get(), timeout_us); \
> > int ret; \
>
> Why is timeout an issue and not ret?
It is! However, it is less likely for someone to use "ret" as a variable name for the given parameter list. Hence, I fixed timeout alone. Feel free to fix "ret" as well.
Thanks,
Ramesh
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2016-10-27 14:32 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-27 9:33 [PATCH 0/2] Avoid namespace collision within macros Ramesh Shanmugasundaram
2016-10-27 9:33 ` [PATCH 1/2] iopoll: " Ramesh Shanmugasundaram
2016-10-27 9:33 ` [PATCH 2/2] regmap: Avoid namespace collision within macro Ramesh Shanmugasundaram
2016-10-27 10:15 ` Mark Brown
2016-10-27 10:22 ` Ramesh Shanmugasundaram
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).