linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lukas Wunner <lukas@wunner.de>
To: Lina Iyer <lina.iyer@linaro.org>
Cc: ulf.hansson@linaro.org, rjw@rjwysocki.net, linux-pm@vger.kernel.org
Subject: Re: [PATCH] PM / Domains: Replace -ENOSYS with -ENODEV
Date: Fri, 5 Aug 2016 21:43:29 +0200	[thread overview]
Message-ID: <20160805194329.GA5020@wunner.de> (raw)
In-Reply-To: <1470416816-53336-1-git-send-email-lina.iyer@linaro.org>

On Fri, Aug 05, 2016 at 11:06:56AM -0600, Lina Iyer wrote:
> ENOSYS is for syscalls that are not supported. ENODEV is a better return
> value when the PM Domains are not available.
> 
> Signed-off-by: Lina Iyer <lina.iyer@linaro.org>

I have no opinion on this, but would like to point out that other parts
in the PM core use -ENOSYS as well (e.g. see drivers/base/power/core.c).
For consistency, if pm_domain.h is changed, the rest should probably be
changed as well. It should also be kept in mind that functions might
check the return code and react specifically to the currently used -ENOSYS.
(I've written code like that just yesterday, for the (unmerged) thunderbolt
runtime pm.)

Thanks,

Lukas

> ---
>  include/linux/pm_domain.h | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h
> index 688dc57..8a63406 100644
> --- a/include/linux/pm_domain.h
> +++ b/include/linux/pm_domain.h
> @@ -151,7 +151,7 @@ extern struct dev_power_governor pm_domain_always_on_gov;
>  
>  static inline struct generic_pm_domain_data *dev_gpd_data(struct device *dev)
>  {
> -	return ERR_PTR(-ENOSYS);
> +	return ERR_PTR(-ENODEV);
>  }
>  static inline struct generic_pm_domain *pm_genpd_lookup_dev(struct device *dev)
>  {
> @@ -161,27 +161,27 @@ static inline int __pm_genpd_add_device(struct generic_pm_domain *genpd,
>  					struct device *dev,
>  					struct gpd_timing_data *td)
>  {
> -	return -ENOSYS;
> +	return -ENODEV;
>  }
>  static inline int pm_genpd_remove_device(struct generic_pm_domain *genpd,
>  					 struct device *dev)
>  {
> -	return -ENOSYS;
> +	return -ENODEV;
>  }
>  static inline int pm_genpd_add_subdomain(struct generic_pm_domain *genpd,
>  					 struct generic_pm_domain *new_sd)
>  {
> -	return -ENOSYS;
> +	return -ENODEV;
>  }
>  static inline int pm_genpd_remove_subdomain(struct generic_pm_domain *genpd,
>  					    struct generic_pm_domain *target)
>  {
> -	return -ENOSYS;
> +	return -ENODEV;
>  }
>  static inline int pm_genpd_init(struct generic_pm_domain *genpd,
>  				struct dev_power_governor *gov, bool is_off)
>  {
> -	return -ENOSYS;
> +	return -ENODEV;
>  }
>  static inline int pm_genpd_of_parse_power_states(
>  				struct generic_pm_domain *genpd)
> -- 
> 2.7.4
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-pm" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2016-08-05 19:43 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-05 17:06 [PATCH] PM / Domains: Replace -ENOSYS with -ENODEV Lina Iyer
2016-08-05 19:43 ` Lukas Wunner [this message]
2016-08-05 22:17   ` Rafael J. Wysocki
2016-08-05 23:44     ` Lukas Wunner
2016-08-08  9:11     ` Geert Uytterhoeven
2016-08-08 13:04       ` Rafael J. Wysocki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160805194329.GA5020@wunner.de \
    --to=lukas@wunner.de \
    --cc=lina.iyer@linaro.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=rjw@rjwysocki.net \
    --cc=ulf.hansson@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).