Commit 64acb661 authored by Johan Hovold's avatar Johan Hovold Committed by Greg Kroah-Hartman

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: default avatarJohan Hovold <johan@hovoldconsulting.com>
Reviewed-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@google.com>
parent 11548c83
...@@ -54,9 +54,6 @@ static struct attribute *interface_attrs[] = { ...@@ -54,9 +54,6 @@ static struct attribute *interface_attrs[] = {
ATTRIBUTE_GROUPS(interface); 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 // FIXME, odds are you don't want to call this function, rework the caller to
// not need it please. // not need it please.
struct gb_interface *gb_interface_find(struct gb_host_device *hd, struct gb_interface *gb_interface_find(struct gb_host_device *hd,
...@@ -100,6 +97,9 @@ struct device_type greybus_interface_type = { ...@@ -100,6 +97,9 @@ struct device_type greybus_interface_type = {
* *
* Returns a pointer to the new interfce or a null pointer if a * Returns a pointer to the new interfce or a null pointer if a
* failure occurs due to memory exhaustion. * 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, struct gb_interface *gb_interface_create(struct gb_host_device *hd,
u8 interface_id) u8 interface_id)
...@@ -132,9 +132,7 @@ struct gb_interface *gb_interface_create(struct gb_host_device *hd, ...@@ -132,9 +132,7 @@ struct gb_interface *gb_interface_create(struct gb_host_device *hd,
return NULL; return NULL;
} }
spin_lock_irq(&gb_interfaces_lock);
list_add(&intf->links, &hd->interfaces); list_add(&intf->links, &hd->interfaces);
spin_unlock_irq(&gb_interfaces_lock);
return intf; return intf;
} }
...@@ -164,9 +162,7 @@ void gb_interface_remove(struct gb_interface *intf) ...@@ -164,9 +162,7 @@ void gb_interface_remove(struct gb_interface *intf)
gb_control_disable(intf->control); gb_control_disable(intf->control);
spin_lock_irq(&gb_interfaces_lock);
list_del(&intf->links); list_del(&intf->links);
spin_unlock_irq(&gb_interfaces_lock);
put_device(&intf->dev); put_device(&intf->dev);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment