aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/rapidio/rio-scan.c
diff options
context:
space:
mode:
authorAlexandre Bounine <alexandre.bounine@idt.com>2010-05-26 17:44:03 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-05-27 12:12:51 -0400
commit058f88d672b3161fe511ebe2996c3faef63c1c8e (patch)
treefb4bb8d93aef661cc9e24e1e6e2e8bd4edc2e764 /drivers/rapidio/rio-scan.c
parent011507e49a696462c30914e2eeebcdda33ed30f8 (diff)
rapidio: modify initialization of switch operations
Modify the way how RapidIO switch operations are declared. Multiple assignments through the linker script replaced by single initialization call. Signed-off-by: Alexandre Bounine <alexandre.bounine@idt.com> Cc: Matt Porter <mporter@kernel.crashing.org> Cc: Li Yang <leoli@freescale.com> Cc: Kumar Gala <galak@kernel.crashing.org> Cc: Thomas Moll <thomas.moll@sysgo.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/rapidio/rio-scan.c')
-rw-r--r--drivers/rapidio/rio-scan.c49
1 files changed, 12 insertions, 37 deletions
diff --git a/drivers/rapidio/rio-scan.c b/drivers/rapidio/rio-scan.c
index 1faa1a5756e2..566432106cc5 100644
--- a/drivers/rapidio/rio-scan.c
+++ b/drivers/rapidio/rio-scan.c
@@ -246,24 +246,24 @@ static int rio_is_switch(struct rio_dev *rdev)
246} 246}
247 247
248/** 248/**
249 * rio_route_set_ops- Sets routing operations for a particular vendor switch 249 * rio_switch_init - Sets switch operations for a particular vendor switch
250 * @rdev: RIO device 250 * @rdev: RIO device
251 * @do_enum: Enumeration/Discovery mode flag
251 * 252 *
252 * Searches the RIO route ops table for known switch types. If the vid 253 * Searches the RIO switch ops table for known switch types. If the vid
253 * and did match a switch table entry, then set the add_entry() and 254 * and did match a switch table entry, then call switch initialization
254 * get_entry() ops to the table entry values. 255 * routine to setup switch-specific routines.
255 */ 256 */
256static void rio_route_set_ops(struct rio_dev *rdev) 257static void rio_switch_init(struct rio_dev *rdev, int do_enum)
257{ 258{
258 struct rio_route_ops *cur = __start_rio_route_ops; 259 struct rio_switch_ops *cur = __start_rio_switch_ops;
259 struct rio_route_ops *end = __end_rio_route_ops; 260 struct rio_switch_ops *end = __end_rio_switch_ops;
260 261
261 while (cur < end) { 262 while (cur < end) {
262 if ((cur->vid == rdev->vid) && (cur->did == rdev->did)) { 263 if ((cur->vid == rdev->vid) && (cur->did == rdev->did)) {
263 pr_debug("RIO: adding routing ops for %s\n", rio_name(rdev)); 264 pr_debug("RIO: calling init routine for %s\n",
264 rdev->rswitch->add_entry = cur->add_hook; 265 rio_name(rdev));
265 rdev->rswitch->get_entry = cur->get_hook; 266 cur->init_hook(rdev, do_enum);
266 rdev->rswitch->clr_table = cur->clr_hook;
267 break; 267 break;
268 } 268 }
269 cur++; 269 cur++;
@@ -283,30 +283,6 @@ static void rio_route_set_ops(struct rio_dev *rdev)
283} 283}
284 284
285/** 285/**
286 * rio_em_set_ops- Sets Error Managment operations for a particular vendor switch
287 * @rdev: RIO device
288 *
289 * Searches the RIO EM ops table for known switch types. If the vid
290 * and did match a switch table entry, then set the em_init() and
291 * em_handle() ops to the table entry values.
292 */
293static void rio_em_set_ops(struct rio_dev *rdev)
294{
295 struct rio_em_ops *cur = __start_rio_em_ops;
296 struct rio_em_ops *end = __end_rio_em_ops;
297
298 while (cur < end) {
299 if ((cur->vid == rdev->vid) && (cur->did == rdev->did)) {
300 pr_debug("RIO: adding EM ops for %s\n", rio_name(rdev));
301 rdev->rswitch->em_init = cur->init_hook;
302 rdev->rswitch->em_handle = cur->handler_hook;
303 break;
304 }
305 cur++;
306 }
307}
308
309/**
310 * rio_add_device- Adds a RIO device to the device model 286 * rio_add_device- Adds a RIO device to the device model
311 * @rdev: RIO device 287 * @rdev: RIO device
312 * 288 *
@@ -484,8 +460,7 @@ static struct rio_dev __devinit *rio_setup_device(struct rio_net *net,
484 rdev->rswitch = rswitch; 460 rdev->rswitch = rswitch;
485 dev_set_name(&rdev->dev, "%02x:s:%04x", rdev->net->id, 461 dev_set_name(&rdev->dev, "%02x:s:%04x", rdev->net->id,
486 rdev->rswitch->switchid); 462 rdev->rswitch->switchid);
487 rio_route_set_ops(rdev); 463 rio_switch_init(rdev, do_enum);
488 rio_em_set_ops(rdev);
489 464
490 if (do_enum && rdev->rswitch->clr_table) 465 if (do_enum && rdev->rswitch->clr_table)
491 rdev->rswitch->clr_table(port, destid, hopcount, 466 rdev->rswitch->clr_table(port, destid, hopcount,