str: String representation of the value
"""
if ftype == fdt.Type.INT:
- return '%#x' % fdt_util.fdt32_to_cpu(value)
+ val = '%#x' % fdt_util.fdt32_to_cpu(value)
elif ftype == fdt.Type.BYTE:
char = value[0]
- return '%#x' % (ord(char) if isinstance(char, str) else char)
+ val = '%#x' % (ord(char) if isinstance(char, str) else char)
elif ftype == fdt.Type.STRING:
# Handle evil ACPI backslashes by adding another backslash before them.
# So "\\_SB.GPO0" in the device tree effectively stays like that in C
- return '"%s"' % value.replace('\\', '\\\\')
+ val = '"%s"' % value.replace('\\', '\\\\')
elif ftype == fdt.Type.BOOL:
- return 'true'
+ val = 'true'
else: # ftype == fdt.Type.INT64:
- return '%#x' % value
+ val = '%#x' % value
+ return val
def get_compat_name(node):
"""Get the node's list of compatible string as a C identifiers
Args:
node (fdt.Node): Node object to check
Return:
- List of C identifiers for all the compatible strings
+ list of str: List of C identifiers for all the compatible strings
"""
compat = node.props['compatible'].value
if not isinstance(compat, list):
return [conv_name_to_c(c) for c in compat]
-class DtbPlatdata(object):
+class DtbPlatdata():
"""Provide a means to convert device tree binary data to platform data
The output of this process is C structures which can be used in space-
and a lookup in driver_aliases printing a warning in case of failure.
Args:
- node: Node object to check
+ node (Node): Node object to check
Return:
Tuple:
Driver name associated with the first compatible string
# The following re will search for driver names declared as
# U_BOOT_DRIVER(driver_name)
- drivers = re.findall('U_BOOT_DRIVER\((.*)\)', buff)
+ drivers = re.findall(r'U_BOOT_DRIVER\((.*)\)', buff)
for driver in drivers:
self._drivers.append(driver)
# The following re will search for driver aliases declared as
# U_BOOT_DRIVER_ALIAS(alias, driver_name)
driver_aliases = re.findall(
- 'U_BOOT_DRIVER_ALIAS\(\s*(\w+)\s*,\s*(\w+)\s*\)',
+ r'U_BOOT_DRIVER_ALIAS\(\s*(\w+)\s*,\s*(\w+)\s*\)',
buff)
for alias in driver_aliases: # pragma: no cover
This adds each node to self._valid_nodes.
Args:
- root: Root node for scan
- valid_nodes: List of Node objects to add to
+ root (Node): Root node for scan
+ valid_nodes (list of Node): List of Node objects to add to
"""
for node in root.subnodes:
if 'compatible' in node.props:
updated to match that width.
Returns:
- dict containing structures:
+ dict of dict: dict containing structures:
key (str): Node name, as a C identifier
value: dict containing structure fields:
key (str): Field name
doc/driver-model/of-plat.rst for more information.
Args:
- structs: dict containing structures:
+ structs (dict): dict containing structures:
key (str): Node name, as a C identifier
value: dict containing structure fields:
key (str): Field name
output (str): Name of output file
warning_disabled (bool): True to avoid showing warnings about missing
drivers
- _drivers_additional (list): List of additional drivers to use during
+ drivers_additional (list): List of additional drivers to use during
scanning
Raises:
ValueError: if args has no command, or an unknown command