[PATCH] wlcore: sdio: warn only once for wl12xx_sdio_raw_{read,write}() failures

From: Javier Martinez Canillas
Date: Mon Feb 26 2024 - 19:21:19 EST


Report these failures only once, instead of keep logging the warnings for
the same condition every time that a SDIO read or write is attempted. This
behaviour is spammy and unnecessarily pollutes the kernel log buffer.

For example, on an AM625 BeaglePlay board where accessing a SDIO WiFi chip
fails with an -110 error:

$ dmesg | grep "sdio write\|read failed (-110)" | wc -l
39

Signed-off-by: Javier Martinez Canillas <javierm@xxxxxxxxxx>
---

drivers/net/wireless/ti/wlcore/sdio.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/ti/wlcore/sdio.c b/drivers/net/wireless/ti/wlcore/sdio.c
index eb5482ed76ae..47ecf33a0fbe 100644
--- a/drivers/net/wireless/ti/wlcore/sdio.c
+++ b/drivers/net/wireless/ti/wlcore/sdio.c
@@ -75,8 +75,8 @@ static int __must_check wl12xx_sdio_raw_read(struct device *child, int addr,

sdio_release_host(func);

- if (WARN_ON(ret))
- dev_err(child->parent, "sdio read failed (%d)\n", ret);
+ if (WARN_ON_ONCE(ret))
+ dev_err_once(child->parent, "sdio read failed (%d)\n", ret);

if (unlikely(dump)) {
printk(KERN_DEBUG "wlcore_sdio: READ from 0x%04x\n", addr);
@@ -120,8 +120,8 @@ static int __must_check wl12xx_sdio_raw_write(struct device *child, int addr,

sdio_release_host(func);

- if (WARN_ON(ret))
- dev_err(child->parent, "sdio write failed (%d)\n", ret);
+ if (WARN_ON_ONCE(ret))
+ dev_err_once(child->parent, "sdio write failed (%d)\n", ret);

return ret;
}
--
2.43.0