Example #1
0
static ssize_t i2c_dev_show_cpu_temp(struct device *dev,
                                     struct device_attribute *attr,
                                     char *buf)
{
  int ret_val;

  ret_val = i2c_dev_read_byte(dev, attr);
  if (ret_val < 0) {
    return ret_val;
  }
  return scnprintf(buf, PAGE_SIZE, "%u\n", ret_val);
}
Example #2
0
static ssize_t fancpld_fan_rpm_show(struct device *dev,
                                    struct device_attribute *attr,
                                    char *buf)
{
  int val;

  val = i2c_dev_read_byte(dev, attr);
  if (val < 0) {
    return val;
  }
  /* Multiply by 150 to get the RPM */
  val *= 150;

  return scnprintf(buf, PAGE_SIZE, "%u\n", val);
}