Commit 6ceb8fde authored by Viresh Kumar's avatar Viresh Kumar Committed by Greg Kroah-Hartman

greybus: svc: save pointer to struct gb_svc in struct gb_interface

Its another special protocol (just like control protocol) and is
required to be accessed from other files, lets save a pointer to it in
interface structure.
Signed-off-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@google.com>
parent ab69c4ce
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
struct gb_interface { struct gb_interface {
struct device dev; struct device dev;
struct gb_control *control; struct gb_control *control;
struct gb_svc *svc;
struct list_head bundles; struct list_head bundles;
struct list_head links; /* greybus_host_device->interfaces */ struct list_head links; /* greybus_host_device->interfaces */
......
...@@ -9,12 +9,6 @@ ...@@ -9,12 +9,6 @@
#include "greybus.h" #include "greybus.h"
struct gb_svc {
struct gb_connection *connection;
u8 version_major;
u8 version_minor;
};
/* Define get_version() routine */ /* Define get_version() routine */
define_get_version(gb_svc, SVC); define_get_version(gb_svc, SVC);
...@@ -217,6 +211,9 @@ static int gb_svc_connection_init(struct gb_connection *connection) ...@@ -217,6 +211,9 @@ static int gb_svc_connection_init(struct gb_connection *connection)
if (ret) if (ret)
kfree(svc); kfree(svc);
/* Set interface's svc connection */
connection->bundle->intf->svc = svc;
return ret; return ret;
} }
...@@ -224,9 +221,11 @@ static void gb_svc_connection_exit(struct gb_connection *connection) ...@@ -224,9 +221,11 @@ static void gb_svc_connection_exit(struct gb_connection *connection)
{ {
struct gb_svc *svc = connection->private; struct gb_svc *svc = connection->private;
if (!svc) if (WARN_ON(connection->bundle->intf->svc != svc))
return; return;
connection->bundle->intf->svc = NULL;
kfree(svc); kfree(svc);
} }
......
...@@ -10,7 +10,12 @@ ...@@ -10,7 +10,12 @@
#ifndef __SVC_H #ifndef __SVC_H
#define __SVC_H #define __SVC_H
struct gb_svc; struct gb_svc {
struct gb_connection *connection;
u8 version_major;
u8 version_minor;
};
int gb_svc_intf_device_id(struct gb_svc *svc, u8 intf_id, u8 device_id); int gb_svc_intf_device_id(struct gb_svc *svc, u8 intf_id, u8 device_id);
int gb_svc_intf_reset(struct gb_svc *svc, u8 intf_id); int gb_svc_intf_reset(struct gb_svc *svc, u8 intf_id);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment