[PATCH 0/6] use BUG_ON correctly, v2

From: Coly Li
Date: Thu Jan 27 2011 - 06:54:18 EST


Most of BUG_ON() implementations use unlikely() internally for better
branch prediction results. The following method to use BUG_ON() with
an explicit unlikely() doesn't make things better and is unwelcome:
BUG_ON(unlikely(condition));
Source code should use BUG_ON() just with condition code.

For arch dependent BUG_ON() implementations, they should use unlikely()
internally if they are able to.

This patch set does two things,
1) Remove all explicit unlikey() where kernel code uses BUG_ON().
2) Fix arch dependent BUG_ON() implementations if they don't use
unlikely() internally.

The difference between v2 and v1 patch set are,
1) Remove the fix of mm/nommu.c, because it's in mm-tree already.
2) Add unlikely() inside the BUG_ON() implementations of MIPS and PPC.

Signed-off-by: Coly Li <bosong.ly@xxxxxxxxxx>
Cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
Cc: Greg KH <gregkh@xxxxxxx>
---
arch/mips/include/asm/bug.h | 2 +-
arch/powerpc/include/asm/bug.h | 4 +++-
drivers/dma/iop-adma.c | 6 +++---
drivers/dma/mv_xor.c | 6 +++---
drivers/dma/ppc4xx/adma.c | 8 ++++----
drivers/scsi/scsi_lib.c | 4 ++--
drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c | 14 +++++++-------
7 files changed, 23 insertions(+), 21 deletions(-)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/