From 839acebc9350d3ed4d8e23aca4a0c919ee2d9ad8 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=E8=AE=B8=E7=9B=9B=E9=A3=9E?= Date: Mon, 24 Nov 2014 12:00:21 +0800 Subject: [PATCH] test-power: add testpower dts-config Change-Id: Ib2c78602f604d610a648397cbf08c56cdbd77eab Signed-off-by: Shengfei Xu --- drivers/power/test_power.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/drivers/power/test_power.c b/drivers/power/test_power.c index 83c42ea88f2b..328ddd8bb773 100644 --- a/drivers/power/test_power.c +++ b/drivers/power/test_power.c @@ -20,6 +20,7 @@ #include #include #include +#include enum test_power_id { TEST_AC, @@ -197,6 +198,19 @@ static int __init test_power_init(void) { int i; int ret; + struct device_node *dev_node; + + dev_node = of_find_node_by_name(NULL, "test-power"); + + if (!dev_node) { + pr_info("%s: could not find dev node\n", __func__); + return 0; + } + if (!of_device_is_available(dev_node)) { + pr_info("%s: test power disabled\n", __func__); + return 0; + } + of_node_put(dev_node); BUILD_BUG_ON(TEST_POWER_NUM != ARRAY_SIZE(test_power_supplies)); BUILD_BUG_ON(TEST_POWER_NUM != ARRAY_SIZE(test_power_configs)); -- 2.34.1