summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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