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@gmail.com