greybus: connection: serialise connection creation
authorJohan Hovold <johan@hovoldconsulting.com>
Tue, 19 Jan 2016 11:51:26 +0000 (12:51 +0100)
committerGreg Kroah-Hartman <gregkh@google.com>
Tue, 19 Jan 2016 20:17:13 +0000 (12:17 -0800)
commit210b508e45f00fd81c1ba35c979836d8ffea3980
tree9004b7b0563bfcf6106eed50ceb43d70bc72d6a6
parent0e46fab7dd5afbb4db97d9520812c57e9301bfc2
greybus: connection: serialise connection creation

Serialise connection creation against concurrent creation and
destruction using a global mutex.

This is needed to prevent two drivers from attempting to create a
connection to the same interface CPort and to cope with a racing
connection destroy when moving to driver managed connections.

Note that the locking can not (easily) be made more fine-grained as not
all connections have an interface, but these are not hot paths anyway.

Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
drivers/staging/greybus/connection.c