summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJiyoung Yun <jy910.yun@samsung.com>2015-02-05 21:00:39 +0900
committerJiyoung Yun <jy910.yun@samsung.com>2015-02-05 21:00:39 +0900
commit9298d6349a42a62be2b48d108bf8ea7bed1ac4bb (patch)
tree924313b6be722ff341093cfdf0d88734d8253325
parentd252272ef2e77b8b709d8cc09664e27d6e8e866e (diff)
downloadlibdevice-node-9298d6349a42a62be2b48d108bf8ea7bed1ac4bb.tar.gz
libdevice-node-9298d6349a42a62be2b48d108bf8ea7bed1ac4bb.tar.bz2
libdevice-node-9298d6349a42a62be2b48d108bf8ea7bed1ac4bb.zip
Change-Id: I3ab9e9455eeba8a6d2cd5ca3a65b2cc069d7b894 Signed-off-by: Jiyoung Yun <jy910.yun@samsung.com>
-rw-r--r--hw/common.c11
-rw-r--r--hw/common.h15
2 files changed, 20 insertions, 6 deletions
diff --git a/hw/common.c b/hw/common.c
index 3e2dc7a..66e1705 100644
--- a/hw/common.c
+++ b/hw/common.c
@@ -31,8 +31,15 @@
#define EXPORT __attribute__ ((visibility("default")))
#endif
+#ifndef LIBPATH
+#error LIBPATH is not defined.
+#endif
+
#define MODULE_PATH LIBPATH"/hw"
+#define STRINGIZE2(s) #s
+#define STRINGIZE(s) STRINGIZE2(s)
+
EXPORT
int hw_get_info(const char *id, const struct hw_info **info)
{
@@ -40,7 +47,7 @@ int hw_get_info(const char *id, const struct hw_info **info)
void *handle;
struct hw_info *it;
- if (!*info || !id)
+ if (!info || !id)
return -EINVAL;
/* Find matched module path */
@@ -58,7 +65,7 @@ int hw_get_info(const char *id, const struct hw_info **info)
}
/* Get the address of struct hw_common */
- it = dlsym(handle, HARDWARE_INFO_SYM_AS_STR);
+ it = dlsym(handle, STRINGIZE(HARDWARE_INFO_SYM));
if (!it) {
_E("fail to find symbol : %s", dlerror());
goto error;
diff --git a/hw/common.h b/hw/common.h
index e14e705..b333532 100644
--- a/hw/common.h
+++ b/hw/common.h
@@ -68,11 +68,18 @@ struct hw_common {
*/
#define HARDWARE_INFO_SYM TizenHwInfo
+int hw_get_info(const char *id, const struct hw_info **info);
+
/**
- * Name of the hardware info symbolic as a string
+ * Structure define of hardware info module
+ * All hardware module should be use below define
+ * to make a specific structure for Tizen HAL.
+ * hw_get_info function will load a hw_info structure
+ * by using TizenHwInfo name at runtime.
+ * TizenHwInfo means Tizen Hardware Info.
*/
-#define HARDWARE_INFO_SYM_AS_STR "TizenHwInfo"
-
-int hw_get_info(const char *id, const struct hw_info **info);
+#define HARDWARE_MODULE_STRUCTURE \
+ __attribute__ ((visibility("default"))) \
+ struct hw_info HARDWARE_INFO_SYM
#endif