Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 732eacc0 authored by Hagen Paul Pfeifer's avatar Hagen Paul Pfeifer Committed by Linus Torvalds
Browse files

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: default avatarHagen 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: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent f27c85c5
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -358,8 +358,7 @@ static int calc_clk_div(struct clk *clk, unsigned long rate,
	int i, found = 0, __div = 0, __pdiv = 0;

	/* Don't exceed the maximum rate */
	max_rate = max(max(clk_pll1.rate / 4, clk_pll2.rate / 4),
		       clk_xtali.rate / 4);
	max_rate = max3(clk_pll1.rate / 4, clk_pll2.rate / 4, clk_xtali.rate / 4);
	rate = min(rate, max_rate);

	/*
+1 −3
Original line number Diff line number Diff line
@@ -238,9 +238,7 @@ static inline void vio_cmo_dealloc(struct vio_dev *viodev, size_t size)
	 * memory in this pool does not change.
	 */
	if (spare_needed && reserve_freed) {
		tmp = min(spare_needed, min(reserve_freed,
		                            (viodev->cmo.entitled -
		                             VIO_CMO_MIN_ENT)));
		tmp = min3(spare_needed, reserve_freed, (viodev->cmo.entitled - VIO_CMO_MIN_ENT));

		vio_cmo.spare += tmp;
		viodev->cmo.entitled -= tmp;
+1 −0
Original line number Diff line number Diff line
@@ -327,6 +327,7 @@ static void __cpuinit amd_calc_l3_indices(struct amd_l3_cache *l3)
	l3->subcaches[3] = sc3 = !(val & BIT(12)) + !(val & BIT(13));

	l3->indices = (max(max(max(sc0, sc1), sc2), sc3) << 10) - 1;
	l3->indices = (max(max3(sc0, sc1, sc2), sc3) << 10) - 1;
}

static struct amd_l3_cache * __cpuinit amd_init_l3_cache(int node)
+2 −2
Original line number Diff line number Diff line
@@ -1467,7 +1467,7 @@ static int ablkcipher_add(unsigned int *drestp, struct scatterlist *dst,
		return -EINVAL;

	while (size) {
		copy = min(drest, min(size, dst->length));
		copy = min3(drest, size, dst->length);

		size -= copy;
		drest -= copy;
@@ -1729,7 +1729,7 @@ static int ablkcipher_get(void *saddr, unsigned int *srestp, unsigned int offset
		return -EINVAL;

	while (size) {
		copy = min(srest, min(dst->length, size));
		copy = min3(srest, dst->length, size);

		daddr = kmap_atomic(sg_page(dst), KM_IRQ0);
		memcpy(daddr + dst->offset + offset, saddr, copy);
+1 −2
Original line number Diff line number Diff line
@@ -1409,8 +1409,7 @@ static int __init ipoib_init_module(void)

	ipoib_sendq_size = roundup_pow_of_two(ipoib_sendq_size);
	ipoib_sendq_size = min(ipoib_sendq_size, IPOIB_MAX_QUEUE_SIZE);
	ipoib_sendq_size = max(ipoib_sendq_size, max(2 * MAX_SEND_CQE,
						     IPOIB_MIN_QUEUE_SIZE));
	ipoib_sendq_size = max3(ipoib_sendq_size, 2 * MAX_SEND_CQE, IPOIB_MIN_QUEUE_SIZE);
#ifdef CONFIG_INFINIBAND_IPOIB_CM
	ipoib_max_conn_qp = min(ipoib_max_conn_qp, IPOIB_CM_MAX_CONN_QP);
#endif
Loading