From nobody Sun Feb 8 04:17:57 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 726403164B6; Mon, 29 Dec 2025 13:30:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767015002; cv=none; b=ObVs6LATs8kDIbhhejCEpamnUt2eUfGDyBT39kAUxBP7Y6eLdbldb+R4Qw0HXAfRweNWskzIypVuCzraVAnQ1SOXqpN5KWWq6obPjY1pO+1fqqNMwiM/kFVTkqVnMZhU+Z+0mTom/9Ovumb+em3zGOYY8rvD5UkudOjM+p8IUJM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767015002; c=relaxed/simple; bh=yFiRKLzO2PsdoX2p4G7xQ2A4ecAxxsCJbsLjlGCf8bw=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type; b=dg9cKDi1meT1GESFLLyL+jm1AzTS4RK9qMQIMBY1rfADdSaBTppgqXWULfmVeNlfNqtuUekFVe/paD6CQX5WdLhdZPYND3Feu7rLR8WW/jUVOZbhVBsrRQA4fOCmJYPiF9aWg8clpCcvl7ArPuLNCTxYMalQNdS4wBge0g4H7dc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Y/RrEvVg; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Y/RrEvVg" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 19CD9C4CEF7; Mon, 29 Dec 2025 13:30:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1767015002; bh=yFiRKLzO2PsdoX2p4G7xQ2A4ecAxxsCJbsLjlGCf8bw=; h=From:To:Cc:Subject:Date:From; b=Y/RrEvVgXjcfXA3lKPwZ3FkSYHT/aCSC34h7zBwDincKLY7xGfafbr+y8g7uwMzmu iBxk5hVAbuWceq7t8RTOd0XqOeIAj17y0sbfHVU9ILyJrSe+MEO3GjKK9liDQEn4Fx Yb3YS/BdOXYyDUvoC68ZLTnq3x4fBZQQtAMmg5NnP5BGccAclTifCnalvB6oan9v77 uw+0y1cgUCP0fMCBY/osBQKJyF+IGamC4dyXuCUOZY5R6Vkq1H0OoX31PHHs5rqPZx e7vm/dAWAxSeha1uLvUhvWC364hIm7JyygCQiE5eoLunvhcEqoNzSL6M+29V/Qrx5+ wudsBeF8x7iuA== From: "Rafael J. Wysocki" To: Linux ACPI Cc: LKML , Hans de Goede , Andy Shevchenko Subject: [PATCH v2] ACPI: sysfs: Add device cid attribute for exposing _CID lists Date: Mon, 29 Dec 2025 14:29:59 +0100 Message-ID: <5957407.DvuYhMxLoT@rafael.j.wysocki> Organization: Linux Kernel Development Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Rafael J. Wysocki Add a new sysfs attribute called "cid" under struct acpi_device for exposing the list of compatible device IDs returned by the device's _CID object, if present. The new attribute will be present only if the _CID object is present. Signed-off-by: Rafael J. Wysocki Reviewed-by: Andy Shevchenko --- v1 -> v2: Use sysfs_emit_at() instead of sysfs_emit() as appropriate (Andy). --- drivers/acpi/device_sysfs.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) --- a/drivers/acpi/device_sysfs.c +++ b/drivers/acpi/device_sysfs.c @@ -403,6 +403,33 @@ hid_show(struct device *dev, struct devi } static DEVICE_ATTR_RO(hid); =20 +static ssize_t cid_show(struct device *dev, struct device_attribute *attr, + char *buf) +{ + struct acpi_device *acpi_dev =3D to_acpi_device(dev); + struct acpi_device_info *info =3D NULL; + ssize_t len =3D 0; + + acpi_get_object_info(acpi_dev->handle, &info); + if (!info) + return 0; + + if (info->valid & ACPI_VALID_CID) { + struct acpi_pnp_device_id_list *cid_list =3D &info->compatible_id_list; + int i; + + for (i =3D 0; i < cid_list->count - 1; i++) + len +=3D sysfs_emit_at(buf, len, "%s,", cid_list->ids[i].string); + + len +=3D sysfs_emit_at(buf, len, "%s\n", cid_list->ids[i].string); + } + + kfree(info); + + return len; +} +static DEVICE_ATTR_RO(cid); + static ssize_t uid_show(struct device *dev, struct device_attribute *attr, char *buf) { @@ -520,6 +547,7 @@ static DEVICE_ATTR_RO(status); static struct attribute *acpi_attrs[] =3D { &dev_attr_path.attr, &dev_attr_hid.attr, + &dev_attr_cid.attr, &dev_attr_modalias.attr, &dev_attr_description.attr, &dev_attr_adr.attr, @@ -562,6 +590,9 @@ static bool acpi_show_attr(struct acpi_d if (attr =3D=3D &dev_attr_status) return acpi_has_method(dev->handle, "_STA"); =20 + if (attr =3D=3D &dev_attr_cid) + return acpi_has_method(dev->handle, "_CID"); + /* * If device has _EJ0, 'eject' file is created that is used to trigger * hot-removal function from userland.