diff --git a/drivers/input/misc/rk805-pwrkey.c b/drivers/input/misc/rk805-pwrkey.c index 3fb64dbda1a2..02e7b6e29429 100644 --- a/drivers/input/misc/rk805-pwrkey.c +++ b/drivers/input/misc/rk805-pwrkey.c @@ -13,6 +13,7 @@ #include #include #include +#include #include static irqreturn_t pwrkey_fall_irq(int irq, void *_pwr) @@ -39,8 +40,15 @@ static int rk805_pwrkey_probe(struct platform_device *pdev) { struct input_dev *pwr; int fall_irq, rise_irq; + struct device_node *np; int err; + np = of_get_child_by_name(pdev->dev.parent->of_node, "pwrkey"); + if (np && !of_device_is_available(np)) { + dev_info(&pdev->dev, "device is disabled\n"); + return -EINVAL; + } + pwr = devm_input_allocate_device(&pdev->dev); if (!pwr) { dev_err(&pdev->dev, "Can't allocate power button\n");