From patchwork Thu Apr 21 06:21:18 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 66308 Delivered-To: patches@linaro.org Received: by 10.140.93.198 with SMTP id d64csp2860476qge; Wed, 20 Apr 2016 23:21:24 -0700 (PDT) X-Received: by 10.66.138.16 with SMTP id qm16mr18369500pab.28.1461219684738; Wed, 20 Apr 2016 23:21:24 -0700 (PDT) Return-Path: Received: from mail-pf0-x22d.google.com (mail-pf0-x22d.google.com. [2607:f8b0:400e:c00::22d]) by mx.google.com with ESMTPS id yt2si1709400pab.188.2016.04.20.23.21.24 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 Apr 2016 23:21:24 -0700 (PDT) Received-SPF: pass (google.com: domain of john.stultz@linaro.org designates 2607:f8b0:400e:c00::22d as permitted sender) client-ip=2607:f8b0:400e:c00::22d; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org; spf=pass (google.com: domain of john.stultz@linaro.org designates 2607:f8b0:400e:c00::22d as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE dis=NONE) header.from=linaro.org Received: by mail-pf0-x22d.google.com with SMTP id e128so26511989pfe.3 for ; Wed, 20 Apr 2016 23:21:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=Er8UgeslOYCW/TzMbqAVPGe66/o5oCMvccoBE5ja6b0=; b=aK0sdCjYuklaDWOVVxbQku4eZKtax+5G/crNWhm9D6UVbwheVsgtESGZ0SUJcMGPgt LgrgwHtnWNJZ5TVBHc5Qt5RnaQTwH+LjR6mRiuXDVaZ3Y4iChw10HBAPYM4U+GowFRAS Vs7rmHXOCGwDi5sdzA+AY9YscTg0QCxS38bLA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=Er8UgeslOYCW/TzMbqAVPGe66/o5oCMvccoBE5ja6b0=; b=d3rTGqLY07vW1nSYQPLIRon4rNBn2+CIqmtWDtRJhBSvjCO6sJHUUNhTEFFhyMG/wj KfdcbA420+oZtNamFs4Z0WXzTOcTDMQpCppaF+6bxCPeZNeT/KQYqGLxRM2awqhT+t6b UiFIqnZ7k2s7TAgIiFnANJ3hbaCrKInaeMpKsHP9fl46mq6MJrMt++4YQ5L8lplEO7PL EMaaCQl2hZnxe635yCt/nhVaQkGElvHf3gQ+JxP9GTZb6KDw4XNwX8K4rHpMxehGec9m +aMD1WADXYBrnLVC1YbBOyHnLnQG2Ue2hUxJTLHrEv1eCFDgQA7Skjo8Z4fANNfyVppa +V6w== X-Gm-Message-State: AOPr4FXDTkyDv3RdBY815fKT3+RyhtWBo6uoeWDnzKSHgstkWSd7tyfVXdXoC2MHidrvC7LT1JU= X-Received: by 10.98.18.148 with SMTP id 20mr18250849pfs.104.1461219684477; Wed, 20 Apr 2016 23:21:24 -0700 (PDT) Return-Path: Received: from localhost.localdomain (c-73-67-244-238.hsd1.or.comcast.net. [73.67.244.238]) by smtp.gmail.com with ESMTPSA id m184sm295164pfb.22.2016.04.20.23.21.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 20 Apr 2016 23:21:23 -0700 (PDT) From: John Stultz To: Guodong Xu Cc: John Stultz Subject: [PATCH] hisi_powerkey: Convert from wakelocks to wakeup_sources Date: Wed, 20 Apr 2016 23:21:18 -0700 Message-Id: <1461219678-20392-1-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 1.9.1 Update hisi_powerkey driver to use wakeup_sources instead of wakelocks. Signed-off-by: John Stultz --- drivers/input/misc/hisi_powerkey.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) -- 1.9.1 diff --git a/drivers/input/misc/hisi_powerkey.c b/drivers/input/misc/hisi_powerkey.c index da4cda6..dd6872b 100644 --- a/drivers/input/misc/hisi_powerkey.c +++ b/drivers/input/misc/hisi_powerkey.c @@ -16,7 +16,6 @@ #include #include -#include #include #include #include @@ -25,7 +24,7 @@ #include /* the above held interrupt will trigger after 4 seconds */ -#define MAX_HELD_TIME (4 * HZ) +#define MAX_HELD_TIME (4 * MSEC_PER_SEC) #define irq_handler_id(x) button_irq_##x #define irq_handler_declaration(x) \ @@ -86,7 +85,7 @@ static struct key_report_pairs { struct hi65xx_priv { struct input_dev *input; - struct wake_lock wlock; + struct wakeup_source wlock; }; static inline void report_key(struct input_dev *dev, int id_action) @@ -115,7 +114,7 @@ irq_handler_declaration(action) \ if (irq != irq_info[id_##action].irq) \ return IRQ_NONE; \ \ - wake_lock_timeout(&p->wlock, MAX_HELD_TIME); \ + __pm_wakeup_event(&p->wlock, MAX_HELD_TIME); \ \ report_key(p->input, id_##action); \ input_sync(p->input); \ @@ -179,7 +178,7 @@ static int hi65xx_powerkey_probe(struct platform_device *pdev) irq_info[i].irq = irq; } - wake_lock_init(&priv->wlock, WAKE_LOCK_SUSPEND, "hisi-powerkey"); + wakeup_source_init(&priv->wlock, "hisi-powerkey"); ret = input_register_device(priv->input); if (ret) { @@ -194,7 +193,7 @@ static int hi65xx_powerkey_probe(struct platform_device *pdev) return 0; err_register: - wake_lock_destroy(&priv->wlock); + wakeup_source_trash(&priv->wlock); err_irq: input_free_device(priv->input); @@ -205,7 +204,7 @@ static int hi65xx_powerkey_remove(struct platform_device *pdev) { struct hi65xx_priv *priv = platform_get_drvdata(pdev); - wake_lock_destroy(&priv->wlock); + wakeup_source_trash(&priv->wlock); input_unregister_device(priv->input); return 0;