From f6117bb806ee0efb9f7a220d11eedc67d81da1d2 Mon Sep 17 00:00:00 2001 From: Marc Kleine-Budde Date: Fri, 3 Jul 2015 18:37:44 +0200 Subject: common: import is_zero_ether_addr() and EPROBE_DEFER from barebox Signed-off-by: Marc Kleine-Budde --- src/dt/common.h | 30 +++++++++++++++++++++++++----- 1 file 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 +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 -- cgit v1.2.3