Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1ba30c33 authored by Johan Hovold's avatar Johan Hovold Committed by Greg Kroah-Hartman
Browse files

greybus: connection: prevent drivers from specifying core flags



Prevent drivers from specifying core flags (currently only
GB_CONNECTION_FLAG_CONTROL) when creating connections.

Reviewed-by: default avatarAlex Elder <elder@linaro.org>
Signed-off-by: default avatarJohan Hovold <johan@hovoldconsulting.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@google.com>
parent 6910fa2d
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -260,6 +260,9 @@ gb_connection_create_flags(struct gb_bundle *bundle, u16 cport_id,
{
	struct gb_interface *intf = bundle->intf;

	if (WARN_ON_ONCE(flags & GB_CONNECTION_FLAG_CORE_MASK))
		flags &= ~GB_CONNECTION_FLAG_CORE_MASK;

	return _gb_connection_create(intf->hd, -1, intf, bundle, cport_id,
					handler, flags);
}
@@ -269,12 +272,9 @@ struct gb_connection *
gb_connection_create_offloaded(struct gb_bundle *bundle, u16 cport_id,
					unsigned long flags)
{
	struct gb_interface *intf = bundle->intf;

	flags |= GB_CONNECTION_FLAG_OFFLOADED;

	return _gb_connection_create(intf->hd, -1, intf, bundle, cport_id,
					NULL, flags);
	return gb_connection_create_flags(bundle, cport_id, NULL, flags);
}
EXPORT_SYMBOL_GPL(gb_connection_create_offloaded);

+2 −0
Original line number Diff line number Diff line
@@ -19,6 +19,8 @@
#define GB_CONNECTION_FLAG_CDSI1	BIT(3)
#define GB_CONNECTION_FLAG_CONTROL	BIT(4)

#define GB_CONNECTION_FLAG_CORE_MASK	GB_CONNECTION_FLAG_CONTROL

enum gb_connection_state {
	GB_CONNECTION_STATE_DISABLED		= 0,
	GB_CONNECTION_STATE_ENABLED_TX		= 1,