Re: [PATCH v2 6/9] gpio: sysfs: don't look up exported lines as class devices
From: Andy Shevchenko
Date: Fri Jun 27 2025 - 11:47:42 EST
On Mon, Jun 23, 2025 at 10:59:54AM +0200, Bartosz Golaszewski wrote:
>
> In preparation for adding a parallel, per-chip attribute group for
> exported GPIO lines, stop using class device APIs to refer to it in the
> code. When unregistering the chip, don't call class_find_device() but
> instead store exported lines in a linked list inside the GPIO chip data
> object and look it up there.
...
> + struct list_head list;
> };
If you make this to be the first member, you may make the container_of() (from
list_entry APIs) to be no-op. Have you checked with bloat-o-meter the difference?
...
> + struct list_head exported_lines;
> };
Ditto.
...
> - desc_data->value_class_node = sysfs_get_dirent(dev->kobj.sd, "value");
> + desc_data->value_class_node = sysfs_get_dirent(desc_data->dev->kobj.sd,
> + "value");
In such cases I find the following style to be slightly better to read.
desc_data->value_class_node =
sysfs_get_dirent(desc_data->dev->kobj.sd, "value");
--
With Best Regards,
Andy Shevchenko