mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 19:30:30 +09:00
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:
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user