Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6d373331 authored by Tomas Winkler's avatar Tomas Winkler Committed by Pierre Ossman
Browse files

mmc: fix sdio_io sparse errors



This patch fixes sdio_io sparse errors.
This fix changes signature of API functions,
changing
unsigned char -> u8
unsigned short -> u16
unsigned long -> u32 - this was probably a bug in 64 bit platforms

Signed-off-by: default avatarTomas Winkler <tomas.winkler@intel.com>
Signed-off-by: default avatarPierre Ossman <drzeus@drzeus.cx>
parent 9eeebd22
Loading
Loading
Loading
Loading

drivers/mmc/core/sdio_io.c

100644 → 100755
+16 −26
Original line number Original line Diff line number Diff line
@@ -167,10 +167,8 @@ int sdio_set_block_size(struct sdio_func *func, unsigned blksz)
		return -EINVAL;
		return -EINVAL;


	if (blksz == 0) {
	if (blksz == 0) {
		blksz = min(min(
		blksz = min(func->max_blksize, func->card->host->max_blk_size);
			func->max_blksize,
		blksz = min(blksz, 512u);
			func->card->host->max_blk_size),
			512u);
	}
	}


	ret = mmc_io_rw_direct(func->card, 1, 0,
	ret = mmc_io_rw_direct(func->card, 1, 0,
@@ -311,10 +309,9 @@ static int sdio_io_rw_ext_helper(struct sdio_func *func, int write,
		/* Blocks per command is limited by host count, host transfer
		/* Blocks per command is limited by host count, host transfer
		 * size (we only use a single sg entry) and the maximum for
		 * size (we only use a single sg entry) and the maximum for
		 * IO_RW_EXTENDED of 511 blocks. */
		 * IO_RW_EXTENDED of 511 blocks. */
		max_blocks = min(min(
		max_blocks = min(func->card->host->max_blk_count,
			func->card->host->max_blk_count,
			func->card->host->max_seg_size / func->cur_blksize);
			func->card->host->max_seg_size / func->cur_blksize),
		max_blocks = min(max_blocks, 511u);
			511u);


		while (remainder > func->cur_blksize) {
		while (remainder > func->cur_blksize) {
			unsigned blocks;
			unsigned blocks;
@@ -364,11 +361,10 @@ static int sdio_io_rw_ext_helper(struct sdio_func *func, int write,
 *	function. If there is a problem reading the address, 0xff
 *	function. If there is a problem reading the address, 0xff
 *	is returned and @err_ret will contain the error code.
 *	is returned and @err_ret will contain the error code.
 */
 */
unsigned char sdio_readb(struct sdio_func *func, unsigned int addr,
u8 sdio_readb(struct sdio_func *func, unsigned int addr, int *err_ret)
	int *err_ret)
{
{
	int ret;
	int ret;
	unsigned char val;
	u8 val;


	BUG_ON(!func);
	BUG_ON(!func);


@@ -397,8 +393,7 @@ EXPORT_SYMBOL_GPL(sdio_readb);
 *	function. @err_ret will contain the status of the actual
 *	function. @err_ret will contain the status of the actual
 *	transfer.
 *	transfer.
 */
 */
void sdio_writeb(struct sdio_func *func, unsigned char b, unsigned int addr,
void sdio_writeb(struct sdio_func *func, u8 b, unsigned int addr, int *err_ret)
	int *err_ret)
{
{
	int ret;
	int ret;


@@ -459,7 +454,6 @@ int sdio_readsb(struct sdio_func *func, void *dst, unsigned int addr,
{
{
	return sdio_io_rw_ext_helper(func, 0, addr, 0, dst, count);
	return sdio_io_rw_ext_helper(func, 0, addr, 0, dst, count);
}
}

EXPORT_SYMBOL_GPL(sdio_readsb);
EXPORT_SYMBOL_GPL(sdio_readsb);


/**
/**
@@ -489,8 +483,7 @@ EXPORT_SYMBOL_GPL(sdio_writesb);
 *	function. If there is a problem reading the address, 0xffff
 *	function. If there is a problem reading the address, 0xffff
 *	is returned and @err_ret will contain the error code.
 *	is returned and @err_ret will contain the error code.
 */
 */
unsigned short sdio_readw(struct sdio_func *func, unsigned int addr,
u16 sdio_readw(struct sdio_func *func, unsigned int addr, int *err_ret)
	int *err_ret)
{
{
	int ret;
	int ret;


@@ -504,7 +497,7 @@ unsigned short sdio_readw(struct sdio_func *func, unsigned int addr,
		return 0xFFFF;
		return 0xFFFF;
	}
	}


	return le16_to_cpu(*(u16*)func->tmpbuf);
	return le16_to_cpup((__le16 *)func->tmpbuf);
}
}
EXPORT_SYMBOL_GPL(sdio_readw);
EXPORT_SYMBOL_GPL(sdio_readw);


@@ -519,12 +512,11 @@ EXPORT_SYMBOL_GPL(sdio_readw);
 *	function. @err_ret will contain the status of the actual
 *	function. @err_ret will contain the status of the actual
 *	transfer.
 *	transfer.
 */
 */
void sdio_writew(struct sdio_func *func, unsigned short b, unsigned int addr,
void sdio_writew(struct sdio_func *func, u16 b, unsigned int addr, int *err_ret)
	int *err_ret)
{
{
	int 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);
	ret = sdio_memcpy_toio(func, addr, func->tmpbuf, 2);
	if (err_ret)
	if (err_ret)
@@ -543,8 +535,7 @@ EXPORT_SYMBOL_GPL(sdio_writew);
 *	0xffffffff is returned and @err_ret will contain the error
 *	0xffffffff is returned and @err_ret will contain the error
 *	code.
 *	code.
 */
 */
unsigned long sdio_readl(struct sdio_func *func, unsigned int addr,
u32 sdio_readl(struct sdio_func *func, unsigned int addr, int *err_ret)
	int *err_ret)
{
{
	int ret;
	int ret;


@@ -558,7 +549,7 @@ unsigned long sdio_readl(struct sdio_func *func, unsigned int addr,
		return 0xFFFFFFFF;
		return 0xFFFFFFFF;
	}
	}


	return le32_to_cpu(*(u32*)func->tmpbuf);
	return le32_to_cpup((__le32 *)func->tmpbuf);
}
}
EXPORT_SYMBOL_GPL(sdio_readl);
EXPORT_SYMBOL_GPL(sdio_readl);


@@ -573,12 +564,11 @@ EXPORT_SYMBOL_GPL(sdio_readl);
 *	function. @err_ret will contain the status of the actual
 *	function. @err_ret will contain the status of the actual
 *	transfer.
 *	transfer.
 */
 */
void sdio_writel(struct sdio_func *func, unsigned long b, unsigned int addr,
void sdio_writel(struct sdio_func *func, u32 b, unsigned int addr, int *err_ret)
	int *err_ret)
{
{
	int 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);
	ret = sdio_memcpy_toio(func, addr, func->tmpbuf, 4);
	if (err_ret)
	if (err_ret)

include/linux/mmc/sdio_func.h

100644 → 100755
+6 −9
Original line number Original line Diff line number Diff line
@@ -122,23 +122,20 @@ extern int sdio_release_irq(struct sdio_func *func);


extern unsigned int sdio_align_size(struct sdio_func *func, unsigned int sz);
extern unsigned int sdio_align_size(struct sdio_func *func, unsigned int sz);


extern unsigned char sdio_readb(struct sdio_func *func,
extern u8 sdio_readb(struct sdio_func *func, unsigned int addr, int *err_ret);
	unsigned int addr, int *err_ret);
extern u16 sdio_readw(struct sdio_func *func, unsigned int addr, int *err_ret);
extern unsigned short sdio_readw(struct sdio_func *func,
extern u32 sdio_readl(struct sdio_func *func, unsigned int addr, int *err_ret);
	unsigned int addr, int *err_ret);
extern unsigned long sdio_readl(struct sdio_func *func,
	unsigned int addr, int *err_ret);


extern int sdio_memcpy_fromio(struct sdio_func *func, void *dst,
extern int sdio_memcpy_fromio(struct sdio_func *func, void *dst,
	unsigned int addr, int count);
	unsigned int addr, int count);
extern int sdio_readsb(struct sdio_func *func, void *dst,
extern int sdio_readsb(struct sdio_func *func, void *dst,
	unsigned int addr, int count);
	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);
	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);
	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);
	unsigned int addr, int *err_ret);


extern int sdio_memcpy_toio(struct sdio_func *func, unsigned int addr,
extern int sdio_memcpy_toio(struct sdio_func *func, unsigned int addr,