1 /* SPDX-License-Identifier: GPL-2.0+ */ 2 /* 3 * Copyright (c) 2013 Google, Inc 4 */ 5 6 #ifndef __DM_UTIL_H 7 #define __DM_UTIL_H 8 9 struct dm_stats; 10 11 #if CONFIG_IS_ENABLED(DM_WARN) 12 #define dm_warn(fmt...) log(LOGC_DM, LOGL_WARNING, ##fmt) 13 #else 14 #define dm_warn(fmt...) log(LOGC_DM, LOGL_DEBUG, ##fmt) 15 #endif 16 17 struct list_head; 18 19 /** 20 * Dump out a tree of all devices starting @uclass 21 * 22 * @dev_name: udevice name 23 * @extended: true if forword-matching expected 24 * @sort: Sort by uclass name 25 */ 26 void dm_dump_tree(char *dev_name, bool extended, bool sort); 27 28 /* 29 * Dump out a list of uclasses and their devices 30 * 31 * @uclass: uclass name 32 * @extended: true if forword-matching expected 33 */ 34 void dm_dump_uclass(char *uclass, bool extended); 35 36 #ifdef CONFIG_DEBUG_DEVRES 37 /* Dump out a list of device resources */ 38 void dm_dump_devres(void); 39 #else dm_dump_devres(void)40static inline void dm_dump_devres(void) 41 { 42 } 43 #endif 44 45 /* Dump out a list of drivers */ 46 void dm_dump_drivers(void); 47 48 /* Dump out a list with each driver's compatibility strings */ 49 void dm_dump_driver_compat(void); 50 51 /* Dump out a list of drivers with static platform data */ 52 void dm_dump_static_driver_info(void); 53 54 /** 55 * dm_dump_mem() - Dump stats on memory usage in driver model 56 * 57 * @mem: Stats to dump 58 */ 59 void dm_dump_mem(struct dm_stats *stats); 60 61 #if CONFIG_IS_ENABLED(OF_PLATDATA_INST) && CONFIG_IS_ENABLED(READ_ONLY) 62 void *dm_priv_to_rw(void *priv); 63 #else dm_priv_to_rw(void * priv)64static inline void *dm_priv_to_rw(void *priv) 65 { 66 return priv; 67 } 68 #endif 69 70 #endif 71