#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>
enum ltc4215_cmd { … };
struct ltc4215_data { … };
static struct ltc4215_data *ltc4215_update_device(struct device *dev)
{ … }
static int ltc4215_get_voltage(struct device *dev, u8 reg)
{ … }
static unsigned int ltc4215_get_current(struct device *dev)
{ … }
static ssize_t ltc4215_voltage_show(struct device *dev,
struct device_attribute *da, char *buf)
{ … }
static ssize_t ltc4215_current_show(struct device *dev,
struct device_attribute *da, char *buf)
{ … }
static ssize_t ltc4215_power_show(struct device *dev,
struct device_attribute *da, char *buf)
{ … }
static ssize_t ltc4215_alarm_show(struct device *dev,
struct device_attribute *da, char *buf)
{ … }
static SENSOR_DEVICE_ATTR_RO(curr1_input, ltc4215_current, 0);
static SENSOR_DEVICE_ATTR_RO(curr1_max_alarm, ltc4215_alarm, 1 << 2);
static SENSOR_DEVICE_ATTR_RO(power1_input, ltc4215_power, 0);
static SENSOR_DEVICE_ATTR_RO(in1_input, ltc4215_voltage, LTC4215_ADIN);
static SENSOR_DEVICE_ATTR_RO(in1_max_alarm, ltc4215_alarm, 1 << 0);
static SENSOR_DEVICE_ATTR_RO(in1_min_alarm, ltc4215_alarm, 1 << 1);
static SENSOR_DEVICE_ATTR_RO(in2_input, ltc4215_voltage, LTC4215_SOURCE);
static SENSOR_DEVICE_ATTR_RO(in2_min_alarm, ltc4215_alarm, 1 << 3);
static struct attribute *ltc4215_attrs[] = …;
ATTRIBUTE_GROUPS(…);
static int ltc4215_probe(struct i2c_client *client)
{ … }
static const struct i2c_device_id ltc4215_id[] = …;
MODULE_DEVICE_TABLE(i2c, ltc4215_id);
static struct i2c_driver ltc4215_driver = …;
module_i2c_driver(…) …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;