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


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to