From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: "Rafael J. Wysocki" <rafael@kernel.org>
Cc: Linux ACPI <linux-acpi@vger.kernel.org>,
LKML <linux-kernel@vger.kernel.org>,
Hans de Goede <hansg@kernel.org>
Subject: Re: [PATCH v1] ACPI: sysfs: Add device cid attribute for exposing _CID lists
Date: Sun, 28 Dec 2025 22:19:00 +0200 [thread overview]
Message-ID: <aVGQtNsm0hDgRR0m@smile.fi.intel.com> (raw)
In-Reply-To: <2812426.mvXUDI8C0e@rafael.j.wysocki>
On Fri, Dec 12, 2025 at 09:52:44PM +0100, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
>
> 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.
...
> +static ssize_t cid_show(struct device *dev, struct device_attribute *attr,
> + char *buf)
> +{
> + struct acpi_device *acpi_dev = to_acpi_device(dev);
> + struct acpi_device_info *info = NULL;
> + ssize_t len = 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 = &info->compatible_id_list;
> + int i;
> +
> + for (i = 0; i < cid_list->count - 1; i++)
> + len += sysfs_emit(buf, "%s,", cid_list->ids[i].string);
> +
> + len += sysfs_emit(buf, "%s\n", cid_list->ids[i].string);
You definitely meant to use sysfs_emit_at().
> + }
> +
> + kfree(info);
> +
> + return len;
> +}
> +static DEVICE_ATTR_RO(cid);
Do wee have any ABI documentation for these sysfs attributes?
If so, it needs to be updated, otherwise perhaps create one?
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2025-12-28 20:19 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-12 20:52 [PATCH v1] ACPI: sysfs: Add device cid attribute for exposing _CID lists Rafael J. Wysocki
2025-12-28 20:19 ` Andy Shevchenko [this message]
2025-12-29 13:05 ` Rafael J. Wysocki
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=aVGQtNsm0hDgRR0m@smile.fi.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=hansg@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rafael@kernel.org \
/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