From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: "Rafael J. Wysocki" <rjw@rjwysocki.net>
Cc: Linux ACPI <linux-acpi@vger.kernel.org>,
LKML <linux-kernel@vger.kernel.org>,
Dan Williams <dan.j.williams@intel.co>
Subject: Re: [PATCH] ACPI: scan: Use ida_alloc() instead of ida_simple_get()
Date: Fri, 11 Feb 2022 10:41:21 +0200 [thread overview]
Message-ID: <YgYhMRS7cqal7/01@smile.fi.intel.com> (raw)
In-Reply-To: <2645186.mvXUDI8C0e@kreacher>
On Thu, Feb 10, 2022 at 09:05:33PM +0100, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
>
> 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.
Makes sense,
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> ---
> drivers/acpi/internal.h | 2 --
> drivers/acpi/scan.c | 5 +++--
> 2 files changed, 3 insertions(+), 4 deletions(-)
>
> Index: linux-pm/drivers/acpi/internal.h
> ===================================================================
> --- linux-pm.orig/drivers/acpi/internal.h
> +++ linux-pm/drivers/acpi/internal.h
> @@ -96,8 +96,6 @@ void acpi_scan_table_notify(void);
>
> extern struct list_head acpi_bus_id_list;
>
> -#define ACPI_MAX_DEVICE_INSTANCES 4096
> -
> struct acpi_device_bus_id {
> const char *bus_id;
> struct ida instance_ida;
> Index: linux-pm/drivers/acpi/scan.c
> ===================================================================
> --- linux-pm.orig/drivers/acpi/scan.c
> +++ linux-pm/drivers/acpi/scan.c
> @@ -477,7 +477,8 @@ static void acpi_device_del(struct acpi_
> list_for_each_entry(acpi_device_bus_id, &acpi_bus_id_list, node)
> if (!strcmp(acpi_device_bus_id->bus_id,
> acpi_device_hid(device))) {
> - ida_simple_remove(&acpi_device_bus_id->instance_ida, device->pnp.instance_no);
> + ida_free(&acpi_device_bus_id->instance_ida,
> + device->pnp.instance_no);
> if (ida_is_empty(&acpi_device_bus_id->instance_ida)) {
> list_del(&acpi_device_bus_id->node);
> kfree_const(acpi_device_bus_id->bus_id);
> @@ -642,7 +643,7 @@ static int acpi_device_set_name(struct a
> struct ida *instance_ida = &acpi_device_bus_id->instance_ida;
> int result;
>
> - result = ida_simple_get(instance_ida, 0, ACPI_MAX_DEVICE_INSTANCES, GFP_KERNEL);
> + result = ida_alloc(instance_ida, GFP_KERNEL);
> if (result < 0)
> return result;
>
>
>
>
--
With Best Regards,
Andy Shevchenko
prev parent reply other threads:[~2022-02-11 8:42 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-10 20:05 Rafael J. Wysocki
2022-02-11 8:41 ` Andy Shevchenko [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YgYhMRS7cqal7/01@smile.fi.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=dan.j.williams@intel.co \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rjw@rjwysocki.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®