[RFC 07/10] drivers/base/platform.c: use simpler id allocator
From: Rasmus Villemoes
Date: Wed Dec 07 2016 - 20:29:53 EST
Use the newly introduced tida allocator, which saves about 16 KB of memory.
Signed-off-by: Rasmus Villemoes <linux@xxxxxxxxxxxxxxxxxx>
---
drivers/base/platform.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/base/platform.c b/drivers/base/platform.c
index c4af00385502..3177222b28dc 100644
--- a/drivers/base/platform.c
+++ b/drivers/base/platform.c
@@ -22,7 +22,7 @@
#include <linux/slab.h>
#include <linux/pm_runtime.h>
#include <linux/pm_domain.h>
-#include <linux/idr.h>
+#include <linux/tida.h>
#include <linux/acpi.h>
#include <linux/clk/clk-conf.h>
#include <linux/limits.h>
@@ -32,7 +32,7 @@
#include "power/power.h"
/* For automatically allocated device IDs */
-static DEFINE_IDA(platform_devid_ida);
+static DEFINE_TIDA(platform_devid_ida);
struct device platform_bus = {
.init_name = "platform",
@@ -372,7 +372,7 @@ int platform_device_add(struct platform_device *pdev)
* that we remember it must be freed, and we append a suffix
* to avoid namespace collision with explicit IDs.
*/
- ret = ida_simple_get(&platform_devid_ida, 0, 0, GFP_KERNEL);
+ ret = tida_get(&platform_devid_ida, GFP_KERNEL);
if (ret < 0)
goto err_out;
pdev->id = ret;
@@ -411,7 +411,7 @@ int platform_device_add(struct platform_device *pdev)
failed:
if (pdev->id_auto) {
- ida_simple_remove(&platform_devid_ida, pdev->id);
+ tida_put(&platform_devid_ida, pdev->id);
pdev->id = PLATFORM_DEVID_AUTO;
}
@@ -443,7 +443,7 @@ void platform_device_del(struct platform_device *pdev)
device_del(&pdev->dev);
if (pdev->id_auto) {
- ida_simple_remove(&platform_devid_ida, pdev->id);
+ tida_put(&platform_devid_ida, pdev->id);
pdev->id = PLATFORM_DEVID_AUTO;
}
--
2.1.4