Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 171202
b: refs/heads/master
c: c77ca95
h: refs/heads/master
v: v3
  • Loading branch information
Inaky Perez-Gonzalez committed Oct 19, 2009
1 parent 86443f7 commit a14f429
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 8d8fe198c6a756ae96617548af4776e7a86c0d3e
refs/heads/master: c77ca950abb587bcebad6dcd0b0b41d7c0255ce9
16 changes: 13 additions & 3 deletions trunk/drivers/net/wimax/i2400m/sdio.c
Original file line number Diff line number Diff line change
Expand Up @@ -95,17 +95,23 @@ static const struct i2400m_poke_table i2400ms_pokes[] = {
* when we ask it to explicitly doing). Tries until a timeout is
* reached.
*
* The @maxtries argument indicates how many times (at most) it should
* be tried to enable the function. 0 means forever. This acts along
* with the timeout (ie: it'll stop trying as soon as the maximum
* number of tries is reached _or_ as soon as the timeout is reached).
*
* The reverse of this is...sdio_disable_function()
*
* Returns: 0 if the SDIO function was enabled, < 0 errno code on
* error (-ENODEV when it was unable to enable the function).
*/
static
int i2400ms_enable_function(struct sdio_func *func)
int i2400ms_enable_function(struct sdio_func *func, unsigned maxtries)
{
u64 timeout;
int err;
struct device *dev = &func->dev;
unsigned tries = 0;

d_fnstart(3, dev, "(func %p)\n", func);
/* Setup timeout (FIXME: This needs to read the CIS table to
Expand All @@ -131,6 +137,10 @@ int i2400ms_enable_function(struct sdio_func *func)
}
d_printf(2, dev, "SDIO function failed to enable: %d\n", err);
sdio_release_host(func);
if (maxtries > 0 && ++tries >= maxtries) {
err = -ETIME;
break;
}
msleep(I2400MS_INIT_SLEEP_INTERVAL);
}
/* If timed out, device is not there yet -- get -ENODEV so
Expand Down Expand Up @@ -305,7 +315,7 @@ int i2400ms_bus_reset(struct i2400m *i2400m, enum i2400m_reset_type rt)
/* Wait for the device to settle */
msleep(40);

result = i2400ms_enable_function(i2400ms->func);
result = i2400ms_enable_function(i2400ms->func, 0);
if (result >= 0)
i2400ms_rx_setup(i2400ms);
} else
Expand Down Expand Up @@ -452,7 +462,7 @@ int i2400ms_probe(struct sdio_func *func,
goto error_set_blk_size;
}

result = i2400ms_enable_function(i2400ms->func);
result = i2400ms_enable_function(i2400ms->func, 1);
if (result < 0) {
dev_err(dev, "Cannot enable SDIO function: %d\n", result);
goto error_func_enable;
Expand Down

0 comments on commit a14f429

Please sign in to comment.