aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorHagen Paul Pfeifer <hagen@jauu.net>2010-10-26 17:22:23 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-10-26 19:52:12 -0400
commit732eacc0542d0aa48797f675888b85d6065af837 (patch)
tree53205cea4b99cc8dfed8f59438cf4214ef6546ad /drivers
parentf27c85c56b32c42bcc54a43189c1e00fdceb23ec (diff)
replace nested max/min macros with {max,min}3 macro
Use the new {max,min}3 macros to save some cycles and bytes on the stack. This patch substitutes trivial nested macros with their counterpart. Signed-off-by: Hagen Paul Pfeifer <hagen@jauu.net> Cc: Joe Perches <joe@perches.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Hartley Sweeten <hsweeten@visionengravers.com> Cc: Russell King <linux@arm.linux.org.uk> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Herbert Xu <herbert@gondor.apana.org.au> Cc: Roland Dreier <rolandd@cisco.com> Cc: Sean Hefty <sean.hefty@intel.com> Cc: Pekka Enberg <penberg@cs.helsinki.fi> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/crypto/hifn_795x.c4
-rw-r--r--drivers/infiniband/ulp/ipoib/ipoib_main.c3
-rw-r--r--drivers/macintosh/windfarm_pm121.c2
-rw-r--r--drivers/video/au1200fb.c2
4 files changed, 5 insertions, 6 deletions
diff --git a/drivers/crypto/hifn_795x.c b/drivers/crypto/hifn_795x.c
index 0eac3da566ba..a84250a5dd51 100644
--- a/drivers/crypto/hifn_795x.c
+++ b/drivers/crypto/hifn_795x.c
@@ -1467,7 +1467,7 @@ static int ablkcipher_add(unsigned int *drestp, struct scatterlist *dst,
1467 return -EINVAL; 1467 return -EINVAL;
1468 1468
1469 while (size) { 1469 while (size) {
1470 copy = min(drest, min(size, dst->length)); 1470 copy = min3(drest, size, dst->length);
1471 1471
1472 size -= copy; 1472 size -= copy;
1473 drest -= copy; 1473 drest -= copy;
@@ -1729,7 +1729,7 @@ static int ablkcipher_get(void *saddr, unsigned int *srestp, unsigned int offset
1729 return -EINVAL; 1729 return -EINVAL;
1730 1730
1731 while (size) { 1731 while (size) {
1732 copy = min(srest, min(dst->length, size)); 1732 copy = min3(srest, dst->length, size);
1733 1733
1734 daddr = kmap_atomic(sg_page(dst), KM_IRQ0); 1734 daddr = kmap_atomic(sg_page(dst), KM_IRQ0);
1735 memcpy(daddr + dst->offset + offset, saddr, copy); 1735 memcpy(daddr + dst->offset + offset, saddr, copy);
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c
index b4b22576f12a..19c5d3b191f4 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_main.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c
@@ -1409,8 +1409,7 @@ static int __init ipoib_init_module(void)
1409 1409
1410 ipoib_sendq_size = roundup_pow_of_two(ipoib_sendq_size); 1410 ipoib_sendq_size = roundup_pow_of_two(ipoib_sendq_size);
1411 ipoib_sendq_size = min(ipoib_sendq_size, IPOIB_MAX_QUEUE_SIZE); 1411 ipoib_sendq_size = min(ipoib_sendq_size, IPOIB_MAX_QUEUE_SIZE);
1412 ipoib_sendq_size = max(ipoib_sendq_size, max(2 * MAX_SEND_CQE, 1412 ipoib_sendq_size = max3(ipoib_sendq_size, 2 * MAX_SEND_CQE, IPOIB_MIN_QUEUE_SIZE);
1413 IPOIB_MIN_QUEUE_SIZE));
1414#ifdef CONFIG_INFINIBAND_IPOIB_CM 1413#ifdef CONFIG_INFINIBAND_IPOIB_CM
1415 ipoib_max_conn_qp = min(ipoib_max_conn_qp, IPOIB_CM_MAX_CONN_QP); 1414 ipoib_max_conn_qp = min(ipoib_max_conn_qp, IPOIB_CM_MAX_CONN_QP);
1416#endif 1415#endif
diff --git a/drivers/macintosh/windfarm_pm121.c b/drivers/macintosh/windfarm_pm121.c
index 947d4afa25ca..30e6195e19d4 100644
--- a/drivers/macintosh/windfarm_pm121.c
+++ b/drivers/macintosh/windfarm_pm121.c
@@ -482,7 +482,7 @@ static s32 pm121_correct(s32 new_setpoint,
482 new_min += correction->offset; 482 new_min += correction->offset;
483 new_min = (new_min >> 16) + min; 483 new_min = (new_min >> 16) + min;
484 484
485 return max(new_setpoint, max(new_min, 0)); 485 return max3(new_setpoint, new_min, 0);
486} 486}
487 487
488static s32 pm121_connect(unsigned int control_id, s32 setpoint) 488static s32 pm121_connect(unsigned int control_id, s32 setpoint)
diff --git a/drivers/video/au1200fb.c b/drivers/video/au1200fb.c
index e77e8e4280fb..4ea187d93768 100644
--- a/drivers/video/au1200fb.c
+++ b/drivers/video/au1200fb.c
@@ -1079,7 +1079,7 @@ static int au1200fb_fb_check_var(struct fb_var_screeninfo *var,
1079 * clock can only be obtain by dividing this value by an even integer. 1079 * clock can only be obtain by dividing this value by an even integer.
1080 * Fallback to a slower pixel clock if necessary. */ 1080 * Fallback to a slower pixel clock if necessary. */
1081 pixclock = max((u32)(PICOS2KHZ(var->pixclock) * 1000), fbi->monspecs.dclkmin); 1081 pixclock = max((u32)(PICOS2KHZ(var->pixclock) * 1000), fbi->monspecs.dclkmin);
1082 pixclock = min(pixclock, min(fbi->monspecs.dclkmax, (u32)AU1200_LCD_MAX_CLK/2)); 1082 pixclock = min3(pixclock, fbi->monspecs.dclkmax, (u32)AU1200_LCD_MAX_CLK/2);
1083 1083
1084 if (AU1200_LCD_MAX_CLK % pixclock) { 1084 if (AU1200_LCD_MAX_CLK % pixclock) {
1085 int diff = AU1200_LCD_MAX_CLK % pixclock; 1085 int diff = AU1200_LCD_MAX_CLK % pixclock;