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>
This commit is contained in:
Родитель
6910fa2dd6
Коммит
1ba30c3309
|
@ -260,6 +260,9 @@ gb_connection_create_flags(struct gb_bundle *bundle, u16 cport_id,
|
||||||
{
|
{
|
||||||
struct gb_interface *intf = bundle->intf;
|
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,
|
return _gb_connection_create(intf->hd, -1, intf, bundle, cport_id,
|
||||||
handler, flags);
|
handler, flags);
|
||||||
}
|
}
|
||||||
|
@ -269,12 +272,9 @@ struct gb_connection *
|
||||||
gb_connection_create_offloaded(struct gb_bundle *bundle, u16 cport_id,
|
gb_connection_create_offloaded(struct gb_bundle *bundle, u16 cport_id,
|
||||||
unsigned long flags)
|
unsigned long flags)
|
||||||
{
|
{
|
||||||
struct gb_interface *intf = bundle->intf;
|
|
||||||
|
|
||||||
flags |= GB_CONNECTION_FLAG_OFFLOADED;
|
flags |= GB_CONNECTION_FLAG_OFFLOADED;
|
||||||
|
|
||||||
return _gb_connection_create(intf->hd, -1, intf, bundle, cport_id,
|
return gb_connection_create_flags(bundle, cport_id, NULL, flags);
|
||||||
NULL, flags);
|
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(gb_connection_create_offloaded);
|
EXPORT_SYMBOL_GPL(gb_connection_create_offloaded);
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,8 @@
|
||||||
#define GB_CONNECTION_FLAG_CDSI1 BIT(3)
|
#define GB_CONNECTION_FLAG_CDSI1 BIT(3)
|
||||||
#define GB_CONNECTION_FLAG_CONTROL BIT(4)
|
#define GB_CONNECTION_FLAG_CONTROL BIT(4)
|
||||||
|
|
||||||
|
#define GB_CONNECTION_FLAG_CORE_MASK GB_CONNECTION_FLAG_CONTROL
|
||||||
|
|
||||||
enum gb_connection_state {
|
enum gb_connection_state {
|
||||||
GB_CONNECTION_STATE_DISABLED = 0,
|
GB_CONNECTION_STATE_DISABLED = 0,
|
||||||
GB_CONNECTION_STATE_ENABLED_TX = 1,
|
GB_CONNECTION_STATE_ENABLED_TX = 1,
|
||||||
|
|
Загрузка…
Ссылка в новой задаче