summaryrefslogtreecommitdiffstats
path: root/drivers/staging/greybus/interface.c
diff options
context:
space:
mode:
authorJohan Hovold <johan@hovoldconsulting.com>2016-03-09 12:20:40 +0100
committerGreg Kroah-Hartman <gregkh@google.com>2016-03-10 13:57:42 -0800
commit64acb6611f3c17251347870e73ddc106fed807cb (patch)
treec7fa5c4db75ffd4e57fb2ed1b27b513cf08940a7 /drivers/staging/greybus/interface.c
parent11548c8327000302cfaaf7bcac02a3ccf14c2db1 (diff)
downloadop-kernel-dev-64acb6611f3c17251347870e73ddc106fed807cb.zip
op-kernel-dev-64acb6611f3c17251347870e73ddc106fed807cb.tar.gz
greybus: interface: remove useless spinlock
Remove useless global interface spinlock that appeared to protect the host-device interface list, but really did not as we are doing lock-less look-ups by relying on the single-threaded SVC workqueue. Document the locking assumptions. Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Diffstat (limited to 'drivers/staging/greybus/interface.c')
-rw-r--r--drivers/staging/greybus/interface.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/drivers/staging/greybus/interface.c b/drivers/staging/greybus/interface.c
index 2654fa8..4671f40 100644
--- a/drivers/staging/greybus/interface.c
+++ b/drivers/staging/greybus/interface.c
@@ -54,9 +54,6 @@ static struct attribute *interface_attrs[] = {
ATTRIBUTE_GROUPS(interface);
-/* XXX This could be per-host device */
-static DEFINE_SPINLOCK(gb_interfaces_lock);
-
// FIXME, odds are you don't want to call this function, rework the caller to
// not need it please.
struct gb_interface *gb_interface_find(struct gb_host_device *hd,
@@ -100,6 +97,9 @@ struct device_type greybus_interface_type = {
*
* Returns a pointer to the new interfce or a null pointer if a
* failure occurs due to memory exhaustion.
+ *
+ * Locking: Caller ensures serialisation with gb_interface_remove and
+ * gb_interface_find.
*/
struct gb_interface *gb_interface_create(struct gb_host_device *hd,
u8 interface_id)
@@ -132,9 +132,7 @@ struct gb_interface *gb_interface_create(struct gb_host_device *hd,
return NULL;
}
- spin_lock_irq(&gb_interfaces_lock);
list_add(&intf->links, &hd->interfaces);
- spin_unlock_irq(&gb_interfaces_lock);
return intf;
}
@@ -164,9 +162,7 @@ void gb_interface_remove(struct gb_interface *intf)
gb_control_disable(intf->control);
- spin_lock_irq(&gb_interfaces_lock);
list_del(&intf->links);
- spin_unlock_irq(&gb_interfaces_lock);
put_device(&intf->dev);
}
OpenPOWER on IntegriCloud