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  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Tue, 7 Oct 2014 18:06:38 +0200
From:	Andrew Lunn <andrew@...n.ch>
To:	Guenter Roeck <linux@...ck-us.net>
Cc:	linux-kernel@...r.kernel.org, linux-m32r-ja@...linux-m32r.org,
	linux-mips@...ux-mips.org, linux-efi@...r.kernel.org,
	linux-ia64@...r.kernel.org, linux-xtensa@...ux-xtensa.org,
	devel@...verdev.osuosl.org, linux-s390@...r.kernel.org,
	lguest@...ts.ozlabs.org, linux-c6x-dev@...ux-c6x.org,
	Dmitry Eremin-Solenikov <dbaryshkov@...il.com>,
	linux-hexagon@...r.kernel.org, linux-sh@...r.kernel.org,
	linux-acpi@...r.kernel.org, xen-devel@...ts.xenproject.org,
	devicetree@...r.kernel.org,
	user-mode-linux-devel@...ts.sourceforge.net,
	linux-pm@...r.kernel.org,
	adi-buildroot-devel@...ts.sourceforge.net,
	linux-m68k@...ts.linux-m68k.org, linux-am33-list@...hat.com,
	linux-tegra@...r.kernel.org,
	openipmi-developer@...ts.sourceforge.net,
	linux-metag@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
	linux-parisc@...r.kernel.org, linux-cris-kernel@...s.com,
	David Woodhouse <dwmw2@...radead.org>,
	Sebastian Reichel <sre@...nel.org>,
	linux-alpha@...r.kernel.org, linuxppc-dev@...ts.ozlabs.org
Subject: Re: [PATCH 20/44] power/reset: restart-poweroff: Register with
 kernel poweroff handler

On Mon, Oct 06, 2014 at 10:28:22PM -0700, Guenter Roeck wrote:
> Register with kernel poweroff handler instead of seting pm_power_off
> directly.  Register as poweroff handler of last resort since the driver
> does not really power off the system but executes a restart.

I would not say last resort, this is how it is designed to work. There
is no way to turn the power off from with linux, it is designed that
u-boot will put the hardware into minimal power consumption until the
"power" button is pressed.

Other than that, 

Acked-by: Andrew Lunn <andrew@...n.ch>

Thanks
	Andrew

> 
> Cc: Sebastian Reichel <sre@...nel.org>
> Cc: Dmitry Eremin-Solenikov <dbaryshkov@...il.com>
> Cc: David Woodhouse <dwmw2@...radead.org>
> Signed-off-by: Guenter Roeck <linux@...ck-us.net>
> ---
>  drivers/power/reset/restart-poweroff.c | 25 ++++++++++++-------------
>  1 file changed, 12 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/power/reset/restart-poweroff.c b/drivers/power/reset/restart-poweroff.c
> index edd707e..5437697 100644
> --- a/drivers/power/reset/restart-poweroff.c
> +++ b/drivers/power/reset/restart-poweroff.c
> @@ -12,35 +12,34 @@
>   */
>  #include <linux/kernel.h>
>  #include <linux/init.h>
> +#include <linux/notifier.h>
>  #include <linux/platform_device.h>
>  #include <linux/of_platform.h>
>  #include <linux/module.h>
> +#include <linux/pm.h>
>  #include <linux/reboot.h>
> -#include <asm/system_misc.h>
>  
> -static void restart_poweroff_do_poweroff(void)
> +static int restart_poweroff_do_poweroff(struct notifier_block *this,
> +					unsigned long unused1, void *unused2)
>  {
>  	reboot_mode = REBOOT_HARD;
>  	machine_restart(NULL);
> +
> +	return NOTIFY_DONE;
>  }
>  
> +static struct notifier_block restart_poweroff_handler = {
> +	.notifier_call = restart_poweroff_do_poweroff,
> +};
> +
>  static int restart_poweroff_probe(struct platform_device *pdev)
>  {
> -	/* If a pm_power_off function has already been added, leave it alone */
> -	if (pm_power_off != NULL) {
> -		dev_err(&pdev->dev,
> -			"pm_power_off function already registered");
> -		return -EBUSY;
> -	}
> -
> -	pm_power_off = &restart_poweroff_do_poweroff;
> -	return 0;
> +	return register_poweroff_handler(&restart_poweroff_handler);
>  }
>  
>  static int restart_poweroff_remove(struct platform_device *pdev)
>  {
> -	if (pm_power_off == &restart_poweroff_do_poweroff)
> -		pm_power_off = NULL;
> +	unregister_poweroff_handler(&restart_poweroff_handler);
>  
>  	return 0;
>  }
> -- 
> 1.9.1
> 
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@...ts.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists