Skip to content

Commit b0667a8

Browse files
mbolivar-nordiccfriedt
authored andcommitted
Revert "device: iterable supported devices"
This reverts commit 0c6588f. It's not clear that the supported devices are being properly computed, so let's revert this for v2.7.0 until we've had more time to think it through. Signed-off-by: Martí Bolívar <[email protected]>
1 parent e2ae4ec commit b0667a8

File tree

2 files changed

+6
-44
lines changed

2 files changed

+6
-44
lines changed

include/device.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -699,17 +699,13 @@ static inline bool device_is_ready(const struct device *dev)
699699
* List of devicetree dependency ordinals (if any),
700700
* DEVICE_HANDLE_SEP,
701701
* List of injected dependency ordinals (if any),
702-
* DEVICE_HANDLE_SEP,
703-
* List of devicetree supporting ordinals (if any),
704702
* }
705703
*
706704
* After processing in gen_handles.py, the format is updated to:
707705
* {
708706
* List of existing devicetree dependency handles (if any),
709707
* DEVICE_HANDLE_SEP,
710708
* List of injected dependency ordinals (if any),
711-
* DEVICE_HANDLE_SEP,
712-
* List of existing devicetree support handles (if any),
713709
* DEVICE_HANDLE_NULL padding to original length (at least one)
714710
* }
715711
*
@@ -741,9 +737,6 @@ BUILD_ASSERT(sizeof(device_handle_t) == 2, "fix the linker scripts");
741737
)) \
742738
DEVICE_HANDLE_SEP, \
743739
Z_DEVICE_EXTRA_HANDLES(__VA_ARGS__) \
744-
DEVICE_HANDLE_SEP, \
745-
COND_CODE_1(DT_NODE_EXISTS(node_id), \
746-
(DT_SUPPORTS_DEP_ORDS(node_id)), ()) \
747740
};
748741

749742
#ifdef CONFIG_PM_DEVICE

scripts/gen_handles.py

Lines changed: 6 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -246,19 +246,15 @@ def main():
246246
hvi = 1
247247
handle.dev_deps = []
248248
handle.ext_deps = []
249-
handle.dev_sups = []
250-
hdls = handle.dev_deps
249+
deps = handle.dev_deps
251250
while hvi < len(hv):
252251
h = hv[hvi]
253252
if h == DEVICE_HANDLE_ENDS:
254253
break
255254
if h == DEVICE_HANDLE_SEP:
256-
if hdls == handle.dev_deps:
257-
hdls = handle.ext_deps
258-
else:
259-
hdls = handle.dev_sups
255+
deps = handle.ext_deps
260256
else:
261-
hdls.append(h)
257+
deps.append(h)
262258
n = edt
263259
hvi += 1
264260

@@ -271,7 +267,6 @@ def main():
271267
for sn in used_nodes:
272268
# Where we're storing the final set of nodes: these are all used
273269
sn.__depends = set()
274-
sn.__supports = set()
275270

276271
deps = set(sn.depends_on)
277272
debug("\nNode: %s\nOrig deps:\n\t%s" % (sn.path, "\n\t".join([dn.path for dn in deps])))
@@ -284,16 +279,7 @@ def main():
284279
# forward the dependency up one level
285280
for ddn in dn.depends_on:
286281
deps.add(ddn)
287-
debug("Final deps:\n\t%s\n" % ("\n\t".join([ _dn.path for _dn in sn.__depends])))
288-
289-
sups = set(sn.required_by)
290-
debug("\nOrig sups:\n\t%s" % ("\n\t".join([dn.path for dn in sups])))
291-
while len(sups) > 0:
292-
dn = sups.pop()
293-
if dn in used_nodes:
294-
# this is used
295-
sn.__supports.add(dn)
296-
debug("\nFinal sups:\n\t%s" % ("\n\t".join([dn.path for dn in sn.__supports])))
282+
debug("final deps:\n\t%s\n" % ("\n\t".join([ _dn.path for _dn in sn.__depends])))
297283

298284
with open(args.output_source, "w") as fp:
299285
fp.write('#include <device.h>\n')
@@ -304,7 +290,6 @@ def main():
304290
assert hs, "no hs for %s" % (dev.sym.name,)
305291
dep_paths = []
306292
ext_paths = []
307-
sup_paths = []
308293
hdls = []
309294

310295
sn = hs.node
@@ -315,24 +300,13 @@ def main():
315300
dep_paths.append(dn.path)
316301
else:
317302
dep_paths.append('(%s)' % dn.path)
318-
319303
# Force separator to signal start of injected dependencies
320304
hdls.append(DEVICE_HANDLE_SEP)
321305
if len(hs.ext_deps) > 0:
322306
# TODO: map these to something smaller?
323307
ext_paths.extend(map(str, hs.ext_deps))
324308
hdls.extend(hs.ext_deps)
325309

326-
# Force separator to signal start of supported devices
327-
hdls.append(DEVICE_HANDLE_SEP)
328-
if len(hs.dev_sups) > 0:
329-
for dn in sn.required_by:
330-
if dn in sn.__supports:
331-
sup_paths.append(dn.path)
332-
else:
333-
sup_paths.append('(%s)' % dn.path)
334-
hdls.extend(dn.__device.dev_handle for dn in sn.__supports)
335-
336310
# When CONFIG_USERSPACE is enabled the pre-built elf is
337311
# also used to get hashes that identify kernel objects by
338312
# address. We can't allow the size of any object in the
@@ -349,14 +323,9 @@ def main():
349323
]
350324

351325
if len(dep_paths) > 0:
352-
lines.append(' * Direct Dependencies:')
353-
lines.append(' * - %s' % ('\n * - '.join(dep_paths)))
326+
lines.append(' * - %s' % ('\n * - '.join(dep_paths)))
354327
if len(ext_paths) > 0:
355-
lines.append(' * Injected Dependencies:')
356-
lines.append(' * - %s' % ('\n * - '.join(ext_paths)))
357-
if len(sup_paths) > 0:
358-
lines.append(' * Supported:')
359-
lines.append(' * - %s' % ('\n * - '.join(sup_paths)))
328+
lines.append(' * + %s' % ('\n * + '.join(ext_paths)))
360329

361330
lines.extend([
362331
' */',

0 commit comments

Comments
 (0)