remove build warning 11/149011/1 accepted/tizen/unified/20170912.191739 submit/tizen/20170911.090430
authorINSUN PYO <insun.pyo@samsung.com>
Mon, 11 Sep 2017 04:31:41 +0000 (13:31 +0900)
committerINSUN PYO <insun.pyo@samsung.com>
Mon, 11 Sep 2017 09:03:53 +0000 (09:03 +0000)
Touchscreen_init calls the open function of hal at the beginning of the boot with the call stack below.
So the open function of hal is never called at the same time in multi-thread.

Therefore, we can use safely readdir in deviced.

0  touchscreen_init
1  0x2a00b02c in devices_init (data=0x0) at /usr/src/debug/deviced-2.0.0/src/core/devices.c:102
2  0x2a00e424 in deviced_main (argc=<optimized out>, argv=<optimized out>) at /usr/src/debug/deviced-2.0.0/src/core/main.c:93
3  0x2a0078f4 in main (argc=1, argv=0xbefffe64) at /usr/src/debug/deviced-2.0.0/src/core/main.c:123

Signed-off-by: INSUN PYO <insun.pyo@samsung.com>
Change-Id: I188a49d5b8a01b145ad421d20ee936503f0084e0
(cherry picked from commit 8a6aa43bf479e645fbccbe4611611ad083c4acca)

hw/touchscreen/touchscreen.c

index 1d5be64da239820c286c639082d5ca82ddc8b31e..fe3c97e959c6db1fa662b08bfd572313e10bf139 100644 (file)
@@ -40,7 +40,6 @@ static char *touchscreen_node;
 static int touchscreen_probe(void)
 {
        DIR *d;
-       struct dirent entry;
        struct dirent *dir;
        char buf[PATH_MAX];
        int val, ret = -ENOTSUP;
@@ -49,7 +48,7 @@ static int touchscreen_probe(void)
        if (!d)
                return -errno;
 
-       while (readdir_r(d, &entry, &dir) == 0 && dir != NULL) {
+       while ((dir = readdir(d))) {
                if (dir->d_name[0] == '.')
                        continue;
                snprintf(buf, sizeof(buf), "%s%s%s", INPUT_PATH,