* [PATCH 1/4] dma: use BUG_ON correctly in iop-adma.c, v4
2011-03-26 17:26 [PATCH 0/4] use BUG_ON correctly, v4 Coly Li
@ 2011-03-26 17:26 ` Coly Li
2011-03-26 17:26 ` [PATCH 2/4] dma: use BUG_ON correctly in mv_xor.c, v4 Coly Li
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Coly Li @ 2011-03-26 17:26 UTC (permalink / raw)
To: linux-kernel; +Cc: Coly Li, Dan Williams, Vinod Koul
This patch makes BUG_ON() usage correct in drivers/dma/iop-adma.c.
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Coly Li <bosong.ly@taobao.com>
---
drivers/dma/iop-adma.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/dma/iop-adma.c b/drivers/dma/iop-adma.c
index c6b01f5..e03f811 100644
--- a/drivers/dma/iop-adma.c
+++ b/drivers/dma/iop-adma.c
@@ -619,7 +619,7 @@ iop_adma_prep_dma_memcpy(struct dma_chan *chan, dma_addr_t dma_dest,
if (unlikely(!len))
return NULL;
- BUG_ON(unlikely(len > IOP_ADMA_MAX_BYTE_COUNT));
+ BUG_ON(len > IOP_ADMA_MAX_BYTE_COUNT);
dev_dbg(iop_chan->device->common.dev, "%s len: %u\n",
__func__, len);
@@ -652,7 +652,7 @@ iop_adma_prep_dma_memset(struct dma_chan *chan, dma_addr_t dma_dest,
if (unlikely(!len))
return NULL;
- BUG_ON(unlikely(len > IOP_ADMA_MAX_BYTE_COUNT));
+ BUG_ON(len > IOP_ADMA_MAX_BYTE_COUNT);
dev_dbg(iop_chan->device->common.dev, "%s len: %u\n",
__func__, len);
@@ -686,7 +686,7 @@ iop_adma_prep_dma_xor(struct dma_chan *chan, dma_addr_t dma_dest,
if (unlikely(!len))
return NULL;
- BUG_ON(unlikely(len > IOP_ADMA_XOR_MAX_BYTE_COUNT));
+ BUG_ON(len > IOP_ADMA_XOR_MAX_BYTE_COUNT);
dev_dbg(iop_chan->device->common.dev,
"%s src_cnt: %d len: %u flags: %lx\n",
--
1.7.3.4
^ permalink raw reply [flat|nested] 6+ messages in thread* [PATCH 2/4] dma: use BUG_ON correctly in mv_xor.c, v4
2011-03-26 17:26 [PATCH 0/4] use BUG_ON correctly, v4 Coly Li
2011-03-26 17:26 ` [PATCH 1/4] dma: use BUG_ON correctly in iop-adma.c, v4 Coly Li
@ 2011-03-26 17:26 ` Coly Li
2011-03-26 17:26 ` [PATCH 3/4] dma: use BUG_ON correctly in ppc4xx/adam.c, v4 Coly Li
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Coly Li @ 2011-03-26 17:26 UTC (permalink / raw)
To: linux-kernel; +Cc: Coly Li, Vinod Koul, Dan Williams
This patch makes BUG_ON() usage correct in drivers/dma/mv_xor.c
Cc: Vinod Koul <vinod.koul@intel.com>
Cc: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Coly Li <bosong.ly@taobao.com>
---
drivers/dma/mv_xor.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/dma/mv_xor.c b/drivers/dma/mv_xor.c
index a25f5f6..954e334 100644
--- a/drivers/dma/mv_xor.c
+++ b/drivers/dma/mv_xor.c
@@ -671,7 +671,7 @@ mv_xor_prep_dma_memcpy(struct dma_chan *chan, dma_addr_t dest, dma_addr_t src,
if (unlikely(len < MV_XOR_MIN_BYTE_COUNT))
return NULL;
- BUG_ON(unlikely(len > MV_XOR_MAX_BYTE_COUNT));
+ BUG_ON(len > MV_XOR_MAX_BYTE_COUNT);
spin_lock_bh(&mv_chan->lock);
slot_cnt = mv_chan_memcpy_slot_count(len);
@@ -710,7 +710,7 @@ mv_xor_prep_dma_memset(struct dma_chan *chan, dma_addr_t dest, int value,
if (unlikely(len < MV_XOR_MIN_BYTE_COUNT))
return NULL;
- BUG_ON(unlikely(len > MV_XOR_MAX_BYTE_COUNT));
+ BUG_ON(len > MV_XOR_MAX_BYTE_COUNT);
spin_lock_bh(&mv_chan->lock);
slot_cnt = mv_chan_memset_slot_count(len);
@@ -744,7 +744,7 @@ mv_xor_prep_dma_xor(struct dma_chan *chan, dma_addr_t dest, dma_addr_t *src,
if (unlikely(len < MV_XOR_MIN_BYTE_COUNT))
return NULL;
- BUG_ON(unlikely(len > MV_XOR_MAX_BYTE_COUNT));
+ BUG_ON(len > MV_XOR_MAX_BYTE_COUNT);
dev_dbg(mv_chan->device->common.dev,
"%s src_cnt: %d len: dest %x %u flags: %ld\n",
--
1.7.3.4
^ permalink raw reply [flat|nested] 6+ messages in thread* [PATCH 3/4] dma: use BUG_ON correctly in ppc4xx/adam.c, v4
2011-03-26 17:26 [PATCH 0/4] use BUG_ON correctly, v4 Coly Li
2011-03-26 17:26 ` [PATCH 1/4] dma: use BUG_ON correctly in iop-adma.c, v4 Coly Li
2011-03-26 17:26 ` [PATCH 2/4] dma: use BUG_ON correctly in mv_xor.c, v4 Coly Li
@ 2011-03-26 17:26 ` Coly Li
2011-03-26 17:26 ` [PATCH 4/4] scsi_lib.c: use BUG_ON correctly, v4 Coly Li
2011-03-31 5:44 ` [PATCH 0/4] " Koul, Vinod
4 siblings, 0 replies; 6+ messages in thread
From: Coly Li @ 2011-03-26 17:26 UTC (permalink / raw)
To: linux-kernel
Cc: Coly Li, Vinod Koul, Dan Williams, Grant Likely,
Anatolij Gustschin, Sean MacLennan, Joe Perches
This patch makes BUG_ON() usage correct in drivers/dma/ppc4xx/adam.c
Cc: Vinod Koul <vinod.koul@intel.com>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: Grant Likely <grant.likely@secretlab.ca>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Sean MacLennan <smaclennan@pikatech.com>
Cc: Joe Perches <joe@perches.com>
Signed-off-by: Coly Li <bosong.ly@taobao.com>
---
drivers/dma/ppc4xx/adma.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/dma/ppc4xx/adma.c b/drivers/dma/ppc4xx/adma.c
index cef5845..a2b62e9 100644
--- a/drivers/dma/ppc4xx/adma.c
+++ b/drivers/dma/ppc4xx/adma.c
@@ -2313,7 +2313,7 @@ static struct dma_async_tx_descriptor *ppc440spe_adma_prep_dma_memcpy(
if (unlikely(!len))
return NULL;
- BUG_ON(unlikely(len > PPC440SPE_ADMA_DMA_MAX_BYTE_COUNT));
+ BUG_ON(len > PPC440SPE_ADMA_DMA_MAX_BYTE_COUNT);
spin_lock_bh(&ppc440spe_chan->lock);
@@ -2354,7 +2354,7 @@ static struct dma_async_tx_descriptor *ppc440spe_adma_prep_dma_memset(
if (unlikely(!len))
return NULL;
- BUG_ON(unlikely(len > PPC440SPE_ADMA_DMA_MAX_BYTE_COUNT));
+ BUG_ON(len > PPC440SPE_ADMA_DMA_MAX_BYTE_COUNT);
spin_lock_bh(&ppc440spe_chan->lock);
@@ -2397,7 +2397,7 @@ static struct dma_async_tx_descriptor *ppc440spe_adma_prep_dma_xor(
dma_dest, dma_src, src_cnt));
if (unlikely(!len))
return NULL;
- BUG_ON(unlikely(len > PPC440SPE_ADMA_XOR_MAX_BYTE_COUNT));
+ BUG_ON(len > PPC440SPE_ADMA_XOR_MAX_BYTE_COUNT);
dev_dbg(ppc440spe_chan->device->common.dev,
"ppc440spe adma%d: %s src_cnt: %d len: %u int_en: %d\n",
@@ -2887,7 +2887,7 @@ static struct dma_async_tx_descriptor *ppc440spe_adma_prep_dma_pq(
ADMA_LL_DBG(prep_dma_pq_dbg(ppc440spe_chan->device->id,
dst, src, src_cnt));
BUG_ON(!len);
- BUG_ON(unlikely(len > PPC440SPE_ADMA_XOR_MAX_BYTE_COUNT));
+ BUG_ON(len > PPC440SPE_ADMA_XOR_MAX_BYTE_COUNT);
BUG_ON(!src_cnt);
if (src_cnt == 1 && dst[1] == src[0]) {
--
1.7.3.4
^ permalink raw reply [flat|nested] 6+ messages in thread* [PATCH 4/4] scsi_lib.c: use BUG_ON correctly, v4
2011-03-26 17:26 [PATCH 0/4] use BUG_ON correctly, v4 Coly Li
` (2 preceding siblings ...)
2011-03-26 17:26 ` [PATCH 3/4] dma: use BUG_ON correctly in ppc4xx/adam.c, v4 Coly Li
@ 2011-03-26 17:26 ` Coly Li
2011-03-31 5:44 ` [PATCH 0/4] " Koul, Vinod
4 siblings, 0 replies; 6+ messages in thread
From: Coly Li @ 2011-03-26 17:26 UTC (permalink / raw)
To: linux-kernel; +Cc: Coly Li, James Bottomley, linux-scsi
This patch makes BUG_ON() usage correct in drivers/scsi/scsi_lib.c
Cc: James Bottomley <James.Bottomley@suse.de>
Cc: linux-scsi@vger.kernel.org
Signed-off-by: Coly Li <bosong.ly@taobao.com>
---
drivers/scsi/scsi_lib.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
Index: linux-2.6/drivers/scsi/scsi_lib.c
===================================================================
--- linux-2.6.orig/drivers/scsi/scsi_lib.c
+++ linux-2.6/drivers/scsi/scsi_lib.c
@@ -1033,8 +1033,8 @@ int scsi_init_io(struct scsi_cmnd *cmd,
count = blk_rq_map_integrity_sg(rq->q, rq->bio,
prot_sdb->table.sgl);
- BUG_ON(unlikely(count > ivecs));
- BUG_ON(unlikely(count > queue_max_integrity_segments(rq->q)));
+ BUG_ON(count > ivecs);
+ BUG_ON(count > queue_max_integrity_segments(rq->q));
cmd->prot_sdb = prot_sdb;
cmd->prot_sdb->table.nents = count;
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH 0/4] use BUG_ON correctly, v4
2011-03-26 17:26 [PATCH 0/4] use BUG_ON correctly, v4 Coly Li
` (3 preceding siblings ...)
2011-03-26 17:26 ` [PATCH 4/4] scsi_lib.c: use BUG_ON correctly, v4 Coly Li
@ 2011-03-31 5:44 ` Koul, Vinod
4 siblings, 0 replies; 6+ messages in thread
From: Koul, Vinod @ 2011-03-31 5:44 UTC (permalink / raw)
To: Coly Li; +Cc: linux-kernel, Greg KH, Yong Zhang, Wang Cong, Dan
On Sun, 2011-03-27 at 01:26 +0800, Coly Li wrote:
> 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 implementation of BUG_ON(), there are feed backs for v2 patch
> set from MIPS and PowerPC developers than neither explicit no implicit
> unlikely() does help anything.
>
> Therefore using unlikely() explicit with BUG_ON() is always a bug. This
> patch set removes all incorrect BUG_ON() usage.
>
> Patch "Staging: wl_cfg80211.c: use BUG_ON correctly" is merged into
> upstream (commit d7ddd169), no longer in v4 patch set. For v4
> patch set, proper maintainers are added into Cc list by the help of
> scripts/get_maintainer.pl.
>
> Cc: Greg KH <gregkh@suse.de>
> Cc: Yong Zhang <yong.zhang0@gmail.com>
> Cc: Wang Cong <xiyou.wangcong@gmail.com>
> Signed-off-by: Coly Li <bosong.ly@taobao.com>
> ---
> drivers/dma/iop-adma.c | 6 +++---
> drivers/dma/mv_xor.c | 6 +++---
> drivers/dma/ppc4xx/adma.c | 8 ++++----
> drivers/scsi/scsi_lib.c | 4 ++--
> 4 files changed, 12 insertions(+), 12 deletions(-)
Thanks, Applied first 3 patches. 4th one should go to scsi folks.
It would help if you can split patch series per subsystem.
--
~Vinod
^ permalink raw reply [flat|nested] 6+ messages in thread