[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Thu, 12 Dec 2013 18:54:53 +0530
From: Laxman Dewangan <ldewangan@...dia.com>
To: <robh+dt@...nel.org>, <pawel.moll@....com>, <mark.rutland@....com>,
<grant.likely@...aro.org>
CC: <ijc+devicetree@...lion.org.uk>, <galak@...eaurora.org>,
<linux-kernel@...r.kernel.org>, <devicetree@...r.kernel.org>,
<swarren@...dia.com>, <kerwinw@...dia.com>,
Laxman Dewangan <ldewangan@...dia.com>
Subject: [PATCH 2/2] dt-binding: add header to define types and conversion
Add a header file to define the macros for type conversion
to be used by DTS file.
Add macro for the S32 to U32 conversion by using 2's complement.
Signed-off-by: Laxman Dewangan <ldewangan@...dia.com>
---
include/dt-bindings/types.h | 18 ++++++++++++++++++
1 files changed, 18 insertions(+), 0 deletions(-)
create mode 100644 include/dt-bindings/types.h
diff --git a/include/dt-bindings/types.h b/include/dt-bindings/types.h
new file mode 100644
index 0000000..2b7ea75
--- /dev/null
+++ b/include/dt-bindings/types.h
@@ -0,0 +1,18 @@
+/*
+ * This header provides macros for different types and conversions
+ */
+
+#ifndef _DT_BINDINGS_TYPES_H_
+#define _DT_BINDINGS_TYPES_H_
+
+/*
+ * S32_TO_U32: This macro converts the signed number to 2's complement
+ * unisgned number. E.g. S32_TO_U32(-3) will be 0xfffffffd and
+ * S32_TO_U32(3) will be 0x3;
+ * Use of_property_read_s32() for getting back the correct signed value
+ * in driver.
+ */
+#define S32_TO_U32(x) (((x) < 0) ? (((-(x)) ^ 0xFFFFFFFFU) + 1) : (x))
+
+#endif
+
--
1.7.0.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists