#include <linux/delay.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/list.h>
#include <linux/interrupt.h>
#include <linux/spinlock.h>
#include <linux/timer.h>
#include <linux/device.h>
#include <linux/slab.h>
#include <linux/sched.h>
#include <linux/kthread.h>
#include <linux/freezer.h>
#include <linux/hwmon.h>
#include <linux/of.h>
#include <linux/atomic.h>
#include "w1_internal.h"
#include "w1_netlink.h"
#define W1_FAMILY_DEFAULT …
#define W1_FAMILY_DS28E04 …
static int w1_timeout = …;
module_param_named(timeout, w1_timeout, int, 0);
MODULE_PARM_DESC(…) …;
static int w1_timeout_us;
module_param_named(timeout_us, w1_timeout_us, int, 0);
MODULE_PARM_DESC(…) …;
int w1_max_slave_count = …;
module_param_named(max_slave_count, w1_max_slave_count, int, 0);
MODULE_PARM_DESC(…) …;
int w1_max_slave_ttl = …;
module_param_named(slave_ttl, w1_max_slave_ttl, int, 0);
MODULE_PARM_DESC(…) …;
DEFINE_MUTEX(…) …;
LIST_HEAD(…);
static int w1_master_probe(struct device *dev)
{ … }
static void w1_master_release(struct device *dev)
{ … }
static void w1_slave_release(struct device *dev)
{ … }
static ssize_t name_show(struct device *dev, struct device_attribute *attr, char *buf)
{ … }
static DEVICE_ATTR_RO(name);
static ssize_t id_show(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
static DEVICE_ATTR_RO(id);
static struct attribute *w1_slave_attrs[] = …;
ATTRIBUTE_GROUPS(…);
static ssize_t rw_write(struct file *filp, struct kobject *kobj,
struct bin_attribute *bin_attr, char *buf, loff_t off,
size_t count)
{ … }
static ssize_t rw_read(struct file *filp, struct kobject *kobj,
struct bin_attribute *bin_attr, char *buf, loff_t off,
size_t count)
{ … }
static BIN_ATTR_RW(rw, PAGE_SIZE);
static struct bin_attribute *w1_slave_bin_attrs[] = …;
static const struct attribute_group w1_slave_default_group = …;
static const struct attribute_group *w1_slave_default_groups[] = …;
static const struct w1_family_ops w1_default_fops = …;
static struct w1_family w1_default_family = …;
static int w1_uevent(const struct device *dev, struct kobj_uevent_env *env);
static const struct bus_type w1_bus_type = …;
struct device_driver w1_master_driver = …;
struct device w1_master_device = …;
static struct device_driver w1_slave_driver = …;
#if 0
struct device w1_slave_device = {
.parent = NULL,
.bus = &w1_bus_type,
.init_name = "w1 bus slave",
.driver = &w1_slave_driver,
.release = &w1_slave_release
};
#endif
static ssize_t w1_master_attribute_show_name(struct device *dev, struct device_attribute *attr, char *buf)
{ … }
static ssize_t w1_master_attribute_store_search(struct device * dev,
struct device_attribute *attr,
const char * buf, size_t count)
{ … }
static ssize_t w1_master_attribute_show_search(struct device *dev,
struct device_attribute *attr,
char *buf)
{ … }
static ssize_t w1_master_attribute_store_pullup(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t count)
{ … }
static ssize_t w1_master_attribute_show_pullup(struct device *dev,
struct device_attribute *attr,
char *buf)
{ … }
static ssize_t w1_master_attribute_show_pointer(struct device *dev, struct device_attribute *attr, char *buf)
{ … }
static ssize_t w1_master_attribute_show_timeout(struct device *dev, struct device_attribute *attr, char *buf)
{ … }
static ssize_t w1_master_attribute_show_timeout_us(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
static ssize_t w1_master_attribute_store_max_slave_count(struct device *dev,
struct device_attribute *attr, const char *buf, size_t count)
{ … }
static ssize_t w1_master_attribute_show_max_slave_count(struct device *dev, struct device_attribute *attr, char *buf)
{ … }
static ssize_t w1_master_attribute_show_attempts(struct device *dev, struct device_attribute *attr, char *buf)
{ … }
static ssize_t w1_master_attribute_show_slave_count(struct device *dev, struct device_attribute *attr, char *buf)
{ … }
static ssize_t w1_master_attribute_show_slaves(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
static ssize_t w1_master_attribute_show_add(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
static int w1_atoreg_num(struct device *dev, const char *buf, size_t count,
struct w1_reg_num *rn)
{ … }
struct w1_slave *w1_slave_search_device(struct w1_master *dev,
struct w1_reg_num *rn)
{ … }
static ssize_t w1_master_attribute_store_add(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t count)
{ … }
static ssize_t w1_master_attribute_show_remove(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
static ssize_t w1_master_attribute_store_remove(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t count)
{ … }
#define W1_MASTER_ATTR_RO(_name, _mode) …
#define W1_MASTER_ATTR_RW(_name, _mode) …
static W1_MASTER_ATTR_RO(name, S_IRUGO);
static W1_MASTER_ATTR_RO(slaves, S_IRUGO);
static W1_MASTER_ATTR_RO(slave_count, S_IRUGO);
static W1_MASTER_ATTR_RW(max_slave_count, S_IRUGO | S_IWUSR | S_IWGRP);
static W1_MASTER_ATTR_RO(attempts, S_IRUGO);
static W1_MASTER_ATTR_RO(timeout, S_IRUGO);
static W1_MASTER_ATTR_RO(timeout_us, S_IRUGO);
static W1_MASTER_ATTR_RO(pointer, S_IRUGO);
static W1_MASTER_ATTR_RW(search, S_IRUGO | S_IWUSR | S_IWGRP);
static W1_MASTER_ATTR_RW(pullup, S_IRUGO | S_IWUSR | S_IWGRP);
static W1_MASTER_ATTR_RW(add, S_IRUGO | S_IWUSR | S_IWGRP);
static W1_MASTER_ATTR_RW(remove, S_IRUGO | S_IWUSR | S_IWGRP);
static struct attribute *w1_master_default_attrs[] = …;
static const struct attribute_group w1_master_defattr_group = …;
int w1_create_master_attributes(struct w1_master *master)
{ … }
void w1_destroy_master_attributes(struct w1_master *master)
{ … }
static int w1_uevent(const struct device *dev, struct kobj_uevent_env *env)
{ … }
static int w1_family_notify(unsigned long action, struct w1_slave *sl)
{ … }
static int __w1_attach_slave_device(struct w1_slave *sl)
{ … }
int w1_attach_slave_device(struct w1_master *dev, struct w1_reg_num *rn)
{ … }
int w1_unref_slave(struct w1_slave *sl)
{ … }
int w1_slave_detach(struct w1_slave *sl)
{ … }
struct w1_master *w1_search_master_id(u32 id)
{ … }
struct w1_slave *w1_search_slave(struct w1_reg_num *id)
{ … }
void w1_reconnect_slaves(struct w1_family *f, int attach)
{ … }
static int w1_addr_crc_is_valid(struct w1_master *dev, u64 rn)
{ … }
void w1_slave_found(struct w1_master *dev, u64 rn)
{ … }
void w1_search(struct w1_master *dev, u8 search_type, w1_slave_found_callback cb)
{ … }
void w1_search_process_cb(struct w1_master *dev, u8 search_type,
w1_slave_found_callback cb)
{ … }
static void w1_search_process(struct w1_master *dev, u8 search_type)
{ … }
int w1_process_callbacks(struct w1_master *dev)
{ … }
int w1_process(void *data)
{ … }
static int __init w1_init(void)
{ … }
static void __exit w1_fini(void)
{ … }
module_init(…) …;
module_exit(w1_fini);
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;