On Mon, Nov 27, 2017 at 09:54:44AM -0600, Eddie James wrote: > Hi Guenter, > > We're having a problem with overflowing signed 32 bit integers for reading > some hwmon attributes: > > struct hwmon_ops { umode_t (*is_visible)(const void *drvdata, enum > hwmon_sensor_types type, u32 attr, int channel); int (*read)(struct device > *dev, enum hwmon_sensor_types type, u32 attr, int channel, long *val); int > (*read_string)(struct device *dev, enum hwmon_sensor_types type, u32 attr, > int channel, const char **str); int (*write)(struct device *dev, enum > hwmon_sensor_types type, u32 attr, int channel, long val); }; > > Specifically, power values in micro-watts (about 2200 watts will overflow > the value - imagine multiple processors and a number of GPUs...). What do > you suggest in this case? > > This is relevant for our OCC driver; thanks for the comments btw. In our OCC > driver, we have custom sysfs entries for power, and so can return a string > with "%llx" to deal with this. But of course, the user space client, based > on the hwmon API, can't handle it. > > Appreciate any suggestions. > The easiest solution might be to expand the API with an optional function pointer to return 64 bit values. The hwmon core would then call either one or the other function. Guenter > Thanks, > Eddie > -- To unsubscribe from this list: send the line "unsubscribe linux-hwmon" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html