Sudeep Holla <[email protected]> writes:
> This patch hooks up the support for device power domain provided by
> SCPI using the Linux generic power domain infrastructure.
>
> Cc: "Rafael J. Wysocki" <[email protected]>
> Cc: Kevin Hilman <[email protected]>
> Cc: Ulf Hansson <[email protected]>
> Cc: [email protected]
> Signed-off-by: Sudeep Holla <[email protected]>
[...]
> +static int scpi_pd_power(struct scpi_pm_domain *pd, bool power_on)
> +{
> + int ret;
> + enum scpi_power_domain_state state;
> +
> + if (power_on)
> + state = SCPI_PD_STATE_ON;
> + else
> + state = SCPI_PD_STATE_OFF;
> +
> + ret = pd->ops->device_set_power_state(pd->domain, state);
There should probably be some sanity checks here that these function
pointers are non-NULL.
> + if (ret)
> + return ret;
> +
> + return !(state == pd->ops->device_get_power_state(pd->domain));
> +}
Kevin