summaryrefslogtreecommitdiffstats
path: root/drivers/staging/greybus/hd.c
diff options
context:
space:
mode:
authorJohan Hovold <johan@hovoldconsulting.com>2015-12-07 15:05:37 +0100
committerGreg Kroah-Hartman <gregkh@google.com>2015-12-08 15:31:14 -0500
commit7adeaae7132e06cd760b86576b8aefd2f0feb4d1 (patch)
tree8bf02f9966a47add25d150221522cc28ea9744cf /drivers/staging/greybus/hd.c
parent2c848944c14cf9c74c298b2459cc39dc3c757f25 (diff)
downloadop-kernel-dev-7adeaae7132e06cd760b86576b8aefd2f0feb4d1.zip
op-kernel-dev-7adeaae7132e06cd760b86576b8aefd2f0feb4d1.tar.gz
greybus: svc: create svc along with host device
Create svc device along with host-device and move the svc-connection to the svc structure. The svc connection is enabled when registering the host device, but as the SVC protocol is currently driven by the SVC, we need to defer registration of the svc device to the connection request handler. Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Diffstat (limited to 'drivers/staging/greybus/hd.c')
-rw-r--r--drivers/staging/greybus/hd.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/drivers/staging/greybus/hd.c b/drivers/staging/greybus/hd.c
index 469b31e..bff6861 100644
--- a/drivers/staging/greybus/hd.c
+++ b/drivers/staging/greybus/hd.c
@@ -21,8 +21,8 @@ static void gb_hd_release(struct device *dev)
{
struct gb_host_device *hd = to_gb_host_device(dev);
- if (hd->svc_connection)
- gb_connection_destroy(hd->svc_connection);
+ if (hd->svc)
+ gb_svc_put(hd->svc);
ida_simple_remove(&gb_hd_bus_id_map, hd->bus_id);
ida_destroy(&hd->cport_id_map);
kfree(hd);
@@ -95,10 +95,9 @@ struct gb_host_device *gb_hd_create(struct gb_hd_driver *driver,
device_initialize(&hd->dev);
dev_set_name(&hd->dev, "greybus%d", hd->bus_id);
- hd->svc_connection = gb_connection_create_static(hd, GB_SVC_CPORT_ID,
- GREYBUS_PROTOCOL_SVC);
- if (!hd->svc_connection) {
- dev_err(&hd->dev, "failed to create svc connection\n");
+ hd->svc = gb_svc_create(hd);
+ if (!hd->svc) {
+ dev_err(&hd->dev, "failed to create svc\n");
put_device(&hd->dev);
return ERR_PTR(-ENOMEM);
}
@@ -115,7 +114,7 @@ int gb_hd_add(struct gb_host_device *hd)
if (ret)
return ret;
- ret = gb_connection_init(hd->svc_connection);
+ ret = gb_svc_add(hd->svc);
if (ret) {
device_del(&hd->dev);
return ret;
@@ -129,7 +128,7 @@ void gb_hd_del(struct gb_host_device *hd)
{
gb_interfaces_remove(hd);
- gb_connection_exit(hd->svc_connection);
+ gb_svc_del(hd->svc);
device_del(&hd->dev);
}
OpenPOWER on IntegriCloud