diff options
Diffstat (limited to 'drivers/w1/w1_smem.c')
-rw-r--r-- | drivers/w1/w1_smem.c | 49 |
1 files changed, 0 insertions, 49 deletions
diff --git a/drivers/w1/w1_smem.c b/drivers/w1/w1_smem.c index 70d2d469963c..e3209d0aca9b 100644 --- a/drivers/w1/w1_smem.c +++ b/drivers/w1/w1_smem.c | |||
@@ -36,61 +36,12 @@ MODULE_LICENSE("GPL"); | |||
36 | MODULE_AUTHOR("Evgeniy Polyakov <johnpol@2ka.mipt.ru>"); | 36 | MODULE_AUTHOR("Evgeniy Polyakov <johnpol@2ka.mipt.ru>"); |
37 | MODULE_DESCRIPTION("Driver for 1-wire Dallas network protocol, 64bit memory family."); | 37 | MODULE_DESCRIPTION("Driver for 1-wire Dallas network protocol, 64bit memory family."); |
38 | 38 | ||
39 | static ssize_t w1_smem_read_name(struct device *, struct device_attribute *attr, char *); | ||
40 | static ssize_t w1_smem_read_bin(struct kobject *, char *, loff_t, size_t); | ||
41 | |||
42 | static struct w1_family_ops w1_smem_fops = { | ||
43 | .rname = &w1_smem_read_name, | ||
44 | .rbin = &w1_smem_read_bin, | ||
45 | }; | ||
46 | |||
47 | static ssize_t w1_smem_read_name(struct device *dev, struct device_attribute *attr, char *buf) | ||
48 | { | ||
49 | struct w1_slave *sl = container_of(dev, struct w1_slave, dev); | ||
50 | |||
51 | return sprintf(buf, "%s\n", sl->name); | ||
52 | } | ||
53 | |||
54 | static ssize_t w1_smem_read_bin(struct kobject *kobj, char *buf, loff_t off, size_t count) | ||
55 | { | ||
56 | struct w1_slave *sl = container_of(container_of(kobj, struct device, kobj), | ||
57 | struct w1_slave, dev); | ||
58 | int i; | ||
59 | |||
60 | atomic_inc(&sl->refcnt); | ||
61 | if (down_interruptible(&sl->master->mutex)) { | ||
62 | count = 0; | ||
63 | goto out_dec; | ||
64 | } | ||
65 | |||
66 | if (off > W1_SLAVE_DATA_SIZE) { | ||
67 | count = 0; | ||
68 | goto out; | ||
69 | } | ||
70 | if (off + count > W1_SLAVE_DATA_SIZE) { | ||
71 | count = 0; | ||
72 | goto out; | ||
73 | } | ||
74 | for (i = 0; i < 8; ++i) | ||
75 | count += sprintf(buf + count, "%02x ", ((u8 *)&sl->reg_num)[i]); | ||
76 | count += sprintf(buf + count, "\n"); | ||
77 | |||
78 | out: | ||
79 | up(&sl->master->mutex); | ||
80 | out_dec: | ||
81 | atomic_dec(&sl->refcnt); | ||
82 | |||
83 | return count; | ||
84 | } | ||
85 | |||
86 | static struct w1_family w1_smem_family_01 = { | 39 | static struct w1_family w1_smem_family_01 = { |
87 | .fid = W1_FAMILY_SMEM_01, | 40 | .fid = W1_FAMILY_SMEM_01, |
88 | .fops = &w1_smem_fops, | ||
89 | }; | 41 | }; |
90 | 42 | ||
91 | static struct w1_family w1_smem_family_81 = { | 43 | static struct w1_family w1_smem_family_81 = { |
92 | .fid = W1_FAMILY_SMEM_81, | 44 | .fid = W1_FAMILY_SMEM_81, |
93 | .fops = &w1_smem_fops, | ||
94 | }; | 45 | }; |
95 | 46 | ||
96 | static int __init w1_smem_init(void) | 47 | static int __init w1_smem_init(void) |