Arm Linux Kernel Hacks

rousalome.egloos.com

포토로그 Kernel Crash


통계 위젯 (화이트)

51107
469
422683


[리눅스 커널] dts: 디바이스 트리 속성 확인 리눅스 디바이스 드라이버

다음 패치를 적용하면 디바이스 트리의 속성을 확인할 수 있습니다.

diff --git a/drivers/of/base.c b/drivers/of/base.c
index ce8a6e0..c2cf6da 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -497,6 +497,12 @@ int of_device_is_compatible(const struct device_node *device,
        raw_spin_lock_irqsave(&devtree_lock, flags);
        res = __of_device_is_compatible(device, compat, NULL, NULL);
        raw_spin_unlock_irqrestore(&devtree_lock, flags);
+
+       printk("[+] [%s][%s,%d]: caller: (%pS)\n",
+                                               current->comm, __func__,__LINE__,  (void *)__builtin_return_address(0));
+
+       printk("[+][dts_debug] name: %s, full_name: %s, ret: %d \n",
+                                               device->name, device->full_name, res);
        return res;
 }
 EXPORT_SYMBOL(of_device_is_compatible);
@@ -565,6 +571,9 @@ static bool __of_device_is_available(const struct device_node *device)
                return true;

        if (statlen > 0) {
+               printk("[+] [%s][%s,%d]: caller: (%pS)\n",
+                                                       current->comm, __func__,__LINE__,  (void *)__builtin_return_address(0));
+               printk("[+][dts_debug] name: %s, full_name: %s, status: %s \n", device->name, device->full_name, status);
                if (!strcmp(status, "okay") || !strcmp(status, "ok"))
                        return true;
        }


'/soc/i2c@78b6000'와 '/soc/i2c@78b7000'는 okay로 설정돼 있군요.

이 로그가 실행될 때의 콜 스택은 다음과 같습니다.

[   87.880806] Call trace:
[   87.883327] [<ffffff878e28ce8c>] dump_backtrace+0x0/0x3dc
[   87.888879] [<ffffff878e28d2bc>] show_stack+0x20/0x2c
[   87.894070] [<ffffff878f15dd1c>] __dump_stack+0x20/0x28
[   87.899436] [<ffffff878f15dcc0>] dump_stack+0x8c/0xc8
[   87.904629] [<ffffff878ed00840>] __of_device_is_available+0x5c/0xc8
[   87.911068] [<ffffff878ed007c0>] of_device_is_available+0x34/0x58
[   87.917330] [<ffffff878ed02d70>] of_platform_device_create_pdata+0x30/0xcc
[   87.924387] [<ffffff878ed03154>] of_platform_bus_create+0x220/0x43c
[   87.930827] [<ffffff878ed031b8>] of_platform_bus_create+0x284/0x43c
[   87.937266] [<ffffff878ed033f8>] of_platform_populate+0x88/0x104
[   87.943436] [<ffffff878ed034ac>] of_platform_default_populate+0x38/0x48
[   87.950224] [<ffffff878f7da81c>] of_platform_default_populate_init+0x5c/0x70
[   87.957456] [<ffffff878e283944>] do_one_initcall+0x10c/0x1b0
[   87.963267] [<ffffff878f780f90>] kernel_init_freeable+0x198/0x238
[   87.969529] [<ffffff878f16fa24>] kernel_init+0x14/0x104
[   87.974895] [<ffffff878e285bd4>] ret_from_fork+0x10/0x18

관련 로그

[    0.616224 / 01-01 00:00:00.609][0] [+][dts_debug] name: i2c, full_name: /soc/i2c@78b6000, status: okay 
[    0.616574 / 01-01 00:00:00.609][0] [+][dts_debug] name: i2c, full_name: /soc/i2c@78b7000, status: okay 
[    0.616913 / 01-01 00:00:00.609][0] [+][dts_debug] name: i2c, full_name: /soc/i2c@7af5000, status: ok 
[    0.617261 / 01-01 00:00:00.609][0] [+][dts_debug] name: i2c, full_name: /soc/i2c@7af6000, status: ok 




덧글

댓글 입력 영역