On Sun, Sep 21, 2025 at 4:00 PM Hans de Goede hansg@kernel.org wrote:
On 20-Sep-25 11:27 PM, Dmitry Torokhov wrote:
On Sat, Sep 20, 2025 at 10:09:55PM +0200, Hans de Goede wrote:
...
Bikeshedding for later. Maybe do it like this in case we can have more than 2 nodes at some point?
do { desc = gpiod_find_by_fwnode(fwnode, consumer, con_id, idx, flags, lookupflags); if (!gpiod_not_found(desc)) return desc; fwnode = fwnode->secondary; } while (!IS_ERR_OR_NULL(fwnode)); return ERR_PTR(-ENOENT);
At a minimum this would need to a regular while () {} loop then, the initial fwnode may also be NULL and we don't want to deref that.
Andy did mention turning the fwnode-s into a regular linked-list in the future, but I think that would be using <linux/list.h> then, replacing the secondary pointer with a list head ?
Dropping secondary in the struct fwnode_handle and use struct list_head somewhere else, e.g., struct device.
+}