struct ida *ida = &connection->hd->cport_id_map;
int id;
+ spin_lock(&connection->hd->cport_id_map_lock);
id = ida_simple_get(ida, 0, HOST_DEV_CPORT_ID_MAX, GFP_KERNEL);
+ spin_unlock(&connection->hd->cport_id_map_lock);
if (id < 0)
return false;
{
struct ida *ida = &connection->hd->cport_id_map;
+ spin_lock(&connection->hd->cport_id_map_lock);
ida_simple_remove(ida, connection->hd_cport_id);
+ spin_unlock(&connection->hd->cport_id_map_lock);
connection->hd_cport_id = CPORT_ID_BAD;
}
kfree(connection);
return NULL;
}
- connection->hd = hd; /* XXX refcount? */
+
connection->interface = interface; /* XXX refcount? */
connection->interface_cport_id = cport_id;
connection->protocol = protocol;
}
EXPORT_SYMBOL_GPL(greybus_disabled);
-static spinlock_t cport_id_map_lock;
-
static int greybus_module_match(struct device *dev, struct device_driver *drv)
{
struct greybus_driver *driver = to_greybus_driver(dev->driver);
INIT_LIST_HEAD(&hd->modules);
hd->connections = RB_ROOT;
ida_init(&hd->cport_id_map);
+ spin_lock_init(&hd->cport_id_map_lock);
return hd;
}
int retval;
BUILD_BUG_ON(HOST_DEV_CPORT_ID_MAX >= (long)CPORT_ID_BAD);
- spin_lock_init(&cport_id_map_lock);
retval = gb_debugfs_init();
if (retval) {
struct list_head modules;
struct rb_root connections;
struct ida cport_id_map;
+ spinlock_t cport_id_map_lock;
/* Private data for the host driver */
unsigned long hd_priv[0] __attribute__ ((aligned(sizeof(s64))));