From patchwork Mon Feb 26 21:51:02 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tony Lindgren X-Patchwork-Id: 10243693 X-Patchwork-Delegate: rjw@sisk.pl Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 3F0CC60211 for ; Mon, 26 Feb 2018 21:51:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2ECB52A41C for ; Mon, 26 Feb 2018 21:51:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 214FE2A41F; Mon, 26 Feb 2018 21:51:07 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 724B02A41C for ; Mon, 26 Feb 2018 21:51:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751165AbeBZVvF (ORCPT ); Mon, 26 Feb 2018 16:51:05 -0500 Received: from muru.com ([72.249.23.125]:58410 "EHLO muru.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750877AbeBZVvE (ORCPT ); Mon, 26 Feb 2018 16:51:04 -0500 Received: from atomide.com (localhost [127.0.0.1]) by muru.com (Postfix) with ESMTPS id 1201D8121; Mon, 26 Feb 2018 21:51:52 +0000 (UTC) Date: Mon, 26 Feb 2018 13:51:02 -0800 From: Tony Lindgren To: Andy Shevchenko Cc: "Rafael J . Wysocki" , Alan Stern , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Brian Norris , Grygorii Strashko , Ulf Hansson Subject: Re: [PATCHv2] PM / wakeirq: Add wakeup name to dedicated wake irqs Message-ID: <20180226215102.GG16043@atomide.com> References: <20180223220612.35181-1-tony@atomide.com> <1519565632.10722.150.camel@linux.intel.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1519565632.10722.150.camel@linux.intel.com> User-Agent: Mutt/1.9.3 (2018-01-21) Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP * Andy Shevchenko [180225 13:37]: > On Fri, 2018-02-23 at 14:06 -0800, Tony Lindgren wrote: > > This makes it easy to grep :wakeup /proc/interrupts. > > > + char *name; > > Wouldn't be const? Yup it can be const. And the kasprintf() can be made simpler as suggested earlier by Rafael. Here's v3 of the patch. Thanks, Tony 8< -------------------- From tony Mon Sep 17 00:00:00 2001 From: Tony Lindgren Date: Thu, 8 Feb 2018 08:30:10 -0800 Subject: [PATCHv3] PM / wakeirq: Add wakeup name to dedicated wake irqs This makes it easy to grep :wakeup /proc/interrupts. Cc: Andy Shevchenko Cc: Brian Norris Cc: Grygorii Strashko Cc: Ulf Hansson Suggested-by: Jeffy Chen Signed-off-by: Tony Lindgren Reviewed-by: Andy Shevchenko --- drivers/base/power/power.h | 1 + drivers/base/power/wakeirq.c | 14 ++++++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/drivers/base/power/power.h b/drivers/base/power/power.h --- a/drivers/base/power/power.h +++ b/drivers/base/power/power.h @@ -31,6 +31,7 @@ struct wake_irq { struct device *dev; unsigned int status; int irq; + const char *name; }; extern void dev_pm_arm_wake_irq(struct wake_irq *wirq); diff --git a/drivers/base/power/wakeirq.c b/drivers/base/power/wakeirq.c --- a/drivers/base/power/wakeirq.c +++ b/drivers/base/power/wakeirq.c @@ -112,6 +112,7 @@ void dev_pm_clear_wake_irq(struct device *dev) free_irq(wirq->irq, wirq); wirq->status &= ~WAKE_IRQ_DEDICATED_MASK; } + kfree(wirq->name); kfree(wirq); } EXPORT_SYMBOL_GPL(dev_pm_clear_wake_irq); @@ -184,6 +185,13 @@ int dev_pm_set_dedicated_wake_irq(struct device *dev, int irq) if (!wirq) return -ENOMEM; + wirq->name = kasprintf(GFP_KERNEL, "%s:wakeup", + dev_name(dev)); + if (!wirq->name) { + err = -ENOMEM; + goto err_free; + } + wirq->dev = dev; wirq->irq = irq; irq_set_status_flags(irq, IRQ_NOAUTOEN); @@ -196,9 +204,9 @@ int dev_pm_set_dedicated_wake_irq(struct device *dev, int irq) * so we use a threaded irq. */ err = request_threaded_irq(irq, NULL, handle_threaded_wake_irq, - IRQF_ONESHOT, dev_name(dev), wirq); + IRQF_ONESHOT, wirq->name, wirq); if (err) - goto err_free; + goto err_free_name; err = dev_pm_attach_wake_irq(dev, irq, wirq); if (err) @@ -210,6 +218,8 @@ int dev_pm_set_dedicated_wake_irq(struct device *dev, int irq) err_free_irq: free_irq(irq, wirq); +err_free_name: + kfree(wirq->name); err_free: kfree(wirq);