summaryrefslogtreecommitdiff
path: root/drivers/hwmon/occ/common.h
diff options
context:
space:
mode:
authorEddie James <eajames@linux.vnet.ibm.com>2018-11-08 15:05:28 -0600
committerGuenter Roeck <linux@roeck-us.net>2018-12-16 15:13:09 -0800
commit54076cb3b5ff21f6474f5fd254a0b018b24771df (patch)
tree35728c56d5b526fd174c577a1ff8cc2c35f69b5a /drivers/hwmon/occ/common.h
parentc10e753d43ebd1d17e1c62bcee20c6124c2c7cca (diff)
hwmon (occ): Add sensor attributes and register hwmon device
Setup the sensor attributes for every OCC sensor found by the first poll response. Register the attributes with hwmon. Signed-off-by: Eddie James <eajames@linux.ibm.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'drivers/hwmon/occ/common.h')
-rw-r--r--drivers/hwmon/occ/common.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/drivers/hwmon/occ/common.h b/drivers/hwmon/occ/common.h
index a363462f5f30..9d01973d93d8 100644
--- a/drivers/hwmon/occ/common.h
+++ b/drivers/hwmon/occ/common.h
@@ -3,7 +3,9 @@
#ifndef OCC_COMMON_H
#define OCC_COMMON_H
+#include <linux/hwmon-sysfs.h>
#include <linux/mutex.h>
+#include <linux/sysfs.h>
struct device;
@@ -76,6 +78,15 @@ struct occ_sensors {
struct occ_sensor extended;
};
+/*
+ * Use our own attribute struct so we can dynamically allocate space for the
+ * name.
+ */
+struct occ_attribute {
+ char name[32];
+ struct sensor_device_attribute_2 sensor;
+};
+
struct occ {
struct device *bus_dev;
@@ -88,6 +99,11 @@ struct occ {
unsigned long last_update;
struct mutex lock; /* lock OCC access */
+
+ struct device *hwmon;
+ struct occ_attribute *attrs;
+ struct attribute_group group;
+ const struct attribute_group *groups[2];
};
int occ_setup(struct occ *occ, const char *name);