Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp1295874imm; Tue, 5 Jun 2018 12:08:38 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKoU/XnaZGj1HzhiwZXU5qgUtbFs5mOOJxhd7vMvrdHjp9WE9UmKm9+rhk0wbscazV8GP0Z X-Received: by 2002:a62:930c:: with SMTP id b12-v6mr26874234pfe.193.1528225718125; Tue, 05 Jun 2018 12:08:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528225718; cv=none; d=google.com; s=arc-20160816; b=Eiwfd1K5Iv3vo722dVge9LW/LQ7LmcJIZMerZpFQleCZt01Q4g1iuy7c8/ifK7r6n5 icfHtbIbH2yvpjc67sYvTWfApjBvaWxdu2MO/GrS9FPVCL10Io6GlUZOoGF15FKfN4AI paGjQoIn7Cr3bg8fiPPhYIxlJJQ5aXICjup2jApTdwiF0YZB1dL0LZM22lNaE4D7jCJi v/IE9jWjNT6UfBw9N4iHu2M1vGK4nqiOGTJ6jvAWuxU7o87sWW9SFgg38XWa32P7jInX 0KD7R3sYLBZftnCk/SvhIVkoqKCIIsv99eBgfpA3yse8bxSu4GnUiXpJZLPyUTdpyC3u BE+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=zCa7eQlS/wgPgNZi2/SVBw4ZFhY06Qo0kdVQtpmcnBU=; b=kwx3qO9cNg42OGXpuP6bTKn6+DR88Snvio67cWlPEZAPiwFvn8qRHHs+uqrxJF2xVa 0VcF+gzDPK0oWeqPrYtpvBRqT7fci0/IPueD19V9kDg/vqK0mshgyhsuTJG3F4DF+e0F sFgp9CLvtMJGdJFZAallOGkyuNCL05y/XIuYZtqhrpGVHo3j/UnT4dPNoivOWf88rG3A +FjCqOaFyxgY6WTdswB819XMcxQvrz2RLiDlRXX09oKUBMKqxHE+1FWlhchJ2n3+IVYe irRgLwEA5R5lxN6Vhf30hbAzVH+8yMJITTxr0jFGQ8A/pzyewJAiV3jbocwCRZrfx3rD GddQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=XwEgN9YB; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 13-v6si19714326pge.159.2018.06.05.12.08.22; Tue, 05 Jun 2018 12:08:38 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=XwEgN9YB; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752305AbeFETHS (ORCPT + 99 others); Tue, 5 Jun 2018 15:07:18 -0400 Received: from mail-vk0-f68.google.com ([209.85.213.68]:46871 "EHLO mail-vk0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751900AbeFETHR (ORCPT ); Tue, 5 Jun 2018 15:07:17 -0400 Received: by mail-vk0-f68.google.com with SMTP id b134-v6so2104622vke.13 for ; Tue, 05 Jun 2018 12:07:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=zCa7eQlS/wgPgNZi2/SVBw4ZFhY06Qo0kdVQtpmcnBU=; b=XwEgN9YBDrhH8VJTiMAr+GG4i4H2knswU6zLLZ9VYCymLB1NVBIFwoOyKkFpJNZr1g uvNtMwlmHOXVpb5dof1sOzyk7PgoIHQW84QwYqS53/uK4SAzmlwtgN6FB5AHut0dSWRR HnpQX64WjXD+LDPt4p1LKfA7h1mlExCC1IEm7J+cYxouw7uc3+aNpVy6taFYsqawmkFa I1INHH+GtcGMSfUgQ/J6tLoySi4YJLJ3W8DhQd2OL+RHv4BZSf2cgn0ldbVAJJXFWtT7 HaT1XkTIIOBB1tgmMmY52l8OAOCCWHeyYMlWcFOtzpAnN9473X5lRll8M4uLMNAsPJhu N6CQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=zCa7eQlS/wgPgNZi2/SVBw4ZFhY06Qo0kdVQtpmcnBU=; b=B4DXr3uJZlmgrT82vU33+vNn5+K6ovFrWxwLMtT+LV+3sFzG/HMrKJJQWqnep3Zw3z XzhdV1c7ZpdMXIGhRjFQNn8l7HVH72pWBMLpD8Qf6mVmBdW5tKjEe5eKJ712+s9WsjYU yo26mQ5uP+C1oal4DaknUWOzomeLXllBBrfuk8C2hr3ZD1QfTeTNqdvFa27r9AluN0Me unONcbDnV/kmeQu5gKpgLZwW6uMoeixIefBXrPCHlet6FcRfZroVKrlEUlr2pen6SYQH 1GqyoC+2cSbhgExiiO2j+iVKu8jSIUHjLXJH7cSP3f7XKrD57tWY8mfcgpu6X05zGM2x USkw== X-Gm-Message-State: ALKqPweizYeovYu2918uJTsMDy8YME9JcjgpuWm4wyOY6j/NvTDNrD+r UEqhwY2B2rkjd4idvy09mZ5GqROyXkwLiEttpckPxg== X-Received: by 2002:a1f:88cc:: with SMTP id k195-v6mr16667573vkd.85.1528225634332; Tue, 05 Jun 2018 12:07:14 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a67:80d4:0:0:0:0:0 with HTTP; Tue, 5 Jun 2018 12:06:53 -0700 (PDT) In-Reply-To: References: <20180601180053.120202-1-ravisadineni@chromium.org> <20180602010708.152025-1-ravisadineni@chromium.org> <20180604215339.GG164893@dtor-ws> From: Ravi Chandra Sadineni Date: Tue, 5 Jun 2018 12:06:53 -0700 Message-ID: Subject: Re: [PATCH V2] i8042: Increment wakeup_count for the respective port. To: "Rafael J. Wysocki" Cc: Dmitry Torokhov , Ravi Chandra Sadineni , chenhong3@huawei.com, Dmitry Torokhov , Todd Broch , Linux Kernel Mailing List , linux-input@vger.kernel.org, Rajat Jain , Benson Leung Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jun 5, 2018 at 2:14 AM, Rafael J. Wysocki wrote: > On Mon, Jun 4, 2018 at 11:53 PM, Dmitry Torokhov > wrote: >> On Fri, Jun 01, 2018 at 06:07:08PM -0700, Ravi Chandra Sadineni wrote: >>> Call pm_wakeup_event on every irq. This should help us in identifying if >>> keyboard was a potential wake reason for the last resume. >>> >>> Signed-off-by: Ravi Chandra Sadineni >>> --- >>> V2: Increment the wakeup count only when there is a irq and not when the >>> method is called internally. >>> >>> drivers/input/serio/i8042.c | 3 +++ >>> 1 file changed, 3 insertions(+) >>> >>> diff --git a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c >>> index 824f4c1c1f310..2bd6f2633e29a 100644 >>> --- a/drivers/input/serio/i8042.c >>> +++ b/drivers/input/serio/i8042.c >>> @@ -573,6 +573,9 @@ static irqreturn_t i8042_interrupt(int irq, void *dev_id) >>> port = &i8042_ports[port_no]; >>> serio = port->exists ? port->serio : NULL; >>> >>> + if (irq && serio && device_may_wakeup(&serio->dev)) >>> + pm_wakeup_event(&serio->dev, 0); >> >> The constant checks for device_may_wakeup() before calling >> pm_wakeup_event()needed to avoid warnings in wakeup_source_activate() >> (?) are annoying. > > I'm not following you here. > > pm_wakeup_event() -> > pm_wakeup_dev_event() -> > pm_wakeup_ws_event(dev->power.wakeup, ...) > Checks if the first arg is NULL and returns quietly if so. > > I don't see why you need the device_may_wakeup() check. Just realized that device_may_wakeup check is not needed. Removed the check in V3. Thanks. > >> Rafael, can we move the check into pm_wakeup_dev_event()? > > That would be redundant, wouldn't it? > >> I am also confused when pm_wakeup_event() vs pm_wakeup_hard_event() vs >> pm_wakeup_dev_event() should be used, if any. Is there any guidance? > > First off, the "hard" variant is for when you want to abort suspends > in progress or wake up from suspend to idle regardless of whether or > not wakeup source tracking is enabled. > > Second, use pm_wakeup_dev_event() if the decision on "hard" vs "soft" > needs to be made at run time. > > Thanks, > Rafael