Commit 592ff0c8 authored by keliu's avatar keliu Committed by Alexandre Belloni

rtc: 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>
Signed-off-by: default avatarAlexandre Belloni <alexandre.belloni@bootlin.com>
Link: https://lore.kernel.org/r/20220527073636.2474546-1-liuke94@huawei.com
parent b09d6335
...@@ -36,7 +36,7 @@ static void rtc_device_release(struct device *dev) ...@@ -36,7 +36,7 @@ static void rtc_device_release(struct device *dev)
cancel_work_sync(&rtc->irqwork); cancel_work_sync(&rtc->irqwork);
ida_simple_remove(&rtc_ida, rtc->id); ida_free(&rtc_ida, rtc->id);
mutex_destroy(&rtc->ops_lock); mutex_destroy(&rtc->ops_lock);
kfree(rtc); kfree(rtc);
} }
...@@ -262,7 +262,7 @@ static int rtc_device_get_id(struct device *dev) ...@@ -262,7 +262,7 @@ static int rtc_device_get_id(struct device *dev)
} }
if (id < 0) if (id < 0)
id = ida_simple_get(&rtc_ida, 0, 0, GFP_KERNEL); id = ida_alloc(&rtc_ida, GFP_KERNEL);
return id; return id;
} }
...@@ -368,7 +368,7 @@ struct rtc_device *devm_rtc_allocate_device(struct device *dev) ...@@ -368,7 +368,7 @@ struct rtc_device *devm_rtc_allocate_device(struct device *dev)
rtc = rtc_allocate_device(); rtc = rtc_allocate_device();
if (!rtc) { if (!rtc) {
ida_simple_remove(&rtc_ida, id); ida_free(&rtc_ida, id);
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
} }
......
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