Commit 1a4c013a authored by Matt Porter's avatar Matt Porter Committed by Greg Kroah-Hartman

greybus: interface: add gb_interface_find()

Add support for getting a struct gb_interface from an
Interface ID.
Signed-off-by: default avatarMatt Porter <mporter@linaro.org>
Signed-off-by: default avatarGreg Kroah-Hartman <greg@kroah.com>
parent 6271b5ba
...@@ -60,6 +60,18 @@ void gb_interface_destroy(struct gb_interface *interface) ...@@ -60,6 +60,18 @@ void gb_interface_destroy(struct gb_interface *interface)
kfree(interface); kfree(interface);
} }
struct gb_interface *gb_interface_find(struct gb_module *module,
u8 interface_id)
{
struct gb_interface *interface;
list_for_each_entry(interface, &module->interfaces, links)
if (interface->id == interface_id)
return interface;
return NULL;
}
int gb_interface_connections_init(struct gb_interface *interface) int gb_interface_connections_init(struct gb_interface *interface)
{ {
struct gb_connection *connection; struct gb_connection *connection;
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
struct gb_interface { struct gb_interface {
struct gb_module *gmod; struct gb_module *gmod;
u8 id; u8 id;
u8 device_id;
struct list_head connections; struct list_head connections;
struct list_head links; /* module->interfaces */ struct list_head links; /* module->interfaces */
...@@ -22,6 +23,8 @@ struct gb_interface { ...@@ -22,6 +23,8 @@ struct gb_interface {
struct gb_interface *gb_interface_create(struct gb_module *gmod, u8 module_id); struct gb_interface *gb_interface_create(struct gb_module *gmod, u8 module_id);
void gb_interface_destroy(struct gb_interface *interface); void gb_interface_destroy(struct gb_interface *interface);
struct gb_interface *gb_interface_find(struct gb_module *gmod, u8 interface_id);
int gb_interface_connections_init(struct gb_interface *interface); int gb_interface_connections_init(struct gb_interface *interface);
void gb_interface_connections_exit(struct gb_interface *interface); void gb_interface_connections_exit(struct gb_interface *interface);
......
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