@@ -20,7 +20,6 @@
BLOCKING_NOTIFIER_HEAD(scmi_requested_devices_nh);
EXPORT_SYMBOL_GPL(scmi_requested_devices_nh);
-static DEFINE_IDA(scmi_bus_id);
static DEFINE_IDR(scmi_requested_devices);
/* Protect access to scmi_requested_devices */
@@ -341,7 +340,6 @@ static void __scmi_device_destroy(struct scmi_device *scmi_dev)
if (scmi_dev->protocol_id == SCMI_PROTOCOL_SYSTEM)
atomic_set(&scmi_syspower_registered, 0);
- ida_free(&scmi_bus_id, scmi_dev->id);
device_unregister(&scmi_dev->dev);
}
@@ -349,7 +347,7 @@ static struct scmi_device *
__scmi_device_create(struct device_node *np, struct device *parent,
int protocol, const char *name)
{
- int id, retval;
+ int retval;
struct scmi_device *scmi_dev;
/*
@@ -387,20 +385,12 @@ __scmi_device_create(struct device_node *np, struct device *parent,
return NULL;
}
- id = ida_alloc_min(&scmi_bus_id, 1, GFP_KERNEL);
- if (id < 0) {
- kfree_const(scmi_dev->name);
- kfree(scmi_dev);
- return NULL;
- }
-
- scmi_dev->id = id;
scmi_dev->protocol_id = protocol;
scmi_dev->dev.parent = parent;
device_set_node(&scmi_dev->dev, of_fwnode_handle(np));
scmi_dev->dev.bus = &scmi_bus_type;
scmi_dev->dev.release = scmi_device_release;
- dev_set_name(&scmi_dev->dev, "scmi_dev.%d", id);
+ dev_set_name(&scmi_dev->dev, "scmi_dev.%s.%d", scmi_dev->name, protocol);
retval = device_register(&scmi_dev->dev);
if (retval)
@@ -413,7 +403,6 @@ __scmi_device_create(struct device_node *np, struct device *parent,
return scmi_dev;
put_dev:
put_device(&scmi_dev->dev);
- ida_free(&scmi_bus_id, id);
return NULL;
}
@@ -526,7 +515,6 @@ static void __exit scmi_bus_exit(void)
*/
scmi_devices_unregister();
bus_unregister(&scmi_bus_type);
- ida_destroy(&scmi_bus_id);
}
module_exit(scmi_bus_exit);
@@ -2641,8 +2641,8 @@ static int scmi_chan_setup(struct scmi_info *info, struct device_node *of_node,
cinfo->max_msg_size = info->desc->max_msg_size;
/* Create a unique name for this transport device */
- snprintf(name, 32, "__scmi_transport_device_%s_%02X",
- idx ? "rx" : "tx", prot_id);
+ snprintf(name, 32, "__scmi_transport_device_%s",
+ idx ? "rx" : "tx");
/* Create a uniquely named, dedicated transport device for this chan */
tdev = scmi_device_create(of_node, info->dev, prot_id, name);
if (!tdev) {