#define REG_LS_BYTE …
#define REG_MS_BYTE …
#define REG_PGA_VALID …
#define REG_AD_CONTROL …
#define REG_GAIN_MUX …
#define REG_IO_STATE …
#define REG_IO_CONTROL …
#define REG_OSC_CONTROL …
#define REG_SER_CONTROL …
#define REG_ID …
#define INST_MODE_BM …
#define INST_READ_BM …
#define INST_16BIT_BM …
#define MUX_CNV_BV …
#define MUX_CNV_BM …
#define MUX_M3_BM …
#define MUX_G_BV …
#define OSC_OSCR_BM …
#define OSC_OSCE_BM …
#define OSC_REFE_BM …
#define OSC_BUFE_BM …
#define OSC_R2V_BM …
#define OSC_RBG_BM …
#include <linux/module.h>
#include <linux/init.h>
#include <linux/spi/spi.h>
#include <linux/hwmon.h>
#include <linux/hwmon-sysfs.h>
#include <linux/err.h>
#include <linux/delay.h>
#define DEVICE_NAME …
struct ads7871_data { … };
static int ads7871_read_reg8(struct spi_device *spi, int reg)
{ … }
static int ads7871_read_reg16(struct spi_device *spi, int reg)
{ … }
static int ads7871_write_reg8(struct spi_device *spi, int reg, u8 val)
{ … }
static ssize_t voltage_show(struct device *dev, struct device_attribute *da,
char *buf)
{ … }
static SENSOR_DEVICE_ATTR_RO(in0_input, voltage, 0);
static SENSOR_DEVICE_ATTR_RO(in1_input, voltage, 1);
static SENSOR_DEVICE_ATTR_RO(in2_input, voltage, 2);
static SENSOR_DEVICE_ATTR_RO(in3_input, voltage, 3);
static SENSOR_DEVICE_ATTR_RO(in4_input, voltage, 4);
static SENSOR_DEVICE_ATTR_RO(in5_input, voltage, 5);
static SENSOR_DEVICE_ATTR_RO(in6_input, voltage, 6);
static SENSOR_DEVICE_ATTR_RO(in7_input, voltage, 7);
static struct attribute *ads7871_attrs[] = …;
ATTRIBUTE_GROUPS(…);
static int ads7871_probe(struct spi_device *spi)
{ … }
static struct spi_driver ads7871_driver = …;
module_spi_driver(…) …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;