armbian_build/patch/misc/wireless-xradio-vmmaped-stack-fix.patch
Gunjan Gupta 46e756540e xradio: fix compilation for 6.1+
Also added some cleanup fixes to silence some of the compiler warnings,
fixes for issues during inserting and removing xradio module and fixes
for possible data corruption on vmmaped stack.

All of these fixes were taken from https://github.com/fifteenhex/xradio
2023-09-04 14:37:10 +02:00

60 lines
1.8 KiB
Diff

From 10691900f8fdd5ef6d5cadfd27b81c8c4ecd41c0 Mon Sep 17 00:00:00 2001
From: Gunjan Gupta <viraniac@gmail.com>
Date: Sat, 2 Sep 2023 23:11:04 +0000
Subject: [PATCH 3/3] Added fixes for vmmaped stack
Changes taken from
https://github.com/fifteenhex/xradio/commit/a835c4747be088978a055b9645e3c523d0c54fe1
---
drivers/net/wireless/xradio/sdio.c | 28 ++++++++++++++++++++++------
1 file changed, 22 insertions(+), 6 deletions(-)
diff --git a/drivers/net/wireless/xradio/sdio.c b/drivers/net/wireless/xradio/sdio.c
index cfff47120337..6c375f4ece46 100644
--- a/drivers/net/wireless/xradio/sdio.c
+++ b/drivers/net/wireless/xradio/sdio.c
@@ -36,18 +36,34 @@ static const struct sdio_device_id xradio_sdio_ids[] = {
int sdio_data_read(struct xradio_common* self, unsigned int addr,
void *dst, int count)
{
- int ret = sdio_memcpy_fromio(self->sdio_func, dst, addr, count);
-// printk("sdio_memcpy_fromio 0x%x:%d ret %d\n", addr, count, ret);
-// print_hex_dump_bytes("sdio read ", 0, dst, min(count,32));
+ int ret;
+
+ switch (count) {
+ case 4:
+ *((u32 *)dst) = sdio_readl(self->sdio_func, addr, &ret);
+ break;
+ default:
+ ret = sdio_memcpy_fromio(self->sdio_func, dst, addr, count);
+ break;
+ }
+
return ret;
}
int sdio_data_write(struct xradio_common* self, unsigned int addr,
const void *src, int count)
{
- int ret = sdio_memcpy_toio(self->sdio_func, addr, (void *)src, count);
-// printk("sdio_memcpy_toio 0x%x:%d ret %d\n", addr, count, ret);
-// print_hex_dump_bytes("sdio write", 0, src, min(count,32));
+ int ret;
+
+ switch (count) {
+ case 4:
+ sdio_writel(self->sdio_func, *((u32 *)src), addr, &ret);
+ break;
+ default:
+ ret = sdio_memcpy_toio(self->sdio_func, addr, (void *)src, count);
+ break;
+ }
+
return ret;
}
--
2.34.1