wl12xx: Clean up the block size alignment code
Simplify and clean up the block size alignment code:
1. Set the block size according to the padding field type, as it cannot
exceed the maximum value this field can hold.
2. Move the alignment code into a function instead of duplicating it in
multiple places.
3. In the current implementation, the block_size member can be
misleading because a zero value actually means that there's no need to
align. Declare a block size alignment quirk instead.
Signed-off-by: Ido Yariv <ido@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
diff --git a/drivers/net/wireless/wl12xx/main.c b/drivers/net/wireless/wl12xx/main.c
index 01205ea..1cd3963 100644
--- a/drivers/net/wireless/wl12xx/main.c
+++ b/drivers/net/wireless/wl12xx/main.c
@@ -1017,6 +1017,8 @@
ret = wl1271_setup(wl);
if (ret < 0)
goto out;
+ if (wl1271_set_block_size(wl))
+ wl->quirks |= WL12XX_QUIRK_BLOCKSIZE_ALIGNMENT;
break;
case CHIP_ID_1283_PG10:
default:
@@ -1487,7 +1489,6 @@
memset(wl->ap_hlid_map, 0, sizeof(wl->ap_hlid_map));
wl->ap_fw_ps_map = 0;
wl->ap_ps_map = 0;
- wl->block_size = 0;
/*
* this is performed after the cancel_work calls and the associated
@@ -3632,7 +3633,6 @@
wl->ap_ps_map = 0;
wl->ap_fw_ps_map = 0;
wl->quirks = 0;
- wl->block_size = 0;
memset(wl->tx_frames_map, 0, sizeof(wl->tx_frames_map));
for (i = 0; i < ACX_TX_DESCRIPTORS; i++)