diff options
Diffstat (limited to 'drivers/w1/slaves/w1_ds2433.c')
-rw-r--r-- | drivers/w1/slaves/w1_ds2433.c | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/drivers/w1/slaves/w1_ds2433.c b/drivers/w1/slaves/w1_ds2433.c index 2ac238f1480e..8ea17a53eed8 100644 --- a/drivers/w1/slaves/w1_ds2433.c +++ b/drivers/w1/slaves/w1_ds2433.c | |||
@@ -13,7 +13,7 @@ | |||
13 | #include <linux/device.h> | 13 | #include <linux/device.h> |
14 | #include <linux/types.h> | 14 | #include <linux/types.h> |
15 | #include <linux/delay.h> | 15 | #include <linux/delay.h> |
16 | #ifdef CONFIG_W1_F23_CRC | 16 | #ifdef CONFIG_W1_SLAVE_DS2433_CRC |
17 | #include <linux/crc16.h> | 17 | #include <linux/crc16.h> |
18 | 18 | ||
19 | #define CRC16_INIT 0 | 19 | #define CRC16_INIT 0 |
@@ -62,7 +62,7 @@ static inline size_t w1_f23_fix_count(loff_t off, size_t count, size_t size) | |||
62 | return count; | 62 | return count; |
63 | } | 63 | } |
64 | 64 | ||
65 | #ifdef CONFIG_W1_F23_CRC | 65 | #ifdef CONFIG_W1_SLAVE_DS2433_CRC |
66 | static int w1_f23_refresh_block(struct w1_slave *sl, struct w1_f23_data *data, | 66 | static int w1_f23_refresh_block(struct w1_slave *sl, struct w1_f23_data *data, |
67 | int block) | 67 | int block) |
68 | { | 68 | { |
@@ -89,13 +89,13 @@ static int w1_f23_refresh_block(struct w1_slave *sl, struct w1_f23_data *data, | |||
89 | 89 | ||
90 | return 0; | 90 | return 0; |
91 | } | 91 | } |
92 | #endif /* CONFIG_W1_F23_CRC */ | 92 | #endif /* CONFIG_W1_SLAVE_DS2433_CRC */ |
93 | 93 | ||
94 | static ssize_t w1_f23_read_bin(struct kobject *kobj, char *buf, loff_t off, | 94 | static ssize_t w1_f23_read_bin(struct kobject *kobj, char *buf, loff_t off, |
95 | size_t count) | 95 | size_t count) |
96 | { | 96 | { |
97 | struct w1_slave *sl = kobj_to_w1_slave(kobj); | 97 | struct w1_slave *sl = kobj_to_w1_slave(kobj); |
98 | #ifdef CONFIG_W1_F23_CRC | 98 | #ifdef CONFIG_W1_SLAVE_DS2433_CRC |
99 | struct w1_f23_data *data = sl->family_data; | 99 | struct w1_f23_data *data = sl->family_data; |
100 | int i, min_page, max_page; | 100 | int i, min_page, max_page; |
101 | #else | 101 | #else |
@@ -107,7 +107,7 @@ static ssize_t w1_f23_read_bin(struct kobject *kobj, char *buf, loff_t off, | |||
107 | 107 | ||
108 | mutex_lock(&sl->master->mutex); | 108 | mutex_lock(&sl->master->mutex); |
109 | 109 | ||
110 | #ifdef CONFIG_W1_F23_CRC | 110 | #ifdef CONFIG_W1_SLAVE_DS2433_CRC |
111 | 111 | ||
112 | min_page = (off >> W1_PAGE_BITS); | 112 | min_page = (off >> W1_PAGE_BITS); |
113 | max_page = (off + count - 1) >> W1_PAGE_BITS; | 113 | max_page = (off + count - 1) >> W1_PAGE_BITS; |
@@ -119,7 +119,7 @@ static ssize_t w1_f23_read_bin(struct kobject *kobj, char *buf, loff_t off, | |||
119 | } | 119 | } |
120 | memcpy(buf, &data->memory[off], count); | 120 | memcpy(buf, &data->memory[off], count); |
121 | 121 | ||
122 | #else /* CONFIG_W1_F23_CRC */ | 122 | #else /* CONFIG_W1_SLAVE_DS2433_CRC */ |
123 | 123 | ||
124 | /* read directly from the EEPROM */ | 124 | /* read directly from the EEPROM */ |
125 | if (w1_reset_select_slave(sl)) { | 125 | if (w1_reset_select_slave(sl)) { |
@@ -133,7 +133,7 @@ static ssize_t w1_f23_read_bin(struct kobject *kobj, char *buf, loff_t off, | |||
133 | w1_write_block(sl->master, wrbuf, 3); | 133 | w1_write_block(sl->master, wrbuf, 3); |
134 | w1_read_block(sl->master, buf, count); | 134 | w1_read_block(sl->master, buf, count); |
135 | 135 | ||
136 | #endif /* CONFIG_W1_F23_CRC */ | 136 | #endif /* CONFIG_W1_SLAVE_DS2433_CRC */ |
137 | 137 | ||
138 | out_up: | 138 | out_up: |
139 | mutex_unlock(&sl->master->mutex); | 139 | mutex_unlock(&sl->master->mutex); |
@@ -208,7 +208,7 @@ static ssize_t w1_f23_write_bin(struct kobject *kobj, char *buf, loff_t off, | |||
208 | if ((count = w1_f23_fix_count(off, count, W1_EEPROM_SIZE)) == 0) | 208 | if ((count = w1_f23_fix_count(off, count, W1_EEPROM_SIZE)) == 0) |
209 | return 0; | 209 | return 0; |
210 | 210 | ||
211 | #ifdef CONFIG_W1_F23_CRC | 211 | #ifdef CONFIG_W1_SLAVE_DS2433_CRC |
212 | /* can only write full blocks in cached mode */ | 212 | /* can only write full blocks in cached mode */ |
213 | if ((off & W1_PAGE_MASK) || (count & W1_PAGE_MASK)) { | 213 | if ((off & W1_PAGE_MASK) || (count & W1_PAGE_MASK)) { |
214 | dev_err(&sl->dev, "invalid offset/count off=%d cnt=%zd\n", | 214 | dev_err(&sl->dev, "invalid offset/count off=%d cnt=%zd\n", |
@@ -223,7 +223,7 @@ static ssize_t w1_f23_write_bin(struct kobject *kobj, char *buf, loff_t off, | |||
223 | return -EINVAL; | 223 | return -EINVAL; |
224 | } | 224 | } |
225 | } | 225 | } |
226 | #endif /* CONFIG_W1_F23_CRC */ | 226 | #endif /* CONFIG_W1_SLAVE_DS2433_CRC */ |
227 | 227 | ||
228 | mutex_lock(&sl->master->mutex); | 228 | mutex_lock(&sl->master->mutex); |
229 | 229 | ||
@@ -262,7 +262,7 @@ static struct bin_attribute w1_f23_bin_attr = { | |||
262 | static int w1_f23_add_slave(struct w1_slave *sl) | 262 | static int w1_f23_add_slave(struct w1_slave *sl) |
263 | { | 263 | { |
264 | int err; | 264 | int err; |
265 | #ifdef CONFIG_W1_F23_CRC | 265 | #ifdef CONFIG_W1_SLAVE_DS2433_CRC |
266 | struct w1_f23_data *data; | 266 | struct w1_f23_data *data; |
267 | 267 | ||
268 | data = kmalloc(sizeof(struct w1_f23_data), GFP_KERNEL); | 268 | data = kmalloc(sizeof(struct w1_f23_data), GFP_KERNEL); |
@@ -271,24 +271,24 @@ static int w1_f23_add_slave(struct w1_slave *sl) | |||
271 | memset(data, 0, sizeof(struct w1_f23_data)); | 271 | memset(data, 0, sizeof(struct w1_f23_data)); |
272 | sl->family_data = data; | 272 | sl->family_data = data; |
273 | 273 | ||
274 | #endif /* CONFIG_W1_F23_CRC */ | 274 | #endif /* CONFIG_W1_SLAVE_DS2433_CRC */ |
275 | 275 | ||
276 | err = sysfs_create_bin_file(&sl->dev.kobj, &w1_f23_bin_attr); | 276 | err = sysfs_create_bin_file(&sl->dev.kobj, &w1_f23_bin_attr); |
277 | 277 | ||
278 | #ifdef CONFIG_W1_F23_CRC | 278 | #ifdef CONFIG_W1_SLAVE_DS2433_CRC |
279 | if (err) | 279 | if (err) |
280 | kfree(data); | 280 | kfree(data); |
281 | #endif /* CONFIG_W1_F23_CRC */ | 281 | #endif /* CONFIG_W1_SLAVE_DS2433_CRC */ |
282 | 282 | ||
283 | return err; | 283 | return err; |
284 | } | 284 | } |
285 | 285 | ||
286 | static void w1_f23_remove_slave(struct w1_slave *sl) | 286 | static void w1_f23_remove_slave(struct w1_slave *sl) |
287 | { | 287 | { |
288 | #ifdef CONFIG_W1_F23_CRC | 288 | #ifdef CONFIG_W1_SLAVE_DS2433_CRC |
289 | kfree(sl->family_data); | 289 | kfree(sl->family_data); |
290 | sl->family_data = NULL; | 290 | sl->family_data = NULL; |
291 | #endif /* CONFIG_W1_F23_CRC */ | 291 | #endif /* CONFIG_W1_SLAVE_DS2433_CRC */ |
292 | sysfs_remove_bin_file(&sl->dev.kobj, &w1_f23_bin_attr); | 292 | sysfs_remove_bin_file(&sl->dev.kobj, &w1_f23_bin_attr); |
293 | } | 293 | } |
294 | 294 | ||