stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ben Hutchings <ben@decadent.org.uk>
To: Petr Vorel <pvorel@suse.cz>, stable@vger.kernel.org
Cc: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>,
	Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [PATCH v3.16] alarmtimer: Use EOPNOTSUPP instead of ENOTSUPP
Date: Tue, 19 Nov 2019 14:37:27 +0000	[thread overview]
Message-ID: <43b375712cdd400695af9e4e8e4a9381706601fc.camel@decadent.org.uk> (raw)
In-Reply-To: <20191108155411.13306-1-pvorel@suse.cz>

[-- Attachment #1: Type: text/plain, Size: 2672 bytes --]

On Fri, 2019-11-08 at 16:54 +0100, Petr Vorel wrote:
> From: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
> 
> ENOTSUPP is not supposed to be returned to userspace. This was found on an
> OpenPower machine, where the RTC does not support set_alarm.
> 
> On that system, a clock_nanosleep(CLOCK_REALTIME_ALARM, ...) results in
> "524 Unknown error 524"
> 
> Replace it with EOPNOTSUPP which results in the expected "95 Operation not
> supported" error.
> 
> Fixes: 1c6b39ad3f01 (alarmtimers: Return -ENOTSUPP if no RTC device is present)
> Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
> [ pvorel: backport for v3.16, changes also in alarm_timer_{del,set}(), which
> were removed in f2c45807d3992fe0f173f34af9c347d907c31686 in v4.13-rc1 ]
> Signed-off-by: Petr Vorel <pvorel@suse.cz>
> Cc: stable@vger.kernel.org # v3.16
> Cc: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
> Cc: Ben Hutchings <ben@decadent.org.uk>
> Link: https://lkml.kernel.org/r/20190903171802.28314-1-cascardo@canonical.com

I've queued this up, thanks.  In future please remember to include the
upstream commit hash.

Ben.

> ---
>  kernel/time/alarmtimer.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/kernel/time/alarmtimer.c b/kernel/time/alarmtimer.c
> index 8c65c236f26a..c3fc69986850 100644
> --- a/kernel/time/alarmtimer.c
> +++ b/kernel/time/alarmtimer.c
> @@ -533,7 +533,7 @@ static int alarm_timer_create(struct k_itimer *new_timer)
>  	struct alarm_base *base;
>  
>  	if (!alarmtimer_get_rtcdev())
> -		return -ENOTSUPP;
> +		return -EOPNOTSUPP;
>  
>  	if (!capable(CAP_WAKE_ALARM))
>  		return -EPERM;
> @@ -576,7 +576,7 @@ static void alarm_timer_get(struct k_itimer *timr,
>  static int alarm_timer_del(struct k_itimer *timr)
>  {
>  	if (!rtcdev)
> -		return -ENOTSUPP;
> +		return -EOPNOTSUPP;
>  
>  	if (alarm_try_to_cancel(&timr->it.alarm.alarmtimer) < 0)
>  		return TIMER_RETRY;
> @@ -600,7 +600,7 @@ static int alarm_timer_set(struct k_itimer *timr, int flags,
>  	ktime_t exp;
>  
>  	if (!rtcdev)
> -		return -ENOTSUPP;
> +		return -EOPNOTSUPP;
>  
>  	if (flags & ~TIMER_ABSTIME)
>  		return -EINVAL;
> @@ -761,7 +761,7 @@ static int alarm_timer_nsleep(const clockid_t which_clock, int flags,
>  	struct restart_block *restart;
>  
>  	if (!alarmtimer_get_rtcdev())
> -		return -ENOTSUPP;
> +		return -EOPNOTSUPP;
>  
>  	if (flags & ~TIMER_ABSTIME)
>  		return -EINVAL;
-- 
Ben Hutchings
Theory and practice are closer in theory than in practice - John Levine



[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  parent reply	other threads:[~2019-11-19 14:37 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-08 15:54 [PATCH v3.16] alarmtimer: Use EOPNOTSUPP instead of ENOTSUPP Petr Vorel
2019-11-08 16:59 ` Thadeu Lima de Souza Cascardo
2019-11-19 14:37 ` Ben Hutchings [this message]
2019-11-19 14:53   ` Petr Vorel

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=43b375712cdd400695af9e4e8e4a9381706601fc.camel@decadent.org.uk \
    --to=ben@decadent.org.uk \
    --cc=cascardo@canonical.com \
    --cc=pvorel@suse.cz \
    --cc=stable@vger.kernel.org \
    --cc=tglx@linutronix.de \
    /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).