<feed xmlns='http://www.w3.org/2005/Atom'>
<title>u-boot.git/include/dm/uclass.h, branch master</title>
<subtitle>Unnamed repository; edit this file 'description' to name the repository.
</subtitle>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/'/>
<entry>
<title>dm: core: Add a helper to retrieve devices through graph endpoints</title>
<updated>2025-04-11T01:32:55+00:00</updated>
<author>
<name>Miquel Raynal</name>
<email>miquel.raynal@bootlin.com</email>
</author>
<published>2025-04-03T07:39:03+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=04fcddac28c9f28239f40c9b90e3e76ed5f5cb13'/>
<id>04fcddac28c9f28239f40c9b90e3e76ed5f5cb13</id>
<content type='text'>
There are already several helpers to find a udevice based on its
position in a device tree, like getting a child or a node pointed by a
phandle, but there was no support for graph endpoints, which are very
common in display pipelines.

Add a new helper, named uclass_get_device_by_endpoint() which enters the
child graph reprensentation, looks for a specific port, then follows the
remote endpoint, and finally retrieves the first parent of the given
uclass_id.

This is a very handy and straightforward way to get a bridge or a panel
handle.

Reviewed-by: Simon Glass &lt;sjg@chromium.org&gt;
Signed-off-by: Miquel Raynal &lt;miquel.raynal@bootlin.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
There are already several helpers to find a udevice based on its
position in a device tree, like getting a child or a node pointed by a
phandle, but there was no support for graph endpoints, which are very
common in display pipelines.

Add a new helper, named uclass_get_device_by_endpoint() which enters the
child graph reprensentation, looks for a specific port, then follows the
remote endpoint, and finally retrieves the first parent of the given
uclass_id.

This is a very handy and straightforward way to get a bridge or a panel
handle.

Reviewed-by: Simon Glass &lt;sjg@chromium.org&gt;
Signed-off-by: Miquel Raynal &lt;miquel.raynal@bootlin.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>dm: core: Add a function to see if a device exists</title>
<updated>2024-11-04T03:27:12+00:00</updated>
<author>
<name>Simon Glass</name>
<email>sjg@chromium.org</email>
</author>
<published>2024-10-19T15:21:49+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=79b3e9d25b3f96fdf66f9d7dc6a14fdce9a15f93'/>
<id>79b3e9d25b3f96fdf66f9d7dc6a14fdce9a15f93</id>
<content type='text'>
All the uclass functions for finding a device end up creating a uclass
if it doesn't exist. Add a function which instead returns NULL in this
case.

This is useful when in the 'unbind' path, since we don't want to undo
any unbinding which has already happened.

Signed-off-by: Simon Glass &lt;sjg@chromium.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
All the uclass functions for finding a device end up creating a uclass
if it doesn't exist. Add a function which instead returns NULL in this
case.

This is useful when in the 'unbind' path, since we don't want to undo
any unbinding which has already happened.

Signed-off-by: Simon Glass &lt;sjg@chromium.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>dm: core: fix introduce uclass_get_device_by_of_path</title>
<updated>2023-05-04T07:57:43+00:00</updated>
<author>
<name>Heinrich Schuchardt</name>
<email>heinrich.schuchardt@canonical.com</email>
</author>
<published>2023-05-02T02:59:18+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=f8816a8a9189250e4513d5cd15d1db657f9549a1'/>
<id>f8816a8a9189250e4513d5cd15d1db657f9549a1</id>
<content type='text'>
Correct the function documentation.

Fixes: ca031c082700 ("dm: core: introduce uclass_get_device_by_of_path()")
Reported-by: Tom Rini &lt;trini@konsulko.com&gt;
Signed-off-by: Heinrich Schuchardt &lt;heinrich.schuchardt@canonical.com&gt;
Reviewed-by: Simon Glass &lt;sjg@chromium.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Correct the function documentation.

Fixes: ca031c082700 ("dm: core: introduce uclass_get_device_by_of_path()")
Reported-by: Tom Rini &lt;trini@konsulko.com&gt;
Signed-off-by: Heinrich Schuchardt &lt;heinrich.schuchardt@canonical.com&gt;
Reviewed-by: Simon Glass &lt;sjg@chromium.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>dm: core: introduce uclass_get_device_by_of_path()</title>
<updated>2023-04-28T17:48:59+00:00</updated>
<author>
<name>Rasmus Villemoes</name>
<email>rasmus.villemoes@prevas.dk</email>
</author>
<published>2023-04-13T15:17:03+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=ca031c082700631264d1e058f2f705438c2be8c2'/>
<id>ca031c082700631264d1e058f2f705438c2be8c2</id>
<content type='text'>
There's quite a few instances of board-specific code doing

  off = fdt_path_offset(gd-&gt;fdt_blob, ...);
  ...
  ret = uclass_get_device_by_of_offset(..., off, &amp;dev);

looking for an eeprom or a pmic via some alias. Such code can be
simplified a little if we have a helper for directly getting a device
via device tree path (including being given as an alias).

Implement it in terms of ofnode rather than raw offsets so that this
will work whether live tree is enabled or not.

Signed-off-by: Rasmus Villemoes &lt;rasmus.villemoes@prevas.dk&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
There's quite a few instances of board-specific code doing

  off = fdt_path_offset(gd-&gt;fdt_blob, ...);
  ...
  ret = uclass_get_device_by_of_offset(..., off, &amp;dev);

looking for an eeprom or a pmic via some alias. Such code can be
simplified a little if we have a helper for directly getting a device
via device tree path (including being given as an alias).

Implement it in terms of ofnode rather than raw offsets so that this
will work whether live tree is enabled or not.

Signed-off-by: Rasmus Villemoes &lt;rasmus.villemoes@prevas.dk&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>dm: core: Do not stop uclass iteration on error</title>
<updated>2022-10-29T13:36:33+00:00</updated>
<author>
<name>Michal Suchanek</name>
<email>msuchanek@suse.de</email>
</author>
<published>2022-10-12T19:58:09+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=f21954750aa8ed445ab83998bb099e366136c428'/>
<id>f21954750aa8ed445ab83998bb099e366136c428</id>
<content type='text'>
When probing a device fails NULL pointer is returned, and following
devices in uclass list cannot be iterated. Skip to next device on error
instead.

With that the only condition under which these simple iteration
functions return error is when the dm is not initialized at uclass_get
time. This is not all that interesting, change return type to void.

Fixes: 6494d708bf ("dm: Add base driver model support")
Signed-off-by: Michal Suchanek &lt;msuchanek@suse.de&gt;
Reviewed-by: Simon Glass &lt;sjg@chromium.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
When probing a device fails NULL pointer is returned, and following
devices in uclass list cannot be iterated. Skip to next device on error
instead.

With that the only condition under which these simple iteration
functions return error is when the dm is not initialized at uclass_get
time. This is not all that interesting, change return type to void.

Fixes: 6494d708bf ("dm: Add base driver model support")
Signed-off-by: Michal Suchanek &lt;msuchanek@suse.de&gt;
Reviewed-by: Simon Glass &lt;sjg@chromium.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>dm: core: Switch uclass_*_device_err to use uclass_*_device_check</title>
<updated>2022-10-29T13:36:33+00:00</updated>
<author>
<name>Michal Suchanek</name>
<email>msuchanek@suse.de</email>
</author>
<published>2022-09-25T11:08:16+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=58ddb937e1699de241e4aa39de90a68a0be71744'/>
<id>58ddb937e1699de241e4aa39de90a68a0be71744</id>
<content type='text'>
Clarify documentation, fix a few more cases that could be broken by the
change.

Signed-off-by: Michal Suchanek &lt;msuchanek@suse.de&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Clarify documentation, fix a few more cases that could be broken by the
change.

Signed-off-by: Michal Suchanek &lt;msuchanek@suse.de&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>dm: core: Switch uclass_*_device_err to use uclass_*_device_check</title>
<updated>2022-10-18T03:17:12+00:00</updated>
<author>
<name>Michal Suchanek</name>
<email>msuchanek@suse.de</email>
</author>
<published>2022-10-12T19:58:06+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=e44d7e73fe0d649693d8d0a110cd7632bc919273'/>
<id>e44d7e73fe0d649693d8d0a110cd7632bc919273</id>
<content type='text'>
The _err variant iterators use the simple iterators without suffix as
basis.

However, there is no user that uclass_next_device_err for iteration,
many users of uclass_first_device_err use it to get the first and
(assumed) only device of an uclass, and a couple that use
uclass_next_device_err to get the device following a known device in the
uclass list.

While there are some truly singleton device classes in which more than
one device cannot exist these are quite rare, and most classes can have
multiple devices even if it is not the case on the SoC's EVB.

In a later patch the simple iterators will be updated to not stop on
error and return next device instead. With this in many cases the code
that expects the first device or an error if it fails to probe may get
the next device instead. Use the _check iterators as the basis of _err
iterators to preserve the old behavior.

Signed-off-by: Michal Suchanek &lt;msuchanek@suse.de&gt;
Reviewed-by: Simon Glass &lt;sjg@chromium.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The _err variant iterators use the simple iterators without suffix as
basis.

However, there is no user that uclass_next_device_err for iteration,
many users of uclass_first_device_err use it to get the first and
(assumed) only device of an uclass, and a couple that use
uclass_next_device_err to get the device following a known device in the
uclass list.

While there are some truly singleton device classes in which more than
one device cannot exist these are quite rare, and most classes can have
multiple devices even if it is not the case on the SoC's EVB.

In a later patch the simple iterators will be updated to not stop on
error and return next device instead. With this in many cases the code
that expects the first device or an error if it fails to probe may get
the next device instead. Use the _check iterators as the basis of _err
iterators to preserve the old behavior.

Signed-off-by: Michal Suchanek &lt;msuchanek@suse.de&gt;
Reviewed-by: Simon Glass &lt;sjg@chromium.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>dm: core: Switch uclass_foreach_dev_probe to use simple iterator</title>
<updated>2022-10-18T03:17:12+00:00</updated>
<author>
<name>Michal Suchanek</name>
<email>msuchanek@suse.de</email>
</author>
<published>2022-10-12T19:58:05+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=801f71194c54c75e90d723b9be3434b6354fce71'/>
<id>801f71194c54c75e90d723b9be3434b6354fce71</id>
<content type='text'>
The return value is not used for anythig, and in a later patch the
behavior of the _err iterator will change in an incompatible way.

Signed-off-by: Michal Suchanek &lt;msuchanek@suse.de&gt;
Reviewed-by: Simon Glass &lt;sjg@chromium.org&gt;
Update pvblock_probe() to avoid using internal var:
Signed-off-by: Simon Glass &lt;sjg@chromium.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The return value is not used for anythig, and in a later patch the
behavior of the _err iterator will change in an incompatible way.

Signed-off-by: Michal Suchanek &lt;msuchanek@suse.de&gt;
Reviewed-by: Simon Glass &lt;sjg@chromium.org&gt;
Update pvblock_probe() to avoid using internal var:
Signed-off-by: Simon Glass &lt;sjg@chromium.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>dm: core: Rename and fix uclass_get_by_name_len()</title>
<updated>2022-04-25T14:00:03+00:00</updated>
<author>
<name>Simon Glass</name>
<email>sjg@chromium.org</email>
</author>
<published>2022-04-25T05:30:59+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=6aa4fe39122a85ce1ef559139518fa5042406186'/>
<id>6aa4fe39122a85ce1ef559139518fa5042406186</id>
<content type='text'>
It seems that namelen is more common in U-Boot. Rename this function to
fit in better. Also fix a bug where it breaks the operation of
uclass_get_by_name() and add a test.

Signed-off-by: Simon Glass &lt;sjg@chromium.org&gt;
Reported-by: Patrick Delaunay &lt;patrick.delaunay@foss.st.com&gt;
Reported-by: Tim Harvey &lt;tharvey@gateworks.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
It seems that namelen is more common in U-Boot. Rename this function to
fit in better. Also fix a bug where it breaks the operation of
uclass_get_by_name() and add a test.

Signed-off-by: Simon Glass &lt;sjg@chromium.org&gt;
Reported-by: Patrick Delaunay &lt;patrick.delaunay@foss.st.com&gt;
Reported-by: Tim Harvey &lt;tharvey@gateworks.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>dm: core: Tidy up comments in uclass headers</title>
<updated>2022-04-06T18:03:17+00:00</updated>
<author>
<name>Simon Glass</name>
<email>sjg@chromium.org</email>
</author>
<published>2022-02-28T19:08:34+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=e86b6f71002e5892c28acd206e68d13adc76c4b7'/>
<id>e86b6f71002e5892c28acd206e68d13adc76c4b7</id>
<content type='text'>
Improve some of the comments in these files, which don't follow the
correct style.

Signed-off-by: Simon Glass &lt;sjg@chromium.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Improve some of the comments in these files, which don't follow the
correct style.

Signed-off-by: Simon Glass &lt;sjg@chromium.org&gt;
</pre>
</div>
</content>
</entry>
</feed>
