aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorIdo Yariv <ido@wizery.com>2012-06-19 17:03:46 -0400
committerLuciano Coelho <coelho@ti.com>2012-06-22 03:49:45 -0400
commitf1a26e638e646d971f77c5a5186ee254b3f4e818 (patch)
tree6bbab98111938733b37f7eacbe2fc85b49b47b0c /drivers
parent2b80040782af56e1b13ad451f593dd4e1875b2b8 (diff)
wlcore: Force checking of io functions' return values
All io functions' return values should be propagated and handled. Add a __must_check annotation to verify that the return values are checked and to avoid future mistakes. Signed-off-by: Ido Yariv <ido@wizery.com> Signed-off-by: Luciano Coelho <coelho@ti.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/wireless/ti/wl12xx/main.c6
-rw-r--r--drivers/net/wireless/ti/wl18xx/io.h4
-rw-r--r--drivers/net/wireless/ti/wlcore/io.h61
-rw-r--r--drivers/net/wireless/ti/wlcore/sdio.c8
-rw-r--r--drivers/net/wireless/ti/wlcore/spi.c8
-rw-r--r--drivers/net/wireless/ti/wlcore/wlcore_i.h8
6 files changed, 55 insertions, 40 deletions
diff --git a/drivers/net/wireless/ti/wl12xx/main.c b/drivers/net/wireless/ti/wl12xx/main.c
index 3a4ab65db0ec..47ba2e0017f4 100644
--- a/drivers/net/wireless/ti/wl12xx/main.c
+++ b/drivers/net/wireless/ti/wl12xx/main.c
@@ -688,7 +688,8 @@ out:
688 return ret; 688 return ret;
689} 689}
690 690
691static int wl12xx_top_reg_write(struct wl1271 *wl, int addr, u16 val) 691static int __must_check wl12xx_top_reg_write(struct wl1271 *wl, int addr,
692 u16 val)
692{ 693{
693 int ret; 694 int ret;
694 695
@@ -712,7 +713,8 @@ out:
712 return ret; 713 return ret;
713} 714}
714 715
715static int wl12xx_top_reg_read(struct wl1271 *wl, int addr, u16 *out) 716static int __must_check wl12xx_top_reg_read(struct wl1271 *wl, int addr,
717 u16 *out)
716{ 718{
717 u32 val; 719 u32 val;
718 int timeout = OCP_CMD_LOOP; 720 int timeout = OCP_CMD_LOOP;
diff --git a/drivers/net/wireless/ti/wl18xx/io.h b/drivers/net/wireless/ti/wl18xx/io.h
index 0e1b8d28edb2..c32ae30277df 100644
--- a/drivers/net/wireless/ti/wl18xx/io.h
+++ b/drivers/net/wireless/ti/wl18xx/io.h
@@ -22,7 +22,7 @@
22#ifndef __WL18XX_IO_H__ 22#ifndef __WL18XX_IO_H__
23#define __WL18XX_IO_H__ 23#define __WL18XX_IO_H__
24 24
25int wl18xx_top_reg_write(struct wl1271 *wl, int addr, u16 val); 25int __must_check wl18xx_top_reg_write(struct wl1271 *wl, int addr, u16 val);
26int wl18xx_top_reg_read(struct wl1271 *wl, int addr, u16 *out); 26int __must_check wl18xx_top_reg_read(struct wl1271 *wl, int addr, u16 *out);
27 27
28#endif /* __WL18XX_IO_H__ */ 28#endif /* __WL18XX_IO_H__ */
diff --git a/drivers/net/wireless/ti/wlcore/io.h b/drivers/net/wireless/ti/wlcore/io.h
index 4a6688b03aea..1cd545b0ed1e 100644
--- a/drivers/net/wireless/ti/wlcore/io.h
+++ b/drivers/net/wireless/ti/wlcore/io.h
@@ -53,31 +53,36 @@ void wl1271_io_init(struct wl1271 *wl);
53int wlcore_translate_addr(struct wl1271 *wl, int addr); 53int wlcore_translate_addr(struct wl1271 *wl, int addr);
54 54
55/* Raw target IO, address is not translated */ 55/* Raw target IO, address is not translated */
56static inline int wlcore_raw_write(struct wl1271 *wl, int addr, void *buf, 56static inline int __must_check wlcore_raw_write(struct wl1271 *wl, int addr,
57 size_t len, bool fixed) 57 void *buf, size_t len,
58 bool fixed)
58{ 59{
59 return wl->if_ops->write(wl->dev, addr, buf, len, fixed); 60 return wl->if_ops->write(wl->dev, addr, buf, len, fixed);
60} 61}
61 62
62static inline int wlcore_raw_read(struct wl1271 *wl, int addr, void *buf, 63static inline int __must_check wlcore_raw_read(struct wl1271 *wl, int addr,
63 size_t len, bool fixed) 64 void *buf, size_t len,
65 bool fixed)
64{ 66{
65 return wl->if_ops->read(wl->dev, addr, buf, len, fixed); 67 return wl->if_ops->read(wl->dev, addr, buf, len, fixed);
66} 68}
67 69
68static inline int wlcore_raw_read_data(struct wl1271 *wl, int reg, void *buf, 70static inline int __must_check wlcore_raw_read_data(struct wl1271 *wl, int reg,
69 size_t len, bool fixed) 71 void *buf, size_t len,
72 bool fixed)
70{ 73{
71 return wlcore_raw_read(wl, wl->rtable[reg], buf, len, fixed); 74 return wlcore_raw_read(wl, wl->rtable[reg], buf, len, fixed);
72} 75}
73 76
74static inline int wlcore_raw_write_data(struct wl1271 *wl, int reg, void *buf, 77static inline int __must_check wlcore_raw_write_data(struct wl1271 *wl, int reg,
75 size_t len, bool fixed) 78 void *buf, size_t len,
79 bool fixed)
76{ 80{
77 return wlcore_raw_write(wl, wl->rtable[reg], buf, len, fixed); 81 return wlcore_raw_write(wl, wl->rtable[reg], buf, len, fixed);
78} 82}
79 83
80static inline int wlcore_raw_read32(struct wl1271 *wl, int addr, u32 *val) 84static inline int __must_check wlcore_raw_read32(struct wl1271 *wl, int addr,
85 u32 *val)
81{ 86{
82 int ret; 87 int ret;
83 88
@@ -92,15 +97,16 @@ static inline int wlcore_raw_read32(struct wl1271 *wl, int addr, u32 *val)
92 return 0; 97 return 0;
93} 98}
94 99
95static inline int wlcore_raw_write32(struct wl1271 *wl, int addr, u32 val) 100static inline int __must_check wlcore_raw_write32(struct wl1271 *wl, int addr,
101 u32 val)
96{ 102{
97 wl->buffer_32 = cpu_to_le32(val); 103 wl->buffer_32 = cpu_to_le32(val);
98 return wlcore_raw_write(wl, addr, &wl->buffer_32, 104 return wlcore_raw_write(wl, addr, &wl->buffer_32,
99 sizeof(wl->buffer_32), false); 105 sizeof(wl->buffer_32), false);
100} 106}
101 107
102static inline int wlcore_read(struct wl1271 *wl, int addr, void *buf, 108static inline int __must_check wlcore_read(struct wl1271 *wl, int addr,
103 size_t len, bool fixed) 109 void *buf, size_t len, bool fixed)
104{ 110{
105 int physical; 111 int physical;
106 112
@@ -109,8 +115,8 @@ static inline int wlcore_read(struct wl1271 *wl, int addr, void *buf,
109 return wlcore_raw_read(wl, physical, buf, len, fixed); 115 return wlcore_raw_read(wl, physical, buf, len, fixed);
110} 116}
111 117
112static inline int wlcore_write(struct wl1271 *wl, int addr, void *buf, 118static inline int __must_check wlcore_write(struct wl1271 *wl, int addr,
113 size_t len, bool fixed) 119 void *buf, size_t len, bool fixed)
114{ 120{
115 int physical; 121 int physical;
116 122
@@ -119,20 +125,23 @@ static inline int wlcore_write(struct wl1271 *wl, int addr, void *buf,
119 return wlcore_raw_write(wl, physical, buf, len, fixed); 125 return wlcore_raw_write(wl, physical, buf, len, fixed);
120} 126}
121 127
122static inline int wlcore_write_data(struct wl1271 *wl, int reg, void *buf, 128static inline int __must_check wlcore_write_data(struct wl1271 *wl, int reg,
123 size_t len, bool fixed) 129 void *buf, size_t len,
130 bool fixed)
124{ 131{
125 return wlcore_write(wl, wl->rtable[reg], buf, len, fixed); 132 return wlcore_write(wl, wl->rtable[reg], buf, len, fixed);
126} 133}
127 134
128static inline int wlcore_read_data(struct wl1271 *wl, int reg, void *buf, 135static inline int __must_check wlcore_read_data(struct wl1271 *wl, int reg,
129 size_t len, bool fixed) 136 void *buf, size_t len,
137 bool fixed)
130{ 138{
131 return wlcore_read(wl, wl->rtable[reg], buf, len, fixed); 139 return wlcore_read(wl, wl->rtable[reg], buf, len, fixed);
132} 140}
133 141
134static inline int wlcore_read_hwaddr(struct wl1271 *wl, int hwaddr, 142static inline int __must_check wlcore_read_hwaddr(struct wl1271 *wl, int hwaddr,
135 void *buf, size_t len, bool fixed) 143 void *buf, size_t len,
144 bool fixed)
136{ 145{
137 int physical; 146 int physical;
138 int addr; 147 int addr;
@@ -145,24 +154,28 @@ static inline int wlcore_read_hwaddr(struct wl1271 *wl, int hwaddr,
145 return wlcore_raw_read(wl, physical, buf, len, fixed); 154 return wlcore_raw_read(wl, physical, buf, len, fixed);
146} 155}
147 156
148static inline int wlcore_read32(struct wl1271 *wl, int addr, u32 *val) 157static inline int __must_check wlcore_read32(struct wl1271 *wl, int addr,
158 u32 *val)
149{ 159{
150 return wlcore_raw_read32(wl, wlcore_translate_addr(wl, addr), val); 160 return wlcore_raw_read32(wl, wlcore_translate_addr(wl, addr), val);
151} 161}
152 162
153static inline int wlcore_write32(struct wl1271 *wl, int addr, u32 val) 163static inline int __must_check wlcore_write32(struct wl1271 *wl, int addr,
164 u32 val)
154{ 165{
155 return wlcore_raw_write32(wl, wlcore_translate_addr(wl, addr), val); 166 return wlcore_raw_write32(wl, wlcore_translate_addr(wl, addr), val);
156} 167}
157 168
158static inline int wlcore_read_reg(struct wl1271 *wl, int reg, u32 *val) 169static inline int __must_check wlcore_read_reg(struct wl1271 *wl, int reg,
170 u32 *val)
159{ 171{
160 return wlcore_raw_read32(wl, 172 return wlcore_raw_read32(wl,
161 wlcore_translate_addr(wl, wl->rtable[reg]), 173 wlcore_translate_addr(wl, wl->rtable[reg]),
162 val); 174 val);
163} 175}
164 176
165static inline int wlcore_write_reg(struct wl1271 *wl, int reg, u32 val) 177static inline int __must_check wlcore_write_reg(struct wl1271 *wl, int reg,
178 u32 val)
166{ 179{
167 return wlcore_raw_write32(wl, 180 return wlcore_raw_write32(wl,
168 wlcore_translate_addr(wl, wl->rtable[reg]), 181 wlcore_translate_addr(wl, wl->rtable[reg]),
diff --git a/drivers/net/wireless/ti/wlcore/sdio.c b/drivers/net/wireless/ti/wlcore/sdio.c
index 9069dc93b1bc..204e69fa9327 100644
--- a/drivers/net/wireless/ti/wlcore/sdio.c
+++ b/drivers/net/wireless/ti/wlcore/sdio.c
@@ -71,8 +71,8 @@ static void wl1271_sdio_set_block_size(struct device *child,
71 sdio_release_host(func); 71 sdio_release_host(func);
72} 72}
73 73
74static int wl12xx_sdio_raw_read(struct device *child, int addr, void *buf, 74static int __must_check wl12xx_sdio_raw_read(struct device *child, int addr,
75 size_t len, bool fixed) 75 void *buf, size_t len, bool fixed)
76{ 76{
77 int ret; 77 int ret;
78 struct wl12xx_sdio_glue *glue = dev_get_drvdata(child->parent); 78 struct wl12xx_sdio_glue *glue = dev_get_drvdata(child->parent);
@@ -109,8 +109,8 @@ static int wl12xx_sdio_raw_read(struct device *child, int addr, void *buf,
109 return ret; 109 return ret;
110} 110}
111 111
112static int wl12xx_sdio_raw_write(struct device *child, int addr, void *buf, 112static int __must_check wl12xx_sdio_raw_write(struct device *child, int addr,
113 size_t len, bool fixed) 113 void *buf, size_t len, bool fixed)
114{ 114{
115 int ret; 115 int ret;
116 struct wl12xx_sdio_glue *glue = dev_get_drvdata(child->parent); 116 struct wl12xx_sdio_glue *glue = dev_get_drvdata(child->parent);
diff --git a/drivers/net/wireless/ti/wlcore/spi.c b/drivers/net/wireless/ti/wlcore/spi.c
index d6768e9d7dab..6420abae40ee 100644
--- a/drivers/net/wireless/ti/wlcore/spi.c
+++ b/drivers/net/wireless/ti/wlcore/spi.c
@@ -193,8 +193,8 @@ static int wl12xx_spi_read_busy(struct device *child)
193 return -ETIMEDOUT; 193 return -ETIMEDOUT;
194} 194}
195 195
196static int wl12xx_spi_raw_read(struct device *child, int addr, void *buf, 196static int __must_check wl12xx_spi_raw_read(struct device *child, int addr,
197 size_t len, bool fixed) 197 void *buf, size_t len, bool fixed)
198{ 198{
199 struct wl12xx_spi_glue *glue = dev_get_drvdata(child->parent); 199 struct wl12xx_spi_glue *glue = dev_get_drvdata(child->parent);
200 struct wl1271 *wl = dev_get_drvdata(child); 200 struct wl1271 *wl = dev_get_drvdata(child);
@@ -260,8 +260,8 @@ static int wl12xx_spi_raw_read(struct device *child, int addr, void *buf,
260 return 0; 260 return 0;
261} 261}
262 262
263static int wl12xx_spi_raw_write(struct device *child, int addr, void *buf, 263static int __must_check wl12xx_spi_raw_write(struct device *child, int addr,
264 size_t len, bool fixed) 264 void *buf, size_t len, bool fixed)
265{ 265{
266 struct wl12xx_spi_glue *glue = dev_get_drvdata(child->parent); 266 struct wl12xx_spi_glue *glue = dev_get_drvdata(child->parent);
267 struct spi_transfer t[2 * WSPI_MAX_NUM_OF_CHUNKS]; 267 struct spi_transfer t[2 * WSPI_MAX_NUM_OF_CHUNKS];
diff --git a/drivers/net/wireless/ti/wlcore/wlcore_i.h b/drivers/net/wireless/ti/wlcore/wlcore_i.h
index 5ab31ff4080e..e5a34dd34baf 100644
--- a/drivers/net/wireless/ti/wlcore/wlcore_i.h
+++ b/drivers/net/wireless/ti/wlcore/wlcore_i.h
@@ -209,10 +209,10 @@ struct wl1271_scan {
209}; 209};
210 210
211struct wl1271_if_operations { 211struct wl1271_if_operations {
212 int (*read)(struct device *child, int addr, void *buf, size_t len, 212 int __must_check (*read)(struct device *child, int addr, void *buf,
213 bool fixed); 213 size_t len, bool fixed);
214 int (*write)(struct device *child, int addr, void *buf, size_t len, 214 int __must_check (*write)(struct device *child, int addr, void *buf,
215 bool fixed); 215 size_t len, bool fixed);
216 void (*reset)(struct device *child); 216 void (*reset)(struct device *child);
217 void (*init)(struct device *child); 217 void (*init)(struct device *child);
218 int (*power)(struct device *child, bool enable); 218 int (*power)(struct device *child, bool enable);