diff options
author | Alexandre Bounine <alexandre.bounine@idt.com> | 2011-01-12 20:00:38 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-01-13 11:03:17 -0500 |
commit | a93192a5d245a262dc52fa426de5b20467308a77 (patch) | |
tree | f3231240286ef3d204375e047f6b2e1a8efbbcd2 /include/linux/rio_drv.h | |
parent | e6d7202b66d99bf514c8e901db68386b1fcd6d56 (diff) |
rapidio: use common destid storage for endpoints and switches
Change code to use one storage location common for switches and endpoints.
This eliminates unnecessary device type checks during basic access
operations. Logic that assigns destid to RIO devices stays unchanged - as
before, switches use an associated destid because they do not have their
own.
Signed-off-by: Alexandre Bounine <alexandre.bounine@idt.com>
Cc: Kumar Gala <galak@kernel.crashing.org>
Cc: Matt Porter <mporter@kernel.crashing.org>
Cc: Li Yang <leoli@freescale.com>
Cc: Thomas Moll <thomas.moll@sysgo.com>
Cc: Micha Nelissen <micha@neli.hopto.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux/rio_drv.h')
-rw-r--r-- | include/linux/rio_drv.h | 72 |
1 files changed, 12 insertions, 60 deletions
diff --git a/include/linux/rio_drv.h b/include/linux/rio_drv.h index edc55da717b3..e09e565c4bce 100644 --- a/include/linux/rio_drv.h +++ b/include/linux/rio_drv.h | |||
@@ -150,16 +150,8 @@ static inline int rio_local_write_config_8(struct rio_mport *port, u32 offset, | |||
150 | static inline int rio_read_config_32(struct rio_dev *rdev, u32 offset, | 150 | static inline int rio_read_config_32(struct rio_dev *rdev, u32 offset, |
151 | u32 * data) | 151 | u32 * data) |
152 | { | 152 | { |
153 | u8 hopcount = 0xff; | 153 | return rio_mport_read_config_32(rdev->net->hport, rdev->destid, |
154 | u16 destid = rdev->destid; | 154 | rdev->hopcount, offset, data); |
155 | |||
156 | if (rdev->rswitch) { | ||
157 | destid = rdev->rswitch->destid; | ||
158 | hopcount = rdev->rswitch->hopcount; | ||
159 | } | ||
160 | |||
161 | return rio_mport_read_config_32(rdev->net->hport, destid, hopcount, | ||
162 | offset, data); | ||
163 | }; | 155 | }; |
164 | 156 | ||
165 | /** | 157 | /** |
@@ -174,16 +166,8 @@ static inline int rio_read_config_32(struct rio_dev *rdev, u32 offset, | |||
174 | static inline int rio_write_config_32(struct rio_dev *rdev, u32 offset, | 166 | static inline int rio_write_config_32(struct rio_dev *rdev, u32 offset, |
175 | u32 data) | 167 | u32 data) |
176 | { | 168 | { |
177 | u8 hopcount = 0xff; | 169 | return rio_mport_write_config_32(rdev->net->hport, rdev->destid, |
178 | u16 destid = rdev->destid; | 170 | rdev->hopcount, offset, data); |
179 | |||
180 | if (rdev->rswitch) { | ||
181 | destid = rdev->rswitch->destid; | ||
182 | hopcount = rdev->rswitch->hopcount; | ||
183 | } | ||
184 | |||
185 | return rio_mport_write_config_32(rdev->net->hport, destid, hopcount, | ||
186 | offset, data); | ||
187 | }; | 171 | }; |
188 | 172 | ||
189 | /** | 173 | /** |
@@ -198,16 +182,8 @@ static inline int rio_write_config_32(struct rio_dev *rdev, u32 offset, | |||
198 | static inline int rio_read_config_16(struct rio_dev *rdev, u32 offset, | 182 | static inline int rio_read_config_16(struct rio_dev *rdev, u32 offset, |
199 | u16 * data) | 183 | u16 * data) |
200 | { | 184 | { |
201 | u8 hopcount = 0xff; | 185 | return rio_mport_read_config_16(rdev->net->hport, rdev->destid, |
202 | u16 destid = rdev->destid; | 186 | rdev->hopcount, offset, data); |
203 | |||
204 | if (rdev->rswitch) { | ||
205 | destid = rdev->rswitch->destid; | ||
206 | hopcount = rdev->rswitch->hopcount; | ||
207 | } | ||
208 | |||
209 | return rio_mport_read_config_16(rdev->net->hport, destid, hopcount, | ||
210 | offset, data); | ||
211 | }; | 187 | }; |
212 | 188 | ||
213 | /** | 189 | /** |
@@ -222,16 +198,8 @@ static inline int rio_read_config_16(struct rio_dev *rdev, u32 offset, | |||
222 | static inline int rio_write_config_16(struct rio_dev *rdev, u32 offset, | 198 | static inline int rio_write_config_16(struct rio_dev *rdev, u32 offset, |
223 | u16 data) | 199 | u16 data) |
224 | { | 200 | { |
225 | u8 hopcount = 0xff; | 201 | return rio_mport_write_config_16(rdev->net->hport, rdev->destid, |
226 | u16 destid = rdev->destid; | 202 | rdev->hopcount, offset, data); |
227 | |||
228 | if (rdev->rswitch) { | ||
229 | destid = rdev->rswitch->destid; | ||
230 | hopcount = rdev->rswitch->hopcount; | ||
231 | } | ||
232 | |||
233 | return rio_mport_write_config_16(rdev->net->hport, destid, hopcount, | ||
234 | offset, data); | ||
235 | }; | 203 | }; |
236 | 204 | ||
237 | /** | 205 | /** |
@@ -245,16 +213,8 @@ static inline int rio_write_config_16(struct rio_dev *rdev, u32 offset, | |||
245 | */ | 213 | */ |
246 | static inline int rio_read_config_8(struct rio_dev *rdev, u32 offset, u8 * data) | 214 | static inline int rio_read_config_8(struct rio_dev *rdev, u32 offset, u8 * data) |
247 | { | 215 | { |
248 | u8 hopcount = 0xff; | 216 | return rio_mport_read_config_8(rdev->net->hport, rdev->destid, |
249 | u16 destid = rdev->destid; | 217 | rdev->hopcount, offset, data); |
250 | |||
251 | if (rdev->rswitch) { | ||
252 | destid = rdev->rswitch->destid; | ||
253 | hopcount = rdev->rswitch->hopcount; | ||
254 | } | ||
255 | |||
256 | return rio_mport_read_config_8(rdev->net->hport, destid, hopcount, | ||
257 | offset, data); | ||
258 | }; | 218 | }; |
259 | 219 | ||
260 | /** | 220 | /** |
@@ -268,16 +228,8 @@ static inline int rio_read_config_8(struct rio_dev *rdev, u32 offset, u8 * data) | |||
268 | */ | 228 | */ |
269 | static inline int rio_write_config_8(struct rio_dev *rdev, u32 offset, u8 data) | 229 | static inline int rio_write_config_8(struct rio_dev *rdev, u32 offset, u8 data) |
270 | { | 230 | { |
271 | u8 hopcount = 0xff; | 231 | return rio_mport_write_config_8(rdev->net->hport, rdev->destid, |
272 | u16 destid = rdev->destid; | 232 | rdev->hopcount, offset, data); |
273 | |||
274 | if (rdev->rswitch) { | ||
275 | destid = rdev->rswitch->destid; | ||
276 | hopcount = rdev->rswitch->hopcount; | ||
277 | } | ||
278 | |||
279 | return rio_mport_write_config_8(rdev->net->hport, destid, hopcount, | ||
280 | offset, data); | ||
281 | }; | 233 | }; |
282 | 234 | ||
283 | extern int rio_mport_send_doorbell(struct rio_mport *mport, u16 destid, | 235 | extern int rio_mport_send_doorbell(struct rio_mport *mport, u16 destid, |