From 373ebfbf17a8ecad304f65cb92c4d2d10adc0a19 Mon Sep 17 00:00:00 2001 From: Eric Sesterhenn Date: Sun, 26 Mar 2006 18:15:12 +0200 Subject: BUG_ON() Conversion in drivers/mtd/ this changes if() BUG(); constructs to BUG_ON() which is cleaner, contains unlikely() and can better optimized away. Signed-off-by: Eric Sesterhenn Signed-off-by: Adrian Bunk --- drivers/mtd/maps/dilnetpc.c | 8 ++++---- drivers/mtd/mtd_blkdevs.c | 3 +-- drivers/mtd/mtdconcat.c | 6 ++---- 3 files changed, 7 insertions(+), 10 deletions(-) (limited to 'drivers') diff --git a/drivers/mtd/maps/dilnetpc.c b/drivers/mtd/maps/dilnetpc.c index b51c757817d8..efb221692641 100644 --- a/drivers/mtd/maps/dilnetpc.c +++ b/drivers/mtd/maps/dilnetpc.c @@ -218,8 +218,8 @@ static void dnp_set_vpp(struct map_info *not_used, int on) { if(--vpp_counter == 0) setcsc(CSC_RBWR, getcsc(CSC_RBWR) | 0x4); - else if(vpp_counter < 0) - BUG(); + else + BUG_ON(vpp_counter < 0); } spin_unlock_irq(&dnpc_spin); } @@ -240,8 +240,8 @@ static void adnp_set_vpp(struct map_info *not_used, int on) { if(--vpp_counter == 0) setcsc(CSC_RBWR, getcsc(CSC_RBWR) | 0x8); - else if(vpp_counter < 0) - BUG(); + else + BUG_ON(vpp_counter < 0); } spin_unlock_irq(&dnpc_spin); } diff --git a/drivers/mtd/mtd_blkdevs.c b/drivers/mtd/mtd_blkdevs.c index 7f3ff500b68e..840dd66ce2dc 100644 --- a/drivers/mtd/mtd_blkdevs.c +++ b/drivers/mtd/mtd_blkdevs.c @@ -450,8 +450,7 @@ int deregister_mtd_blktrans(struct mtd_blktrans_ops *tr) kfree(tr->blkcore_priv); - if (!list_empty(&tr->devs)) - BUG(); + BUG_ON(!list_empty(&tr->devs)); return 0; } diff --git a/drivers/mtd/mtdconcat.c b/drivers/mtd/mtdconcat.c index b1bf8c411de7..9af840364a74 100644 --- a/drivers/mtd/mtdconcat.c +++ b/drivers/mtd/mtdconcat.c @@ -477,8 +477,7 @@ static int concat_erase(struct mtd_info *mtd, struct erase_info *instr) } /* must never happen since size limit has been verified above */ - if (i >= concat->num_subdev) - BUG(); + BUG_ON(i >= concat->num_subdev); /* now do the erase: */ err = 0; @@ -500,8 +499,7 @@ static int concat_erase(struct mtd_info *mtd, struct erase_info *instr) if ((err = concat_dev_erase(subdev, erase))) { /* sanity check: should never happen since * block alignment has been checked above */ - if (err == -EINVAL) - BUG(); + BUG_ON(err == -EINVAL); if (erase->fail_addr != 0xffffffff) instr->fail_addr = erase->fail_addr + offset; break; -- cgit v1.2.2 From 56ee48277fa214b3b7b0fd91e7fd3464e12597de Mon Sep 17 00:00:00 2001 From: Eric Sesterhenn Date: Sun, 26 Mar 2006 18:17:21 +0200 Subject: BUG_ON() Conversion in drivers/char this changes if() BUG(); constructs to BUG_ON() which is cleaner, contains unlikely() and can better optimized away. Signed-off-by: Eric Sesterhenn Signed-off-by: Adrian Bunk --- drivers/char/epca.c | 3 +-- drivers/char/tty_io.c | 11 ++++------- 2 files changed, 5 insertions(+), 9 deletions(-) (limited to 'drivers') diff --git a/drivers/char/epca.c b/drivers/char/epca.c index 765c5c108bf4..9cad8501d62c 100644 --- a/drivers/char/epca.c +++ b/drivers/char/epca.c @@ -486,8 +486,7 @@ static void pc_close(struct tty_struct * tty, struct file * filp) } /* End channel is open more than once */ /* Port open only once go ahead with shutdown & reset */ - if (ch->count < 0) - BUG(); + BUG_ON(ch->count < 0); /* --------------------------------------------------------------- Let the rest of the driver know the channel is being closed. diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c index 48d795bb8c4b..811dadb9ce3e 100644 --- a/drivers/char/tty_io.c +++ b/drivers/char/tty_io.c @@ -543,14 +543,12 @@ void tty_ldisc_put(int disc) struct tty_ldisc *ld; unsigned long flags; - if (disc < N_TTY || disc >= NR_LDISCS) - BUG(); + BUG_ON(disc < N_TTY || disc >= NR_LDISCS); spin_lock_irqsave(&tty_ldisc_lock, flags); ld = &tty_ldiscs[disc]; - if(ld->refcount == 0) - BUG(); - ld->refcount --; + BUG_ON(ld->refcount == 0); + ld->refcount--; module_put(ld->owner); spin_unlock_irqrestore(&tty_ldisc_lock, flags); } @@ -645,8 +643,7 @@ void tty_ldisc_deref(struct tty_ldisc *ld) { unsigned long flags; - if(ld == NULL) - BUG(); + BUG_ON(ld == NULL); spin_lock_irqsave(&tty_ldisc_lock, flags); if(ld->refcount == 0) -- cgit v1.2.2 From 6dd44a74469c203c5106ada2082c46267b4ac674 Mon Sep 17 00:00:00 2001 From: Eric Sesterhenn Date: Sun, 26 Mar 2006 18:19:26 +0200 Subject: BUG_ON() Conversion in drivers/isdn this changes if() BUG(); constructs to BUG_ON() which is cleaner, contains unlikely() and can better optimized away. Signed-off-by: Eric Sesterhenn Signed-off-by: Adrian Bunk --- drivers/isdn/hisax/hisax_fcpcipnp.c | 7 ++----- drivers/isdn/hisax/hisax_isac.c | 9 +++------ drivers/isdn/hisax/st5481_b.c | 4 +--- drivers/isdn/hisax/st5481_d.c | 4 +--- drivers/isdn/i4l/isdn_ppp.c | 6 ++---- 5 files changed, 9 insertions(+), 21 deletions(-) (limited to 'drivers') diff --git a/drivers/isdn/hisax/hisax_fcpcipnp.c b/drivers/isdn/hisax/hisax_fcpcipnp.c index dc7ef957e897..dbcca287ee2c 100644 --- a/drivers/isdn/hisax/hisax_fcpcipnp.c +++ b/drivers/isdn/hisax/hisax_fcpcipnp.c @@ -387,8 +387,7 @@ static void hdlc_fill_fifo(struct fritz_bcs *bcs) DBG(0x40, "hdlc_fill_fifo"); - if (skb->len == 0) - BUG(); + BUG_ON(skb->len == 0); bcs->ctrl.sr.cmd &= ~HDLC_CMD_XME; if (bcs->tx_skb->len > bcs->fifo_size) { @@ -630,9 +629,7 @@ static void fritz_b_l2l1(struct hisax_if *ifc, int pr, void *arg) switch (pr) { case PH_DATA | REQUEST: - if (bcs->tx_skb) - BUG(); - + BUG_ON(bcs->tx_skb); bcs->tx_skb = skb; DBG_SKB(1, skb); hdlc_fill_fifo(bcs); diff --git a/drivers/isdn/hisax/hisax_isac.c b/drivers/isdn/hisax/hisax_isac.c index f4972f6c1f5d..81eac344bb03 100644 --- a/drivers/isdn/hisax/hisax_isac.c +++ b/drivers/isdn/hisax/hisax_isac.c @@ -476,12 +476,10 @@ static void isac_fill_fifo(struct isac *isac) unsigned char cmd; u_char *ptr; - if (!isac->tx_skb) - BUG(); + BUG_ON(!isac->tx_skb); count = isac->tx_skb->len; - if (count <= 0) - BUG(); + BUG_ON(count <= 0); DBG(DBG_IRQ, "count %d", count); @@ -859,8 +857,7 @@ void isac_d_l2l1(struct hisax_if *hisax_d_if, int pr, void *arg) dev_kfree_skb(skb); break; } - if (isac->tx_skb) - BUG(); + BUG_ON(isac->tx_skb); isac->tx_skb = skb; isac_fill_fifo(isac); diff --git a/drivers/isdn/hisax/st5481_b.c b/drivers/isdn/hisax/st5481_b.c index 657817a591fe..22fd5db18d48 100644 --- a/drivers/isdn/hisax/st5481_b.c +++ b/drivers/isdn/hisax/st5481_b.c @@ -356,9 +356,7 @@ void st5481_b_l2l1(struct hisax_if *ifc, int pr, void *arg) switch (pr) { case PH_DATA | REQUEST: - if (bcs->b_out.tx_skb) - BUG(); - + BUG_ON(bcs->b_out.tx_skb); bcs->b_out.tx_skb = skb; break; case PH_ACTIVATE | REQUEST: diff --git a/drivers/isdn/hisax/st5481_d.c b/drivers/isdn/hisax/st5481_d.c index 941f7022ada1..493dc94992e5 100644 --- a/drivers/isdn/hisax/st5481_d.c +++ b/drivers/isdn/hisax/st5481_d.c @@ -596,9 +596,7 @@ void st5481_d_l2l1(struct hisax_if *hisax_d_if, int pr, void *arg) break; case PH_DATA | REQUEST: DBG(2, "PH_DATA REQUEST len %d", skb->len); - if (adapter->d_out.tx_skb) - BUG(); - + BUG_ON(adapter->d_out.tx_skb); adapter->d_out.tx_skb = skb; FsmEvent(&adapter->d_out.fsm, EV_DOUT_START_XMIT, NULL); break; diff --git a/drivers/isdn/i4l/isdn_ppp.c b/drivers/isdn/i4l/isdn_ppp.c index b9fed8a3bcc6..a0927d1b7a0c 100644 --- a/drivers/isdn/i4l/isdn_ppp.c +++ b/drivers/isdn/i4l/isdn_ppp.c @@ -974,8 +974,7 @@ void isdn_ppp_receive(isdn_net_dev * net_dev, isdn_net_local * lp, struct sk_buf int slot; int proto; - if (net_dev->local->master) - BUG(); // we're called with the master device always + BUG_ON(net_dev->local->master); // we're called with the master device always slot = lp->ppp_slot; if (slot < 0 || slot >= ISDN_MAX_CHANNELS) { @@ -2527,8 +2526,7 @@ static struct sk_buff *isdn_ppp_decompress(struct sk_buff *skb,struct ippp_struc printk(KERN_DEBUG "ippp: no decompressor defined!\n"); return skb; } - if (!stat) // if we have a compressor, stat has been set as well - BUG(); + BUG_ON(!stat); // if we have a compressor, stat has been set as well if((master && *proto == PPP_COMP) || (!master && *proto == PPP_COMPFRAG) ) { // compressed packets are compressed by their protocol type -- cgit v1.2.2 From c163c7293eb68bf6c0c824d122a2192b9f129193 Mon Sep 17 00:00:00 2001 From: Eric Sesterhenn Date: Sun, 26 Mar 2006 18:21:58 +0200 Subject: BUG_ON() Conversion in md/dm-path-selector.c this changes if() BUG(); constructs to BUG_ON() which is cleaner and can better optimized away Signed-off-by: Eric Sesterhenn Signed-off-by: Adrian Bunk --- drivers/md/dm-path-selector.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'drivers') diff --git a/drivers/md/dm-path-selector.c b/drivers/md/dm-path-selector.c index a28c1c2b4ef5..f10a0c89b3f4 100644 --- a/drivers/md/dm-path-selector.c +++ b/drivers/md/dm-path-selector.c @@ -86,8 +86,7 @@ void dm_put_path_selector(struct path_selector_type *pst) if (--psi->use == 0) module_put(psi->pst.module); - if (psi->use < 0) - BUG(); + BUG_ON(psi->use < 0); out: up_read(&_ps_lock); -- cgit v1.2.2 From 547bc92649345af6014578a64b27cc5787617935 Mon Sep 17 00:00:00 2001 From: Eric Sesterhenn Date: Sun, 26 Mar 2006 18:22:50 +0200 Subject: BUG_ON() Conversion in md/dm-table.c this changes if() BUG(); constructs to BUG_ON() which is cleaner and can better optimized away Signed-off-by: Eric Sesterhenn Signed-off-by: Adrian Bunk --- drivers/md/dm-table.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'drivers') diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c index 9b1e2f5ca630..907b08ddb783 100644 --- a/drivers/md/dm-table.c +++ b/drivers/md/dm-table.c @@ -352,8 +352,7 @@ static int open_dev(struct dm_dev *d, dev_t dev) int r; - if (d->bdev) - BUG(); + BUG_ON(d->bdev); bdev = open_by_devnum(dev, d->mode); if (IS_ERR(bdev)) @@ -427,8 +426,7 @@ static int __table_get_device(struct dm_table *t, struct dm_target *ti, struct dm_dev *dd; unsigned int major, minor; - if (!t) - BUG(); + BUG_ON(!t); if (sscanf(path, "%u:%u", &major, &minor) == 2) { /* Extract the major/minor numbers */ -- cgit v1.2.2 From fddaaae16ba4d9f4d392a9ef94616d9d22485571 Mon Sep 17 00:00:00 2001 From: Eric Sesterhenn Date: Sun, 26 Mar 2006 18:23:47 +0200 Subject: BUG_ON() Conversion in input/serio/hp_sdc_mlc.c this changes if() BUG(); constructs to BUG_ON() which is cleaner and can better optimized away Signed-off-by: Eric Sesterhenn Signed-off-by: Adrian Bunk --- drivers/input/serio/hp_sdc_mlc.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'drivers') diff --git a/drivers/input/serio/hp_sdc_mlc.c b/drivers/input/serio/hp_sdc_mlc.c index 1c9426fd5205..aa4a8a4ccfdb 100644 --- a/drivers/input/serio/hp_sdc_mlc.c +++ b/drivers/input/serio/hp_sdc_mlc.c @@ -270,9 +270,10 @@ static void hp_sdc_mlc_out (hil_mlc *mlc) { do_control: priv->emtestmode = mlc->opacket & HIL_CTRL_TEST; - if ((mlc->opacket & (HIL_CTRL_APE | HIL_CTRL_IPF)) == HIL_CTRL_APE) { - BUG(); /* we cannot emulate this, it should not be used. */ - } + + /* we cannot emulate this, it should not be used. */ + BUG_ON((mlc->opacket & (HIL_CTRL_APE | HIL_CTRL_IPF)) == HIL_CTRL_APE); + if ((mlc->opacket & HIL_CTRL_ONLY) == HIL_CTRL_ONLY) goto control_only; if (mlc->opacket & HIL_CTRL_APE) { BUG(); /* Should not send command/data after engaging APE */ -- cgit v1.2.2 From 606f44228e257ea1e35557c2fec7133cca634096 Mon Sep 17 00:00:00 2001 From: Eric Sesterhenn Date: Sun, 26 Mar 2006 18:33:07 +0200 Subject: BUG_ON() Conversion in drivers/s390/block/dasd_devmap.c this changes if() BUG(); constructs to BUG_ON() which is cleaner, contains unlikely() and can better optimized away. Signed-off-by: Eric Sesterhenn Signed-off-by: Adrian Bunk --- drivers/s390/block/dasd_devmap.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'drivers') diff --git a/drivers/s390/block/dasd_devmap.c b/drivers/s390/block/dasd_devmap.c index 2f720108a7e0..c1c6f1381150 100644 --- a/drivers/s390/block/dasd_devmap.c +++ b/drivers/s390/block/dasd_devmap.c @@ -437,8 +437,7 @@ dasd_forget_ranges(void) spin_lock(&dasd_devmap_lock); for (i = 0; i < 256; i++) { list_for_each_entry_safe(devmap, n, &dasd_hashlists[i], list) { - if (devmap->device != NULL) - BUG(); + BUG_ON(devmap->device != NULL); list_del(&devmap->list); kfree(devmap); } @@ -547,8 +546,7 @@ dasd_delete_device(struct dasd_device *device) /* First remove device pointer from devmap. */ devmap = dasd_find_busid(device->cdev->dev.bus_id); - if (IS_ERR(devmap)) - BUG(); + BUG_ON(IS_ERR(devmap)); spin_lock(&dasd_devmap_lock); if (devmap->device != device) { spin_unlock(&dasd_devmap_lock); -- cgit v1.2.2 From 8917f6f70b01ac6e4d534f8a387900caec11bf54 Mon Sep 17 00:00:00 2001 From: Adrian Bunk Date: Sun, 26 Mar 2006 19:15:03 +0200 Subject: Kconfig help: MTD_JEDECPROBE already supports Intel Intel chips are already supported. Signed-off-by: Adrian Bunk Acked-by: David Woodhouse --- drivers/mtd/chips/Kconfig | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'drivers') diff --git a/drivers/mtd/chips/Kconfig b/drivers/mtd/chips/Kconfig index 205bb7083335..0f6bb2e625d8 100644 --- a/drivers/mtd/chips/Kconfig +++ b/drivers/mtd/chips/Kconfig @@ -25,9 +25,8 @@ config MTD_JEDECPROBE compatible with the Common Flash Interface, but will use the common CFI-targetted flash drivers for any chips which are identified which are in fact compatible in all but the probe method. This actually - covers most AMD/Fujitsu-compatible chips, and will shortly cover also - non-CFI Intel chips (that code is in MTD CVS and should shortly be sent - for inclusion in Linus' tree) + covers most AMD/Fujitsu-compatible chips and also non-CFI + Intel chips. config MTD_GEN_PROBE tristate -- cgit v1.2.2 From e9415777b1cd0eaf4d1d3d61772f0e6d5c2551ad Mon Sep 17 00:00:00 2001 From: Bastien Roucaries Date: Sun, 26 Mar 2006 19:18:07 +0200 Subject: drivers/char/ftape/lowlevel/fdc-io.c: Correct a comment This patch correct a comment about cli(). Signed-off-by: Bastien Roucaries Signed-off-by: Adrian Bunk --- drivers/char/ftape/lowlevel/fdc-io.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers') diff --git a/drivers/char/ftape/lowlevel/fdc-io.c b/drivers/char/ftape/lowlevel/fdc-io.c index b2e0928e8428..093fdf98b19a 100644 --- a/drivers/char/ftape/lowlevel/fdc-io.c +++ b/drivers/char/ftape/lowlevel/fdc-io.c @@ -607,7 +607,7 @@ void fdc_reset(void) fdc_mode = fdc_idle; - /* maybe the cli()/sti() pair is not necessary, BUT: + /* maybe the spin_lock_irq* pair is not necessary, BUT: * the following line MUST be here. Otherwise fdc_interrupt_wait() * won't wait. Note that fdc_reset() is called from * ftape_dumb_stop() when the fdc is busy transferring data. In this -- cgit v1.2.2