aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/greybus/connection.c
diff options
context:
space:
mode:
authorJohan Hovold <johan@hovoldconsulting.com>2016-06-22 11:42:03 +0200
committerGreg Kroah-Hartman <gregkh@google.com>2016-06-24 16:22:30 -0700
commit1ba30c33096ced9d5c5814acdc46f53f3864f4e6 (patch)
treee09280ba6453cf4406d1d005f812887fceb718f4 /drivers/staging/greybus/connection.c
parentgreybus: hd: add flag argument to cport_enable callback (diff)
downloadlinux-dev-1ba30c33096ced9d5c5814acdc46f53f3864f4e6.tar.xz
linux-dev-1ba30c33096ced9d5c5814acdc46f53f3864f4e6.zip
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>
Diffstat (limited to 'drivers/staging/greybus/connection.c')
-rw-r--r--drivers/staging/greybus/connection.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/staging/greybus/connection.c b/drivers/staging/greybus/connection.c
index 232af8d13111..7b2d6358f432 100644
--- a/drivers/staging/greybus/connection.c
+++ b/drivers/staging/greybus/connection.c
@@ -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);