[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <201411301700.36828@pali>
Date: Sun, 30 Nov 2014 17:00:36 +0100
From: Pali Rohár <pali.rohar@...il.com>
To: Guenter Roeck <linux@...ck-us.net>
Cc: Arnd Bergmann <arnd@...db.de>,
"Greg Kroah-Hartman" <gregkh@...uxfoundation.org>,
Steven Honeyman <stevenhoneyman@...il.com>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] i8k: Fix temperature bug handling in i8k_get_temp()
On Sunday 30 November 2014 16:56:32 Guenter Roeck wrote:
> On 11/30/2014 06:48 AM, Pali Rohár wrote:
> [ ... ]
>
> >>> + if (temp > I8K_MAX_TEMP)
> >>> + return -ERANGE;
> >>
> >> Can we return -ENODATA in this case ? I think that would be
> >> more appropriate.
> >
> > This is internal kernel function, no problem. If you prefer
> > NODATA instead RANGE I will change it.
>
> The idea was to return ENODATA to user space (see below).
>
> >>> #endif
> >>>
> >>> return temp;
> >>>
> >>> @@ -499,6 +501,8 @@ static ssize_t
> >>> i8k_hwmon_show_temp(struct device *dev,
> >>>
> >>> int temp;
> >>>
> >>> temp = i8k_get_temp(index);
> >>>
> >>> + if (temp == -ERANGE)
> >>> + return -EINVAL;
> >>
> >> and can we also return -ENODATA to user space ?
> >> This would make the code a bit cleaner.
> >>
> >> Thanks,
> >> Guenter
> >
> > There was some problems when I tested similar patch for
> > radeon.ko (do not report temperature to userspace when card
> > is turned off).
>
> You mean when returning -ENODATA to user space ?
> I tested that; it worked for me and does what we want it to do
> (the sensors command to displays N/A). This would avoid having
> to change -ERANGE to a different error code above.
>
> Guenter
Now I tested it too on Ubuntu and it working. sensors display N/A
without error message. So I will change code.
--
Pali Rohár
pali.rohar@...il.com
Download attachment "signature.asc " of type "application/pgp-signature" (199 bytes)
Powered by blists - more mailing lists