From: Tony Lindgren <tony@atomide.com>
To: "Rafael J. Wysocki" <rafael@kernel.org>
Cc: "Rafael J . Wysocki" <rafael.j.wysocki@intel.com>,
Alan Stern <stern@rowland.harvard.edu>,
Linux PM <linux-pm@vger.kernel.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Brian Norris <briannorris@chromium.org>,
Grygorii Strashko <grygorii.strashko@ti.com>,
Ulf Hansson <ulf.hansson@linaro.org>
Subject: Re: [PATCH] PM / wakeirq: Add wakeup name to dedicated wake irqs
Date: Fri, 16 Feb 2018 08:42:40 -0800 [thread overview]
Message-ID: <20180216164240.GU6364@atomide.com> (raw)
In-Reply-To: <CAJZ5v0iF0M+X5vujyaKmXrEWpBEceQ=PX6bhgcwFf8P-q7Cu-Q@mail.gmail.com>
* Rafael J. Wysocki <rafael@kernel.org> [180216 09:42]:
> On Fri, Feb 9, 2018 at 5:14 PM, Tony Lindgren <tony@atomide.com> wrote:
> > This makes it easy to grep :wakeup /proc/interrupts.
> > 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);
> > @@ -175,7 +176,8 @@ static irqreturn_t handle_threaded_wake_irq(int irq, void *_wirq)
> > int dev_pm_set_dedicated_wake_irq(struct device *dev, int irq)
> > {
> > struct wake_irq *wirq;
> > - int err;
> > + int err, namelen;
> > + const char *postfix = ":wakeup";
> >
> > if (irq < 0)
> > return -EINVAL;
> > @@ -184,6 +186,14 @@ int dev_pm_set_dedicated_wake_irq(struct device *dev, int irq)
> > if (!wirq)
> > return -ENOMEM;
> >
> > + namelen = strlen(dev_name(dev)) + strlen(postfix) + 1;
> > + wirq->name = kzalloc(namelen, GFP_KERNEL);
> > + if (!wirq->name) {
> > + err = -ENOMEM;
> > + goto err_free;
> > + }
> > +
> > + snprintf(wirq->name, namelen, "%s%s", dev_name(dev), postfix);
>
> As Andy said you can do
>
> wirq->name = kasprintf(GFP_KERNEL, "%s:wakeup", dev_name(dev));
> if (!wirq->name) {
> err = -ENOMEM;
> goto err_free;
> }
>
> here and it will allocate the buffer for you.
Yeah great, will update and repost next week. I'll also
give Andy's patch a try, sounds like we may want to do
both though.
Regards,
Tony
prev parent reply other threads:[~2018-02-16 16:42 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-09 16:14 [PATCH] PM / wakeirq: Add wakeup name to dedicated wake irqs Tony Lindgren
2018-02-14 10:52 ` Rafael J. Wysocki
2018-02-14 11:23 ` Andy Shevchenko
2018-02-16 9:14 ` Rafael J. Wysocki
2018-02-16 10:39 ` Andy Shevchenko
2018-02-16 10:54 ` Rafael J. Wysocki
2018-02-16 14:52 ` Andy Shevchenko
2018-02-16 16:54 ` Tony Lindgren
2018-02-16 9:42 ` Rafael J. Wysocki
2018-02-16 16:42 ` Tony Lindgren [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180216164240.GU6364@atomide.com \
--to=tony@atomide.com \
--cc=briannorris@chromium.org \
--cc=grygorii.strashko@ti.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=rafael.j.wysocki@intel.com \
--cc=rafael@kernel.org \
--cc=stern@rowland.harvard.edu \
--cc=ulf.hansson@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).