Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Typedefs | Enumerations | Functions
checks.c File Reference
#include "dtc.h"

Go to the source code of this file.

Data Structures

struct  check
 

Macros

#define TRACE(c, fmt,...)   do { } while (0)
 
#define CHECK_ENTRY(nm, tfn, nfn, pfn, d, w, e,...)
 
#define WARNING(nm, tfn, nfn, pfn, d,...)   CHECK_ENTRY(nm, tfn, nfn, pfn, d, true, false, __VA_ARGS__)
 
#define ERROR(nm, tfn, nfn, pfn, d,...)   CHECK_ENTRY(nm, tfn, nfn, pfn, d, false, true, __VA_ARGS__)
 
#define CHECK(nm, tfn, nfn, pfn, d,...)   CHECK_ENTRY(nm, tfn, nfn, pfn, d, false, false, __VA_ARGS__)
 
#define TREE_WARNING(nm, d,...)   WARNING(nm, check_##nm, NULL, NULL, d, __VA_ARGS__)
 
#define TREE_ERROR(nm, d,...)   ERROR(nm, check_##nm, NULL, NULL, d, __VA_ARGS__)
 
#define TREE_CHECK(nm, d,...)   CHECK(nm, check_##nm, NULL, NULL, d, __VA_ARGS__)
 
#define NODE_WARNING(nm, d,...)   WARNING(nm, NULL, check_##nm, NULL, d, __VA_ARGS__)
 
#define NODE_ERROR(nm, d,...)   ERROR(nm, NULL, check_##nm, NULL, d, __VA_ARGS__)
 
#define NODE_CHECK(nm, d,...)   CHECK(nm, NULL, check_##nm, NULL, d, __VA_ARGS__)
 
#define PROP_WARNING(nm, d,...)   WARNING(nm, NULL, NULL, check_##nm, d, __VA_ARGS__)
 
#define PROP_ERROR(nm, d,...)   ERROR(nm, NULL, NULL, check_##nm, d, __VA_ARGS__)
 
#define PROP_CHECK(nm, d,...)   CHECK(nm, NULL, NULL, check_##nm, d, __VA_ARGS__)
 
#define FAIL(c,...)
 
#define WARNING_IF_NOT_STRING(nm, propname)   WARNING(nm, NULL, check_is_string, NULL, (propname))
 
#define ERROR_IF_NOT_STRING(nm, propname)   ERROR(nm, NULL, check_is_string, NULL, (propname))
 
#define WARNING_IF_NOT_CELL(nm, propname)   WARNING(nm, NULL, check_is_cell, NULL, (propname))
 
#define ERROR_IF_NOT_CELL(nm, propname)   ERROR(nm, NULL, check_is_cell, NULL, (propname))
 
#define LOWERCASE   "abcdefghijklmnopqrstuvwxyz"
 
#define UPPERCASE   "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
 
#define DIGITS   "0123456789"
 
#define PROPNODECHARS   LOWERCASE UPPERCASE DIGITS ",._+*#?-"
 
#define DESCLABEL_FMT   "%s%s%s%s%s"
 
#define DESCLABEL_ARGS(node, prop, mark)
 
#define node_addr_cells(n)   (((n)->addr_cells == -1) ? 2 : (n)->addr_cells)
 
#define node_size_cells(n)   (((n)->size_cells == -1) ? 1 : (n)->size_cells)
 

Typedefs

typedef void(* tree_check_fn )(struct check *c, struct node *dt)
 
typedef void(* node_check_fn )(struct check *c, struct node *dt, struct node *node)
 
typedef void(* prop_check_fn )(struct check *c, struct node *dt, struct node *node, struct property *prop)
 

Enumerations

enum  checkstatus { UNCHECKED = 0, PREREQ, PASSED, FAILED }
 

Functions

 TREE_CHECK (always_fail, NULL)
 
 NODE_ERROR (duplicate_node_names, NULL)
 
 NODE_ERROR (duplicate_property_names, NULL)
 
 NODE_ERROR (node_name_chars, PROPNODECHARS"@")
 
 NODE_ERROR (node_name_format, NULL,&node_name_chars)
 
 PROP_ERROR (property_name_chars, PROPNODECHARS)
 
 ERROR (duplicate_label, NULL, check_duplicate_label_node, check_duplicate_label_prop, NULL)
 
 PROP_ERROR (explicit_phandles, NULL)
 
 ERROR_IF_NOT_STRING (name_is_string,"name")
 
 NODE_ERROR (name_properties, NULL,&name_is_string)
 
 ERROR (phandle_references, NULL, NULL, fixup_phandle_references, NULL,&duplicate_node_names,&explicit_phandles)
 
 ERROR (path_references, NULL, NULL, fixup_path_references, NULL,&duplicate_node_names)
 
 WARNING_IF_NOT_CELL (address_cells_is_cell,"#address-cells")
 
 WARNING_IF_NOT_CELL (size_cells_is_cell,"#size-cells")
 
 WARNING_IF_NOT_CELL (interrupt_cells_is_cell,"#interrupt-cells")
 
 WARNING_IF_NOT_STRING (device_type_is_string,"device_type")
 
 WARNING_IF_NOT_STRING (model_is_string,"model")
 
 WARNING_IF_NOT_STRING (status_is_string,"status")
 
 WARNING (addr_size_cells, NULL, fixup_addr_size_cells, NULL, NULL,&address_cells_is_cell,&size_cells_is_cell)
 
 NODE_WARNING (reg_format, NULL,&addr_size_cells)
 
 NODE_WARNING (ranges_format, NULL,&addr_size_cells)
 
 NODE_WARNING (avoid_default_addr_size, NULL,&addr_size_cells)
 
 TREE_WARNING (obsolete_chosen_interrupt_controller, NULL)
 
void parse_checks_option (bool warn, bool error, const char *optarg)
 
void process_checks (int force, struct boot_info *bi)
 

Macro Definition Documentation

#define CHECK (   nm,
  tfn,
  nfn,
  pfn,
  d,
  ... 
)    CHECK_ENTRY(nm, tfn, nfn, pfn, d, false, false, __VA_ARGS__)

Definition at line 79 of file checks.c.

#define CHECK_ENTRY (   nm,
  tfn,
  nfn,
  pfn,
  d,
  w,
  e,
  ... 
)
Value:
static struct check *nm##_prereqs[] = { __VA_ARGS__ }; \
static struct check nm = { \
.name = #nm, \
.tree_fn = (tfn), \
.node_fn = (nfn), \
.prop_fn = (pfn), \
.data = (d), \
.warn = (w), \
.error = (e), \
.status = UNCHECKED, \
.num_prereqs = ARRAY_SIZE(nm##_prereqs), \
.prereq = nm##_prereqs, \
};

Definition at line 61 of file checks.c.

#define DESCLABEL_ARGS (   node,
  prop,
  mark 
)
Value:
((mark) ? "value of " : ""), \
((prop) ? "'" : ""), \
((prop) ? (prop)->name : ""), \
((prop) ? "' in " : ""), (node)->fullpath

Definition at line 308 of file checks.c.

#define DESCLABEL_FMT   "%s%s%s%s%s"

Definition at line 307 of file checks.c.

#define DIGITS   "0123456789"

Definition at line 273 of file checks.c.

#define ERROR (   nm,
  tfn,
  nfn,
  pfn,
  d,
  ... 
)    CHECK_ENTRY(nm, tfn, nfn, pfn, d, false, true, __VA_ARGS__)

Definition at line 77 of file checks.c.

#define ERROR_IF_NOT_CELL (   nm,
  propname 
)    ERROR(nm, NULL, check_is_cell, NULL, (propname))

Definition at line 232 of file checks.c.

#define ERROR_IF_NOT_STRING (   nm,
  propname 
)    ERROR(nm, NULL, check_is_string, NULL, (propname))

Definition at line 213 of file checks.c.

#define FAIL (   c,
  ... 
)
Value:
do { \
TRACE((c), "\t\tFAILED at %s:%d", __FILE__, __LINE__); \
(c)->status = FAILED; \
check_msg((c), __VA_ARGS__); \
} while (0)

Definition at line 118 of file checks.c.

#define LOWERCASE   "abcdefghijklmnopqrstuvwxyz"

Definition at line 271 of file checks.c.

#define node_addr_cells (   n)    (((n)->addr_cells == -1) ? 2 : (n)->addr_cells)

Definition at line 535 of file checks.c.

#define NODE_CHECK (   nm,
  d,
  ... 
)    CHECK(nm, NULL, check_##nm, NULL, d, __VA_ARGS__)

Definition at line 92 of file checks.c.

#define NODE_ERROR (   nm,
  d,
  ... 
)    ERROR(nm, NULL, check_##nm, NULL, d, __VA_ARGS__)

Definition at line 90 of file checks.c.

#define node_size_cells (   n)    (((n)->size_cells == -1) ? 1 : (n)->size_cells)

Definition at line 537 of file checks.c.

#define NODE_WARNING (   nm,
  d,
  ... 
)    WARNING(nm, NULL, check_##nm, NULL, d, __VA_ARGS__)

Definition at line 88 of file checks.c.

#define PROP_CHECK (   nm,
  d,
  ... 
)    CHECK(nm, NULL, NULL, check_##nm, d, __VA_ARGS__)

Definition at line 98 of file checks.c.

#define PROP_ERROR (   nm,
  d,
  ... 
)    ERROR(nm, NULL, NULL, check_##nm, d, __VA_ARGS__)

Definition at line 96 of file checks.c.

#define PROP_WARNING (   nm,
  d,
  ... 
)    WARNING(nm, NULL, NULL, check_##nm, d, __VA_ARGS__)

Definition at line 94 of file checks.c.

#define PROPNODECHARS   LOWERCASE UPPERCASE DIGITS ",._+*#?-"

Definition at line 274 of file checks.c.

#define TRACE (   c,
  fmt,
  ... 
)    do { } while (0)

Definition at line 31 of file checks.c.

#define TREE_CHECK (   nm,
  d,
  ... 
)    CHECK(nm, check_##nm, NULL, NULL, d, __VA_ARGS__)

Definition at line 86 of file checks.c.

#define TREE_ERROR (   nm,
  d,
  ... 
)    ERROR(nm, check_##nm, NULL, NULL, d, __VA_ARGS__)

Definition at line 84 of file checks.c.

#define TREE_WARNING (   nm,
  d,
  ... 
)    WARNING(nm, check_##nm, NULL, NULL, d, __VA_ARGS__)

Definition at line 82 of file checks.c.

#define UPPERCASE   "ABCDEFGHIJKLMNOPQRSTUVWXYZ"

Definition at line 272 of file checks.c.

#define WARNING (   nm,
  tfn,
  nfn,
  pfn,
  d,
  ... 
)    CHECK_ENTRY(nm, tfn, nfn, pfn, d, true, false, __VA_ARGS__)

Definition at line 75 of file checks.c.

#define WARNING_IF_NOT_CELL (   nm,
  propname 
)    WARNING(nm, NULL, check_is_cell, NULL, (propname))

Definition at line 230 of file checks.c.

#define WARNING_IF_NOT_STRING (   nm,
  propname 
)    WARNING(nm, NULL, check_is_string, NULL, (propname))

Definition at line 211 of file checks.c.

Typedef Documentation

typedef void(* node_check_fn)(struct check *c, struct node *dt, struct node *node)

Definition at line 44 of file checks.c.

typedef void(* prop_check_fn)(struct check *c, struct node *dt, struct node *node, struct property *prop)

Definition at line 45 of file checks.c.

typedef void(* tree_check_fn)(struct check *c, struct node *dt)

Definition at line 43 of file checks.c.

Enumeration Type Documentation

Enumerator:
UNCHECKED 
PREREQ 
PASSED 
FAILED 

Definition at line 34 of file checks.c.

Function Documentation

ERROR ( duplicate_label  ,
NULL  ,
check_duplicate_label_node  ,
check_duplicate_label_prop  ,
NULL   
)
ERROR ( phandle_references  ,
NULL  ,
NULL  ,
fixup_phandle_references  ,
NULL  ,
duplicate_node_names,
explicit_phandles 
)
ERROR ( path_references  ,
NULL  ,
NULL  ,
fixup_path_references  ,
NULL  ,
duplicate_node_names 
)
ERROR_IF_NOT_STRING ( name_is_string  ,
"name"   
)
NODE_ERROR ( duplicate_node_names  ,
NULL   
)
NODE_ERROR ( duplicate_property_names  ,
NULL   
)
NODE_ERROR ( node_name_chars  ,
PROPNODECHARS"@"   
)
NODE_ERROR ( node_name_format  ,
NULL  ,
node_name_chars 
)
NODE_ERROR ( name_properties  ,
NULL  ,
name_is_string 
)
NODE_WARNING ( reg_format  ,
NULL  ,
addr_size_cells 
)
NODE_WARNING ( ranges_format  ,
NULL  ,
addr_size_cells 
)
NODE_WARNING ( avoid_default_addr_size  ,
NULL  ,
addr_size_cells 
)
void parse_checks_option ( bool  warn,
bool  error,
const char optarg 
)

Definition at line 709 of file checks.c.

void process_checks ( int  force,
struct boot_info bi 
)

Definition at line 736 of file checks.c.

PROP_ERROR ( property_name_chars  ,
PROPNODECHARS   
)
PROP_ERROR ( explicit_phandles  ,
NULL   
)
TREE_CHECK ( always_fail  ,
NULL   
)
TREE_WARNING ( obsolete_chosen_interrupt_controller  ,
NULL   
)
WARNING ( addr_size_cells  ,
NULL  ,
fixup_addr_size_cells  ,
NULL  ,
NULL  ,
address_cells_is_cell,
size_cells_is_cell 
)
WARNING_IF_NOT_CELL ( address_cells_is_cell  ,
"#address-cells"   
)
WARNING_IF_NOT_CELL ( size_cells_is_cell  ,
"#size-cells"   
)
WARNING_IF_NOT_CELL ( interrupt_cells_is_cell  ,
"#interrupt-cells"   
)
WARNING_IF_NOT_STRING ( device_type_is_string  ,
"device_type"   
)
WARNING_IF_NOT_STRING ( model_is_string  ,
"model"   
)
WARNING_IF_NOT_STRING ( status_is_string  ,
"status"   
)