summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc Kleine-Budde <mkl@pengutronix.de>2015-07-03 18:37:44 +0200
committerMarc Kleine-Budde <mkl@pengutronix.de>2015-09-30 17:02:45 +0200
commitf6117bb806ee0efb9f7a220d11eedc67d81da1d2 (patch)
treed9c06a73165599dd2a31c51ba3b977a70e802271
parent43f9010008f08da0106d0ed51b575778bb2a8428 (diff)
downloaddt-utils-f6117bb806ee0efb9f7a220d11eedc67d81da1d2.tar.gz
dt-utils-f6117bb806ee0efb9f7a220d11eedc67d81da1d2.tar.xz
common: import is_zero_ether_addr() and EPROBE_DEFER from barebox
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
-rw-r--r--src/dt/common.h30
1 files changed, 25 insertions, 5 deletions
diff --git a/src/dt/common.h b/src/dt/common.h
index 720180d..3f3707c 100644
--- a/src/dt/common.h
+++ b/src/dt/common.h
@@ -16,6 +16,11 @@
#include <mtd/mtd-abi.h>
+typedef uint8_t u8;
+typedef uint16_t u16;
+typedef uint32_t u32;
+typedef uint64_t u64;
+
/**
* container_of - cast a member of a structure out to the containing structure
* @ptr: the pointer to the member.
@@ -42,6 +47,10 @@
#define dev_info(dev, fmt, arg...) pr_err(fmt, ##arg)
#define dev_dbg(dev, fmt, arg...) pr_debug(fmt, ##arg)
+#ifndef EPROBE_DEFER
+#define EPROBE_DEFER 517
+#endif
+
#ifndef ENOTSUPP
#define ENOTSUPP 524
#endif
@@ -192,6 +201,11 @@ static inline int erase(int fd, size_t count, loff_t offset)
return ioctl(fd, MEMERASE, &erase);
}
+static inline int protect(int fd, size_t count, loff_t offset, int prot)
+{
+ return 0;
+}
+
/*
* read_full - read from filedescriptor
*
@@ -284,6 +298,17 @@ static inline int ctrlc (void)
return 0;
}
+/**
+ * is_zero_ether_addr - Determine if give Ethernet address is all zeros.
+ * @addr: Pointer to a six-byte array containing the Ethernet address
+ *
+ * Return true if the address is all zeroes.
+ */
+static inline int is_zero_ether_addr(const u8 *addr)
+{
+ return !(addr[0] | addr[1] | addr[2] | addr[3] | addr[4] | addr[5]);
+}
+
#define MAX_DRIVER_NAME 32
#define DEVICE_ID_SINGLE -1
@@ -381,11 +406,6 @@ static void __attribute__ ((constructor)) __initcall_##id##_##fn() { \
#define environment_initcall(fn) __define_initcall("13",fn,13)
#define postenvironment_initcall(fn) __define_initcall("14",fn,14)
-typedef uint8_t u8;
-typedef uint16_t u16;
-typedef uint32_t u32;
-typedef uint64_t u64;
-
#define cpu_to_be32 __cpu_to_be32
#define be32_to_cpu __be32_to_cpu