2008-06-30 07:51:30

by Winkler, Tomas

[permalink] [raw]
Subject: [PATCH 1/3] mmc_core: fix the use of hard coded timeout value.

From: Benzi Zbit <[email protected]>

Signed-off-by: Benzi Zbit <[email protected]>
Signed-off-by: Tomas Winkler <[email protected]>
---
drivers/mmc/core/sdio_cis.c | 2 ++
drivers/mmc/core/sdio_io.c | 7 ++-----
include/linux/mmc/sdio_func.h | 1 +
3 files changed, 5 insertions(+), 5 deletions(-)
mode change 100644 => 100755 drivers/mmc/core/sdio_cis.c
mode change 100644 => 100755 drivers/mmc/core/sdio_io.c
mode change 100644 => 100755 include/linux/mmc/sdio_func.h

diff --git a/drivers/mmc/core/sdio_cis.c b/drivers/mmc/core/sdio_cis.c
old mode 100644
new mode 100755
index d5e51b1..e3a9797
--- a/drivers/mmc/core/sdio_cis.c
+++ b/drivers/mmc/core/sdio_cis.c
@@ -129,6 +129,8 @@ static int cistpl_funce_func(struct sdio_func *func,
/* TPLFE_MAX_BLK_SIZE */
func->max_blksize = buf[12] | (buf[13] << 8);

+ /* TPLFE_ENABLE_TIMEOUT_VAL */
+ func->enable_timeout = buf[28] | (buf[29] << 8);
return 0;
}

diff --git a/drivers/mmc/core/sdio_io.c b/drivers/mmc/core/sdio_io.c
old mode 100644
new mode 100755
index 625b92c..252c4fd
--- a/drivers/mmc/core/sdio_io.c
+++ b/drivers/mmc/core/sdio_io.c
@@ -76,11 +76,8 @@ int sdio_enable_func(struct sdio_func *func)
if (ret)
goto err;

- /*
- * FIXME: This should timeout based on information in the CIS,
- * but we don't have card to parse that yet.
- */
- timeout = jiffies + HZ;
+ /* max enable timeout is in units of 10mS */
+ timeout = jiffies + msecs_to_jiffies(func->enable_timeout * 10);

while (1) {
ret = mmc_io_rw_direct(func->card, 0, 0, SDIO_CCCR_IORx, 0, &reg);
diff --git a/include/linux/mmc/sdio_func.h b/include/linux/mmc/sdio_func.h
old mode 100644
new mode 100755
index b050f4d..8de40f1
--- a/include/linux/mmc/sdio_func.h
+++ b/include/linux/mmc/sdio_func.h
@@ -46,6 +46,7 @@ struct sdio_func {
unsigned max_blksize; /* maximum block size */
unsigned cur_blksize; /* current block size */

+ unsigned enable_timeout; /* max enable timeout in units of 10mS steps */
unsigned int state; /* function state */
#define SDIO_STATE_PRESENT (1<<0) /* present in sysfs */

--
1.5.4.1

---------------------------------------------------------------------
Intel Israel (74) Limited

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.


2008-06-30 07:51:09

by Winkler, Tomas

[permalink] [raw]
Subject: [PATCH 2/3] mmc: wbsd.c fix shadowing of 'dma' variable

This patch fix warning :shadowing dma variable

Signed-off-by: Tomas Winkler <[email protected]>
---
drivers/mmc/host/wbsd.c | 14 +++++++-------
1 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/mmc/host/wbsd.c b/drivers/mmc/host/wbsd.c
index 67e5a9b..2d7c847 100644
--- a/drivers/mmc/host/wbsd.c
+++ b/drivers/mmc/host/wbsd.c
@@ -75,9 +75,9 @@ static unsigned int nopnp = 0;
#else
static const unsigned int nopnp = 1;
#endif
-static unsigned int io = 0x248;
-static unsigned int irq = 6;
-static int dma = 2;
+static unsigned int param_io = 0x248;
+static unsigned int param_irq = 6;
+static int param_dma = 2;

/*
* Basic functions
@@ -1765,7 +1765,7 @@ static void __devexit wbsd_shutdown(struct device *dev, int pnp)
static int __devinit wbsd_probe(struct platform_device *dev)
{
/* Use the module parameters for resources */
- return wbsd_init(&dev->dev, io, irq, dma, 0);
+ return wbsd_init(&dev->dev, param_io, param_irq, param_dma, 0);
}

static int __devexit wbsd_remove(struct platform_device *dev)
@@ -2031,9 +2031,9 @@ module_exit(wbsd_drv_exit);
#ifdef CONFIG_PNP
module_param(nopnp, uint, 0444);
#endif
-module_param(io, uint, 0444);
-module_param(irq, uint, 0444);
-module_param(dma, int, 0444);
+module_param(param_io, uint, 0444);
+module_param(param_irq, uint, 0444);
+module_param(param_dma, int, 0444);

MODULE_LICENSE("GPL");
MODULE_AUTHOR("Pierre Ossman <[email protected]>");
--
1.5.4.1

---------------------------------------------------------------------
Intel Israel (74) Limited

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.

2008-06-30 07:50:50

by Winkler, Tomas

[permalink] [raw]
Subject: [PATCH 3/3] 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: Tomas Winkler <[email protected]>
---
drivers/mmc/core/sdio_io.c | 43 +++++++++++++++-------------------------
include/linux/mmc/sdio_func.h | 33 ++++++++++++++-----------------
2 files changed, 31 insertions(+), 45 deletions(-)

diff --git a/drivers/mmc/core/sdio_io.c b/drivers/mmc/core/sdio_io.c
index 252c4fd..62ebeba 100755
--- a/drivers/mmc/core/sdio_io.c
+++ b/drivers/mmc/core/sdio_io.c
@@ -164,10 +164,8 @@ int sdio_set_block_size(struct sdio_func *func, unsigned blksz)
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,
@@ -183,7 +181,6 @@ int sdio_set_block_size(struct sdio_func *func, unsigned blksz)
func->cur_blksize = blksz;
return 0;
}
-
EXPORT_SYMBOL_GPL(sdio_set_block_size);

/* Split an arbitrarily sized data transfer into several
@@ -200,10 +197,9 @@ static int sdio_io_rw_ext_helper(struct sdio_func *func, int write,
/* 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;
@@ -257,11 +253,10 @@ static int sdio_io_rw_ext_helper(struct sdio_func *func, int write,
* 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);

@@ -290,8 +285,7 @@ EXPORT_SYMBOL_GPL(sdio_readb);
* 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;

@@ -352,7 +346,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);
}
-
EXPORT_SYMBOL_GPL(sdio_readsb);

/**
@@ -382,8 +375,7 @@ EXPORT_SYMBOL_GPL(sdio_writesb);
* 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;

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

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

@@ -412,12 +404,11 @@ 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)
@@ -436,8 +427,7 @@ EXPORT_SYMBOL_GPL(sdio_writew);
* 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;

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

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

@@ -466,12 +456,11 @@ 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)
diff --git a/include/linux/mmc/sdio_func.h b/include/linux/mmc/sdio_func.h
index 8de40f1..3511607 100755
--- a/include/linux/mmc/sdio_func.h
+++ b/include/linux/mmc/sdio_func.h
@@ -121,34 +121,31 @@ extern int sdio_set_block_size(struct sdio_func *func, unsigned blksz);
extern int sdio_claim_irq(struct sdio_func *func, sdio_irq_handler_t *handler);
extern int sdio_release_irq(struct sdio_func *func);

-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);
+ unsigned int addr, int count);
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,
- unsigned int addr, int *err_ret);
-extern void sdio_writew(struct sdio_func *func, unsigned short b,
- unsigned int addr, int *err_ret);
-extern void sdio_writel(struct sdio_func *func, unsigned long b,
- unsigned int addr, int *err_ret);
+extern void sdio_writeb(struct sdio_func *func, u8 b,
+ unsigned int addr, int *err_ret);
+extern void sdio_writew(struct sdio_func *func, u16 b,
+ unsigned int addr, int *err_ret);
+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,
- void *src, int count);
+ void *src, int count);
extern int sdio_writesb(struct sdio_func *func, unsigned int addr,
- void *src, int count);
+ void *src, int count);

extern unsigned char sdio_f0_readb(struct sdio_func *func,
- unsigned int addr, int *err_ret);
+ unsigned int addr, int *err_ret);
extern void sdio_f0_writeb(struct sdio_func *func, unsigned char b,
- unsigned int addr, int *err_ret);
+ unsigned int addr, int *err_ret);

#endif

--
1.5.4.1

---------------------------------------------------------------------
Intel Israel (74) Limited

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.

2008-06-30 08:57:13

by Marcel Holtmann

[permalink] [raw]
Subject: Re: [PATCH 2/3] mmc: wbsd.c fix shadowing of 'dma' variable

Hi Tomas,

> This patch fix warning :shadowing dma variable

please use module_param_named() instead.

Regards

Marcel

2008-06-30 08:58:08

by Marcel Holtmann

[permalink] [raw]
Subject: Re: [PATCH 1/3] mmc_core: fix the use of hard coded timeout value.

Hi Tomas,

> drivers/mmc/core/sdio_cis.c | 2 ++
> drivers/mmc/core/sdio_io.c | 7 ++-----
> include/linux/mmc/sdio_func.h | 1 +
> 3 files changed, 5 insertions(+), 5 deletions(-)
> mode change 100644 => 100755 drivers/mmc/core/sdio_cis.c
> mode change 100644 => 100755 drivers/mmc/core/sdio_io.c
> mode change 100644 => 100755 include/linux/mmc/sdio_func.h

there is something wrong with your setup. Don't change the file modes
and please resent the patch.

Regards

Marcel

2008-06-30 09:01:00

by Marcel Holtmann

[permalink] [raw]
Subject: Re: [PATCH 3/3] mmc: fix sdio_io sparse errors

Hi Tomas,

> 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

why are we not using the new get_unaligned_le* and put_unaligned_le*
functions for the tmpbuf access?

Regards

Marcel

2008-06-30 11:45:26

by Winkler, Tomas

[permalink] [raw]
Subject: RE: [PATCH 1/3] mmc_core: fix the use of hard coded timeout value.



>-----Original Message-----
>From: Marcel Holtmann [mailto:[email protected]]
>Sent: Monday, June 30, 2008 11:58 AM
>To: Winkler, Tomas
>Cc: [email protected]; [email protected]; Zbit, Benzi
>Subject: Re: [PATCH 1/3] mmc_core: fix the use of hard coded timeout
value.
>
>Hi Tomas,
>
>> drivers/mmc/core/sdio_cis.c | 2 ++
>> drivers/mmc/core/sdio_io.c | 7 ++-----
>> include/linux/mmc/sdio_func.h | 1 +
>> 3 files changed, 5 insertions(+), 5 deletions(-)
>> mode change 100644 => 100755 drivers/mmc/core/sdio_cis.c
>> mode change 100644 => 100755 drivers/mmc/core/sdio_io.c
>> mode change 100644 => 100755 include/linux/mmc/sdio_func.h
>
>there is something wrong with your setup. Don't change the file modes
>and please resent the patch.

Oops, missed that.
Thanks
Tomas


---------------------------------------------------------------------
Intel Israel (74) Limited

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.

2008-06-30 11:48:20

by Winkler, Tomas

[permalink] [raw]
Subject: RE: [PATCH 3/3] mmc: fix sdio_io sparse errors



>-----Original Message-----
>From: Marcel Holtmann [mailto:[email protected]]
>Sent: Monday, June 30, 2008 12:01 PM
>To: Winkler, Tomas
>Cc: [email protected]; [email protected]
>Subject: Re: [PATCH 3/3] mmc: fix sdio_io sparse errors
>
>Hi Tomas,
>
>> 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
>
>why are we not using the new get_unaligned_le* and put_unaligned_le*
>functions for the tmpbuf access?
>
It resides inside sido_func structure there is no reason it will be
unaligned.
Tomas

---------------------------------------------------------------------
Intel Israel (74) Limited

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.

2008-07-04 17:14:43

by Pierre Ossman

[permalink] [raw]
Subject: Re: [PATCH 2/3] mmc: wbsd.c fix shadowing of 'dma' variable

On Mon, 30 Jun 2008 10:50:23 +0300
Tomas Winkler <[email protected]> wrote:

> This patch fix warning :shadowing dma variable
>
> Signed-off-by: Tomas Winkler <[email protected]>
> ---

Looks ok. Applied.

--
-- Pierre Ossman

Linux kernel, MMC maintainer http://www.kernel.org
rdesktop, core developer http://www.rdesktop.org

WARNING: This correspondence is being monitored by the
Swedish government. Make sure your server uses encryption
for SMTP traffic and consider using PGP for end-to-end
encryption.


Attachments:
signature.asc (197.00 B)

2008-07-04 17:13:36

by Pierre Ossman

[permalink] [raw]
Subject: Re: [PATCH 1/3] mmc_core: fix the use of hard coded timeout value.

On Mon, 30 Jun 2008 10:50:22 +0300
Tomas Winkler <[email protected]> wrote:

> From: Benzi Zbit <[email protected]>
>
> Signed-off-by: Benzi Zbit <[email protected]>
> Signed-off-by: Tomas Winkler <[email protected]>
> ---

A nice addition, but I'm afraid that field is not present on all cards
(it was added in version 1.1). Could you make sure you have the proper
guards and a fallback?

Rgds
--
-- Pierre Ossman

Linux kernel, MMC maintainer http://www.kernel.org
rdesktop, core developer http://www.rdesktop.org

WARNING: This correspondence is being monitored by the
Swedish government. Make sure your server uses encryption
for SMTP traffic and consider using PGP for end-to-end
encryption.


Attachments:
signature.asc (197.00 B)

2008-07-04 17:38:21

by Pierre Ossman

[permalink] [raw]
Subject: Re: [PATCH 3/3] mmc: fix sdio_io sparse errors

On Mon, 30 Jun 2008 10:50:24 +0300
Tomas Winkler <[email protected]> wrote:

> 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: Tomas Winkler <[email protected]>
> ---

I'm not entirely comfortable with this as the point was to use the same
types as the "real" read*/write*. But as i386 and x86_64 use different
types, I don't see much choice.

I've applied the patch.

Rgds
--
-- Pierre Ossman

Linux kernel, MMC maintainer http://www.kernel.org
rdesktop, core developer http://www.rdesktop.org

WARNING: This correspondence is being monitored by the
Swedish government. Make sure your server uses encryption
for SMTP traffic and consider using PGP for end-to-end
encryption.


Attachments:
signature.asc (197.00 B)