Changeset 8ea0308 in mainline


Ignore:
Timestamp:
2009-01-16T16:32:59Z (15 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
d4668392
Parents:
0832b4d
Message:

cstyle

File:
1 edited

Legend:

Unmodified
Added
Removed
  • boot/genarch/ofw_tree.c

    r0832b4d r8ea0308  
    4343static ofw_tree_property_t *ofw_tree_properties_alloc(unsigned count)
    4444{
    45         return balloc(count * sizeof(ofw_tree_property_t), sizeof(ofw_tree_property_t));
    46 }
    47 
    48 static void * ofw_tree_space_alloc(size_t size)
     45        return balloc(count * sizeof(ofw_tree_property_t),
     46            sizeof(ofw_tree_property_t));
     47}
     48
     49static void *ofw_tree_space_alloc(size_t size)
    4950{
    5051        char *addr;
     
    6667}
    6768
    68 /** Transfer information from one OpenFirmware node into its memory representation.
    69  *
    70  * Transfer entire information from the OpenFirmware device tree 'current' node to
    71  * its memory representation in 'current_node'. This function recursively processes
    72  * all node's children. Node's peers are processed iteratively in order to prevent
    73  * stack from overflowing.
    74  *
    75  * @param current_node  Pointer to uninitialized ofw_tree_node structure that will
    76  *                      become the memory represenation of 'current'.
    77  * @param parent_node   Parent ofw_tree_node structure or NULL in case of root node.
     69/** Transfer information from one OpenFirmware node into its memory
     70 * representation.
     71 *
     72 * Transfer entire information from the OpenFirmware device tree 'current' node
     73 * to its memory representation in 'current_node'. This function recursively
     74 * processes all node's children. Node's peers are processed iteratively in
     75 * order to prevent stack from overflowing.
     76 *
     77 * @param current_node  Pointer to uninitialized ofw_tree_node structure that
     78 *                      will become the memory represenation of 'current'.
     79 * @param parent_node   Parent ofw_tree_node structure or NULL in case of root
     80 *                      node.
    7881 * @param current       OpenFirmware phandle to the current device tree node.
    7982 */
    8083static void ofw_tree_node_process(ofw_tree_node_t *current_node,
    81         ofw_tree_node_t *parent_node, phandle current)
    82 {
    83         static char path[MAX_PATH_LEN+1];
     84    ofw_tree_node_t *parent_node, phandle current)
     85{
     86        static char path[MAX_PATH_LEN + 1];
    8487        static char name[OFW_TREE_PROPERTY_MAX_NAMELEN];
    8588        static char name2[OFW_TREE_PROPERTY_MAX_NAMELEN];
     
    132135                        child_node = ofw_tree_node_alloc();
    133136                        if (child_node) {
    134                                 ofw_tree_node_process(child_node, current_node, child);
     137                                ofw_tree_node_process(child_node, current_node,
     138                                    child);
    135139                                current_node->child = child_node;
    136140                        }
     
    152156                 * Copy properties.
    153157                 */
    154                 current_node->property = ofw_tree_properties_alloc(current_node->properties);
     158                current_node->property =
     159                    ofw_tree_properties_alloc(current_node->properties);
    155160                if (!current_node->property)
    156161                        return;
     
    165170                        memcpy(name, name2, OFW_TREE_PROPERTY_MAX_NAMELEN);
    166171                        memcpy(current_node->property[i].name, name,
    167                                 OFW_TREE_PROPERTY_MAX_NAMELEN);
    168                         current_node->property[i].name[OFW_TREE_PROPERTY_MAX_NAMELEN] = '\0';
     172                            OFW_TREE_PROPERTY_MAX_NAMELEN);
     173                        current_node->property[i].name[
     174                            OFW_TREE_PROPERTY_MAX_NAMELEN] = '\0';
    169175
    170176                        size = ofw_get_proplen(current, name);
     
    178184                                         * Copy property value to memory node.
    179185                                         */
    180                                         (void) ofw_get_property(current, name, buf, size);
     186                                        (void) ofw_get_property(current, name,
     187                                            buf, size);
    181188                                }
    182189                        } else {
     
    185192                }
    186193
    187                 current_node->properties = i;   /* Just in case we ran out of memory. */
     194                /* Just in case we ran out of memory. */
     195                current_node->properties = i;
    188196
    189197                /*
     
    218226/** Construct memory representation of OpenFirmware device tree.
    219227 *
    220  * @return NULL on failure or pointer to the root node.
     228 * @return              NULL on failure or pointer to the root node.
    221229 */
    222230ofw_tree_node_t *ofw_tree_build(void)
     
    239247                ssm = ofw_tree_node_alloc();
    240248                if (ssm) {
    241                         ofw_tree_node_process(
    242                                 ssm, root, ofw_find_device("/ssm@0,0"));
     249                        ofw_tree_node_process(ssm, root,
     250                            ofw_find_device("/ssm@0,0"));
    243251                        ssm->peer = root->child;
    244252                        root->child = ssm;
Note: See TracChangeset for help on using the changeset viewer.