Nesting min_t/max_t macros produces many shadowed variable warnings
due to use of __x. Add a clamp_t macro to linux/kernel.h and use
it in the FIT macro.
Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
---
include/linux/kernel.h | 9 +++++++++
include/linux/libata.h | 2 +-
2 files changed, 10 insertions(+), 1 deletions(-)
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 2df44e7..47924ce 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -362,6 +362,15 @@ static inline int __attribute__ ((format (printf, 1, 2))) pr_debug(const char *
#define max_t(type,x,y) \
({ type __x = (x); type __y = (y); __x > __y ? __x: __y; })
+/*
+ * Clamp a value to within a given range using comparisons of a specified type.
+ */
+#define clamp_t(type,val,min,max) ({ \
+ type __val = (val); \
+ type __min = (min); \
+ type __max = (max); \
+ __val = __val < __min ? __min: __val; \
+ __val > __max ? __max: __val; })
/**
* container_of - cast a member of a structure out to the containing structure
diff --git a/include/linux/libata.h b/include/linux/libata.h
index 2e098f9..8adc2a0 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -754,7 +754,7 @@ struct ata_timing {
unsigned short udma; /* t2CYCTYP/2 */
};
-#define FIT(v, vmin, vmax) max_t(short, min_t(short, v, vmax), vmin)
+#define FIT(v, vmin, vmax) clamp_t(short, v, vmin, vmax)
extern const unsigned long sata_deb_timing_normal[];
extern const unsigned long sata_deb_timing_hotplug[];
--
1.5.4.2.200.g99e75
--
| Greg KH | Og dreams of kernels |
| Jens Axboe | [PATCH 31/33] Fusion: sg chaining support |
| Arnd Bergmann | Re: finding your own dead "CONFIG_" variables |
| Mark Brown | [PATCH 2/2] Subject: natsemi: Allow users to disable workaround for DspCfg reset |
| Tony Breeds | [LGUEST] Look in object dir for .config |
git: | |
| Brian Downing | Re: Git in a Nutshell guide |
| John Benes | Re: master has some toys |
| Matthias Lederhofer | [PATCH 4/7] introduce GIT_WORK_TREE to specify the work tree |
| Alexander Sulfrian | [RFC/PATCH] RE: git calls SSH_ASKPASS even if DISPLAY is not set |
| Junio C Hamano | Re: Rss produced by git is not valid xml? |
| Linux Kernel Mailing List | iSeries: fix section mismatch in iseries_veth |
| Linux Kernel Mailing List | ixbge: remove TX lock and redo TX accounting. |
| Linux Kernel Mailing List |
