linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] wl12xx: sdio: use dev_dbg instead of wl1271_debug
@ 2011-10-07 11:34 Luciano Coelho
  2011-10-07 11:34 ` [PATCH 2/2] wl12xx: spi: use dev_err instead of wl1271_error Luciano Coelho
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Luciano Coelho @ 2011-10-07 11:34 UTC (permalink / raw)
  To: linux-wireless; +Cc: coelho

To prevent a useless dependency between the sdio module and the wl12xx
module, we need to replace the wl1271_debug macros (and friends) for
dev_dbg and other equivalents.

At the same time, remove the SDIO data hexdump, since this produces
way too much data and is not particularly useful.  There's not
print_hex_dump() equivalent for dynamic debug, so it's hard to control
when the dumps are printed out.

Signed-off-by: Luciano Coelho <coelho@ti.com>
---
 drivers/net/wireless/wl12xx/sdio.c |   47 ++++++++++++++++-------------------
 1 files changed, 22 insertions(+), 25 deletions(-)

diff --git a/drivers/net/wireless/wl12xx/sdio.c b/drivers/net/wireless/wl12xx/sdio.c
index 55c63ad..50fdd9b 100644
--- a/drivers/net/wireless/wl12xx/sdio.c
+++ b/drivers/net/wireless/wl12xx/sdio.c
@@ -34,7 +34,6 @@
 #include <linux/pm_runtime.h>
 
 #include "wl12xx.h"
-#include "debug.h"
 #include "wl12xx_80211.h"
 #include "io.h"
 
@@ -77,21 +76,20 @@ static void wl12xx_sdio_raw_read(struct device *child, int addr, void *buf,
 
 	if (unlikely(addr == HW_ACCESS_ELP_CTRL_REG_ADDR)) {
 		((u8 *)buf)[0] = sdio_f0_readb(func, addr, &ret);
-		wl1271_debug(DEBUG_SDIO, "sdio read 52 addr 0x%x, byte 0x%02x",
-			     addr, ((u8 *)buf)[0]);
+		dev_dbg(child->parent, "sdio read 52 addr 0x%x, byte 0x%02x\n",
+			addr, ((u8 *)buf)[0]);
 	} else {
 		if (fixed)
 			ret = sdio_readsb(func, buf, addr, len);
 		else
 			ret = sdio_memcpy_fromio(func, buf, addr, len);
 
-		wl1271_debug(DEBUG_SDIO, "sdio read 53 addr 0x%x, %zu bytes",
-			     addr, len);
-		wl1271_dump_ascii(DEBUG_SDIO, "data: ", buf, len);
+		dev_dbg(child->parent, "sdio read 53 addr 0x%x, %zu bytes\n",
+			addr, len);
 	}
 
 	if (ret)
-		wl1271_error("sdio read failed (%d)", ret);
+		dev_err(child->parent, "sdio read failed (%d)\n", ret);
 }
 
 static void wl12xx_sdio_raw_write(struct device *child, int addr, void *buf,
@@ -103,12 +101,11 @@ static void wl12xx_sdio_raw_write(struct device *child, int addr, void *buf,
 
 	if (unlikely(addr == HW_ACCESS_ELP_CTRL_REG_ADDR)) {
 		sdio_f0_writeb(func, ((u8 *)buf)[0], addr, &ret);
-		wl1271_debug(DEBUG_SDIO, "sdio write 52 addr 0x%x, byte 0x%02x",
-			     addr, ((u8 *)buf)[0]);
+		dev_dbg(child->parent, "sdio write 52 addr 0x%x, byte 0x%02x\n",
+			addr, ((u8 *)buf)[0]);
 	} else {
-		wl1271_debug(DEBUG_SDIO, "sdio write 53 addr 0x%x, %zu bytes",
-			     addr, len);
-		wl1271_dump_ascii(DEBUG_SDIO, "data: ", buf, len);
+		dev_dbg(child->parent, "sdio write 53 addr 0x%x, %zu bytes\n",
+			addr, len);
 
 		if (fixed)
 			ret = sdio_writesb(func, addr, buf, len);
@@ -117,7 +114,7 @@ static void wl12xx_sdio_raw_write(struct device *child, int addr, void *buf,
 	}
 
 	if (ret)
-		wl1271_error("sdio write failed (%d)", ret);
+		dev_err(child->parent, "sdio write failed (%d)\n", ret);
 }
 
 static int wl12xx_sdio_power_on(struct wl12xx_sdio_glue *glue)
@@ -196,7 +193,7 @@ static int __devinit wl1271_probe(struct sdio_func *func,
 
 	glue = kzalloc(sizeof(*glue), GFP_KERNEL);
 	if (!glue) {
-		wl1271_error("can't allocate glue");
+		dev_err(&func->dev, "can't allocate glue\n");
 		goto out;
 	}
 
@@ -211,13 +208,13 @@ static int __devinit wl1271_probe(struct sdio_func *func,
 	wlan_data = wl12xx_get_platform_data();
 	if (IS_ERR(wlan_data)) {
 		ret = PTR_ERR(wlan_data);
-		wl1271_error("missing wlan platform data: %d", ret);
+		dev_err(glue->dev, "missing wlan platform data: %d\n", ret);
 		goto out_free_glue;
 	}
 
 	/* if sdio can keep power while host is suspended, enable wow */
 	mmcflags = sdio_get_host_pm_caps(func);
-	wl1271_debug(DEBUG_SDIO, "sdio PM caps = 0x%x", mmcflags);
+	dev_dbg(glue->dev, "sdio PM caps = 0x%x\n", mmcflags);
 
 	if (mmcflags & MMC_PM_KEEP_POWER)
 		wlan_data->pwr_in_suspend = true;
@@ -231,7 +228,7 @@ static int __devinit wl1271_probe(struct sdio_func *func,
 
 	glue->core = platform_device_alloc("wl12xx-sdio", -1);
 	if (!glue->core) {
-		wl1271_error("can't allocate platform_device");
+		dev_err(glue->dev, "can't allocate platform_device");
 		ret = -ENOMEM;
 		goto out_free_glue;
 	}
@@ -246,20 +243,20 @@ static int __devinit wl1271_probe(struct sdio_func *func,
 
 	ret = platform_device_add_resources(glue->core, res, ARRAY_SIZE(res));
 	if (ret) {
-		wl1271_error("can't add resources");
+		dev_err(glue->dev, "can't add resources\n");
 		goto out_dev_put;
 	}
 
 	ret = platform_device_add_data(glue->core, wlan_data,
 				       sizeof(*wlan_data));
 	if (ret) {
-		wl1271_error("can't add platform data");
+		dev_err(glue->dev, "can't add platform data\n");
 		goto out_dev_put;
 	}
 
 	ret = platform_device_add(glue->core);
 	if (ret) {
-		wl1271_error("can't add platform device");
+		dev_err(glue->dev, "can't add platform device\n");
 		goto out_dev_put;
 	}
 	return 0;
@@ -296,15 +293,15 @@ static int wl1271_suspend(struct device *dev)
 	mmc_pm_flag_t sdio_flags;
 	int ret = 0;
 
-	wl1271_debug(DEBUG_MAC80211, "wl1271 suspend. wow_enabled: %d",
-		     wl->wow_enabled);
+	dev_dbg(dev, "wl1271 suspend. wow_enabled: %d\n",
+		wl->wow_enabled);
 
 	/* check whether sdio should keep power */
 	if (wl->wow_enabled) {
 		sdio_flags = sdio_get_host_pm_caps(func);
 
 		if (!(sdio_flags & MMC_PM_KEEP_POWER)) {
-			wl1271_error("can't keep power while host "
+			dev_err(dev, "can't keep power while host \n"
 				     "is suspended");
 			ret = -EINVAL;
 			goto out;
@@ -313,7 +310,7 @@ static int wl1271_suspend(struct device *dev)
 		/* keep power while host suspended */
 		ret = sdio_set_host_pm_flags(func, MMC_PM_KEEP_POWER);
 		if (ret) {
-			wl1271_error("error while trying to keep power");
+			dev_err(dev, "error while trying to keep power\n");
 			goto out;
 		}
 
@@ -329,7 +326,7 @@ static int wl1271_resume(struct device *dev)
 	struct sdio_func *func = dev_to_sdio_func(dev);
 	struct wl1271 *wl = sdio_get_drvdata(func);
 
-	wl1271_debug(DEBUG_MAC80211, "wl1271 resume");
+	dev_dbg(dev, "wl1271 resume\n");
 	if (wl->wow_enabled) {
 		/* claim back host */
 		sdio_claim_host(func);
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] wl12xx: spi: use dev_err instead of wl1271_error
  2011-10-07 11:34 [PATCH 1/2] wl12xx: sdio: use dev_dbg instead of wl1271_debug Luciano Coelho
@ 2011-10-07 11:34 ` Luciano Coelho
  2011-10-09  0:08 ` [PATCH 1/2] wl12xx: sdio: use dev_dbg instead of wl1271_debug Eliad Peller
  2011-10-11 13:22 ` Luciano Coelho
  2 siblings, 0 replies; 5+ messages in thread
From: Luciano Coelho @ 2011-10-07 11:34 UTC (permalink / raw)
  To: linux-wireless; +Cc: coelho

To prevent a useless dependency between the spi module and the wl12xx
module, we need to replace the wl1271_error macros with dev_err.

At the same time, remove the SPI data hexdump, since this produces way
too much data and is not particularly useful.  There's no
print_hex_dump() equivalent for dynamic debug, so it's hard to control
when the dumps are printed out.

Signed-off-by: Luciano Coelho <coelho@ti.com>
---
 drivers/net/wireless/wl12xx/spi.c |   31 ++++++++++++-------------------
 1 files changed, 12 insertions(+), 19 deletions(-)

diff --git a/drivers/net/wireless/wl12xx/spi.c b/drivers/net/wireless/wl12xx/spi.c
index bcc7d7c..976d3d5 100644
--- a/drivers/net/wireless/wl12xx/spi.c
+++ b/drivers/net/wireless/wl12xx/spi.c
@@ -31,7 +31,6 @@
 #include <linux/slab.h>
 
 #include "wl12xx.h"
-#include "debug.h"
 #include "wl12xx_80211.h"
 #include "io.h"
 
@@ -85,7 +84,8 @@ static void wl12xx_spi_reset(struct device *child)
 
 	cmd = kzalloc(WSPI_INIT_CMD_LEN, GFP_KERNEL);
 	if (!cmd) {
-		wl1271_error("could not allocate cmd for spi reset");
+		dev_err(child->parent,
+			"could not allocate cmd for spi reset\n");
 		return;
 	}
 
@@ -100,7 +100,6 @@ static void wl12xx_spi_reset(struct device *child)
 
 	spi_sync(to_spi_device(glue->dev), &m);
 
-	wl1271_dump(DEBUG_SPI, "spi reset -> ", cmd, WSPI_INIT_CMD_LEN);
 	kfree(cmd);
 }
 
@@ -113,7 +112,8 @@ static void wl12xx_spi_init(struct device *child)
 
 	cmd = kzalloc(WSPI_INIT_CMD_LEN, GFP_KERNEL);
 	if (!cmd) {
-		wl1271_error("could not allocate cmd for spi init");
+		dev_err(child->parent,
+			"could not allocate cmd for spi init\n");
 		return;
 	}
 
@@ -155,7 +155,6 @@ static void wl12xx_spi_init(struct device *child)
 	spi_message_add_tail(&t, &m);
 
 	spi_sync(to_spi_device(glue->dev), &m);
-	wl1271_dump(DEBUG_SPI, "spi init -> ", cmd, WSPI_INIT_CMD_LEN);
 	kfree(cmd);
 }
 
@@ -192,7 +191,7 @@ static int wl12xx_spi_read_busy(struct device *child)
 	}
 
 	/* The SPI bus is unresponsive, the read failed. */
-	wl1271_error("SPI read busy-word timeout!\n");
+	dev_err(child->parent, "SPI read busy-word timeout!\n");
 	return -ETIMEDOUT;
 }
 
@@ -254,9 +253,6 @@ static void wl12xx_spi_raw_read(struct device *child, int addr, void *buf,
 
 		spi_sync(to_spi_device(glue->dev), &m);
 
-		wl1271_dump(DEBUG_SPI, "spi_read cmd -> ", cmd, sizeof(*cmd));
-		wl1271_dump(DEBUG_SPI, "spi_read buf <- ", buf, chunk_len);
-
 		if (!fixed)
 			addr += chunk_len;
 		buf += chunk_len;
@@ -302,9 +298,6 @@ static void wl12xx_spi_raw_write(struct device *child, int addr, void *buf,
 		t[i].len = chunk_len;
 		spi_message_add_tail(&t[i++], &m);
 
-		wl1271_dump(DEBUG_SPI, "spi_write cmd -> ", cmd, sizeof(*cmd));
-		wl1271_dump(DEBUG_SPI, "spi_write buf -> ", buf, chunk_len);
-
 		if (!fixed)
 			addr += chunk_len;
 		buf += chunk_len;
@@ -332,7 +325,7 @@ static int __devinit wl1271_probe(struct spi_device *spi)
 
 	pdata = spi->dev.platform_data;
 	if (!pdata) {
-		wl1271_error("no platform data");
+		dev_err(&spi->dev, "no platform data\n");
 		return -ENODEV;
 	}
 
@@ -340,7 +333,7 @@ static int __devinit wl1271_probe(struct spi_device *spi)
 
 	glue = kzalloc(sizeof(*glue), GFP_KERNEL);
 	if (!glue) {
-		wl1271_error("can't allocate glue");
+		dev_err(&spi->dev, "can't allocate glue\n");
 		goto out;
 	}
 
@@ -354,13 +347,13 @@ static int __devinit wl1271_probe(struct spi_device *spi)
 
 	ret = spi_setup(spi);
 	if (ret < 0) {
-		wl1271_error("spi_setup failed");
+		dev_err(glue->dev, "spi_setup failed\n");
 		goto out_free_glue;
 	}
 
 	glue->core = platform_device_alloc("wl12xx-spi", -1);
 	if (!glue->core) {
-		wl1271_error("can't allocate platform_device");
+		dev_err(glue->dev, "can't allocate platform_device\n");
 		ret = -ENOMEM;
 		goto out_free_glue;
 	}
@@ -375,19 +368,19 @@ static int __devinit wl1271_probe(struct spi_device *spi)
 
 	ret = platform_device_add_resources(glue->core, res, ARRAY_SIZE(res));
 	if (ret) {
-		wl1271_error("can't add resources");
+		dev_err(glue->dev, "can't add resources\n");
 		goto out_dev_put;
 	}
 
 	ret = platform_device_add_data(glue->core, pdata, sizeof(*pdata));
 	if (ret) {
-		wl1271_error("can't add platform data");
+		dev_err(glue->dev, "can't add platform data\n");
 		goto out_dev_put;
 	}
 
 	ret = platform_device_add(glue->core);
 	if (ret) {
-		wl1271_error("can't register platform device");
+		dev_err(glue->dev, "can't register platform device\n");
 		goto out_dev_put;
 	}
 
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] wl12xx: sdio: use dev_dbg instead of wl1271_debug
  2011-10-07 11:34 [PATCH 1/2] wl12xx: sdio: use dev_dbg instead of wl1271_debug Luciano Coelho
  2011-10-07 11:34 ` [PATCH 2/2] wl12xx: spi: use dev_err instead of wl1271_error Luciano Coelho
@ 2011-10-09  0:08 ` Eliad Peller
  2011-10-09  6:09   ` Luciano Coelho
  2011-10-11 13:22 ` Luciano Coelho
  2 siblings, 1 reply; 5+ messages in thread
From: Eliad Peller @ 2011-10-09  0:08 UTC (permalink / raw)
  To: Luciano Coelho; +Cc: linux-wireless

On Fri, Oct 7, 2011 at 1:34 PM, Luciano Coelho <coelho@ti.com> wrote:
> To prevent a useless dependency between the sdio module and the wl12xx
> module, we need to replace the wl1271_debug macros (and friends) for
> dev_dbg and other equivalents.
>
> At the same time, remove the SDIO data hexdump, since this produces
> way too much data and is not particularly useful.  There's not
> print_hex_dump() equivalent for dynamic debug, so it's hard to control
> when the dumps are printed out.
>
> Signed-off-by: Luciano Coelho <coelho@ti.com>
> ---
[...]
>                if (!(sdio_flags & MMC_PM_KEEP_POWER)) {
> -                       wl1271_error("can't keep power while host "
> +                       dev_err(dev, "can't keep power while host \n"
>                                     "is suspended");

you missed the concatenation here :)

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] wl12xx: sdio: use dev_dbg instead of wl1271_debug
  2011-10-09  0:08 ` [PATCH 1/2] wl12xx: sdio: use dev_dbg instead of wl1271_debug Eliad Peller
@ 2011-10-09  6:09   ` Luciano Coelho
  0 siblings, 0 replies; 5+ messages in thread
From: Luciano Coelho @ 2011-10-09  6:09 UTC (permalink / raw)
  To: Eliad Peller; +Cc: linux-wireless

On Sun, 2011-10-09 at 02:08 +0200, Eliad Peller wrote: 
> On Fri, Oct 7, 2011 at 1:34 PM, Luciano Coelho <coelho@ti.com> wrote:
> > To prevent a useless dependency between the sdio module and the wl12xx
> > module, we need to replace the wl1271_debug macros (and friends) for
> > dev_dbg and other equivalents.
> >
> > At the same time, remove the SDIO data hexdump, since this produces
> > way too much data and is not particularly useful.  There's not
> > print_hex_dump() equivalent for dynamic debug, so it's hard to control
> > when the dumps are printed out.
> >
> > Signed-off-by: Luciano Coelho <coelho@ti.com>
> > ---
> [...]
> >                if (!(sdio_flags & MMC_PM_KEEP_POWER)) {
> > -                       wl1271_error("can't keep power while host "
> > +                       dev_err(dev, "can't keep power while host \n"
> >                                     "is suspended");
> 
> you missed the concatenation here :)

Ouch! Et tu Brutus?! :)

My regex didn't spread across lines.  I'll fix it, thanks for checking.


-- 
Cheers,
Luca.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] wl12xx: sdio: use dev_dbg instead of wl1271_debug
  2011-10-07 11:34 [PATCH 1/2] wl12xx: sdio: use dev_dbg instead of wl1271_debug Luciano Coelho
  2011-10-07 11:34 ` [PATCH 2/2] wl12xx: spi: use dev_err instead of wl1271_error Luciano Coelho
  2011-10-09  0:08 ` [PATCH 1/2] wl12xx: sdio: use dev_dbg instead of wl1271_debug Eliad Peller
@ 2011-10-11 13:22 ` Luciano Coelho
  2 siblings, 0 replies; 5+ messages in thread
From: Luciano Coelho @ 2011-10-11 13:22 UTC (permalink / raw)
  To: linux-wireless

On Fri, 2011-10-07 at 14:34 +0300, Luciano Coelho wrote: 
> To prevent a useless dependency between the sdio module and the wl12xx
> module, we need to replace the wl1271_debug macros (and friends) for
> dev_dbg and other equivalents.
> 
> At the same time, remove the SDIO data hexdump, since this produces
> way too much data and is not particularly useful.  There's not
> print_hex_dump() equivalent for dynamic debug, so it's hard to control
> when the dumps are printed out.
> 
> Signed-off-by: Luciano Coelho <coelho@ti.com>
> ---

Applied both.

-- 
Cheers,
Luca.


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-10-11 13:22 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-07 11:34 [PATCH 1/2] wl12xx: sdio: use dev_dbg instead of wl1271_debug Luciano Coelho
2011-10-07 11:34 ` [PATCH 2/2] wl12xx: spi: use dev_err instead of wl1271_error Luciano Coelho
2011-10-09  0:08 ` [PATCH 1/2] wl12xx: sdio: use dev_dbg instead of wl1271_debug Eliad Peller
2011-10-09  6:09   ` Luciano Coelho
2011-10-11 13:22 ` Luciano Coelho

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).