Commit 5dda7e5a authored by Johan Hovold's avatar Johan Hovold Committed by Greg Kroah-Hartman
Browse files

greybus: legacy: add legacy-protocol bundle driver



Add the first Greybus bundle driver that will be used when transitioning
from legacy Greybus protocols to bundle drivers.

The legacy-protocol driver initially binds to all current bundle classes.

In order to avoid having to update current module-loading scripts, keep
this driver internal to greybus core at least until modalias support is
added. Note that this prevents unloading any protocol drivers without
first tearing down the host device due to a circular module dependency.

Reviewed-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: default avatarJohan Hovold <johan@hovoldconsulting.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@google.com>
parent 5b032710
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -9,7 +9,8 @@ greybus-y := core.o \
		control.o	\
		svc.o		\
		firmware.o	\
		operation.o
		operation.o	\
		legacy.o

gb-phy-y :=	gpbridge.o	\
		sdio.o	\
+0 −10
Original line number Diff line number Diff line
@@ -152,21 +152,11 @@ int gb_bundle_add(struct gb_bundle *bundle)
	return 0;
}

static void gb_bundle_connections_exit(struct gb_bundle *bundle)
{
	struct gb_connection *connection;

	list_for_each_entry(connection, &bundle->connections, bundle_links)
		gb_connection_exit(connection);
}

/*
 * Tear down a previously set up bundle.
 */
void gb_bundle_destroy(struct gb_bundle *bundle)
{
	gb_bundle_connections_exit(bundle);

	if (device_is_registered(&bundle->dev))
		device_del(&bundle->dev);

+2 −0
Original line number Diff line number Diff line
@@ -464,6 +464,7 @@ int gb_connection_init(struct gb_connection *connection)

	return ret;
}
EXPORT_SYMBOL_GPL(gb_connection_init);

void gb_connection_exit(struct gb_connection *connection)
{
@@ -482,6 +483,7 @@ void gb_connection_exit(struct gb_connection *connection)

	gb_connection_unbind_protocol(connection);
}
EXPORT_SYMBOL_GPL(gb_connection_exit);

/*
 * Tear down a previously set up connection.
+10 −0
Original line number Diff line number Diff line
@@ -12,6 +12,7 @@
#define CREATE_TRACE_POINTS
#include "greybus.h"
#include "greybus_trace.h"
#include "legacy.h"

EXPORT_TRACEPOINT_SYMBOL_GPL(gb_host_device_send);
EXPORT_TRACEPOINT_SYMBOL_GPL(gb_host_device_recv);
@@ -240,8 +241,16 @@ static int __init gb_init(void)
		goto error_firmware;
	}

	retval = gb_legacy_init();
	if (retval) {
		pr_err("gb_legacy_init failed\n");
		goto error_legacy;
	}

	return 0;	/* Success */

error_legacy:
	gb_firmware_protocol_exit();
error_firmware:
	gb_svc_protocol_exit();
error_svc:
@@ -261,6 +270,7 @@ module_init(gb_init);

static void __exit gb_exit(void)
{
	gb_legacy_exit();
	gb_firmware_protocol_exit();
	gb_svc_protocol_exit();
	gb_control_protocol_exit();
+0 −10
Original line number Diff line number Diff line
@@ -183,7 +183,6 @@ void gb_interfaces_remove(struct gb_host_device *hd)
int gb_interface_init(struct gb_interface *intf, u8 device_id)
{
	struct gb_bundle *bundle, *tmp;
	struct gb_connection *connection;
	int ret, size;
	void *manifest;

@@ -242,15 +241,6 @@ int gb_interface_init(struct gb_interface *intf, u8 device_id)
			gb_bundle_destroy(bundle);
			continue;
		}

		list_for_each_entry(connection, &bundle->connections,
							bundle_links) {
			ret = gb_connection_init(connection);
			if (ret)
				break;
		}
		if (ret)
			gb_bundle_destroy(bundle);
	}

	ret = 0;
Loading