]> git.baikalelectronics.ru Git - kernel.git/commit
ACPI: scan: Use unique number for instance_no
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Mon, 22 Mar 2021 16:31:00 +0000 (18:31 +0200)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Mon, 22 Mar 2021 16:45:53 +0000 (17:45 +0100)
commit4fce2ec015097ee2030b18ecf01784eab190e5e8
tree50d4df51a5033cfb2832c29ebb7c342ffce85190
parenta123a92a85a64b2b0aa97706608092508241de7b
ACPI: scan: Use unique number for instance_no

The decrementation of acpi_device_bus_id->instance_no
in acpi_device_del() is incorrect, because it may cause
a duplicate instance number to be allocated next time
a device with the same acpi_device_bus_id is added.

Replace above mentioned approach by using IDA framework.

While at it, define the instance range to be [0, 4096).

Fixes: b169ba28b623 ("ACPI: use PNPID:instance_no as bus_id of ACPI device")
Fixes: 4f171a14f523 ("ACPI / scan: Fix acpi_bus_id_list bookkeeping")
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: 4.10+ <stable@vger.kernel.org> # 4.10+
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/acpi/internal.h
drivers/acpi/scan.c
include/acpi/acpi_bus.h