Input: powerkey: rk8xx: check the powerkey is available

Signed-off-by: shengfei Xu <xsf@rock-chips.com>
Change-Id: I24162089c4ada3defd0a4cb066a632316934327b
This commit is contained in:
shengfei Xu 2021-11-13 03:01:21 +00:00 committed by Tao Huang
parent dc74ddc4ec
commit 86c64761ef

View File

@ -13,6 +13,7 @@
#include <linux/interrupt.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/platform_device.h>
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");