Re: [PATCH v2 06/12] software_node: Add support for fwnode_graph*() family of functions

From: Daniel Scally
Date: Fri Dec 18 2020 - 17:26:59 EST


On 18/12/2020 20:37, Andy Shevchenko wrote:
> On Thu, Dec 17, 2020 at 11:43:31PM +0000, Daniel Scally wrote:
>> From: Heikki Krogerus <heikki.krogerus@xxxxxxxxxxxxxxx>
>>
>> This implements the remaining .graph_* callbacks in the
>> fwnode operations structure for the software nodes. That makes
>> the fwnode_graph*() functions available in the drivers also
>> when software nodes are used.
>>
>> The implementation tries to mimic the "OF graph" as much as
>> possible, but there is no support for the "reg" device
>> property. The ports will need to have the index in their
>> name which starts with "port@" (for example "port@0", "port@1",
>> ...) and endpoints will use the index of the software node
>> that is given to them during creation. The port nodes can
>> also be grouped under a specially named "ports" subnode,
>> just like in DT, if necessary.
>>
>> The remote-endpoints are reference properties under the
>> endpoint nodes that are named "remote-endpoint".
>
> ...
>
>> + while ((port = software_node_get_next_child(parent, old))) {
>> + if (!strncmp(to_swnode(port)->node->name, "port", 4))
>> + return port;
>> + old = port;
>> + }
>
> Dunno if we need defines for port and its length here.

Mmm, maybe a comment?

> ...
>
>> + ret = kstrtou32(swnode->parent->node->name + 5, 10, &endpoint->port);
>
> But here at least comment is needed what 5 means ('port@' I suppose).

Ack - I'll add an explanatory comment (and yep, it's 'port@')

>> + if (ret)
>> + return ret;
>
>