Re: [PATCH v3.16] alarmtimer: Use EOPNOTSUPP instead of ENOTSUPP

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 2019-11-08 at 16:54 +0100, Petr Vorel wrote:
> From: Thadeu Lima de Souza Cascardo <cascardo@xxxxxxxxxxxxx>
> 
> 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@xxxxxxxxxxxxx>
> Signed-off-by: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
> [ 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@xxxxxxx>
> Cc: stable@xxxxxxxxxxxxxxx # v3.16
> Cc: Thadeu Lima de Souza Cascardo <cascardo@xxxxxxxxxxxxx>
> Cc: Ben Hutchings <ben@xxxxxxxxxxxxxxx>
> Link: https://lkml.kernel.org/r/20190903171802.28314-1-cascardo@xxxxxxxxxxxxx

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: signature.asc
Description: This is a digitally signed message part


[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux