Re: [RFC 1/3] system-power: Add system power and restart framework

From: Pavel Machek
Date: Mon Jan 30 2017 - 16:53:09 EST


Hi!


> +struct system_power_chip;
> +
> +struct system_power_ops {
> + int (*restart)(struct system_power_chip *chip, enum reboot_mode mode,
> + char *cmd);
> + int (*power_off_prepare)(struct system_power_chip *chip);
> + int (*power_off)(struct system_power_chip *chip);
> +};
> +
> +struct system_power_chip {
> + const struct system_power_ops *ops;
> + struct list_head list;
> + struct device *dev;
> +};

Is it useful to have two structures? AFAICT one would do.

Do we always have struct device * to work with? IMO we have nothing
suitable for example in the ACPI case. Would void * be more suitable?

Could you convert someting (acpi?) to the new framework as
demonstration?
Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html