diff mbox

[PATCHv2] PM / wakeirq: Add wakeup name to dedicated wake irqs

Message ID 20180226215102.GG16043@atomide.com (mailing list archive)
State Mainlined
Delegated to: Rafael Wysocki
Headers show

Commit Message

Tony Lindgren Feb. 26, 2018, 9:51 p.m. UTC
* Andy Shevchenko <andriy.shevchenko@linux.intel.com> [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 <tony@atomide.com>
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 <andriy.shevchenko@linux.intel.com>
Cc: Brian Norris <briannorris@chromium.org>
Cc: Grygorii Strashko <grygorii.strashko@ti.com>
Cc: Ulf Hansson <ulf.hansson@linaro.org>
Suggested-by: Jeffy Chen <jeffy.chen@rock-chips.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
---
 drivers/base/power/power.h   |  1 +
 drivers/base/power/wakeirq.c | 14 ++++++++++++--
 2 files changed, 13 insertions(+), 2 deletions(-)

Comments

Andy Shevchenko Feb. 26, 2018, 9:55 p.m. UTC | #1
On Mon, 2018-02-26 at 13:51 -0800, Tony Lindgren wrote:
> * Andy Shevchenko <andriy.shevchenko@linux.intel.com> [180225 13:37]:
> > On Fri, 2018-02-23 at 14:06 -0800, Tony Lindgren wrote:
> > > 


> +	wirq->name = kasprintf(GFP_KERNEL, "%s:wakeup",
> +			       dev_name(dev));

Can it make one line?

In any case,
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Rafael J. Wysocki Feb. 26, 2018, 10:01 p.m. UTC | #2
On Mon, Feb 26, 2018 at 10:55 PM, Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
> On Mon, 2018-02-26 at 13:51 -0800, Tony Lindgren wrote:
>> * Andy Shevchenko <andriy.shevchenko@linux.intel.com> [180225 13:37]:
>> > On Fri, 2018-02-23 at 14:06 -0800, Tony Lindgren wrote:
>> > >
>
>
>> +     wirq->name = kasprintf(GFP_KERNEL, "%s:wakeup",
>> +                            dev_name(dev));
>
> Can it make one line?

I can fix this up.

>
> In any case,
> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

I'll queue up the patch for 4.17 shortly.

Thanks!
diff mbox

Patch

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);