linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Geoff Levand <geoff@infradead.org>
To: David S. Miller <davem@davemloft.net>, Jakub Kicinski <kuba@kernel.org>
Cc: netdev@vger.kernel.org, linuxppc-dev@lists.ozlabs.org
Subject: [PATCH v4 04/10] net/ps3_gelic: Add new macro BUG_ON_DEBUG
Date: Fri, 23 Jul 2021 20:31:47 +0000	[thread overview]
Message-ID: <bc659850d4eec3b2358c1ccb0e00952ceaa6012f.1627068552.git.geoff@infradead.org> (raw)
In-Reply-To: <cover.1627068552.git.geoff@infradead.org>

Add a new preprocessor macro BUG_ON_DEBUG, that expands to BUG_ON when
the preprocessor macro DEBUG is defined, or to WARN_ON when DEBUG is not
defined.  Also, replace all occurrences of BUG_ON with BUG_ON_DEBUG.

Signed-off-by: Geoff Levand <geoff@infradead.org>
---
 drivers/net/ethernet/toshiba/ps3_gelic_net.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/toshiba/ps3_gelic_net.c b/drivers/net/ethernet/toshiba/ps3_gelic_net.c
index ded467d81f36..946e9bfa071b 100644
--- a/drivers/net/ethernet/toshiba/ps3_gelic_net.c
+++ b/drivers/net/ethernet/toshiba/ps3_gelic_net.c
@@ -44,6 +44,13 @@ MODULE_AUTHOR("SCE Inc.");
 MODULE_DESCRIPTION("Gelic Network driver");
 MODULE_LICENSE("GPL");
 
+#define BUG_ON_DEBUG(_cond) do { \
+	if (__is_defined(DEBUG)) \
+		BUG_ON(_cond); \
+	else \
+		WARN_ON(_cond); \
+} while (0)
+
 int gelic_card_set_irq_mask(struct gelic_card *card, u64 mask)
 {
 	struct device *dev = ctodev(card);
@@ -505,7 +512,7 @@ static void gelic_descr_release_tx(struct gelic_card *card,
 	struct sk_buff *skb = descr->skb;
 	struct device *dev = ctodev(card);
 
-	BUG_ON(!(be32_to_cpu(descr->hw_regs.data_status) &
+	BUG_ON_DEBUG(!(be32_to_cpu(descr->hw_regs.data_status) &
 		GELIC_DESCR_TX_TAIL));
 
 	dma_unmap_single(dev, be32_to_cpu(descr->hw_regs.payload.dev_addr),
@@ -1667,7 +1674,7 @@ static void gelic_card_get_vlan_info(struct gelic_card *card)
 	}
 
 	if (card->vlan[GELIC_PORT_ETHERNET_0].tx) {
-		BUG_ON(!card->vlan[GELIC_PORT_WIRELESS].tx);
+		BUG_ON_DEBUG(!card->vlan[GELIC_PORT_WIRELESS].tx);
 		card->vlan_required = 1;
 	} else
 		card->vlan_required = 0;
@@ -1709,7 +1716,7 @@ static int ps3_gelic_driver_probe(struct ps3_system_bus_device *sb_dev)
 	if (result) {
 		dev_err(dev, "%s:%d: ps3_dma_region_create failed: %d\n",
 			__func__, __LINE__, result);
-		BUG_ON("check region type");
+		BUG_ON_DEBUG("check region type");
 		goto fail_dma_region;
 	}
 
-- 
2.25.1



  parent reply	other threads:[~2021-07-23 20:33 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-23 20:31 [PATCH v4 00/10] DMA fixes for PS3 gelic network driver Geoff Levand
2021-07-23 20:31 ` [PATCH v4 01/10] net/ps3_gelic: Add gelic_descr structures Geoff Levand
2021-08-05  5:03   ` Christophe Leroy
2021-07-23 20:31 ` [PATCH v4 02/10] net/ps3_gelic: Use local dev variable Geoff Levand
2021-07-24 15:51   ` Christophe Leroy
2021-08-05  5:05   ` Christophe Leroy
2021-07-23 20:31 ` [PATCH v4 05/10] net/ps3_gelic: Add vlan_id structure Geoff Levand
2021-08-05  5:07   ` Christophe Leroy
2021-07-23 20:31 ` [PATCH v4 06/10] net/ps3_gelic: Cleanup debug code Geoff Levand
2021-08-05  5:08   ` Christophe Leroy
2021-07-23 20:31 ` [PATCH v4 03/10] net/ps3_gelic: Format cleanups Geoff Levand
2021-07-24 15:44   ` Christophe Leroy
2021-08-05  5:06   ` Christophe Leroy
2021-07-23 20:31 ` [PATCH v4 07/10] net/ps3_gelic: Add new routine gelic_unmap_link Geoff Levand
2021-08-05  5:09   ` Christophe Leroy
2021-07-23 20:31 ` [PATCH v4 08/10] net/ps3_gelic: Rename no to descr_count Geoff Levand
2021-07-25 18:27   ` Christophe Leroy
2021-08-05  5:09   ` Christophe Leroy
2021-07-23 20:31 ` Geoff Levand [this message]
2021-07-25 18:20   ` [PATCH v4 04/10] net/ps3_gelic: Add new macro BUG_ON_DEBUG Christophe Leroy
2021-08-05  5:07   ` Christophe Leroy
2021-07-23 20:31 ` [PATCH v4 10/10] net/ps3_gelic: Fix DMA mapping problems Geoff Levand
2021-07-25 18:38   ` Christophe Leroy
2021-08-05  5:10   ` Christophe Leroy
2021-07-23 20:31 ` [PATCH v4 09/10] net/ps3_gelic: Add new routine gelic_work_to_card Geoff Levand
2021-07-25 18:29   ` Christophe Leroy
2021-08-05  5:10   ` Christophe Leroy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bc659850d4eec3b2358c1ccb0e00952ceaa6012f.1627068552.git.geoff@infradead.org \
    --to=geoff@infradead.org \
    --cc=davem@davemloft.net \
    --cc=kuba@kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).