diff options
author | Ashutosh Dixit <ashutosh.dixit@intel.com> | 2015-09-29 21:11:15 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2015-10-04 07:46:06 -0400 |
commit | d3d912eb7386b7512f131b34407978cecccb3703 (patch) | |
tree | 8ecb25d1b63f3bf6cfafa006df90491c8bbcb0f9 /drivers/misc/mic/scif/scif_api.c | |
parent | b7f944411b4a628443f84a542858a8c78847bb48 (diff) |
misc: mic: Add support for kernel mode SCIF clients
Add support for registration/de-registration of kernel mode SCIF
clients. SCIF clients are probed with new and existing SCIF peer
devices. Similarly the client remove method is called when SCIF
peer devices are removed.
Changes to SCIF peer device framework necessitated by supporting
kernel mode SCIF clients are also included in this patch.
Reviewed-by: Nikhil Rao <nikhil.rao@intel.com>
Reviewed-by: Sudeep Dutt <sudeep.dutt@intel.com>
Signed-off-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/misc/mic/scif/scif_api.c')
-rw-r--r-- | drivers/misc/mic/scif/scif_api.c | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/drivers/misc/mic/scif/scif_api.c b/drivers/misc/mic/scif/scif_api.c index bf2d70fcd055..b47d56d5d93c 100644 --- a/drivers/misc/mic/scif/scif_api.c +++ b/drivers/misc/mic/scif/scif_api.c | |||
@@ -1430,3 +1430,46 @@ int scif_get_node_ids(u16 *nodes, int len, u16 *self) | |||
1430 | return online; | 1430 | return online; |
1431 | } | 1431 | } |
1432 | EXPORT_SYMBOL_GPL(scif_get_node_ids); | 1432 | EXPORT_SYMBOL_GPL(scif_get_node_ids); |
1433 | |||
1434 | static int scif_add_client_dev(struct device *dev, struct subsys_interface *si) | ||
1435 | { | ||
1436 | struct scif_client *client = | ||
1437 | container_of(si, struct scif_client, si); | ||
1438 | struct scif_peer_dev *spdev = | ||
1439 | container_of(dev, struct scif_peer_dev, dev); | ||
1440 | |||
1441 | if (client->probe) | ||
1442 | client->probe(spdev); | ||
1443 | return 0; | ||
1444 | } | ||
1445 | |||
1446 | static void scif_remove_client_dev(struct device *dev, | ||
1447 | struct subsys_interface *si) | ||
1448 | { | ||
1449 | struct scif_client *client = | ||
1450 | container_of(si, struct scif_client, si); | ||
1451 | struct scif_peer_dev *spdev = | ||
1452 | container_of(dev, struct scif_peer_dev, dev); | ||
1453 | |||
1454 | if (client->remove) | ||
1455 | client->remove(spdev); | ||
1456 | } | ||
1457 | |||
1458 | void scif_client_unregister(struct scif_client *client) | ||
1459 | { | ||
1460 | subsys_interface_unregister(&client->si); | ||
1461 | } | ||
1462 | EXPORT_SYMBOL_GPL(scif_client_unregister); | ||
1463 | |||
1464 | int scif_client_register(struct scif_client *client) | ||
1465 | { | ||
1466 | struct subsys_interface *si = &client->si; | ||
1467 | |||
1468 | si->name = client->name; | ||
1469 | si->subsys = &scif_peer_bus; | ||
1470 | si->add_dev = scif_add_client_dev; | ||
1471 | si->remove_dev = scif_remove_client_dev; | ||
1472 | |||
1473 | return subsys_interface_register(&client->si); | ||
1474 | } | ||
1475 | EXPORT_SYMBOL_GPL(scif_client_register); | ||