[PATCH v10 03/10] power: reset: reboot-mode: Add optional cookie argument

Arnd Bergmann arnd at arndb.de
Thu Jul 10 08:29:36 PDT 2025


On Thu, Jul 10, 2025, at 11:15, Shivendra Pratap wrote:

>  static int reboot_mode_notify(struct notifier_block *this,
>  			      unsigned long mode, void *cmd)
>  {
>  	struct reboot_mode_driver *reboot;
> -	unsigned int magic;
> +	struct mode_info *info;
> 
>  	reboot = container_of(this, struct reboot_mode_driver, reboot_notifier);
> -	magic = get_reboot_mode_magic(reboot, cmd);
> -	if (magic)
> -		reboot->write(reboot, magic);
> +	info = get_reboot_mode_info(reboot, cmd);
> +	if (info) {
> +		if (info->is_cookie_valid) {
> +			reboot->write_with_cookie(reboot, info->magic, info->cookie);
> +		} else {
> +			if (info->magic)
> +				reboot->write(reboot, info->magic);
> +		}
> +	}

I don't quite see why we need two possible callbacks here, could
this be done with a single '->write' callback when you either
add another argument, or extend the existing 'magic' value
to 64 bit?

There are only a couple of drivers that provide this callback,
so it should be easy to just change them all at once.

     Arnd



More information about the Linux-rockchip mailing list