sim: fix up style a bit

This touches up the code a bit to match GNU style.  No functional changes.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
This commit is contained in:
Mike Frysinger 2011-04-02 05:30:16 +00:00
parent 4368ebebd8
commit 12c4cbd553
14 changed files with 137 additions and 80 deletions

View File

@ -1,3 +1,24 @@
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.

View File

@ -27,7 +27,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include <stdlib.h>
#endif
struct hw_alloc_data {
struct hw_alloc_data
{
void *alloc;
struct hw_alloc_data *next;
};

View File

@ -40,7 +40,8 @@
#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;
@ -80,14 +81,16 @@ generic_hw_unit_decode (struct hw *bus,
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;
}
@ -124,10 +127,11 @@ generic_hw_unit_encode (struct hw *bus,
{
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

View File

@ -294,7 +294,8 @@ typedef unsigned (hw_dma_write_buffer_method)
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;
@ -399,7 +400,8 @@ extern char *hw_strdup (struct hw *me, const char *str);
*/
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 */
@ -475,7 +477,8 @@ struct hw_instance_data;
/* Finally the hardware device - keep your grubby little mits off of
these internals! :-) */
struct hw {
struct hw
{
/* our relatives */
struct hw *parent_of_hw;

View File

@ -27,7 +27,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* The hw-events object is implemented using sim-events */
struct hw_event {
struct hw_event
{
void *data;
struct hw *me;
hw_event_callback *callback;
@ -35,7 +36,8 @@ struct hw_event {
struct hw_event_data *entry;
};
struct hw_event_data {
struct hw_event_data
{
struct hw_event event;
struct hw_event_data *next;
};

View File

@ -24,7 +24,8 @@
#include "hw-base.h"
struct hw_handle_mapping {
struct hw_handle_mapping
{
cell_word external;
struct hw *phandle;
struct hw_instance *ihandle;
@ -32,7 +33,8 @@ struct hw_handle_mapping {
};
struct hw_handle_data {
struct hw_handle_data
{
int nr_mappings;
struct hw_handle_mapping *mappings;
};

View File

@ -26,7 +26,8 @@
#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;
};

View File

@ -134,7 +134,8 @@ int hw_instance_call_method
/* 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;

View File

@ -39,7 +39,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
typedef void (hw_finish_method)
(struct hw *me);
struct hw_descriptor {
struct hw_descriptor
{
const char *family;
hw_finish_method *to_finish;
};
@ -55,7 +56,8 @@ void do_hw_attach_regs (struct hw *me);
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 */
};

View File

@ -37,7 +37,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include <ctype.h>
struct hw_port_edge {
struct hw_port_edge
{
int my_port;
struct hw *dest;
int dest_port;
@ -45,13 +46,15 @@ struct hw_port_edge {
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 },
};

View File

@ -24,7 +24,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* Initialize a port */
struct hw_port_descriptor {
struct hw_port_descriptor
{
const char *name;
int number;
int nr_ports;

View File

@ -35,7 +35,8 @@
/* property entries */
struct hw_property_data {
struct hw_property_data
{
struct hw_property_data *next;
struct hw_property *property;
const void *init_array;

View File

@ -26,7 +26,8 @@
/* The following are valid property types. The property `array' is
for generic untyped data. */
typedef enum {
typedef enum
{
array_property,
boolean_property,
#if 0
@ -39,7 +40,8 @@ typedef enum {
string_array_property,
} hw_property_type;
struct hw_property {
struct hw_property
{
struct hw *owner;
const char *name;
hw_property_type type;
@ -129,7 +131,8 @@ int hw_find_boolean_property
#if 0
typedef struct _ihandle_runtime_property_spec {
typedef struct _ihandle_runtime_property_spec
{
const char *full_path;
} ihandle_runtime_property_spec;
@ -171,7 +174,8 @@ int hw_find_integer_array_property
typedef struct _range_property_spec {
typedef struct _range_property_spec
{
hw_unit child_address;
hw_unit parent_address;
hw_unit size;
@ -191,7 +195,8 @@ int hw_find_range_array_property
typedef struct _reg_property_spec {
typedef struct _reg_property_spec
{
hw_unit address;
hw_unit size;
} reg_property_spec;

View File

@ -43,7 +43,8 @@
/* manipulate/lookup device names */
typedef struct _name_specifier {
typedef struct _name_specifier
{
/* components in the full length name */
char *path;
@ -153,18 +154,20 @@ split_device_specifier (struct hw *current,
/* 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;
@ -700,11 +703,12 @@ parse_string_property (struct hw *current,
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;
@ -982,7 +986,8 @@ hw_tree_traverse (struct hw *root,
struct printer {
struct printer
{
hw_tree_print_callback *print;
void *file;
};
@ -1006,12 +1011,13 @@ print_size (struct hw *bus,
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");
}
@ -1025,10 +1031,11 @@ print_reg_property (struct hw *me,
reg_property_spec reg;
for (reg_nr = 0;
hw_find_reg_array_property (me, property->name, reg_nr, &reg);
reg_nr++) {
print_address (hw_parent (me), &reg.address, p);
print_size (me, &reg.size, p);
}
reg_nr++)
{
print_address (hw_parent (me), &reg.address, p);
print_size (me, &reg.size, p);
}
}
static void
@ -1054,20 +1061,22 @@ print_string (struct hw *me,
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, "\"");
}
@ -1127,10 +1136,11 @@ print_properties (struct hw *me,
{
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;
}