[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAJZ5v0gzSwpwN5mzUUvATeww2Q5_s95_-T2Jd2fwgE1cXYFuVQ@mail.gmail.com>
Date: Mon, 29 Dec 2025 14:05:33 +0100
From: "Rafael J. Wysocki" <rafael@...nel.org>
To: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Cc: "Rafael J. Wysocki" <rafael@...nel.org>, 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 Sun, Dec 28, 2025 at 9:19 PM Andy Shevchenko
<andriy.shevchenko@...ux.intel.com> wrote:
>
> 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().
Right, thanks!
> > + }
> > +
> > + kfree(info);
> > +
> > + return len;
> > +}
> > +static DEVICE_ATTR_RO(cid);
>
> Do wee have any ABI documentation for these sysfs attributes?
No, there's none I know of.
> If so, it needs to be updated, otherwise perhaps create one?
Well, feel free to do so.
Powered by blists - more mailing lists