linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 5/11v2] ata: replace macro with static inline in libata.h
@ 2008-02-15 22:06 Harvey Harrison
  2008-02-15 22:30 ` Alan Cox
  0 siblings, 1 reply; 8+ messages in thread
From: Harvey Harrison @ 2008-02-15 22:06 UTC (permalink / raw)
  To: Jeff Garzik, Alan Cox; +Cc: linux-ide

Move to using a static inline which will force the same typechecking
that min_t/max_t do (in this case, short).  As a bonus, avoid a ton
of sparse warnings like:

drivers/ata/pata_ali.c:176:14: warning: symbol '__x' shadows an earlier one
drivers/ata/pata_ali.c:176:14: originally declared here

Due to nesting min_t macro inside max_t macro which both use a __x
identifier internally.

Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
---
 include/linux/libata.h |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/include/linux/libata.h b/include/linux/libata.h
index bc5a8d0..b5590fb 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -764,7 +764,14 @@ struct ata_timing {
 	unsigned short udma;		/* t2CYCTYP/2 */
 };
 
-#define FIT(v, vmin, vmax)	max_t(short, min_t(short, v, vmax), vmin)
+static inline short FIT(short v, short vmin, short vmax)
+{
+	if (v >= vmax)
+		return vmax;
+	if (v <= vmin)
+		return vmin;
+	return v;
+}
 
 extern const unsigned long sata_deb_timing_normal[];
 extern const unsigned long sata_deb_timing_hotplug[];
-- 
1.5.4.1.1278.gc75be




^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2008-02-16  0:36 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-02-15 22:06 [PATCH 5/11v2] ata: replace macro with static inline in libata.h Harvey Harrison
2008-02-15 22:30 ` Alan Cox
2008-02-15 22:46   ` Harvey Harrison
2008-02-15 22:53     ` Alan Cox
2008-02-15 23:08       ` Harvey Harrison
2008-02-16  0:05         ` Alan Cox
2008-02-16  0:23           ` Harvey Harrison
2008-02-16  0:36             ` Harvey Harrison

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).