Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp3165562pxb; Thu, 10 Feb 2022 14:02:22 -0800 (PST) X-Google-Smtp-Source: ABdhPJxBseL9vOFoNhImnPVsuccYxWUt6Pza7XFDPxDW0q7lLh089Qf0Xw7BKjs9M1X0HSWume9e X-Received: by 2002:a17:902:f60c:: with SMTP id n12mr2784777plg.155.1644530541802; Thu, 10 Feb 2022 14:02:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644530541; cv=none; d=google.com; s=arc-20160816; b=ghbTbOnNc9Y2lgfT6HEPsTfdZD6ZRDhuYfVb82orz81feN7qqdhC1+RN0C0pM9huYY 1ya3LuCpwGZJZzw9FvLxamyDNNn/IasOsUD9h6ANeLuQJZUATzrdUdQzQooJI2VUWTXo 5A+53+bSwH6Cry7BzgVLe3pz3+4ldEZfLJAxuebiKS1FaBetUJIUUkbhQ5Yhbgex1pWM iz1XJ+CL22WKk7EvkXl413hYMjqQKHhJWLzpoOBPRekclnXE7SH1U/OkkDiWilmv48Mv fnPLyWPr/2KiBkFqv0F9KZQpmlnpGIX0dyfxFJR14gQsUurwu7n1PX44UkEP9qPHD9X0 tlyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=o8sTn/f+1Ucba0xX27kNGlOm/wCZols5ivgbr5kEjZo=; b=u/2BIMxwqAE3uI5J7zRSgLuV1NSidoKNHqoLNWiYJ8O6yL6U6tJs21v5+8DQrIo+FC /KgUaLzXTN7kj6J/UfpfGwfEJV9L9HWsrKN/iIYbad+hW4QxsS6AttBDnAxKNaDqsgKQ Cz+Hh/OfKigGg/Emc/nPJ420ofYL9EAecMjyOe6VohnUt2yJsi+QE2EW1Wt1c+OVfRrl CwUEV/N6T/ns3Vmxkf/ijAz26O8Be/Ou5j6ddxpOgfi/N7YjsBBzi+4/W6ZoxAeu59sj IwHSi8wHkt96CfngCbMR0v0o7vhixl+gOCEUrfUtKB+xABeuhRIWVVHHHP/ZiFobAFTe kE4Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j13si3181747plr.131.2022.02.10.14.02.07; Thu, 10 Feb 2022 14:02:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245736AbiBJUFi (ORCPT + 99 others); Thu, 10 Feb 2022 15:05:38 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:57070 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239246AbiBJUFh (ORCPT ); Thu, 10 Feb 2022 15:05:37 -0500 Received: from cloudserver094114.home.pl (cloudserver094114.home.pl [79.96.170.134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7F14726F3 for ; Thu, 10 Feb 2022 12:05:37 -0800 (PST) Received: from localhost (127.0.0.1) (HELO v370.home.net.pl) by /usr/run/smtp (/usr/run/postfix/private/idea_relay_lmtp) via UNIX with SMTP (IdeaSmtpServer 4.0.0) id b2f2cd1e5498de8e; Thu, 10 Feb 2022 21:05:35 +0100 Received: from kreacher.localnet (unknown [213.134.175.120]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by v370.home.net.pl (Postfix) with ESMTPSA id BBC2266B514; Thu, 10 Feb 2022 21:05:34 +0100 (CET) From: "Rafael J. Wysocki" To: Linux ACPI Cc: LKML , Dan Williams , Andy Shevchenko Subject: [PATCH] ACPI: scan: Use ida_alloc() instead of ida_simple_get() Date: Thu, 10 Feb 2022 21:05:33 +0100 Message-ID: <2645186.mvXUDI8C0e@kreacher> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="UTF-8" X-CLIENT-IP: 213.134.175.120 X-CLIENT-HOSTNAME: 213.134.175.120 X-VADE-SPAMSTATE: clean X-VADE-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvvddriedugddufeduucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecujffqoffgrffnpdggtffipffknecuuegrihhlohhuthemucduhedtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvffufffkggfgtgesthfuredttddtjeenucfhrhhomhepfdftrghfrggvlhculfdrucghhihsohgtkhhifdcuoehrjhifsehrjhifhihsohgtkhhirdhnvghtqeenucggtffrrghtthgvrhhnpefhgedtffejheekgeeljeevvedtuefgffeiieejuddutdekgfejvdehueejjeetvdenucfkphepvddufedrudefgedrudejhedruddvtdenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpedvudefrddufeegrddujeehrdduvddtpdhhvghlohepkhhrvggrtghhvghrrdhlohgtrghlnhgvthdpmhgrihhlfhhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqpdhnsggprhgtphhtthhopeegpdhrtghpthhtoheplhhinhhugidqrggtphhisehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtohepuggrnhdrjhdrfihilhhlihgrmhhssehinhhtvghlrdgtohdprhgtphhtthhopegrnhgurhhihidrshhhvghvtghhvghnkhhosehlihhnuhigrdhinhhtvghl rdgtohhm X-DCC--Metrics: v370.home.net.pl 1024; Body=4 Fuz1=4 Fuz2=4 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Rafael J. Wysocki 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 --- 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;