aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/dtc/util.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-05-05 22:33:07 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2017-05-05 22:33:07 -0400
commit3ef2bc099d1cce09e2844467e2ced98e1a44609d (patch)
treebe3d1ea5da1ba9f3a664d5da7f34574bb7930ce7 /scripts/dtc/util.h
parent2eecf3a49f1ff24c6116c954dd74e83f227fc716 (diff)
parent17a70355ea576843a7ac851f1db26872a50b2850 (diff)
Merge tag 'devicetree-for-4.12' of git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux
Pull DeviceTree updates from Rob Herring: - fix sparse warnings in drivers/of/ - add more overlay unittests - update dtc to v1.4.4-8-g756ffc4f52f6. This adds more checks on dts files such as unit-address formatting and stricter character sets for node and property names - add a common DT modalias function - move trivial-devices.txt up and out of i2c dir - ARM NVIC interrupt controller binding - vendor prefixes for Sensirion, Dioo, Nordic, ROHM - correct some binding file locations * tag 'devicetree-for-4.12' of git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux: (24 commits) of: fix sparse warnings in fdt, irq, reserved mem, and resolver code of: fix sparse warning in of_pci_range_parser_one of: fix sparse warnings in of_find_next_cache_node of/unittest: Missing unlocks on error of: fix uninitialized variable warning for overlay test of: fix unittest build without CONFIG_OF_OVERLAY of: Add unit tests for applying overlays of: per-file dtc compiler flags fpga: region: add missing DT documentation for config complete timeout of: Add vendor prefix for ROHM Semiconductor of: fix "/cpus" reference leak in of_numa_parse_cpu_nodes() of: Add vendor prefix for Nordic Semiconductor dt-bindings: arm,nvic: Binding for ARM NVIC interrupt controller on Cortex-M dtc: update warning settings for new bus and node/property name checks scripts/dtc: Update to upstream version v1.4.4-8-g756ffc4f52f6 scripts/dtc: automate getting dtc version and log in update script of: Add function for generating a DT modalias with a newline of: fix of_device_get_modalias returned length when truncating buffers Documentation: devicetree: move trivial-devices out of I2C realm dt-bindings: add vendor prefix for Dioo ..
Diffstat (limited to 'scripts/dtc/util.h')
-rw-r--r--scripts/dtc/util.h24
1 files changed, 17 insertions, 7 deletions
diff --git a/scripts/dtc/util.h b/scripts/dtc/util.h
index f5c4f1b50d30..ad5f41199edb 100644
--- a/scripts/dtc/util.h
+++ b/scripts/dtc/util.h
@@ -25,9 +25,17 @@
25 * USA 25 * USA
26 */ 26 */
27 27
28#ifdef __GNUC__
29#define PRINTF(i, j) __attribute__((format (printf, i, j)))
30#define NORETURN __attribute__((noreturn))
31#else
32#define PRINTF(i, j)
33#define NORETURN
34#endif
35
28#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) 36#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
29 37
30static inline void __attribute__((noreturn)) die(const char *str, ...) 38static inline void NORETURN PRINTF(1, 2) die(const char *str, ...)
31{ 39{
32 va_list ap; 40 va_list ap;
33 41
@@ -53,13 +61,14 @@ static inline void *xrealloc(void *p, size_t len)
53 void *new = realloc(p, len); 61 void *new = realloc(p, len);
54 62
55 if (!new) 63 if (!new)
56 die("realloc() failed (len=%d)\n", len); 64 die("realloc() failed (len=%zd)\n", len);
57 65
58 return new; 66 return new;
59} 67}
60 68
61extern char *xstrdup(const char *s); 69extern char *xstrdup(const char *s);
62extern int xasprintf(char **strp, const char *fmt, ...); 70
71extern int PRINTF(2, 3) xasprintf(char **strp, const char *fmt, ...);
63extern char *join_path(const char *path, const char *name); 72extern char *join_path(const char *path, const char *name);
64 73
65/** 74/**
@@ -188,7 +197,7 @@ void utilfdt_print_data(const char *data, int len);
188/** 197/**
189 * Show source version and exit 198 * Show source version and exit
190 */ 199 */
191void util_version(void) __attribute__((noreturn)); 200void NORETURN util_version(void);
192 201
193/** 202/**
194 * Show usage and exit 203 * Show usage and exit
@@ -202,9 +211,10 @@ void util_version(void) __attribute__((noreturn));
202 * @param long_opts The structure of long options 211 * @param long_opts The structure of long options
203 * @param opts_help An array of help strings (should align with long_opts) 212 * @param opts_help An array of help strings (should align with long_opts)
204 */ 213 */
205void util_usage(const char *errmsg, const char *synopsis, 214void NORETURN util_usage(const char *errmsg, const char *synopsis,
206 const char *short_opts, struct option const long_opts[], 215 const char *short_opts,
207 const char * const opts_help[]) __attribute__((noreturn)); 216 struct option const long_opts[],
217 const char * const opts_help[]);
208 218
209/** 219/**
210 * Show usage and exit 220 * Show usage and exit