Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3c4d3868 authored by Luciano Coelho's avatar Luciano Coelho
Browse files

wl12xx: sdio: use dev_dbg instead of wl1271_debug



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: default avatarLuciano Coelho <coelho@ti.com>
parent 0f4e3122
Loading
Loading
Loading
Loading
+23 −26
Original line number Original line Diff line number Diff line
@@ -34,7 +34,6 @@
#include <linux/pm_runtime.h>
#include <linux/pm_runtime.h>


#include "wl12xx.h"
#include "wl12xx.h"
#include "debug.h"
#include "wl12xx_80211.h"
#include "wl12xx_80211.h"
#include "io.h"
#include "io.h"


@@ -77,7 +76,7 @@ static void wl12xx_sdio_raw_read(struct device *child, int addr, void *buf,


	if (unlikely(addr == HW_ACCESS_ELP_CTRL_REG_ADDR)) {
	if (unlikely(addr == HW_ACCESS_ELP_CTRL_REG_ADDR)) {
		((u8 *)buf)[0] = sdio_f0_readb(func, addr, &ret);
		((u8 *)buf)[0] = sdio_f0_readb(func, addr, &ret);
		wl1271_debug(DEBUG_SDIO, "sdio read 52 addr 0x%x, byte 0x%02x",
		dev_dbg(child->parent, "sdio read 52 addr 0x%x, byte 0x%02x\n",
			addr, ((u8 *)buf)[0]);
			addr, ((u8 *)buf)[0]);
	} else {
	} else {
		if (fixed)
		if (fixed)
@@ -85,13 +84,12 @@ static void wl12xx_sdio_raw_read(struct device *child, int addr, void *buf,
		else
		else
			ret = sdio_memcpy_fromio(func, buf, addr, len);
			ret = sdio_memcpy_fromio(func, buf, addr, len);


		wl1271_debug(DEBUG_SDIO, "sdio read 53 addr 0x%x, %zu bytes",
		dev_dbg(child->parent, "sdio read 53 addr 0x%x, %zu bytes\n",
			addr, len);
			addr, len);
		wl1271_dump_ascii(DEBUG_SDIO, "data: ", buf, len);
	}
	}


	if (ret)
	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,
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)) {
	if (unlikely(addr == HW_ACCESS_ELP_CTRL_REG_ADDR)) {
		sdio_f0_writeb(func, ((u8 *)buf)[0], addr, &ret);
		sdio_f0_writeb(func, ((u8 *)buf)[0], addr, &ret);
		wl1271_debug(DEBUG_SDIO, "sdio write 52 addr 0x%x, byte 0x%02x",
		dev_dbg(child->parent, "sdio write 52 addr 0x%x, byte 0x%02x\n",
			addr, ((u8 *)buf)[0]);
			addr, ((u8 *)buf)[0]);
	} else {
	} else {
		wl1271_debug(DEBUG_SDIO, "sdio write 53 addr 0x%x, %zu bytes",
		dev_dbg(child->parent, "sdio write 53 addr 0x%x, %zu bytes\n",
			addr, len);
			addr, len);
		wl1271_dump_ascii(DEBUG_SDIO, "data: ", buf, len);


		if (fixed)
		if (fixed)
			ret = sdio_writesb(func, addr, buf, len);
			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)
	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)
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);
	glue = kzalloc(sizeof(*glue), GFP_KERNEL);
	if (!glue) {
	if (!glue) {
		wl1271_error("can't allocate glue");
		dev_err(&func->dev, "can't allocate glue\n");
		goto out;
		goto out;
	}
	}


@@ -211,13 +208,13 @@ static int __devinit wl1271_probe(struct sdio_func *func,
	wlan_data = wl12xx_get_platform_data();
	wlan_data = wl12xx_get_platform_data();
	if (IS_ERR(wlan_data)) {
	if (IS_ERR(wlan_data)) {
		ret = PTR_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;
		goto out_free_glue;
	}
	}


	/* if sdio can keep power while host is suspended, enable wow */
	/* if sdio can keep power while host is suspended, enable wow */
	mmcflags = sdio_get_host_pm_caps(func);
	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)
	if (mmcflags & MMC_PM_KEEP_POWER)
		wlan_data->pwr_in_suspend = true;
		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);
	glue->core = platform_device_alloc("wl12xx-sdio", -1);
	if (!glue->core) {
	if (!glue->core) {
		wl1271_error("can't allocate platform_device");
		dev_err(glue->dev, "can't allocate platform_device");
		ret = -ENOMEM;
		ret = -ENOMEM;
		goto out_free_glue;
		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));
	ret = platform_device_add_resources(glue->core, res, ARRAY_SIZE(res));
	if (ret) {
	if (ret) {
		wl1271_error("can't add resources");
		dev_err(glue->dev, "can't add resources\n");
		goto out_dev_put;
		goto out_dev_put;
	}
	}


	ret = platform_device_add_data(glue->core, wlan_data,
	ret = platform_device_add_data(glue->core, wlan_data,
				       sizeof(*wlan_data));
				       sizeof(*wlan_data));
	if (ret) {
	if (ret) {
		wl1271_error("can't add platform data");
		dev_err(glue->dev, "can't add platform data\n");
		goto out_dev_put;
		goto out_dev_put;
	}
	}


	ret = platform_device_add(glue->core);
	ret = platform_device_add(glue->core);
	if (ret) {
	if (ret) {
		wl1271_error("can't add platform device");
		dev_err(glue->dev, "can't add platform device\n");
		goto out_dev_put;
		goto out_dev_put;
	}
	}
	return 0;
	return 0;
@@ -296,7 +293,7 @@ static int wl1271_suspend(struct device *dev)
	mmc_pm_flag_t sdio_flags;
	mmc_pm_flag_t sdio_flags;
	int ret = 0;
	int ret = 0;


	wl1271_debug(DEBUG_MAC80211, "wl1271 suspend. wow_enabled: %d",
	dev_dbg(dev, "wl1271 suspend. wow_enabled: %d\n",
		wl->wow_enabled);
		wl->wow_enabled);


	/* check whether sdio should keep power */
	/* check whether sdio should keep power */
@@ -304,8 +301,8 @@ static int wl1271_suspend(struct device *dev)
		sdio_flags = sdio_get_host_pm_caps(func);
		sdio_flags = sdio_get_host_pm_caps(func);


		if (!(sdio_flags & MMC_PM_KEEP_POWER)) {
		if (!(sdio_flags & MMC_PM_KEEP_POWER)) {
			wl1271_error("can't keep power while host "
			dev_err(dev, "can't keep power while host "
				     "is suspended");
				     "is suspended\n");
			ret = -EINVAL;
			ret = -EINVAL;
			goto out;
			goto out;
		}
		}
@@ -313,7 +310,7 @@ static int wl1271_suspend(struct device *dev)
		/* keep power while host suspended */
		/* keep power while host suspended */
		ret = sdio_set_host_pm_flags(func, MMC_PM_KEEP_POWER);
		ret = sdio_set_host_pm_flags(func, MMC_PM_KEEP_POWER);
		if (ret) {
		if (ret) {
			wl1271_error("error while trying to keep power");
			dev_err(dev, "error while trying to keep power\n");
			goto out;
			goto out;
		}
		}


@@ -329,7 +326,7 @@ static int wl1271_resume(struct device *dev)
	struct sdio_func *func = dev_to_sdio_func(dev);
	struct sdio_func *func = dev_to_sdio_func(dev);
	struct wl1271 *wl = sdio_get_drvdata(func);
	struct wl1271 *wl = sdio_get_drvdata(func);


	wl1271_debug(DEBUG_MAC80211, "wl1271 resume");
	dev_dbg(dev, "wl1271 resume\n");
	if (wl->wow_enabled) {
	if (wl->wow_enabled) {
		/* claim back host */
		/* claim back host */
		sdio_claim_host(func);
		sdio_claim_host(func);