提交 02eb1d9d 编写于 作者: I Ido Yariv 提交者: Luciano Coelho

wlcore: Change read/write ops to return errors

While bus operations may fail, either due to HW or FW issues, these are
never propagated to higher layers. As a result, the core driver has no
way of knowing that the operations failed, and will only recover if high
level logic requires it (e.g. no command completion).

Change read/write bus operations to return errors to let higher layer
functionality handle these.
Signed-off-by: NIdo Yariv <ido@wizery.com>
Signed-off-by: NLuciano Coelho <coelho@ti.com>
上级 b666bb7f
...@@ -71,8 +71,8 @@ static void wl1271_sdio_set_block_size(struct device *child, ...@@ -71,8 +71,8 @@ static void wl1271_sdio_set_block_size(struct device *child,
sdio_release_host(func); sdio_release_host(func);
} }
static void wl12xx_sdio_raw_read(struct device *child, int addr, void *buf, static int wl12xx_sdio_raw_read(struct device *child, int addr, void *buf,
size_t len, bool fixed) size_t len, bool fixed)
{ {
int ret; int ret;
struct wl12xx_sdio_glue *glue = dev_get_drvdata(child->parent); struct wl12xx_sdio_glue *glue = dev_get_drvdata(child->parent);
...@@ -103,12 +103,14 @@ static void wl12xx_sdio_raw_read(struct device *child, int addr, void *buf, ...@@ -103,12 +103,14 @@ static void wl12xx_sdio_raw_read(struct device *child, int addr, void *buf,
sdio_release_host(func); sdio_release_host(func);
if (ret) if (WARN_ON(ret))
dev_err(child->parent, "sdio read failed (%d)\n", ret); dev_err(child->parent, "sdio read failed (%d)\n", ret);
return ret;
} }
static void wl12xx_sdio_raw_write(struct device *child, int addr, void *buf, static int wl12xx_sdio_raw_write(struct device *child, int addr, void *buf,
size_t len, bool fixed) size_t len, bool fixed)
{ {
int ret; int ret;
struct wl12xx_sdio_glue *glue = dev_get_drvdata(child->parent); struct wl12xx_sdio_glue *glue = dev_get_drvdata(child->parent);
...@@ -139,8 +141,10 @@ static void wl12xx_sdio_raw_write(struct device *child, int addr, void *buf, ...@@ -139,8 +141,10 @@ static void wl12xx_sdio_raw_write(struct device *child, int addr, void *buf,
sdio_release_host(func); sdio_release_host(func);
if (ret) if (WARN_ON(ret))
dev_err(child->parent, "sdio write failed (%d)\n", ret); dev_err(child->parent, "sdio write failed (%d)\n", ret);
return ret;
} }
static int wl12xx_sdio_power_on(struct wl12xx_sdio_glue *glue) static int wl12xx_sdio_power_on(struct wl12xx_sdio_glue *glue)
......
...@@ -193,8 +193,8 @@ static int wl12xx_spi_read_busy(struct device *child) ...@@ -193,8 +193,8 @@ static int wl12xx_spi_read_busy(struct device *child)
return -ETIMEDOUT; return -ETIMEDOUT;
} }
static void wl12xx_spi_raw_read(struct device *child, int addr, void *buf, static int wl12xx_spi_raw_read(struct device *child, int addr, void *buf,
size_t len, bool fixed) size_t len, bool fixed)
{ {
struct wl12xx_spi_glue *glue = dev_get_drvdata(child->parent); struct wl12xx_spi_glue *glue = dev_get_drvdata(child->parent);
struct wl1271 *wl = dev_get_drvdata(child); struct wl1271 *wl = dev_get_drvdata(child);
...@@ -238,7 +238,7 @@ static void wl12xx_spi_raw_read(struct device *child, int addr, void *buf, ...@@ -238,7 +238,7 @@ static void wl12xx_spi_raw_read(struct device *child, int addr, void *buf,
if (!(busy_buf[WL1271_BUSY_WORD_CNT - 1] & 0x1) && if (!(busy_buf[WL1271_BUSY_WORD_CNT - 1] & 0x1) &&
wl12xx_spi_read_busy(child)) { wl12xx_spi_read_busy(child)) {
memset(buf, 0, chunk_len); memset(buf, 0, chunk_len);
return; return 0;
} }
spi_message_init(&m); spi_message_init(&m);
...@@ -256,10 +256,12 @@ static void wl12xx_spi_raw_read(struct device *child, int addr, void *buf, ...@@ -256,10 +256,12 @@ static void wl12xx_spi_raw_read(struct device *child, int addr, void *buf,
buf += chunk_len; buf += chunk_len;
len -= chunk_len; len -= chunk_len;
} }
return 0;
} }
static void wl12xx_spi_raw_write(struct device *child, int addr, void *buf, static int wl12xx_spi_raw_write(struct device *child, int addr, void *buf,
size_t len, bool fixed) size_t len, bool fixed)
{ {
struct wl12xx_spi_glue *glue = dev_get_drvdata(child->parent); struct wl12xx_spi_glue *glue = dev_get_drvdata(child->parent);
struct spi_transfer t[2 * WSPI_MAX_NUM_OF_CHUNKS]; struct spi_transfer t[2 * WSPI_MAX_NUM_OF_CHUNKS];
...@@ -304,6 +306,8 @@ static void wl12xx_spi_raw_write(struct device *child, int addr, void *buf, ...@@ -304,6 +306,8 @@ static void wl12xx_spi_raw_write(struct device *child, int addr, void *buf,
} }
spi_sync(to_spi_device(glue->dev), &m); spi_sync(to_spi_device(glue->dev), &m);
return 0;
} }
static struct wl1271_if_operations spi_ops = { static struct wl1271_if_operations spi_ops = {
......
...@@ -209,9 +209,9 @@ struct wl1271_scan { ...@@ -209,9 +209,9 @@ struct wl1271_scan {
}; };
struct wl1271_if_operations { struct wl1271_if_operations {
void (*read)(struct device *child, int addr, void *buf, size_t len, int (*read)(struct device *child, int addr, void *buf, size_t len,
bool fixed); bool fixed);
void (*write)(struct device *child, int addr, void *buf, size_t len, int (*write)(struct device *child, int addr, void *buf, size_t len,
bool fixed); bool fixed);
void (*reset)(struct device *child); void (*reset)(struct device *child);
void (*init)(struct device *child); void (*init)(struct device *child);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册