treewide: let dev_WARN() accept a condition

WARN() accepts a condition, so it's only fair that
dev_WARN() accepts one too.

Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
diff --git a/drivers/base/core.c b/drivers/base/core.c
index 0a8bdad..b405b77 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -2155,7 +2155,7 @@
 	return pos;
 
 overflow:
-	dev_WARN(dev, "device/subsystem name too long");
+	dev_WARN(dev, true, "device/subsystem name too long");
 	return 0;
 }
 
diff --git a/drivers/dma/dw/core.c b/drivers/dma/dw/core.c
index edf053f..a6faf6d 100644
--- a/drivers/dma/dw/core.c
+++ b/drivers/dma/dw/core.c
@@ -487,8 +487,10 @@
 	 * controller flagged an error instead of scribbling over
 	 * random memory locations.
 	 */
-	dev_WARN(chan2dev(&dwc->chan), "Bad descriptor submitted for DMA!\n"
-				       "  cookie: %d\n", bad_desc->txd.cookie);
+
+	dev_WARN(chan2dev(&dwc->chan), true,
+		 "Bad descriptor submitted for DMA!\n  cookie: %d\n",
+		 bad_desc->txd.cookie);
 	dwc_dump_lli(dwc, bad_desc);
 	list_for_each_entry(child, &bad_desc->tx_list, desc_node)
 		dwc_dump_lli(dwc, child);
diff --git a/drivers/dma/ioat/init.c b/drivers/dma/ioat/init.c
index d406056..ee030de 100644
--- a/drivers/dma/ioat/init.c
+++ b/drivers/dma/ioat/init.c
@@ -729,7 +729,7 @@
 
 	chanerr = readl(ioat_chan->reg_base + IOAT_CHANERR_OFFSET);
 
-	dev_WARN(to_dev(ioat_chan),
+	dev_WARN(to_dev(ioat_chan), true,
 		 "failed to start channel chanerr: %#x\n", chanerr);
 	ioat_free_chan_resources(c);
 	return -EFAULT;
diff --git a/drivers/media/platform/exynos4-is/fimc-is.c b/drivers/media/platform/exynos4-is/fimc-is.c
index 979c388..bf2a54e 100644
--- a/drivers/media/platform/exynos4-is/fimc-is.c
+++ b/drivers/media/platform/exynos4-is/fimc-is.c
@@ -297,10 +297,10 @@
 	int ret = wait_event_timeout(is->irq_queue,
 				     !state ^ test_bit(bit, &is->state),
 				     timeout);
-	if (ret == 0) {
-		dev_WARN(&is->pdev->dev, "%s() timed out\n", __func__);
+
+	if (dev_WARN(&is->pdev->dev, ret == 0, "%s() timed out\n", __func__))
 		return -ETIME;
-	}
+
 	return 0;
 }
 
diff --git a/drivers/media/platform/exynos4-is/mipi-csis.c b/drivers/media/platform/exynos4-is/mipi-csis.c
index bf95442..c09ed39 100644
--- a/drivers/media/platform/exynos4-is/mipi-csis.c
+++ b/drivers/media/platform/exynos4-is/mipi-csis.c
@@ -844,7 +844,7 @@
 		ret = clk_set_rate(state->clock[CSIS_CLK_MUX],
 				   state->clk_frequency);
 	else
-		dev_WARN(dev, "No clock frequency specified!\n");
+		dev_WARN(dev, true, "No clock frequency specified!\n");
 	if (ret < 0)
 		goto e_clkput;
 
diff --git a/drivers/pci/host/pci-mvebu.c b/drivers/pci/host/pci-mvebu.c
index 6b451df..d4b4919 100644
--- a/drivers/pci/host/pci-mvebu.c
+++ b/drivers/pci/host/pci-mvebu.c
@@ -397,11 +397,9 @@
 		return;
 	}
 
-	if (!mvebu_has_ioport(port)) {
-		dev_WARN(&port->pcie->pdev->dev,
-			 "Attempt to set IO when IO is disabled\n");
+	if (dev_WARN(&port->pcie->pdev->dev, !mvebu_has_ioport(port),
+				"Attempt to set IO when IO is disabled\n"))
 		return;
-	}
 
 	/*
 	 * We read the PCI-to-PCI bridge emulated registers, and
diff --git a/drivers/phy/phy-core.c b/drivers/phy/phy-core.c
index b72e9a3..d2a188ad 100644
--- a/drivers/phy/phy-core.c
+++ b/drivers/phy/phy-core.c
@@ -502,10 +502,8 @@
 	int index = 0;
 	struct phy *phy;
 
-	if (string == NULL) {
-		dev_WARN(dev, "missing string\n");
+	if (dev_WARN(dev, string == NULL, "missing string\n"))
 		return ERR_PTR(-EINVAL);
-	}
 
 	if (dev->of_node) {
 		index = of_property_match_string(dev->of_node, "phy-names",
diff --git a/drivers/regulator/pbias-regulator.c b/drivers/regulator/pbias-regulator.c
index f9d74d6..bdb0f14 100644
--- a/drivers/regulator/pbias-regulator.c
+++ b/drivers/regulator/pbias-regulator.c
@@ -177,7 +177,7 @@
 			return -EINVAL;
 
 		offset = res->start;
-		dev_WARN(&pdev->dev,
+		dev_WARN(&pdev->dev, true,
 			 "using legacy dt data for pbias offset\n");
 	}
 
diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index f8fa72c..db01c01 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -4319,9 +4319,9 @@
 	if (!err) {
 		dev_err(hba->dev, "%s: task management cmd 0x%.2x timed-out\n",
 				__func__, tm_function);
-		if (ufshcd_clear_tm_cmd(hba, free_slot))
-			dev_WARN(hba->dev, "%s: unable clear tm cmd (slot %d) after timeout\n",
-					__func__, free_slot);
+		dev_WARN(hba->dev, ufshcd_clear_tm_cmd(hba, free_slot),
+				"%s: unable clear tm cmd (slot %d) after timeout\n",
+				__func__, free_slot);
 		err = -ETIMEDOUT;
 	} else {
 		err = ufshcd_task_req_compl(hba, free_slot, tm_response);
diff --git a/drivers/thunderbolt/ctl.c b/drivers/thunderbolt/ctl.c
index 1146ff4..6ce3167 100644
--- a/drivers/thunderbolt/ctl.c
+++ b/drivers/thunderbolt/ctl.c
@@ -41,7 +41,7 @@
 
 
 #define tb_ctl_WARN(ctl, format, arg...) \
-	dev_WARN(&(ctl)->nhi->pdev->dev, format, ## arg)
+	dev_WARN(&(ctl)->nhi->pdev->dev, true, format, ## arg)
 
 #define tb_ctl_err(ctl, format, arg...) \
 	dev_err(&(ctl)->nhi->pdev->dev, format, ## arg)
diff --git a/drivers/thunderbolt/nhi.c b/drivers/thunderbolt/nhi.c
index 9c15344..631c0c4 100644
--- a/drivers/thunderbolt/nhi.c
+++ b/drivers/thunderbolt/nhi.c
@@ -52,11 +52,10 @@
 		 "%s interrupt at register %#x bit %d (%#x -> %#x)\n",
 		 active ? "enabling" : "disabling", reg, bit, old, new);
 
-	if (new == old)
-		dev_WARN(&ring->nhi->pdev->dev,
-					 "interrupt for %s %d is already %s\n",
-					 RING_TYPE(ring), ring->hop,
-					 active ? "enabled" : "disabled");
+	dev_WARN(&ring->nhi->pdev->dev, new == old,
+			"interrupt for %s %d is already %s\n",
+			RING_TYPE(ring), ring->hop,
+			active ? "enabled" : "disabled");
 	iowrite32(new, ring->nhi->iobase + reg);
 }
 
@@ -190,11 +189,10 @@
 			frame->eof = ring->descriptors[ring->tail].eof;
 			frame->sof = ring->descriptors[ring->tail].sof;
 			frame->flags = ring->descriptors[ring->tail].flags;
-			if (frame->sof != 0)
-				dev_WARN(&ring->nhi->pdev->dev,
-					 "%s %d got unexpected SOF: %#x\n",
-					 RING_TYPE(ring), ring->hop,
-					 frame->sof);
+			dev_WARN(&ring->nhi->pdev->dev, frame->sof != 0,
+					"%s %d got unexpected SOF: %#x\n",
+					RING_TYPE(ring), ring->hop,
+					frame->sof);
 			/*
 			 * known flags:
 			 * raw not enabled, interupt not set: 0x2=0010
@@ -202,11 +200,10 @@
 			 * raw not enabled: 0xb=1011
 			 * partial frame (>MAX_FRAME_SIZE): 0xe=1110
 			 */
-			if (frame->flags != 0xa)
-				dev_WARN(&ring->nhi->pdev->dev,
-					 "%s %d got unexpected flags: %#x\n",
-					 RING_TYPE(ring), ring->hop,
-					 frame->flags);
+			dev_WARN(&ring->nhi->pdev->dev, frame->flags != 0xa,
+					"%s %d got unexpected flags: %#x\n",
+					RING_TYPE(ring), ring->hop,
+					frame->flags);
 		}
 		ring->tail = (ring->tail + 1) % ring->size;
 	}
@@ -247,17 +244,17 @@
 		 transmit ? "TX" : "RX", hop, size);
 
 	mutex_lock(&nhi->lock);
-	if (hop >= nhi->hop_count) {
-		dev_WARN(&nhi->pdev->dev, "invalid hop: %d\n", hop);
+	if (dev_WARN(&nhi->pdev->dev, hop >= nhi->hop_count,
+					"invalid hop: %d\n", hop))
 		goto err;
-	}
-	if (transmit && nhi->tx_rings[hop]) {
-		dev_WARN(&nhi->pdev->dev, "TX hop %d already allocated\n", hop);
+
+	if (dev_WARN(&nhi->pdev->dev, transmit && nhi->tx_rings[hop],
+					"TX hop %d already allocated\n", hop))
 		goto err;
-	} else if (!transmit && nhi->rx_rings[hop]) {
-		dev_WARN(&nhi->pdev->dev, "RX hop %d already allocated\n", hop);
+	else if (dev_WARN(&nhi->pdev->dev, !transmit && nhi->rx_rings[hop],
+					"RX hop %d already allocated\n", hop))
 		goto err;
-	}
+
 	ring = kzalloc(sizeof(*ring), GFP_KERNEL);
 	if (!ring)
 		goto err;
@@ -314,10 +311,10 @@
 {
 	mutex_lock(&ring->nhi->lock);
 	mutex_lock(&ring->lock);
-	if (ring->running) {
-		dev_WARN(&ring->nhi->pdev->dev, "ring already started\n");
+	if (dev_WARN(&ring->nhi->pdev->dev, ring->running,
+					"ring already started\n"))
 		goto err;
-	}
+
 	dev_info(&ring->nhi->pdev->dev, "starting %s %d\n",
 		 RING_TYPE(ring), ring->hop);
 
@@ -360,11 +357,11 @@
 	mutex_lock(&ring->lock);
 	dev_info(&ring->nhi->pdev->dev, "stopping %s %d\n",
 		 RING_TYPE(ring), ring->hop);
-	if (!ring->running) {
-		dev_WARN(&ring->nhi->pdev->dev, "%s %d already stopped\n",
-			 RING_TYPE(ring), ring->hop);
+	if (dev_WARN(&ring->nhi->pdev->dev, !ring->running,
+					"%s %d already stopped\n",
+					RING_TYPE(ring), ring->hop))
 		goto err;
-	}
+
 	ring_interrupt_active(ring, false);
 
 	ring_iowrite32options(ring, 0, 0);
@@ -408,11 +405,8 @@
 	else
 		ring->nhi->rx_rings[ring->hop] = NULL;
 
-	if (ring->running) {
-		dev_WARN(&ring->nhi->pdev->dev, "%s %d still running\n",
-			 RING_TYPE(ring), ring->hop);
-	}
-
+	dev_WARN(&ring->nhi->pdev->dev, ring->running,
+			"%s %d still running\n", RING_TYPE(ring), ring->hop);
 	dma_free_coherent(&ring->nhi->pdev->dev,
 			  ring->size * sizeof(*ring->descriptors),
 			  ring->descriptors, ring->descriptors_dma);
@@ -516,12 +510,10 @@
 	dev_info(&nhi->pdev->dev, "shutdown\n");
 
 	for (i = 0; i < nhi->hop_count; i++) {
-		if (nhi->tx_rings[i])
-			dev_WARN(&nhi->pdev->dev,
-				 "TX ring %d is still active\n", i);
-		if (nhi->rx_rings[i])
-			dev_WARN(&nhi->pdev->dev,
-				 "RX ring %d is still active\n", i);
+		dev_WARN(&nhi->pdev->dev, nhi->tx_rings[i],
+				"TX ring %d is still active\n", i);
+		dev_WARN(&nhi->pdev->dev, nhi->rx_rings[i],
+				"RX ring %d is still active\n", i);
 	}
 	nhi_disable_interrupts(nhi);
 	/*
diff --git a/drivers/thunderbolt/path.c b/drivers/thunderbolt/path.c
index 9562cd0..39eebaa 100644
--- a/drivers/thunderbolt/path.c
+++ b/drivers/thunderbolt/path.c
@@ -53,7 +53,7 @@
 void tb_path_free(struct tb_path *path)
 {
 	if (path->activated) {
-		tb_WARN(path->tb, "trying to free an activated path\n")
+		tb_WARN(path->tb, "trying to free an activated path\n");
 		return;
 	}
 	kfree(path->hops);
diff --git a/drivers/thunderbolt/tb.h b/drivers/thunderbolt/tb.h
index 61d57ba..85ffb71 100644
--- a/drivers/thunderbolt/tb.h
+++ b/drivers/thunderbolt/tb.h
@@ -186,7 +186,7 @@
 }
 
 #define tb_err(tb, fmt, arg...) dev_err(&(tb)->nhi->pdev->dev, fmt, ## arg)
-#define tb_WARN(tb, fmt, arg...) dev_WARN(&(tb)->nhi->pdev->dev, fmt, ## arg)
+#define tb_WARN(tb, fmt, arg...) dev_WARN(&(tb)->nhi->pdev->dev, true, fmt, ## arg)
 #define tb_warn(tb, fmt, arg...) dev_warn(&(tb)->nhi->pdev->dev, fmt, ## arg)
 #define tb_info(tb, fmt, arg...) dev_info(&(tb)->nhi->pdev->dev, fmt, ## arg)
 
diff --git a/drivers/usb/core/urb.c b/drivers/usb/core/urb.c
index c601e25..2509fc1 100644
--- a/drivers/usb/core/urb.c
+++ b/drivers/usb/core/urb.c
@@ -444,8 +444,8 @@
 	 */
 
 	/* Check that the pipe's type matches the endpoint's type */
-	if (usb_pipetype(urb->pipe) != pipetypes[xfertype])
-		dev_WARN(&dev->dev, "BOGUS urb xfer, pipe %x != type %x\n",
+	dev_WARN(&dev->dev, usb_pipetype(urb->pipe) != pipetypes[xfertype],
+			"BOGUS urb xfer, pipe %x != type %x\n",
 			usb_pipetype(urb->pipe), pipetypes[xfertype]);
 
 	/* Check against a simple/standard policy */
@@ -471,8 +471,8 @@
 	allowed &= urb->transfer_flags;
 
 	/* warn if submitter gave bogus flags */
-	if (allowed != urb->transfer_flags)
-		dev_WARN(&dev->dev, "BOGUS urb flags, %x --> %x\n",
+	dev_WARN(&dev->dev, allowed != urb->transfer_flags,
+			"BOGUS urb flags, %x --> %x\n",
 			urb->transfer_flags, allowed);
 
 	/*
diff --git a/drivers/usb/dwc3/dwc3-omap.c b/drivers/usb/dwc3/dwc3-omap.c
index af26449..9e835e3 100644
--- a/drivers/usb/dwc3/dwc3-omap.c
+++ b/drivers/usb/dwc3/dwc3-omap.c
@@ -264,7 +264,7 @@
 		break;
 
 	default:
-		dev_WARN(omap->dev, "invalid state\n");
+		dev_WARN(omap->dev, true, "invalid state\n");
 	}
 }
 
@@ -391,7 +391,7 @@
 		reg &= ~USBOTGSS_UTMI_OTG_CTRL_SW_MODE;
 		break;
 	default:
-		dev_WARN(omap->dev, "UNKNOWN utmi mode %d\n", utmi_mode);
+		dev_WARN(omap->dev, true, "UNKNOWN utmi mode %d\n", utmi_mode);
 	}
 
 	dwc3_omap_write_utmi_ctrl(omap, reg);
diff --git a/drivers/usb/dwc3/ep0.c b/drivers/usb/dwc3/ep0.c
index 51b52a7..34aae5a 100644
--- a/drivers/usb/dwc3/ep0.c
+++ b/drivers/usb/dwc3/ep0.c
@@ -140,10 +140,9 @@
 
 		direction = !!(dep->flags & DWC3_EP0_DIR_IN);
 
-		if (dwc->ep0state != EP0_DATA_PHASE) {
-			dev_WARN(dwc->dev, "Unexpected pending request\n");
+		if (dev_WARN(dwc->dev, dwc->ep0state != EP0_DATA_PHASE,
+						"Unexpected pending request\n"))
 			return 0;
-		}
 
 		__dwc3_ep0_do_control_data(dwc, dwc->eps[direction], req);
 
diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index 07248ff..56e7240 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -2676,7 +2676,7 @@
 		dwc3_trace(trace_dwc3_gadget, "Overflow");
 		break;
 	default:
-		dev_WARN(dwc->dev, "UNKNOWN IRQ %d\n", event->type);
+		dev_WARN(dwc->dev, true, "UNKNOWN IRQ %d\n", event->type);
 	}
 }
 
diff --git a/drivers/usb/host/uhci-q.c b/drivers/usb/host/uhci-q.c
index c17ea15..f097a27 100644
--- a/drivers/usb/host/uhci-q.c
+++ b/drivers/usb/host/uhci-q.c
@@ -123,10 +123,11 @@
 
 static void uhci_free_td(struct uhci_hcd *uhci, struct uhci_td *td)
 {
-	if (!list_empty(&td->list))
-		dev_WARN(uhci_dev(uhci), "td %p still in list!\n", td);
-	if (!list_empty(&td->fl_list))
-		dev_WARN(uhci_dev(uhci), "td %p still in fl_list!\n", td);
+	dev_WARN(uhci_dev(uhci), !list_empty(&td->list),
+			"td %p still in list!\n", td);
+
+	dev_WARN(uhci_dev(uhci), !list_empty(&td->fl_list),
+			"td %p still in fl_list!\n", td);
 
 	dma_pool_free(uhci->td_pool, td, td->dma_handle);
 }
@@ -292,8 +293,9 @@
 static void uhci_free_qh(struct uhci_hcd *uhci, struct uhci_qh *qh)
 {
 	WARN_ON(qh->state != QH_STATE_IDLE && qh->udev);
-	if (!list_empty(&qh->queue))
-		dev_WARN(uhci_dev(uhci), "qh %p list not empty!\n", qh);
+
+	dev_WARN(uhci_dev(uhci), !list_empty(&qh->queue),
+			"qh %p list not empty!\n", qh);
 
 	list_del(&qh->node);
 	if (qh->udev) {
@@ -742,9 +744,9 @@
 {
 	struct uhci_td *td, *tmp;
 
-	if (!list_empty(&urbp->node))
-		dev_WARN(uhci_dev(uhci), "urb %p still on QH's list!\n",
-				urbp->urb);
+	dev_WARN(uhci_dev(uhci), !list_empty(&urbp->node),
+			"urb %p still on QH's list!\n",
+			urbp->urb);
 
 	list_for_each_entry_safe(td, tmp, &urbp->td_list, list) {
 		uhci_remove_td_from_urbp(td);
diff --git a/include/linux/device.h b/include/linux/device.h
index 38f0281..b378c86 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -1309,8 +1309,9 @@
  * dev_WARN*() acts like dev_printk(), but with the key difference of
  * using WARN/WARN_ONCE to include file/line information and a backtrace.
  */
-#define dev_WARN(dev, format, arg...) \
-	WARN(1, "%s %s: " format, dev_driver_string(dev), dev_name(dev), ## arg);
+#define dev_WARN(dev, condition, format, arg...)		\
+	WARN(condition, "%s %s: " format,			\
+			dev_driver_string(dev), dev_name(dev), ## arg)
 
 #define dev_WARN_ONCE(dev, condition, format, arg...) \
 	WARN_ONCE(condition, "%s %s: " format, \