From: Viresh Kumar Date: Fri, 14 Nov 2014 11:55:08 +0000 (+0530) Subject: greybus: interface: move gb_module_interface_init() to interface.c X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=2206ea9cf8c56a0b98db3498ae5b6642a995a0a8;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git greybus: interface: move gb_module_interface_init() to interface.c That's where it belong to. Also rename it in a similar way to: gb_interface_create() and gb_interface_destroy(). Signed-off-by: Viresh Kumar Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/greybus/ap.c b/drivers/staging/greybus/ap.c index 9d743f28e08e..990e5c0620b9 100644 --- a/drivers/staging/greybus/ap.c +++ b/drivers/staging/greybus/ap.c @@ -146,7 +146,7 @@ static void svc_management(struct svc_function_unipro_management *management, management->link_up.module_id); return; } - ret = gb_module_interface_init(module, + ret = gb_interface_init(module, management->link_up.interface_id, management->link_up.device_id); if (ret) diff --git a/drivers/staging/greybus/interface.c b/drivers/staging/greybus/interface.c index 537ef80a599a..04c864f2105f 100644 --- a/drivers/staging/greybus/interface.c +++ b/drivers/staging/greybus/interface.c @@ -111,6 +111,36 @@ void gb_interface_destroy(struct gb_module *gmod) spin_unlock_irq(&gb_interfaces_lock); } +int gb_interface_init(struct gb_module *gmod, u8 interface_id, u8 device_id) +{ + struct gb_interface *interface; + int ret; + + interface = gb_interface_find(gmod, interface_id); + if (!interface) { + dev_err(gmod->hd->parent, "module %hhu not found\n", + interface_id); + return -ENOENT; + } + interface->device_id = device_id; + + ret = svc_set_route_send(interface, gmod->hd); + if (ret) { + dev_err(gmod->hd->parent, "failed to set route (%d)\n", ret); + return ret; + } + + ret = gb_interface_connections_init(interface); + if (ret) { + dev_err(gmod->hd->parent, "module interface init error %d\n", + ret); + /* XXX clear route */ + return ret; + } + + return 0; +} + struct gb_interface *gb_interface_find(struct gb_module *module, u8 interface_id) { diff --git a/drivers/staging/greybus/interface.h b/drivers/staging/greybus/interface.h index 50b0317d267e..bfd1781786ac 100644 --- a/drivers/staging/greybus/interface.h +++ b/drivers/staging/greybus/interface.h @@ -24,6 +24,7 @@ struct gb_interface { struct gb_interface *gb_interface_create(struct gb_module *gmod, u8 module_id); void gb_interface_destroy(struct gb_module *gmod); +int gb_interface_init(struct gb_module *gmod, u8 module_id, u8 device_id); struct gb_interface *gb_interface_find(struct gb_module *gmod, u8 interface_id); diff --git a/drivers/staging/greybus/module.c b/drivers/staging/greybus/module.c index 9583b5a18bd6..51bd5c6131ce 100644 --- a/drivers/staging/greybus/module.c +++ b/drivers/staging/greybus/module.c @@ -201,34 +201,3 @@ void gb_remove_modules(struct greybus_host_device *hd) list_for_each_entry_safe(gmod, temp, &hd->modules, links) gb_module_destroy(gmod); } - -int -gb_module_interface_init(struct gb_module *gmod, u8 interface_id, u8 device_id) -{ - struct gb_interface *interface; - int ret; - - interface = gb_interface_find(gmod, interface_id); - if (!interface) { - dev_err(gmod->hd->parent, "module %hhu not found\n", - interface_id); - return -ENOENT; - } - interface->device_id = device_id; - - ret = svc_set_route_send(interface, gmod->hd); - if (ret) { - dev_err(gmod->hd->parent, "failed to set route (%d)\n", ret); - return ret; - } - - ret = gb_interface_connections_init(interface); - if (ret) { - dev_err(gmod->hd->parent, "module interface init error %d\n", - ret); - /* XXX clear route */ - return ret; - } - - return 0; -} diff --git a/drivers/staging/greybus/module.h b/drivers/staging/greybus/module.h index 74ac4fdd3c83..9e5358bae00a 100644 --- a/drivers/staging/greybus/module.h +++ b/drivers/staging/greybus/module.h @@ -55,7 +55,4 @@ void gb_module_destroy(struct gb_module *module); struct gb_module *gb_module_find(struct greybus_host_device *hd, u8 module_id); -int gb_module_interface_init(struct gb_module *gmod, u8 module_id, - u8 device_id); - #endif /* __MODULE_H */