#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/err.h>
#include <linux/hwmon.h>
#include <linux/hwmon-sysfs.h>
#include <linux/spi/spi.h>
#include <linux/slab.h>
enum chips { … };
#define MAX1111_TX_BUF_SIZE …
#define MAX1111_RX_BUF_SIZE …
#define MAX1111_CTRL_PD0 …
#define MAX1111_CTRL_PD1 …
#define MAX1111_CTRL_SGL …
#define MAX1111_CTRL_UNI …
#define MAX1110_CTRL_SEL_SH …
#define MAX1111_CTRL_SEL_SH …
#define MAX1111_CTRL_STR …
struct max1111_data { … };
static int max1111_read(struct device *dev, int channel)
{ … }
#ifdef CONFIG_SHARPSL_PM
static struct max1111_data *the_max1111;
int max1111_read_channel(int channel);
int max1111_read_channel(int channel)
{
if (!the_max1111 || !the_max1111->spi)
return -ENODEV;
return max1111_read(&the_max1111->spi->dev, channel);
}
EXPORT_SYMBOL(max1111_read_channel);
#endif
static ssize_t name_show(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
static ssize_t show_adc(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
#define MAX1111_ADC_ATTR(_id) …
static DEVICE_ATTR_RO(name);
static MAX1111_ADC_ATTR(0);
static MAX1111_ADC_ATTR(1);
static MAX1111_ADC_ATTR(2);
static MAX1111_ADC_ATTR(3);
static MAX1111_ADC_ATTR(4);
static MAX1111_ADC_ATTR(5);
static MAX1111_ADC_ATTR(6);
static MAX1111_ADC_ATTR(7);
static struct attribute *max1111_attributes[] = …;
static const struct attribute_group max1111_attr_group = …;
static struct attribute *max1110_attributes[] = …;
static const struct attribute_group max1110_attr_group = …;
static int setup_transfer(struct max1111_data *data)
{ … }
static int max1111_probe(struct spi_device *spi)
{ … }
static void max1111_remove(struct spi_device *spi)
{ … }
static const struct spi_device_id max1111_ids[] = …;
MODULE_DEVICE_TABLE(spi, max1111_ids);
static struct spi_driver max1111_driver = …;
module_spi_driver(…) …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;