return -EINVAL;
if (blksz == 0) {
- blksz = min(min(
- func->max_blksize,
- func->card->host->max_blk_size),
- 512u);
+ blksz = min(func->max_blksize, func->card->host->max_blk_size);
+ blksz = min(blksz, 512u);
}
ret = mmc_io_rw_direct(func->card, 1, 0,
/* Blocks per command is limited by host count, host transfer
* size (we only use a single sg entry) and the maximum for
* IO_RW_EXTENDED of 511 blocks. */
- max_blocks = min(min(
- func->card->host->max_blk_count,
- func->card->host->max_seg_size / func->cur_blksize),
- 511u);
+ max_blocks = min(func->card->host->max_blk_count,
+ func->card->host->max_seg_size / func->cur_blksize);
+ max_blocks = min(max_blocks, 511u);
while (remainder > func->cur_blksize) {
unsigned blocks;
* function. If there is a problem reading the address, 0xff
* is returned and @err_ret will contain the error code.
*/
-unsigned char sdio_readb(struct sdio_func *func, unsigned int addr,
- int *err_ret)
+u8 sdio_readb(struct sdio_func *func, unsigned int addr, int *err_ret)
{
int ret;
- unsigned char val;
+ u8 val;
BUG_ON(!func);
* function. @err_ret will contain the status of the actual
* transfer.
*/
-void sdio_writeb(struct sdio_func *func, unsigned char b, unsigned int addr,
- int *err_ret)
+void sdio_writeb(struct sdio_func *func, u8 b, unsigned int addr, int *err_ret)
{
int ret;
{
return sdio_io_rw_ext_helper(func, 0, addr, 0, dst, count);
}
-
EXPORT_SYMBOL_GPL(sdio_readsb);
/**
* function. If there is a problem reading the address, 0xffff
* is returned and @err_ret will contain the error code.
*/
-unsigned short sdio_readw(struct sdio_func *func, unsigned int addr,
- int *err_ret)
+u16 sdio_readw(struct sdio_func *func, unsigned int addr, int *err_ret)
{
int ret;
return 0xFFFF;
}
- return le16_to_cpu(*(u16*)func->tmpbuf);
+ return le16_to_cpup((__le16 *)func->tmpbuf);
}
EXPORT_SYMBOL_GPL(sdio_readw);
* function. @err_ret will contain the status of the actual
* transfer.
*/
-void sdio_writew(struct sdio_func *func, unsigned short b, unsigned int addr,
- int *err_ret)
+void sdio_writew(struct sdio_func *func, u16 b, unsigned int addr, int *err_ret)
{
int ret;
- *(u16*)func->tmpbuf = cpu_to_le16(b);
+ *(__le16 *)func->tmpbuf = cpu_to_le16(b);
ret = sdio_memcpy_toio(func, addr, func->tmpbuf, 2);
if (err_ret)
* 0xffffffff is returned and @err_ret will contain the error
* code.
*/
-unsigned long sdio_readl(struct sdio_func *func, unsigned int addr,
- int *err_ret)
+u32 sdio_readl(struct sdio_func *func, unsigned int addr, int *err_ret)
{
int ret;
return 0xFFFFFFFF;
}
- return le32_to_cpu(*(u32*)func->tmpbuf);
+ return le32_to_cpup((__le32 *)func->tmpbuf);
}
EXPORT_SYMBOL_GPL(sdio_readl);
* function. @err_ret will contain the status of the actual
* transfer.
*/
-void sdio_writel(struct sdio_func *func, unsigned long b, unsigned int addr,
- int *err_ret)
+void sdio_writel(struct sdio_func *func, u32 b, unsigned int addr, int *err_ret)
{
int ret;
- *(u32*)func->tmpbuf = cpu_to_le32(b);
+ *(__le32 *)func->tmpbuf = cpu_to_le32(b);
ret = sdio_memcpy_toio(func, addr, func->tmpbuf, 4);
if (err_ret)
extern unsigned int sdio_align_size(struct sdio_func *func, unsigned int sz);
-extern unsigned char sdio_readb(struct sdio_func *func,
- unsigned int addr, int *err_ret);
-extern unsigned short sdio_readw(struct sdio_func *func,
- unsigned int addr, int *err_ret);
-extern unsigned long sdio_readl(struct sdio_func *func,
- unsigned int addr, int *err_ret);
+extern u8 sdio_readb(struct sdio_func *func, unsigned int addr, int *err_ret);
+extern u16 sdio_readw(struct sdio_func *func, unsigned int addr, int *err_ret);
+extern u32 sdio_readl(struct sdio_func *func, unsigned int addr, int *err_ret);
extern int sdio_memcpy_fromio(struct sdio_func *func, void *dst,
unsigned int addr, int count);
extern int sdio_readsb(struct sdio_func *func, void *dst,
unsigned int addr, int count);
-extern void sdio_writeb(struct sdio_func *func, unsigned char b,
+extern void sdio_writeb(struct sdio_func *func, u8 b,
unsigned int addr, int *err_ret);
-extern void sdio_writew(struct sdio_func *func, unsigned short b,
+extern void sdio_writew(struct sdio_func *func, u16 b,
unsigned int addr, int *err_ret);
-extern void sdio_writel(struct sdio_func *func, unsigned long b,
+extern void sdio_writel(struct sdio_func *func, u32 b,
unsigned int addr, int *err_ret);
extern int sdio_memcpy_toio(struct sdio_func *func, unsigned int addr,