Commit 1e776f31 authored by Alex Elder's avatar Alex Elder Committed by Greg Kroah-Hartman

greybus: get rid of cport_id_map_lock

The only time we get a cport id is when setting up a new connection.
We already have a (coarser-grained) spin lock that's used to protect
the connection lists, and we can use that same lock for protecting
the hd's connection id map.
Signed-off-by: default avatarAlex Elder <elder@linaro.org>
Signed-off-by: default avatarGreg Kroah-Hartman <greg@kroah.com>
parent 2c43ce49
...@@ -42,9 +42,9 @@ static bool gb_connection_hd_cport_id_alloc(struct gb_connection *connection) ...@@ -42,9 +42,9 @@ static bool gb_connection_hd_cport_id_alloc(struct gb_connection *connection)
struct ida *ida = &connection->hd->cport_id_map; struct ida *ida = &connection->hd->cport_id_map;
int id; int id;
spin_lock(&connection->hd->cport_id_map_lock); spin_lock_irq(&gb_connections_lock);
id = ida_simple_get(ida, 0, HOST_DEV_CPORT_ID_MAX, GFP_KERNEL); id = ida_simple_get(ida, 0, HOST_DEV_CPORT_ID_MAX, GFP_KERNEL);
spin_unlock(&connection->hd->cport_id_map_lock); spin_unlock_irq(&gb_connections_lock);
if (id < 0) if (id < 0)
return false; return false;
...@@ -60,9 +60,9 @@ static void gb_connection_hd_cport_id_free(struct gb_connection *connection) ...@@ -60,9 +60,9 @@ static void gb_connection_hd_cport_id_free(struct gb_connection *connection)
{ {
struct ida *ida = &connection->hd->cport_id_map; struct ida *ida = &connection->hd->cport_id_map;
spin_lock(&connection->hd->cport_id_map_lock); spin_lock_irq(&gb_connections_lock);
ida_simple_remove(ida, connection->hd_cport_id); ida_simple_remove(ida, connection->hd_cport_id);
spin_unlock(&connection->hd->cport_id_map_lock); spin_unlock_irq(&gb_connections_lock);
connection->hd_cport_id = CPORT_ID_BAD; connection->hd_cport_id = CPORT_ID_BAD;
} }
......
...@@ -188,7 +188,6 @@ struct greybus_host_device *greybus_create_hd(struct greybus_host_driver *driver ...@@ -188,7 +188,6 @@ struct greybus_host_device *greybus_create_hd(struct greybus_host_driver *driver
INIT_LIST_HEAD(&hd->modules); INIT_LIST_HEAD(&hd->modules);
INIT_LIST_HEAD(&hd->connections); INIT_LIST_HEAD(&hd->connections);
ida_init(&hd->cport_id_map); ida_init(&hd->cport_id_map);
spin_lock_init(&hd->cport_id_map_lock);
return hd; return hd;
} }
......
...@@ -168,7 +168,6 @@ struct greybus_host_device { ...@@ -168,7 +168,6 @@ struct greybus_host_device {
struct list_head modules; struct list_head modules;
struct list_head connections; struct list_head connections;
struct ida cport_id_map; struct ida cport_id_map;
spinlock_t cport_id_map_lock;
u8 device_id; u8 device_id;
/* Private data for the host driver */ /* Private data for the host driver */
......
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