diff options
author | Simon Glass | 2021-03-15 17:25:28 +1300 |
---|---|---|
committer | Simon Glass | 2021-03-26 17:03:08 +1300 |
commit | cc469b708667d24fc2a2c285e52d0d8ef5b14909 (patch) | |
tree | 25a09a443009b99f9c70f918135046b67de003c3 /include/dm | |
parent | e62ad9c8672dc1dcd3afb791d58da34cc02efbe9 (diff) |
dm: Rename device_get_by_driver_info_idx()
This function finds a device by its driver_info index. With
of-platdata-inst we do not use driver_info, but instead instantiate
udevice records at build-time.
However the semantics of using the function are the same in each case:
the caller provides an index and gets back a device.
So rename the function to device_get_by_ofplat_idx(), so that it can be
used for both situations. The caller does not really need to worry about
the details.
Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'include/dm')
-rw-r--r-- | include/dm/device.h | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/include/dm/device.h b/include/dm/device.h index ca796059e0c..9183356468f 100644 --- a/include/dm/device.h +++ b/include/dm/device.h @@ -667,18 +667,24 @@ int device_find_global_by_ofnode(ofnode node, struct udevice **devp); int device_get_global_by_ofnode(ofnode node, struct udevice **devp); /** - * device_get_by_driver_info_idx() - Get a device based on driver_info index + * device_get_by_ofplat_idx() - Get a device based on of-platdata index * - * Locates a device by its struct driver_info, by using its index number which - * is written into the idx field of struct phandle_1_arg, etc. + * Locates a device by either its struct driver_info index, or its + * struct udevice index. The latter is used with OF_PLATDATA_INST, since we have + * a list of build-time instantiated struct udevice records, The former is used + * with !OF_PLATDATA_INST since in that case we have a list of + * struct driver_info records. + * + * The index number is written into the idx field of struct phandle_1_arg, etc. + * It is the position of this driver_info/udevice in its linker list. * * The device is probed to activate it ready for use. * - * @idx: Index number of the driver_info structure (0=first) + * @idx: Index number of the driver_info/udevice structure (0=first) * @devp: Returns pointer to device if found, otherwise this is set to NULL * @return 0 if OK, -ve on error */ -int device_get_by_driver_info_idx(uint idx, struct udevice **devp); +int device_get_by_ofplat_idx(uint idx, struct udevice **devp); /** * device_find_first_child() - Find the first child of a device |