[U-Boot] [PATCH 2/4] power-domain: add dummy functions when CONFIG_POWER_DOMAIN not defined

Simon Glass sjg at chromium.org
Wed Jul 25 02:45:37 UTC 2018


Hi Peng,

On 24 July 2018 at 01:45, Peng Fan <peng.fan at nxp.com> wrote:
> Add dummy functions when CONFIG_POWER_DOMAIN not defined.
>
> Signed-off-by: Peng Fan <peng.fan at nxp.com>
> Reviewed-by: Simon Glass <sjg at chromium.org>
> ---
>  include/power-domain.h | 28 ++++++++++++++++++++++++++++
>  1 file changed, 28 insertions(+)
>
> diff --git a/include/power-domain.h b/include/power-domain.h
> index aba8c0f65c..fe2a1c5119 100644
> --- a/include/power-domain.h
> +++ b/include/power-domain.h
> @@ -87,7 +87,14 @@ struct power_domain {
>   * @power_domain       A pointer to a power domain struct to initialize.
>   * @return 0 if OK, or a negative error code.
>   */
> +#ifdef CONFIG_POWER_DOMAIN
>  int power_domain_get(struct udevice *dev, struct power_domain *power_domain);
> +#else
> +int power_domain_get(struct udevice *dev, struct power_domain *power_domain)
> +{
> +       return -EINVAL;

Actually shouldn't this be -ENOSYS?

> +}
> +#endif
>
>  /**
>   * power_domain_free - Free a previously requested power domain.
> @@ -96,7 +103,14 @@ int power_domain_get(struct udevice *dev, struct power_domain *power_domain);
>   *             requested by power_domain_get().
>   * @return 0 if OK, or a negative error code.
>   */
> +#ifdef CONFIG_POWER_DOMAIN
>  int power_domain_free(struct power_domain *power_domain);
> +#else
> +int power_domain_free(struct power_domain *power_domain)
> +{
> +       return -EINVAL;
> +}
> +#endif
>
>  /**
>   * power_domain_on - Enable power to a power domain.
> @@ -105,7 +119,14 @@ int power_domain_free(struct power_domain *power_domain);
>   *             requested by power_domain_get().
>   * @return 0 if OK, or a negative error code.
>   */
> +#ifdef CONFIG_POWER_DOMAIN
>  int power_domain_on(struct power_domain *power_domain);
> +#else
> +int power_domain_on(struct power_domain *power_domain)
> +{
> +       return -EINVAL;
> +}
> +#endif
>
>  /**
>   * power_domain_off - Disable power ot a power domain.
> @@ -114,6 +135,13 @@ int power_domain_on(struct power_domain *power_domain);
>   *             requested by power_domain_get().
>   * @return 0 if OK, or a negative error code.
>   */
> +#ifdef CONFIG_POWER_DOMAIN
>  int power_domain_off(struct power_domain *power_domain);
> +#else
> +int power_domain_off(struct power_domain *power_domain)
> +{
> +       return -EINVAL;
> +}
> +#endif
>
>  #endif
> --
> 2.14.1
>

Regards,
Simon


More information about the U-Boot mailing list