lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2003557.9eaylDJto6@aspire.rjw.lan>
Date:   Wed, 14 Feb 2018 11:52:56 +0100
From:   "Rafael J. Wysocki" <rjw@...ysocki.net>
To:     Tony Lindgren <tony@...mide.com>
Cc:     "Rafael J . Wysocki" <rafael.j.wysocki@...el.com>,
        Alan Stern <stern@...land.harvard.edu>,
        linux-pm@...r.kernel.org, linux-kernel@...r.kernel.org,
        Brian Norris <briannorris@...omium.org>,
        Grygorii Strashko <grygorii.strashko@...com>,
        Ulf Hansson <ulf.hansson@...aro.org>
Subject: Re: [PATCH] PM / wakeirq: Add wakeup name to dedicated wake irqs

On Friday, February 9, 2018 5:14:56 PM CET Tony Lindgren wrote:
> This makes it easy to grep :wakeup /proc/interrupts.
> 
> Cc: Brian Norris <briannorris@...omium.org>
> Cc: Grygorii Strashko <grygorii.strashko@...com>
> Cc: Ulf Hansson <ulf.hansson@...aro.org>
> Suggested-by: Jeffy Chen <jeffy.chen@...k-chips.com>
> Signed-off-by: Tony Lindgren <tony@...mide.com>
> ---
>  drivers/base/power/power.h   |  1 +
>  drivers/base/power/wakeirq.c | 18 +++++++++++++++---
>  2 files changed, 16 insertions(+), 3 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;
> +	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);
> @@ -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);
>  	wirq->dev = dev;
>  	wirq->irq = irq;
>  	irq_set_status_flags(irq, IRQ_NOAUTOEN);
> @@ -196,9 +206,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 +220,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);
>  
> 

I'll queue this up for 4.17 if there are no objections.

Thanks,
Rafael


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ