summaryrefslogtreecommitdiffstats
path: root/drivers/uwb/whc-rc.c
diff options
context:
space:
mode:
authorDavid Vrabel <david.vrabel@csr.com>2008-12-22 19:22:50 +0100
committerDavid Vrabel <david.vrabel@csr.com>2008-12-22 19:22:50 +0100
commitbce83697c5fe84a7a5d38c96fbbe43b4bc028c3e (patch)
treeb8e920af66f5b4de509e95a7295cedbe42878dd6 /drivers/uwb/whc-rc.c
parentuwb: fix memory leak in uwb_rc_notif() (diff)
downloadlinux-bce83697c5fe84a7a5d38c96fbbe43b4bc028c3e.tar.xz
linux-bce83697c5fe84a7a5d38c96fbbe43b4bc028c3e.zip
uwb: use dev_dbg() for debug messages
Instead of the home-grown d_fnstart(), d_fnend() and d_printf() macros, use dev_dbg() or remove the message entirely. Signed-off-by: David Vrabel <david.vrabel@csr.com>
Diffstat (limited to 'drivers/uwb/whc-rc.c')
-rw-r--r--drivers/uwb/whc-rc.c53
1 files changed, 9 insertions, 44 deletions
diff --git a/drivers/uwb/whc-rc.c b/drivers/uwb/whc-rc.c
index 5f00386e26c7..19a1dd129212 100644
--- a/drivers/uwb/whc-rc.c
+++ b/drivers/uwb/whc-rc.c
@@ -48,10 +48,8 @@
#include <linux/uwb.h>
#include <linux/uwb/whci.h>
#include <linux/uwb/umc.h>
-#include "uwb-internal.h"
-#define D_LOCAL 0
-#include <linux/uwb/debug.h>
+#include "uwb-internal.h"
/**
* Descriptor for an instance of the UWB Radio Control Driver that
@@ -97,13 +95,8 @@ static int whcrc_cmd(struct uwb_rc *uwb_rc,
struct device *dev = &whcrc->umc_dev->dev;
u32 urccmd;
- d_fnstart(3, dev, "(%p, %p, %zu)\n", uwb_rc, cmd, cmd_size);
- might_sleep();
-
- if (cmd_size >= 4096) {
- result = -E2BIG;
- goto error;
- }
+ if (cmd_size >= 4096)
+ return -EINVAL;
/*
* If the URC is halted, then the hardware has reset itself.
@@ -114,16 +107,14 @@ static int whcrc_cmd(struct uwb_rc *uwb_rc,
if (le_readl(whcrc->rc_base + URCSTS) & URCSTS_HALTED) {
dev_err(dev, "requesting reset of halted radio controller\n");
uwb_rc_reset_all(uwb_rc);
- result = -EIO;
- goto error;
+ return -EIO;
}
result = wait_event_timeout(whcrc->cmd_wq,
!(le_readl(whcrc->rc_base + URCCMD) & URCCMD_ACTIVE), HZ/2);
if (result == 0) {
dev_err(dev, "device is not ready to execute commands\n");
- result = -ETIMEDOUT;
- goto error;
+ return -ETIMEDOUT;
}
memmove(whcrc->cmd_buf, cmd, cmd_size);
@@ -136,10 +127,7 @@ static int whcrc_cmd(struct uwb_rc *uwb_rc,
whcrc->rc_base + URCCMD);
spin_unlock(&whcrc->irq_lock);
-error:
- d_fnend(3, dev, "(%p, %p, %zu) = %d\n",
- uwb_rc, cmd, cmd_size, result);
- return result;
+ return 0;
}
static int whcrc_reset(struct uwb_rc *rc)
@@ -166,34 +154,25 @@ static int whcrc_reset(struct uwb_rc *rc)
static
void whcrc_enable_events(struct whcrc *whcrc)
{
- struct device *dev = &whcrc->umc_dev->dev;
u32 urccmd;
- d_fnstart(4, dev, "(whcrc %p)\n", whcrc);
-
le_writeq(whcrc->evt_dma_buf, whcrc->rc_base + URCEVTADDR);
spin_lock(&whcrc->irq_lock);
urccmd = le_readl(whcrc->rc_base + URCCMD) & ~URCCMD_ACTIVE;
le_writel(urccmd | URCCMD_EARV, whcrc->rc_base + URCCMD);
spin_unlock(&whcrc->irq_lock);
-
- d_fnend(4, dev, "(whcrc %p) = void\n", whcrc);
}
static void whcrc_event_work(struct work_struct *work)
{
struct whcrc *whcrc = container_of(work, struct whcrc, event_work);
- struct device *dev = &whcrc->umc_dev->dev;
size_t size;
u64 urcevtaddr;
urcevtaddr = le_readq(whcrc->rc_base + URCEVTADDR);
size = urcevtaddr & URCEVTADDR_OFFSET_MASK;
- d_printf(3, dev, "received %zu octet event\n", size);
- d_dump(4, dev, whcrc->evt_buf, size > 32 ? 32 : size);
-
uwb_rc_neh_grok(whcrc->uwb_rc, whcrc->evt_buf, size);
whcrc_enable_events(whcrc);
}
@@ -216,22 +195,15 @@ irqreturn_t whcrc_irq_cb(int irq, void *_whcrc)
return IRQ_NONE;
le_writel(urcsts & URCSTS_INT_MASK, whcrc->rc_base + URCSTS);
- d_printf(4, dev, "acked 0x%08x, urcsts 0x%08x\n",
- le_readl(whcrc->rc_base + URCSTS), urcsts);
-
if (urcsts & URCSTS_HSE) {
dev_err(dev, "host system error -- hardware halted\n");
/* FIXME: do something sensible here */
goto out;
}
- if (urcsts & URCSTS_ER) {
- d_printf(3, dev, "ER: event ready\n");
+ if (urcsts & URCSTS_ER)
schedule_work(&whcrc->event_work);
- }
- if (urcsts & URCSTS_RCI) {
- d_printf(3, dev, "RCI: ready to execute another command\n");
+ if (urcsts & URCSTS_RCI)
wake_up_all(&whcrc->cmd_wq);
- }
out:
return IRQ_HANDLED;
}
@@ -250,8 +222,7 @@ int whcrc_setup_rc_umc(struct whcrc *whcrc)
whcrc->area = umc_dev->resource.start;
whcrc->rc_len = umc_dev->resource.end - umc_dev->resource.start + 1;
result = -EBUSY;
- if (request_mem_region(whcrc->area, whcrc->rc_len, KBUILD_MODNAME)
- == NULL) {
+ if (request_mem_region(whcrc->area, whcrc->rc_len, KBUILD_MODNAME) == NULL) {
dev_err(dev, "can't request URC region (%zu bytes @ 0x%lx): %d\n",
whcrc->rc_len, whcrc->area, result);
goto error_request_region;
@@ -286,8 +257,6 @@ int whcrc_setup_rc_umc(struct whcrc *whcrc)
dev_err(dev, "Can't allocate evt transfer buffer\n");
goto error_evt_buffer;
}
- d_printf(3, dev, "UWB RC Interface: %zu bytes at 0x%p, irq %u\n",
- whcrc->rc_len, whcrc->rc_base, umc_dev->irq);
return 0;
error_evt_buffer:
@@ -396,7 +365,6 @@ int whcrc_probe(struct umc_dev *umc_dev)
struct whcrc *whcrc;
struct device *dev = &umc_dev->dev;
- d_fnstart(3, dev, "(umc_dev %p)\n", umc_dev);
result = -ENOMEM;
uwb_rc = uwb_rc_alloc();
if (uwb_rc == NULL) {
@@ -428,7 +396,6 @@ int whcrc_probe(struct umc_dev *umc_dev)
if (result < 0)
goto error_rc_add;
umc_set_drvdata(umc_dev, whcrc);
- d_fnend(3, dev, "(umc_dev %p) = 0\n", umc_dev);
return 0;
error_rc_add:
@@ -438,7 +405,6 @@ error_setup_rc_umc:
error_alloc:
uwb_rc_put(uwb_rc);
error_rc_alloc:
- d_fnend(3, dev, "(umc_dev %p) = %d\n", umc_dev, result);
return result;
}
@@ -461,7 +427,6 @@ static void whcrc_remove(struct umc_dev *umc_dev)
whcrc_release_rc_umc(whcrc);
kfree(whcrc);
uwb_rc_put(uwb_rc);
- d_printf(1, &umc_dev->dev, "freed whcrc %p\n", whcrc);
}
static int whcrc_pre_reset(struct umc_dev *umc)