summaryrefslogtreecommitdiffstats
path: root/drivers/rapidio/rio-scan.c
diff options
context:
space:
mode:
authorAlexandre Bounine <alexandre.bounine@idt.com>2010-05-26 14:44:03 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2010-05-27 09:12:51 -0700
commit058f88d672b3161fe511ebe2996c3faef63c1c8e (patch)
treefb4bb8d93aef661cc9e24e1e6e2e8bd4edc2e764 /drivers/rapidio/rio-scan.c
parent011507e49a696462c30914e2eeebcdda33ed30f8 (diff)
downloadlinux-058f88d672b3161fe511ebe2996c3faef63c1c8e.tar.gz
linux-058f88d672b3161fe511ebe2996c3faef63c1c8e.tar.bz2
linux-058f88d672b3161fe511ebe2996c3faef63c1c8e.zip
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)
}
/**
- * rio_route_set_ops- Sets routing operations for a particular vendor switch
+ * rio_switch_init - Sets switch operations for a particular vendor switch
* @rdev: RIO device
+ * @do_enum: Enumeration/Discovery mode flag
*
- * Searches the RIO route ops table for known switch types. If the vid
- * and did match a switch table entry, then set the add_entry() and
- * get_entry() ops to the table entry values.
+ * Searches the RIO switch ops table for known switch types. If the vid
+ * and did match a switch table entry, then call switch initialization
+ * routine to setup switch-specific routines.
*/
-static void rio_route_set_ops(struct rio_dev *rdev)
+static void rio_switch_init(struct rio_dev *rdev, int do_enum)
{
- struct rio_route_ops *cur = __start_rio_route_ops;
- struct rio_route_ops *end = __end_rio_route_ops;
+ struct rio_switch_ops *cur = __start_rio_switch_ops;
+ struct rio_switch_ops *end = __end_rio_switch_ops;
while (cur < end) {
if ((cur->vid == rdev->vid) && (cur->did == rdev->did)) {
- pr_debug("RIO: adding routing ops for %s\n", rio_name(rdev));
- rdev->rswitch->add_entry = cur->add_hook;
- rdev->rswitch->get_entry = cur->get_hook;
- rdev->rswitch->clr_table = cur->clr_hook;
+ pr_debug("RIO: calling init routine for %s\n",
+ rio_name(rdev));
+ cur->init_hook(rdev, do_enum);
break;
}
cur++;
@@ -283,30 +283,6 @@ static void rio_route_set_ops(struct rio_dev *rdev)
}
/**
- * rio_em_set_ops- Sets Error Managment operations for a particular vendor switch
- * @rdev: RIO device
- *
- * Searches the RIO EM ops table for known switch types. If the vid
- * and did match a switch table entry, then set the em_init() and
- * em_handle() ops to the table entry values.
- */
-static void rio_em_set_ops(struct rio_dev *rdev)
-{
- struct rio_em_ops *cur = __start_rio_em_ops;
- struct rio_em_ops *end = __end_rio_em_ops;
-
- while (cur < end) {
- if ((cur->vid == rdev->vid) && (cur->did == rdev->did)) {
- pr_debug("RIO: adding EM ops for %s\n", rio_name(rdev));
- rdev->rswitch->em_init = cur->init_hook;
- rdev->rswitch->em_handle = cur->handler_hook;
- break;
- }
- cur++;
- }
-}
-
-/**
* rio_add_device- Adds a RIO device to the device model
* @rdev: RIO device
*
@@ -484,8 +460,7 @@ static struct rio_dev __devinit *rio_setup_device(struct rio_net *net,
rdev->rswitch = rswitch;
dev_set_name(&rdev->dev, "%02x:s:%04x", rdev->net->id,
rdev->rswitch->switchid);
- rio_route_set_ops(rdev);
- rio_em_set_ops(rdev);
+ rio_switch_init(rdev, do_enum);
if (do_enum && rdev->rswitch->clr_table)
rdev->rswitch->clr_table(port, destid, hopcount,