#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)
{
void *handle;
struct hw_info *it;
- if (!*info || !id)
+ if (!info || !id)
return -EINVAL;
/* Find matched module path */
}
/* 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;
*/
#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