]>
Commit | Line | Data |
---|---|---|
83d290c5 | 1 | /* SPDX-License-Identifier: GPL-2.0+ */ |
6494d708 SG |
2 | /* |
3 | * Copyright (c) 2013 Google, Inc | |
6494d708 SG |
4 | */ |
5 | ||
6 | #ifndef __DM_UTIL_H | |
b1799fcb | 7 | #define __DM_UTIL_H |
6494d708 | 8 | |
2cb4ddb9 SG |
9 | struct dm_stats; |
10 | ||
abb9cd30 | 11 | #if CONFIG_IS_ENABLED(DM_WARN) |
b18b38f2 | 12 | #define dm_warn(fmt...) log(LOGC_DM, LOGL_WARNING, ##fmt) |
a94f468f | 13 | #else |
2c61c0eb | 14 | #define dm_warn(fmt...) log(LOGC_DM, LOGL_DEBUG, ##fmt) |
a94f468f | 15 | #endif |
6494d708 | 16 | |
6494d708 SG |
17 | struct list_head; |
18 | ||
19 | /** | |
20 | * list_count_items() - Count number of items in a list | |
21 | * | |
22 | * @param head: Head of list | |
185f812c | 23 | * Return: number of items, or 0 if empty |
6494d708 SG |
24 | */ |
25 | int list_count_items(struct list_head *head); | |
26 | ||
3d012541 | 27 | /** |
36e45f69 | 28 | * Dump out a tree of all devices starting @uclass |
3d012541 | 29 | * |
36e45f69 AT |
30 | * @dev_name: udevice name |
31 | * @extended: true if forword-matching expected | |
3d012541 SG |
32 | * @sort: Sort by uclass name |
33 | */ | |
36e45f69 | 34 | void dm_dump_tree(char *dev_name, bool extended, bool sort); |
304fbef1 | 35 | |
36e45f69 AT |
36 | /* |
37 | * Dump out a list of uclasses and their devices | |
38 | * | |
39 | * @uclass: uclass name | |
40 | * @extended: true if forword-matching expected | |
41 | */ | |
42 | void dm_dump_uclass(char *uclass, bool extended); | |
304fbef1 | 43 | |
40b6f2d0 MY |
44 | #ifdef CONFIG_DEBUG_DEVRES |
45 | /* Dump out a list of device resources */ | |
46 | void dm_dump_devres(void); | |
47 | #else | |
48 | static inline void dm_dump_devres(void) | |
49 | { | |
50 | } | |
51 | #endif | |
52 | ||
7b9d60fc SA |
53 | /* Dump out a list of drivers */ |
54 | void dm_dump_drivers(void); | |
55 | ||
2e488368 NF |
56 | /* Dump out a list with each driver's compatibility strings */ |
57 | void dm_dump_driver_compat(void); | |
58 | ||
59 | /* Dump out a list of drivers with static platform data */ | |
60 | void dm_dump_static_driver_info(void); | |
61 | ||
2cb4ddb9 SG |
62 | /** |
63 | * dm_dump_mem() - Dump stats on memory usage in driver model | |
64 | * | |
65 | * @mem: Stats to dump | |
66 | */ | |
67 | void dm_dump_mem(struct dm_stats *stats); | |
68 | ||
cfb9c9b7 SG |
69 | #if CONFIG_IS_ENABLED(OF_PLATDATA_INST) && CONFIG_IS_ENABLED(READ_ONLY) |
70 | void *dm_priv_to_rw(void *priv); | |
71 | #else | |
72 | static inline void *dm_priv_to_rw(void *priv) | |
73 | { | |
74 | return priv; | |
75 | } | |
76 | #endif | |
36109708 PCT |
77 | |
78 | #endif |