summaryrefslogtreecommitdiff
path: root/drivers/staging/greybus/svc.c
diff options
context:
space:
mode:
authorBryan O'Donoghue <bryan.odonoghue@linaro.org>2016-06-05 14:03:27 +0100
committerGreg Kroah-Hartman <gregkh@google.com>2016-06-06 20:50:08 -0700
commit4a4484274f7431c68e104a66b497639e1ac9022c (patch)
treedcbfee4f8cb5700cf650f66ab84c93dffc7cc8fd /drivers/staging/greybus/svc.c
parent970dc85bd95d931def5926ae81b5aa84ef14fb7c (diff)
greybus: timesync: Bind TimeSync into Greybus
TimeSync needs to bind into Greybus in a few places. - core.c To initialize its internal state and tear-down its internal state. To schedule a timesync to a newly added Bundle after probe() completes. - svc.c To get access to the SVC and enable/disable timesync as well as extracting the authoritative time from the SVC to subsequently disseminate to other entities in the system. - interface.c To get access to an Interface in order to inform APBx of timesync enable/disable and authoritative operations. This patch adds those bindings into Greybus core. Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org> Reviewed-by: Vaibhav Hiremath <vaibhav.hiremath@linaro.org> Acked-by: Alex Elder <elder@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Diffstat (limited to 'drivers/staging/greybus/svc.c')
-rw-r--r--drivers/staging/greybus/svc.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/drivers/staging/greybus/svc.c b/drivers/staging/greybus/svc.c
index b41d2622d94d..d7458c53b889 100644
--- a/drivers/staging/greybus/svc.c
+++ b/drivers/staging/greybus/svc.c
@@ -851,14 +851,25 @@ static int gb_svc_hello(struct gb_operation *op)
ret = gb_svc_watchdog_create(svc);
if (ret) {
dev_err(&svc->dev, "failed to create watchdog: %d\n", ret);
- input_unregister_device(svc->input);
- device_del(&svc->dev);
- return ret;
+ goto err_unregister_device;
}
gb_svc_debugfs_init(svc);
+ ret = gb_timesync_svc_add(svc);
+ if (ret) {
+ dev_err(&svc->dev, "failed to add SVC to timesync: %d\n", ret);
+ gb_svc_debugfs_exit(svc);
+ goto err_unregister_device;
+ }
+
return gb_svc_queue_deferred_request(op);
+
+err_unregister_device:
+ gb_svc_watchdog_destroy(svc);
+ input_unregister_device(svc->input);
+ device_del(&svc->dev);
+ return ret;
}
static struct gb_interface *gb_svc_interface_lookup(struct gb_svc *svc,
@@ -1404,6 +1415,7 @@ void gb_svc_del(struct gb_svc *svc)
* from the request handler.
*/
if (device_is_registered(&svc->dev)) {
+ gb_timesync_svc_remove(svc);
gb_svc_debugfs_exit(svc);
gb_svc_watchdog_destroy(svc);
input_unregister_device(svc->input);