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: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
struct gb_interface {
struct device dev;
struct gb_control *control;
+ struct gb_svc *svc;
struct list_head bundles;
struct list_head links; /* greybus_host_device->interfaces */
#include "greybus.h"
-struct gb_svc {
- struct gb_connection *connection;
- u8 version_major;
- u8 version_minor;
-};
-
/* Define get_version() routine */
define_get_version(gb_svc, SVC);
if (ret)
kfree(svc);
+ /* Set interface's svc connection */
+ connection->bundle->intf->svc = svc;
+
return ret;
}
{
struct gb_svc *svc = connection->private;
- if (!svc)
+ if (WARN_ON(connection->bundle->intf->svc != svc))
return;
+ connection->bundle->intf->svc = NULL;
+
kfree(svc);
}
#ifndef __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_reset(struct gb_svc *svc, u8 intf_id);