#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/init.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>
#define LTC4261_STATUS …
#define LTC4261_FAULT …
#define LTC4261_ALERT …
#define LTC4261_CONTROL …
#define LTC4261_SENSE_H …
#define LTC4261_SENSE_L …
#define LTC4261_ADIN2_H …
#define LTC4261_ADIN2_L …
#define LTC4261_ADIN_H …
#define LTC4261_ADIN_L …
#define FAULT_OV …
#define FAULT_UV …
#define FAULT_OC …
struct ltc4261_data { … };
static struct ltc4261_data *ltc4261_update_device(struct device *dev)
{ … }
static int ltc4261_get_value(struct ltc4261_data *data, u8 reg)
{ … }
static ssize_t ltc4261_value_show(struct device *dev,
struct device_attribute *da, char *buf)
{ … }
static ssize_t ltc4261_bool_show(struct device *dev,
struct device_attribute *da, char *buf)
{ … }
static SENSOR_DEVICE_ATTR_RO(in1_input, ltc4261_value, LTC4261_ADIN_H);
static SENSOR_DEVICE_ATTR_RO(in2_input, ltc4261_value, LTC4261_ADIN2_H);
static SENSOR_DEVICE_ATTR_RO(in1_min_alarm, ltc4261_bool, FAULT_UV);
static SENSOR_DEVICE_ATTR_RO(in1_max_alarm, ltc4261_bool, FAULT_OV);
static SENSOR_DEVICE_ATTR_RO(in2_min_alarm, ltc4261_bool, FAULT_UV);
static SENSOR_DEVICE_ATTR_RO(in2_max_alarm, ltc4261_bool, FAULT_OV);
static SENSOR_DEVICE_ATTR_RO(curr1_input, ltc4261_value, LTC4261_SENSE_H);
static SENSOR_DEVICE_ATTR_RO(curr1_max_alarm, ltc4261_bool, FAULT_OC);
static struct attribute *ltc4261_attrs[] = …;
ATTRIBUTE_GROUPS(…);
static int ltc4261_probe(struct i2c_client *client)
{ … }
static const struct i2c_device_id ltc4261_id[] = …;
MODULE_DEVICE_TABLE(i2c, ltc4261_id);
static struct i2c_driver ltc4261_driver = …;
module_i2c_driver(…) …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;