Skip to content

Commit ea2bbb8

Browse files
mbolivar-nordiccfriedt
authored andcommitted
Revert "device: simplify structure of handles array"
This reverts commit ec331c6. Although it's a valid simplification under the assumption that we're going to be padding the array out anyway, it would use extra ROM if we fix the build system issues that are currently forcing gen_handles.py to introduce extra padding in the handles arrays for linker pass 2. On the (perhaps optimistic) assumption that we're going to fix the build system, let's get rid of a commit that would get in the way. The extra "complexity" in device_required_handles_get() is trivial. This gets rid of a comment describing the linker passes, but the structure of the comment is a bit misleading (and it contains incorrect information for the results of pass 2: the terminator at the end is DEVICE_HANDLE_ENDS, not DEVICE_HANDLE_NULL). Signed-off-by: Martí Bolívar <[email protected]>
1 parent b0667a8 commit ea2bbb8

File tree

2 files changed

+3
-19
lines changed

2 files changed

+3
-19
lines changed

include/device.h

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,8 @@ device_required_handles_get(const struct device *dev,
479479
if (rv != NULL) {
480480
size_t i = 0;
481481

482-
while (rv[i] != DEVICE_HANDLE_SEP) {
482+
while ((rv[i] != DEVICE_HANDLE_ENDS)
483+
&& (rv[i] != DEVICE_HANDLE_SEP)) {
483484
++i;
484485
}
485486
*count = i;
@@ -693,22 +694,6 @@ static inline bool device_is_ready(const struct device *dev)
693694
* in a distinct pass1 section (which will be replaced by
694695
* postprocessing).
695696
*
696-
* Before processing in gen_handles.py, the array format is:
697-
* {
698-
* DEVICE_ORDINAL (or DEVICE_HANDLE_NULL if not a devicetree node),
699-
* List of devicetree dependency ordinals (if any),
700-
* DEVICE_HANDLE_SEP,
701-
* List of injected dependency ordinals (if any),
702-
* }
703-
*
704-
* After processing in gen_handles.py, the format is updated to:
705-
* {
706-
* List of existing devicetree dependency handles (if any),
707-
* DEVICE_HANDLE_SEP,
708-
* List of injected dependency ordinals (if any),
709-
* DEVICE_HANDLE_NULL padding to original length (at least one)
710-
* }
711-
*
712697
* It is also (experimentally) necessary to provide explicit alignment
713698
* on each object. Otherwise x86-64 builds will introduce padding
714699
* between objects in the same input section in individual object

scripts/gen_handles.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -300,11 +300,10 @@ def main():
300300
dep_paths.append(dn.path)
301301
else:
302302
dep_paths.append('(%s)' % dn.path)
303-
# Force separator to signal start of injected dependencies
304-
hdls.append(DEVICE_HANDLE_SEP)
305303
if len(hs.ext_deps) > 0:
306304
# TODO: map these to something smaller?
307305
ext_paths.extend(map(str, hs.ext_deps))
306+
hdls.append(DEVICE_HANDLE_SEP)
308307
hdls.extend(hs.ext_deps)
309308

310309
# When CONFIG_USERSPACE is enabled the pre-built elf is

0 commit comments

Comments
 (0)