Commit 6f8bded2 authored by Glen Lee's avatar Glen Lee Committed by Greg Kroah-Hartman

staging: wilc1000: wilc_sdio_cmd53: return linux error value

This patch changes return value with linux error value, not 1 or 0.
Signed-off-by: default avatarGlen Lee <glen.lee@atmel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 58ed46f7
...@@ -83,13 +83,10 @@ int wilc_sdio_cmd53(struct wilc *wilc, sdio_cmd53_t *cmd) ...@@ -83,13 +83,10 @@ int wilc_sdio_cmd53(struct wilc *wilc, sdio_cmd53_t *cmd)
sdio_release_host(func); sdio_release_host(func);
if (ret)
if (ret < 0) {
dev_err(&func->dev, "wilc_sdio_cmd53..failed, err(%d)\n", ret); dev_err(&func->dev, "wilc_sdio_cmd53..failed, err(%d)\n", ret);
return 0;
}
return 1; return ret;
} }
static int linux_sdio_probe(struct sdio_func *func, static int linux_sdio_probe(struct sdio_func *func,
......
...@@ -138,6 +138,7 @@ static int sdio_set_func1_block_size(struct wilc *wilc, u32 block_size) ...@@ -138,6 +138,7 @@ static int sdio_set_func1_block_size(struct wilc *wilc, u32 block_size)
static int sdio_write_reg(struct wilc *wilc, u32 addr, u32 data) static int sdio_write_reg(struct wilc *wilc, u32 addr, u32 data)
{ {
struct sdio_func *func = dev_to_sdio_func(wilc->dev); struct sdio_func *func = dev_to_sdio_func(wilc->dev);
int ret;
data = cpu_to_le32(data); data = cpu_to_le32(data);
...@@ -171,8 +172,8 @@ static int sdio_write_reg(struct wilc *wilc, u32 addr, u32 data) ...@@ -171,8 +172,8 @@ static int sdio_write_reg(struct wilc *wilc, u32 addr, u32 data)
cmd.count = 4; cmd.count = 4;
cmd.buffer = (u8 *)&data; cmd.buffer = (u8 *)&data;
cmd.block_size = g_sdio.block_size; /* johnny : prevent it from setting unexpected value */ cmd.block_size = g_sdio.block_size; /* johnny : prevent it from setting unexpected value */
ret = wilc_sdio_cmd53(wilc, &cmd);
if (!wilc_sdio_cmd53(wilc, &cmd)) { if (ret) {
dev_err(&func->dev, dev_err(&func->dev,
"Failed cmd53, write reg (%08x)...\n", addr); "Failed cmd53, write reg (%08x)...\n", addr);
goto _fail_; goto _fail_;
...@@ -191,7 +192,7 @@ static int sdio_write(struct wilc *wilc, u32 addr, u8 *buf, u32 size) ...@@ -191,7 +192,7 @@ static int sdio_write(struct wilc *wilc, u32 addr, u8 *buf, u32 size)
struct sdio_func *func = dev_to_sdio_func(wilc->dev); struct sdio_func *func = dev_to_sdio_func(wilc->dev);
u32 block_size = g_sdio.block_size; u32 block_size = g_sdio.block_size;
sdio_cmd53_t cmd; sdio_cmd53_t cmd;
int nblk, nleft; int nblk, nleft, ret;
cmd.read_write = 1; cmd.read_write = 1;
if (addr > 0) { if (addr > 0) {
...@@ -237,7 +238,8 @@ static int sdio_write(struct wilc *wilc, u32 addr, u8 *buf, u32 size) ...@@ -237,7 +238,8 @@ static int sdio_write(struct wilc *wilc, u32 addr, u8 *buf, u32 size)
if (!sdio_set_func0_csa_address(wilc, addr)) if (!sdio_set_func0_csa_address(wilc, addr))
goto _fail_; goto _fail_;
} }
if (!wilc_sdio_cmd53(wilc, &cmd)) { ret = wilc_sdio_cmd53(wilc, &cmd);
if (ret) {
dev_err(&func->dev, dev_err(&func->dev,
"Failed cmd53 [%x], block send...\n", addr); "Failed cmd53 [%x], block send...\n", addr);
goto _fail_; goto _fail_;
...@@ -259,7 +261,8 @@ static int sdio_write(struct wilc *wilc, u32 addr, u8 *buf, u32 size) ...@@ -259,7 +261,8 @@ static int sdio_write(struct wilc *wilc, u32 addr, u8 *buf, u32 size)
if (!sdio_set_func0_csa_address(wilc, addr)) if (!sdio_set_func0_csa_address(wilc, addr))
goto _fail_; goto _fail_;
} }
if (!wilc_sdio_cmd53(wilc, &cmd)) { ret = wilc_sdio_cmd53(wilc, &cmd);
if (ret) {
dev_err(&func->dev, dev_err(&func->dev,
"Failed cmd53 [%x], bytes send...\n", addr); "Failed cmd53 [%x], bytes send...\n", addr);
goto _fail_; goto _fail_;
...@@ -276,6 +279,7 @@ static int sdio_write(struct wilc *wilc, u32 addr, u8 *buf, u32 size) ...@@ -276,6 +279,7 @@ static int sdio_write(struct wilc *wilc, u32 addr, u8 *buf, u32 size)
static int sdio_read_reg(struct wilc *wilc, u32 addr, u32 *data) static int sdio_read_reg(struct wilc *wilc, u32 addr, u32 *data)
{ {
struct sdio_func *func = dev_to_sdio_func(wilc->dev); struct sdio_func *func = dev_to_sdio_func(wilc->dev);
int ret;
if ((addr >= 0xf0) && (addr <= 0xff)) { if ((addr >= 0xf0) && (addr <= 0xff)) {
sdio_cmd52_t cmd; sdio_cmd52_t cmd;
...@@ -305,8 +309,8 @@ static int sdio_read_reg(struct wilc *wilc, u32 addr, u32 *data) ...@@ -305,8 +309,8 @@ static int sdio_read_reg(struct wilc *wilc, u32 addr, u32 *data)
cmd.buffer = (u8 *)data; cmd.buffer = (u8 *)data;
cmd.block_size = g_sdio.block_size; /* johnny : prevent it from setting unexpected value */ cmd.block_size = g_sdio.block_size; /* johnny : prevent it from setting unexpected value */
ret = wilc_sdio_cmd53(wilc, &cmd);
if (!wilc_sdio_cmd53(wilc, &cmd)) { if (ret) {
dev_err(&func->dev, dev_err(&func->dev,
"Failed cmd53, read reg (%08x)...\n", addr); "Failed cmd53, read reg (%08x)...\n", addr);
goto _fail_; goto _fail_;
...@@ -327,7 +331,7 @@ static int sdio_read(struct wilc *wilc, u32 addr, u8 *buf, u32 size) ...@@ -327,7 +331,7 @@ static int sdio_read(struct wilc *wilc, u32 addr, u8 *buf, u32 size)
struct sdio_func *func = dev_to_sdio_func(wilc->dev); struct sdio_func *func = dev_to_sdio_func(wilc->dev);
u32 block_size = g_sdio.block_size; u32 block_size = g_sdio.block_size;
sdio_cmd53_t cmd; sdio_cmd53_t cmd;
int nblk, nleft; int nblk, nleft, ret;
cmd.read_write = 0; cmd.read_write = 0;
if (addr > 0) { if (addr > 0) {
...@@ -373,7 +377,8 @@ static int sdio_read(struct wilc *wilc, u32 addr, u8 *buf, u32 size) ...@@ -373,7 +377,8 @@ static int sdio_read(struct wilc *wilc, u32 addr, u8 *buf, u32 size)
if (!sdio_set_func0_csa_address(wilc, addr)) if (!sdio_set_func0_csa_address(wilc, addr))
goto _fail_; goto _fail_;
} }
if (!wilc_sdio_cmd53(wilc, &cmd)) { ret = wilc_sdio_cmd53(wilc, &cmd);
if (ret) {
dev_err(&func->dev, dev_err(&func->dev,
"Failed cmd53 [%x], block read...\n", addr); "Failed cmd53 [%x], block read...\n", addr);
goto _fail_; goto _fail_;
...@@ -395,7 +400,8 @@ static int sdio_read(struct wilc *wilc, u32 addr, u8 *buf, u32 size) ...@@ -395,7 +400,8 @@ static int sdio_read(struct wilc *wilc, u32 addr, u8 *buf, u32 size)
if (!sdio_set_func0_csa_address(wilc, addr)) if (!sdio_set_func0_csa_address(wilc, addr))
goto _fail_; goto _fail_;
} }
if (!wilc_sdio_cmd53(wilc, &cmd)) { ret = wilc_sdio_cmd53(wilc, &cmd);
if (ret) {
dev_err(&func->dev, dev_err(&func->dev,
"Failed cmd53 [%x], bytes read...\n", addr); "Failed cmd53 [%x], bytes read...\n", addr);
goto _fail_; goto _fail_;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment