Commit 718fbfa5 authored by keliu's avatar keliu Committed by Guenter Roeck

hwmon: Directly use ida_alloc()/free()

Use ida_alloc()/ida_free() instead of deprecated
ida_simple_get()/ida_simple_remove() .
Signed-off-by: default avatarkeliu <liuke94@huawei.com>
Link: https://lore.kernel.org/r/20220517063126.2142637-1-liuke94@huawei.comSigned-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
parent 5b4285c5
...@@ -764,7 +764,7 @@ __hwmon_device_register(struct device *dev, const char *name, void *drvdata, ...@@ -764,7 +764,7 @@ __hwmon_device_register(struct device *dev, const char *name, void *drvdata,
"hwmon: '%s' is not a valid name attribute, please fix\n", "hwmon: '%s' is not a valid name attribute, please fix\n",
name); name);
id = ida_simple_get(&hwmon_ida, 0, 0, GFP_KERNEL); id = ida_alloc(&hwmon_ida, GFP_KERNEL);
if (id < 0) if (id < 0)
return ERR_PTR(id); return ERR_PTR(id);
...@@ -856,7 +856,7 @@ __hwmon_device_register(struct device *dev, const char *name, void *drvdata, ...@@ -856,7 +856,7 @@ __hwmon_device_register(struct device *dev, const char *name, void *drvdata,
free_hwmon: free_hwmon:
hwmon_dev_release(hdev); hwmon_dev_release(hdev);
ida_remove: ida_remove:
ida_simple_remove(&hwmon_ida, id); ida_free(&hwmon_ida, id);
return ERR_PTR(err); return ERR_PTR(err);
} }
...@@ -968,7 +968,7 @@ void hwmon_device_unregister(struct device *dev) ...@@ -968,7 +968,7 @@ void hwmon_device_unregister(struct device *dev)
if (likely(sscanf(dev_name(dev), HWMON_ID_FORMAT, &id) == 1)) { if (likely(sscanf(dev_name(dev), HWMON_ID_FORMAT, &id) == 1)) {
device_unregister(dev); device_unregister(dev);
ida_simple_remove(&hwmon_ida, id); ida_free(&hwmon_ida, id);
} else } else
dev_dbg(dev->parent, dev_dbg(dev->parent,
"hwmon_device_unregister() failed: bad class ID!\n"); "hwmon_device_unregister() failed: bad class ID!\n");
......
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