From: 许盛飞 Date: Mon, 24 Nov 2014 04:00:21 +0000 (+0800) Subject: test-power: add testpower dts-config X-Git-Tag: firefly_0821_release~1719 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=839acebc9350d3ed4d8e23aca4a0c919ee2d9ad8;p=firefly-linux-kernel-4.4.55.git test-power: add testpower dts-config Change-Id: Ib2c78602f604d610a648397cbf08c56cdbd77eab Signed-off-by: Shengfei Xu --- 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));