1
0
Fork 0

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: Alex Elder <elder@linaro.org>
Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
hifive-unleashed-5.1
Johan Hovold 2016-06-22 11:42:03 +02:00 committed by Greg Kroah-Hartman
parent 6910fa2dd6
commit 1ba30c3309
2 changed files with 6 additions and 4 deletions

View File

@ -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);

View File

@ -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,