treewide: let dev_WARN() accept a condition
Subsystems (15)
PATCH 1/1 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 <[email protected]>
--- drivers/base/core.c | 2 +- drivers/dma/dw/core.c | 6 ++- drivers/dma/ioat/init.c | 2 +- drivers/media/platform/exynos4-is/fimc-is.c | 6 +-- drivers/media/platform/exynos4-is/mipi-csis.c | 2 +- drivers/pci/host/pci-mvebu.c | 6 +-- drivers/phy/phy-core.c | 4 +- drivers/regulator/pbias-regulator.c | 2 +- drivers/scsi/ufs/ufshcd.c | 6 +-- drivers/thunderbolt/ctl.c | 2 +- drivers/thunderbolt/nhi.c | 74 ++++++++++++--------------- drivers/thunderbolt/path.c | 2 +- drivers/thunderbolt/tb.h | 2 +- drivers/usb/core/urb.c | 8 +-- drivers/usb/dwc3/dwc3-omap.c | 4 +- drivers/usb/dwc3/ep0.c | 5 +- drivers/usb/dwc3/gadget.c | 2 +- drivers/usb/host/uhci-q.c | 20 ++++---- include/linux/device.h | 5 +- 19 files changed, 76 insertions(+), 84 deletions(-)
drivers/base/core.c +1 -1
@@ -2155,7 +2155,7 @@ create_syslog_header(const struct device *dev, char *hdr, size_t hdrlen)return pos; overflow: -dev_WARN (dev,"device/subsystem name too long" ); +dev_WARN (dev, true,"device/subsystem name too long" );return 0 ; }
drivers/dma/dw/core.c +4 -2
@@ -506,8 +506,10 @@ static void dwc_handle_error(struct dw_dma *dw, struct dw_dma_chan *dwc)* 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->lli);list_for_each_entry (child, &bad_desc->tx_list, desc_node)dwc_dump_lli (dwc, &child->lli);
drivers/dma/ioat/init.c +1 -1
@@ -741,7 +741,7 @@ static int ioat_alloc_chan_resources(struct dma_chan *c) 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 ;
drivers/media/platform/exynos4-is/fimc-is.c +3 -3
@@ -297,10 +297,10 @@ int fimc_is_wait_event(struct fimc_is *is, unsigned long bit,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 ; }
drivers/media/platform/exynos4-is/mipi-csis.c +1 -1
@@ -838,7 +838,7 @@ static int s5pcsis_probe(struct platform_device *pdev) 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;
drivers/pci/host/pci-mvebu.c +2 -4
@@ -397,11 +397,9 @@ static void mvebu_pcie_handle_iobase_change(struct mvebu_pcie_port *port)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
drivers/phy/phy-core.c +1 -3
@@ -500,10 +500,8 @@ struct phy *phy_get(struct device *dev, const char *string)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",
drivers/regulator/pbias-regulator.c +1 -1
@@ -177,7 +177,7 @@ static int pbias_regulator_probe(struct platform_device *pdev)return -EINVAL ; offset = res->start; -dev_WARN (&pdev->dev, +dev_WARN (&pdev->dev, true,"using legacy dt data for pbias offset\n" ); }
drivers/scsi/ufs/ufshcd.c +3 -3
@@ -3751,9 +3751,9 @@ static int ufshcd_issue_tm_cmd(struct ufs_hba *hba, int lun_id, int task_id,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);
drivers/thunderbolt/ctl.c +1 -1
@@ -41,7 +41,7 @@ struct tb_ctl { #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)
drivers/thunderbolt/nhi.c +33 -41
127 lines not on this page · raw message
drivers/thunderbolt/path.c +1 -1
@@ -53,7 +53,7 @@ struct tb_path *tb_path_alloc(struct tb *tb, int num_hops)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);
drivers/thunderbolt/tb.h +1 -1
@@ -186,7 +186,7 @@ static inline int tb_port_write(struct tb_port *port, void *buffer, } #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)
drivers/usb/core/urb.c +4 -4
@@ -444,8 +444,8 @@ int usb_submit_urb(struct urb *urb, gfp_t mem_flags)*/ /* 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 @@ int usb_submit_urb(struct urb *urb, gfp_t mem_flags) 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);/*
drivers/usb/dwc3/dwc3-omap.c +2 -2
@@ -266,7 +266,7 @@ static void dwc3_omap_set_mailbox(struct dwc3_omap *omap,break ;default : -dev_WARN (omap->dev,"invalid state\n" ); +dev_WARN (omap->dev, true,"invalid state\n" ); } }
@@ -398,7 +398,7 @@ static void dwc3_omap_set_utmi_mode(struct dwc3_omap *omap) 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);
drivers/usb/dwc3/ep0.c +2 -3
@@ -140,10 +140,9 @@ static int __dwc3_gadget_ep0_queue(struct dwc3_ep *dep, 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);
drivers/usb/dwc3/gadget.c +1 -1
@@ -2572,7 +2572,7 @@ static void dwc3_gadget_interrupt(struct dwc3 *dwc,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); } }
drivers/usb/host/uhci-q.c +11 -9
@@ -123,10 +123,11 @@ static struct uhci_td *uhci_alloc_td(struct uhci_hcd *uhci)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); }
@@ -293,8 +294,9 @@ static struct uhci_qh *uhci_alloc_qh(struct uhci_hcd *uhci,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) {
@@ -743,9 +745,9 @@ static void uhci_free_urb_priv(struct uhci_hcd *uhci, {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);
include/linux/device.h +3 -2
@@ -1288,8 +1288,9 @@ do { \* 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, \
Signature · 1 line
2.6.3
Quoted 4 lines · Felipe Balbi
WARN()accepts a condition, so it's only fair thatdev_WARN()accepts one too.Signed-off-by Felipe Balbi <[email protected]>