summaryrefslogtreecommitdiff
path: root/include/blk.h
diff options
context:
space:
mode:
authorGreg Malysa <malysagreg@gmail.com>2025-07-17 06:19:01 -0400
committerTom Rini <trini@konsulko.com>2025-07-23 17:37:14 -0600
commit3532f1f5edfc97c9dcea723cdeb732eda44bc669 (patch)
tree90bface9a3ea9cd9e7dafca4ea85a8047362ea6c /include/blk.h
parentcf13f33d3a684c12f1ef835793cd66193df00c47 (diff)
block: Remove blk_find_first/next
In [0], Andrew noted a code quality issue in the implementation of blk_find_first and blk_find_next. This led to the observation that the logic of these functions was also likely incorrect, and based on a quick check it seemed the functions were unused outside of test code, which did not exercise the potential failure case, so we felt they should be removed. In [1], a test patch which illustrates the failure in sandbox is provided for reference. Because a more thorough check agrees that these functions are unused, they are currently incorrect, and fixed/removable flags on block devices prior to probe are unreliable, just remove these functions instead of fixing them. All potential users should have used blk_first_device_err instead anyway. CI results at [2]. [0] https://patchwork.ozlabs.org/project/uboot/patch/20250714-blk-uclass-v1-1-d21428c5f762@linaro.org/ [1] https://gist.github.com/gmalysa/b05e73a5c14bc18c5741a0e0e06a2992 [2] https://gitlab.com/gmalysa/lnxdsp-u-boot/-/pipelines/1931210857 Signed-off-by: Greg Malysa <malysagreg@gmail.com> Reviewed-by: Andrew Goodbody <andrew.goodbody@linaro.org>
Diffstat (limited to 'include/blk.h')
-rw-r--r--include/blk.h45
1 files changed, 0 insertions, 45 deletions
diff --git a/include/blk.h b/include/blk.h
index 488d04cf32a..8d1b70cabd3 100644
--- a/include/blk.h
+++ b/include/blk.h
@@ -782,51 +782,6 @@ int blk_first_device_err(enum blk_flag_t flags, struct udevice **devp);
int blk_next_device_err(enum blk_flag_t flags, struct udevice **devp);
/**
- * blk_find_first() - Return the first matching block device
- * @flags: Indicates type of device to return
- * @devp: Returns pointer to device, or NULL on error
- *
- * The device is not prepared for use - this is an internal function.
- * The function uclass_get_device_tail() can be used to probe the device.
- *
- * Note that some devices are considered removable until they have been probed
- *
- * @return 0 if found, -ENODEV if not found
- */
-int blk_find_first(enum blk_flag_t flags, struct udevice **devp);
-
-/**
- * blk_find_next() - Return the next matching block device
- * @flags: Indicates type of device to return
- * @devp: On entry, pointer to device to lookup. On exit, returns pointer
- * to the next device in the same uclass, or NULL if none
- *
- * The device is not prepared for use - this is an internal function.
- * The function uclass_get_device_tail() can be used to probe the device.
- *
- * Note that some devices are considered removable until they have been probed
- *
- * @return 0 if found, -ENODEV if not found
- */
-int blk_find_next(enum blk_flag_t flags, struct udevice **devp);
-
-/**
- * blk_foreach() - iterate through block devices
- *
- * This creates a for() loop which works through the available block devices in
- * order from start to end.
- *
- * If for some reason the uclass cannot be found, this does nothing.
- *
- * @_flags: Indicates type of device to return
- * @_pos: struct udevice * to hold the current device. Set to NULL when there
- * are no more devices.
- */
-#define blk_foreach(_flags, _pos) \
- for (int _ret = blk_find_first(_flags, &_pos); !_ret && _pos; \
- _ret = blk_find_next(_flags, &_pos))
-
-/**
* blk_foreach_probe() - Helper function to iteration through block devices
*
* This creates a for() loop which works through the available devices in