[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aVGQtNsm0hDgRR0m@smile.fi.intel.com>
Date: Sun, 28 Dec 2025 22:19:00 +0200
From: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To: "Rafael J. Wysocki" <rafael@...nel.org>
Cc: Linux ACPI <linux-acpi@...r.kernel.org>,
LKML <linux-kernel@...r.kernel.org>,
Hans de Goede <hansg@...nel.org>
Subject: Re: [PATCH v1] ACPI: sysfs: Add device cid attribute for exposing
_CID lists
On Fri, Dec 12, 2025 at 09:52:44PM +0100, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rafael.j.wysocki@...el.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
Powered by blists - more mailing lists