This touches up the code a bit to match GNU style. No functional changes.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
+2011-04-02 Mike Frysinger <vapier@gentoo.org>
+
+ * hw-alloc.c (hw_alloc_data): Adjust brace.
+ * hw-base.c (hw_base_data): Likewise.
+ (generic_hw_unit_decode): Fix indentation.
+ * hw-device.h (_hw_unit, enum, hw): Adjust braces.
+ * hw-events.c (hw_event, hw_event_data): Likewise.
+ * hw-handles.c (hw_handle_mapping, hw_handle_data): Likewise.
+ * hw-instances.c (hw_instance_data): Likewise.
+ * hw-instances.h (hw_instance): Likewise.
+ * hw-main.h (hw_descriptor, enum): Likewise.
+ * hw-ports.c (hw_port_edge, hw_port_data, empty_hw_ports): Likewise.
+ * hw-ports.h (hw_port_descriptor): Likewise.
+ * hw-properties.c (hw_property_data): Likewise.
+ * hw-properties.h (enum, hw_property, _ihandle_runtime_property_spec,
+ _range_property_spec, _reg_property_spec): Likewise.
+ * hw-tree.c (_name_specifier, printer): Likewise.
+ (split_device_specifier, parse_string_property, hw_tree_traverse,
+ print_size, print_reg_property, print_string, print_properties):
+ Fix indentation.
+
2011-03-29 Mike Frysinger <vapier@gentoo.org>
* aclocal.m4 (SIM_AC_OPTION_HARDWARE): Add cfi to default list.
#include <stdlib.h>
#endif
-struct hw_alloc_data {
+struct hw_alloc_data
+{
void *alloc;
struct hw_alloc_data *next;
};
#include "hw-config.h"
-struct hw_base_data {
+struct hw_base_data
+{
int finished_p;
const struct hw_descriptor *descriptor;
hw_delete_callback *to_delete;
return -1;
unit++;
}
- if (nr_cells < max_nr_cells) {
- /* shift everything to correct position */
- int i;
- for (i = 1; i <= nr_cells; i++)
- phys->cells[max_nr_cells - i] = phys->cells[nr_cells - i];
- for (i = 0; i < (max_nr_cells - nr_cells); i++)
- phys->cells[i] = 0;
- }
+ if (nr_cells < max_nr_cells)
+ {
+ /* shift everything to correct position */
+ int i;
+
+ for (i = 1; i <= nr_cells; i++)
+ phys->cells[max_nr_cells - i] = phys->cells[nr_cells - i];
+ for (i = 0; i < (max_nr_cells - nr_cells); i++)
+ phys->cells[i] = 0;
+ }
phys->nr_cells = max_nr_cells;
return max_nr_cells;
}
{
for (; i < phys->nr_cells; i++)
{
- if (pos != buf) {
- strcat(pos, ",");
- pos = strchr(pos, '\0');
- }
+ if (pos != buf)
+ {
+ strcat(pos, ",");
+ pos = strchr(pos, '\0');
+ }
if (phys->cells[i] < 10)
sprintf (pos, "%ld", (unsigned long)phys->cells[i]);
else
The number of words determined by the number of {address,size}
cells attributes of the device. */
-typedef struct _hw_unit {
+typedef struct _hw_unit
+{
int nr_cells;
unsigned_cell cells[4]; /* unused cells are zero */
} hw_unit;
*/
-typedef enum {
+typedef enum
+{
hw_ioctl_break, /* unsigned_word requested_break */
hw_ioctl_set_trace, /* void */
hw_ioctl_create_stack, /* unsigned_word *sp, char **argv, char **envp */
/* Finally the hardware device - keep your grubby little mits off of
these internals! :-) */
-struct hw {
+struct hw
+{
/* our relatives */
struct hw *parent_of_hw;
/* The hw-events object is implemented using sim-events */
-struct hw_event {
+struct hw_event
+{
void *data;
struct hw *me;
hw_event_callback *callback;
struct hw_event_data *entry;
};
-struct hw_event_data {
+struct hw_event_data
+{
struct hw_event event;
struct hw_event_data *next;
};
#include "hw-base.h"
-struct hw_handle_mapping {
+struct hw_handle_mapping
+{
cell_word external;
struct hw *phandle;
struct hw_instance *ihandle;
};
-struct hw_handle_data {
+struct hw_handle_data
+{
int nr_mappings;
struct hw_handle_mapping *mappings;
};
#include "sim-io.h"
#include "sim-assert.h"
-struct hw_instance_data {
+struct hw_instance_data
+{
hw_finish_instance_method *to_finish;
struct hw_instance *instances;
};
/* Finally an instance of a hardware device - keep your grubby little
mits off of these internals! :-) */
-struct hw_instance {
+struct hw_instance
+{
void *data_of_instance;
char *args_of_instance;
typedef void (hw_finish_method)
(struct hw *me);
-struct hw_descriptor {
+struct hw_descriptor
+{
const char *family;
hw_finish_method *to_finish;
};
or a hw_io status code that indicates the reason for the read
failure */
-enum {
+enum
+{
HW_IO_EOF = -1, HW_IO_NOT_READY = -2, /* See: IEEE 1275 */
};
#include <ctype.h>
-struct hw_port_edge {
+struct hw_port_edge
+{
int my_port;
struct hw *dest;
int dest_port;
object_disposition disposition;
};
-struct hw_port_data {
+struct hw_port_data
+{
hw_port_event_method *to_port_event;
const struct hw_port_descriptor *ports;
struct hw_port_edge *edges;
};
-const struct hw_port_descriptor empty_hw_ports[] = {
+const struct hw_port_descriptor empty_hw_ports[] =
+{
{ NULL, 0, 0, 0 },
};
/* Initialize a port */
-struct hw_port_descriptor {
+struct hw_port_descriptor
+{
const char *name;
int number;
int nr_ports;
/* property entries */
-struct hw_property_data {
+struct hw_property_data
+{
struct hw_property_data *next;
struct hw_property *property;
const void *init_array;
/* The following are valid property types. The property `array' is
for generic untyped data. */
-typedef enum {
+typedef enum
+{
array_property,
boolean_property,
#if 0
string_array_property,
} hw_property_type;
-struct hw_property {
+struct hw_property
+{
struct hw *owner;
const char *name;
hw_property_type type;
#if 0
-typedef struct _ihandle_runtime_property_spec {
+typedef struct _ihandle_runtime_property_spec
+{
const char *full_path;
} ihandle_runtime_property_spec;
-typedef struct _range_property_spec {
+typedef struct _range_property_spec
+{
hw_unit child_address;
hw_unit parent_address;
hw_unit size;
-typedef struct _reg_property_spec {
+typedef struct _reg_property_spec
+{
hw_unit address;
hw_unit size;
} reg_property_spec;
/* manipulate/lookup device names */
-typedef struct _name_specifier {
+typedef struct _name_specifier
+{
/* components in the full length name */
char *path;
/* an interrupt spec */
spec->property = NULL;
}
- else {
- chp = strrchr(spec->path, '/');
- if (chp == NULL)
- {
- spec->property = spec->path;
- spec->path = strchr(spec->property, '\0');
- }
- else {
- *chp = '\0';
- spec->property = chp+1;
+ else
+ {
+ chp = strrchr(spec->path, '/');
+ if (chp == NULL)
+ {
+ spec->property = spec->path;
+ spec->path = strchr(spec->property, '\0');
+ }
+ else
+ {
+ *chp = '\0';
+ spec->property = chp+1;
+ }
}
- }
/* and mark the rest as invalid */
spec->name = NULL;
pos = 0;
while (*chp != '\0' && *chp != '"')
{
- if (*chp == '\\' && *(chp+1) != '\0') {
- strings[nr_strings][pos] = *(chp+1);
- chp += 2;
- pos++;
- }
+ if (*chp == '\\' && *(chp+1) != '\0')
+ {
+ strings[nr_strings][pos] = *(chp+1);
+ chp += 2;
+ pos++;
+ }
else
{
strings[nr_strings][pos] = *chp;
\f
-struct printer {
+struct printer
+{
hw_tree_print_callback *print;
void *file;
};
for (i = 0; i < size->nr_cells; i++)
if (size->cells[i] != 0)
break;
- if (i < size->nr_cells) {
- p->print (p->file, " 0x%lx", (unsigned long) size->cells[i]);
- i++;
- for (; i < size->nr_cells; i++)
- p->print (p->file, ",0x%lx", (unsigned long) size->cells[i]);
- }
+ if (i < size->nr_cells)
+ {
+ p->print (p->file, " 0x%lx", (unsigned long) size->cells[i]);
+ i++;
+ for (; i < size->nr_cells; i++)
+ p->print (p->file, ",0x%lx", (unsigned long) size->cells[i]);
+ }
else
p->print (p->file, " 0");
}
reg_property_spec reg;
for (reg_nr = 0;
hw_find_reg_array_property (me, property->name, reg_nr, ®);
- reg_nr++) {
- print_address (hw_parent (me), ®.address, p);
- print_size (me, ®.size, p);
- }
+ reg_nr++)
+ {
+ print_address (hw_parent (me), ®.address, p);
+ print_size (me, ®.size, p);
+ }
}
static void
struct printer *p)
{
p->print (p->file, " \"");
- while (*string != '\0') {
- switch (*string) {
- case '"':
- p->print (p->file, "\\\"");
- break;
- case '\\':
- p->print (p->file, "\\\\");
- break;
- default:
- p->print (p->file, "%c", *string);
- break;
+ while (*string != '\0')
+ {
+ switch (*string)
+ {
+ case '"':
+ p->print (p->file, "\\\"");
+ break;
+ case '\\':
+ p->print (p->file, "\\\\");
+ break;
+ default:
+ p->print (p->file, "%c", *string);
+ break;
+ }
+ string++;
}
- string++;
- }
p->print (p->file, "\"");
}
{
unsigned8 *w = (unsigned8*)property->array;
p->print (p->file, " [");
- while ((char*)w - (char*)property->array < property->sizeof_array) {
- p->print (p->file, " 0x%2x", BE2H_1 (*w));
- w++;
- }
+ while ((char*)w - (char*)property->array < property->sizeof_array)
+ {
+ p->print (p->file, " 0x%2x", BE2H_1 (*w));
+ w++;
+ }
}
break;
}