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>
This commit is contained in:
Ido Yariv
2011-03-31 10:06:58 +02:00
committed by Luciano Coelho
parent d29633b40e
commit 0da13da767
7 changed files with 36 additions and 30 deletions

View File

@@ -51,15 +51,10 @@ static const struct sdio_device_id wl1271_devices[] = {
};
MODULE_DEVICE_TABLE(sdio, wl1271_devices);
/* The max SDIO block size is 256 when working with tx padding to SDIO block */
#define TX_PAD_SDIO_BLK_SIZE 256
static void wl1271_sdio_set_block_size(struct wl1271 *wl)
static void wl1271_sdio_set_block_size(struct wl1271 *wl, unsigned int blksz)
{
wl->block_size = TX_PAD_SDIO_BLK_SIZE;
sdio_claim_host(wl->if_priv);
sdio_set_block_size(wl->if_priv, TX_PAD_SDIO_BLK_SIZE);
sdio_set_block_size(wl->if_priv, blksz);
sdio_release_host(wl->if_priv);
}
@@ -178,9 +173,6 @@ static int wl1271_sdio_power_on(struct wl1271 *wl)
sdio_claim_host(func);
sdio_enable_func(func);
/* Set the default block size in case it was modified */
sdio_set_block_size(func, 0);
out:
return ret;
}