From 2d54e4db4efd244181aa6a2f54f0ec362adc9d4d Mon Sep 17 00:00:00 2001 From: Johan Hovold Date: Mon, 7 Dec 2015 15:05:30 +0100 Subject: [PATCH] greybus: bundle: kill gb_bundle_bind_protocols Remove gb_bundle_bind_protocols() that was used to iterate over all registered bundles and bind protocols to them should a protocol become available post bundle creation. The protocol abstraction as a generic construct is going away in favour of class drivers. Connections will be setup when a class driver is probed, and driver modules can be loaded on-demand by user space based on uevents and modalias. Signed-off-by: Johan Hovold Reviewed-by: Viresh Kumar Signed-off-by: Greg Kroah-Hartman --- drivers/staging/greybus/bundle.c | 30 ------------------------------ drivers/staging/greybus/bundle.h | 1 - drivers/staging/greybus/connection.c | 6 +++++- drivers/staging/greybus/connection.h | 2 -- drivers/staging/greybus/protocol.c | 6 ------ 5 files changed, 5 insertions(+), 40 deletions(-) diff --git a/drivers/staging/greybus/bundle.c b/drivers/staging/greybus/bundle.c index 97a8195..e538336 100644 --- a/drivers/staging/greybus/bundle.c +++ b/drivers/staging/greybus/bundle.c @@ -81,36 +81,6 @@ struct device_type greybus_bundle_type = { /* XXX This could be per-host device or per-module */ static DEFINE_SPINLOCK(gb_bundles_lock); -static int __bundle_bind_protocols(struct device *dev, void *data) -{ - struct gb_bundle *bundle; - struct gb_connection *connection; - - if (!is_gb_bundle(dev)) - return 0; - - bundle = to_gb_bundle(dev); - - list_for_each_entry(connection, &bundle->connections, bundle_links) { - gb_connection_bind_protocol(connection); - } - - return 0; -} - -/* - * Walk all bundles in the system, and see if any connections are not bound to a - * specific prototcol. If they are not, then try to find one for it and bind it - * to it. - * - * This is called after registering a new protocol. - */ -void gb_bundle_bind_protocols(void) -{ - bus_for_each_dev(&greybus_bus_type, NULL, NULL, - __bundle_bind_protocols); -} - /* * Create a gb_bundle structure to represent a discovered * bundle. Returns a pointer to the new bundle or a null diff --git a/drivers/staging/greybus/bundle.h b/drivers/staging/greybus/bundle.h index 662c4a6..70d7b9d 100644 --- a/drivers/staging/greybus/bundle.h +++ b/drivers/staging/greybus/bundle.h @@ -34,6 +34,5 @@ struct gb_bundle *gb_bundle_create(struct gb_interface *intf, u8 bundle_id, void gb_bundle_destroy(struct gb_bundle *bundle); struct gb_bundle *gb_bundle_find(struct gb_interface *intf, u8 bundle_id); -void gb_bundle_bind_protocols(void); #endif /* __BUNDLE_H */ diff --git a/drivers/staging/greybus/connection.c b/drivers/staging/greybus/connection.c index 674e9a8..bf28dad 100644 --- a/drivers/staging/greybus/connection.c +++ b/drivers/staging/greybus/connection.c @@ -11,6 +11,10 @@ #include "greybus.h" + +static int gb_connection_bind_protocol(struct gb_connection *connection); + + static DEFINE_SPINLOCK(gb_connections_lock); /* This is only used at initialization time; no locking is required. */ @@ -520,7 +524,7 @@ void gb_connection_latency_tag_disable(struct gb_connection *connection) } EXPORT_SYMBOL_GPL(gb_connection_latency_tag_disable); -int gb_connection_bind_protocol(struct gb_connection *connection) +static int gb_connection_bind_protocol(struct gb_connection *connection) { struct gb_protocol *protocol; int ret; diff --git a/drivers/staging/greybus/connection.h b/drivers/staging/greybus/connection.h index 8006262..77f77bf 100644 --- a/drivers/staging/greybus/connection.h +++ b/drivers/staging/greybus/connection.h @@ -66,8 +66,6 @@ static inline bool gb_connection_is_static(struct gb_connection *connection) void greybus_data_rcvd(struct gb_host_device *hd, u16 cport_id, u8 *data, size_t length); -int gb_connection_bind_protocol(struct gb_connection *connection); - void gb_connection_latency_tag_enable(struct gb_connection *connection); void gb_connection_latency_tag_disable(struct gb_connection *connection); diff --git a/drivers/staging/greybus/protocol.c b/drivers/staging/greybus/protocol.c index aadb793..d69f648 100644 --- a/drivers/staging/greybus/protocol.c +++ b/drivers/staging/greybus/protocol.c @@ -90,12 +90,6 @@ int __gb_protocol_register(struct gb_protocol *protocol, struct module *module) pr_info("Registered %s protocol.\n", protocol->name); - /* - * Go try to bind any unbound connections, as we have a - * new protocol in the system - */ - gb_bundle_bind_protocols(); - return 0; } EXPORT_SYMBOL_GPL(__gb_protocol_register); -- 2.7.4