#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/err.h>
#include <linux/slab.h>
#include <linux/i2c.h>
#include <linux/hwmon.h>
#include <linux/hwmon-sysfs.h>
#include <linux/jiffies.h>
#include <linux/regmap.h>
#define LTC4260_CONTROL …
#define LTC4260_ALERT …
#define LTC4260_STATUS …
#define LTC4260_FAULT …
#define LTC4260_SENSE …
#define LTC4260_SOURCE …
#define LTC4260_ADIN …
#define FAULT_OV …
#define FAULT_UV …
#define FAULT_OC …
#define FAULT_POWER_BAD …
#define FAULT_FET_SHORT …
static int ltc4260_get_value(struct device *dev, u8 reg)
{ … }
static ssize_t ltc4260_value_show(struct device *dev,
struct device_attribute *da, char *buf)
{ … }
static ssize_t ltc4260_bool_show(struct device *dev,
struct device_attribute *da, char *buf)
{ … }
static SENSOR_DEVICE_ATTR_RO(in1_input, ltc4260_value, LTC4260_SOURCE);
static SENSOR_DEVICE_ATTR_RO(in2_input, ltc4260_value, LTC4260_ADIN);
static SENSOR_DEVICE_ATTR_RO(in1_min_alarm, ltc4260_bool, FAULT_UV);
static SENSOR_DEVICE_ATTR_RO(in1_max_alarm, ltc4260_bool, FAULT_OV);
static SENSOR_DEVICE_ATTR_RO(in2_alarm, ltc4260_bool,
FAULT_POWER_BAD | FAULT_FET_SHORT);
static SENSOR_DEVICE_ATTR_RO(curr1_input, ltc4260_value, LTC4260_SENSE);
static SENSOR_DEVICE_ATTR_RO(curr1_max_alarm, ltc4260_bool, FAULT_OC);
static struct attribute *ltc4260_attrs[] = …;
ATTRIBUTE_GROUPS(…);
static const struct regmap_config ltc4260_regmap_config = …;
static int ltc4260_probe(struct i2c_client *client)
{ … }
static const struct i2c_device_id ltc4260_id[] = …;
MODULE_DEVICE_TABLE(i2c, ltc4260_id);
static struct i2c_driver ltc4260_driver = …;
module_i2c_driver(…) …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;