Skip to content

Commit ad2f3b0

Browse files
committed
ACPI: scan: Use ida_alloc() instead of ida_simple_get()
As recommended in include/linux/idr.h, use ida_alloc() instead of ida_simple_get() for creating unique device object names and for symmetry replace ida_simple_remove() with ida_free() (and fix up the related overly long code line while at it). Also drop the ACPI_MAX_DEVICE_INSTANCES limit that is not necessary any more and may not be sufficient for future platforms. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
1 parent 754e0b0 commit ad2f3b0

2 files changed

Lines changed: 3 additions & 4 deletions

File tree

drivers/acpi/internal.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,6 @@ void acpi_scan_table_notify(void);
9696

9797
extern struct list_head acpi_bus_id_list;
9898

99-
#define ACPI_MAX_DEVICE_INSTANCES 4096
100-
10199
struct acpi_device_bus_id {
102100
const char *bus_id;
103101
struct ida instance_ida;

drivers/acpi/scan.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,8 @@ static void acpi_device_del(struct acpi_device *device)
477477
list_for_each_entry(acpi_device_bus_id, &acpi_bus_id_list, node)
478478
if (!strcmp(acpi_device_bus_id->bus_id,
479479
acpi_device_hid(device))) {
480-
ida_simple_remove(&acpi_device_bus_id->instance_ida, device->pnp.instance_no);
480+
ida_free(&acpi_device_bus_id->instance_ida,
481+
device->pnp.instance_no);
481482
if (ida_is_empty(&acpi_device_bus_id->instance_ida)) {
482483
list_del(&acpi_device_bus_id->node);
483484
kfree_const(acpi_device_bus_id->bus_id);
@@ -642,7 +643,7 @@ static int acpi_device_set_name(struct acpi_device *device,
642643
struct ida *instance_ida = &acpi_device_bus_id->instance_ida;
643644
int result;
644645

645-
result = ida_simple_get(instance_ida, 0, ACPI_MAX_DEVICE_INSTANCES, GFP_KERNEL);
646+
result = ida_alloc(instance_ida, GFP_KERNEL);
646647
if (result < 0)
647648
return result;
648649

0 commit comments

Comments
 (0)