diff options
author | Evgeniy Polyakov <johnpol@2ka.mipt.ru> | 2006-12-06 23:39:27 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.osdl.org> | 2006-12-07 11:39:43 -0500 |
commit | e9d55f9dbcf048a882478b437fa3f87becf8a770 (patch) | |
tree | 0f02323cb9ce17f942c078111873e33c7a09c913 /drivers | |
parent | ec0837f230e57afde65db72539e748d2a75abed0 (diff) |
[PATCH] better CONFIG_W1_SLAVE_DS2433_CRC handling
CONFIG_W1_SLAVE_DS2433_CRC can be used directly, there's no reason for the
indirection of defining a different variable in the Makefile.
Signed-off-by: Adrian Bunk <bunk@stusta.de>
Signed-off-by: Evgeniy Polyakov <johnpol@2ka.mipt.ru>
Cc: Greg KH <greg@kroah.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/w1/Makefile | 4 | ||||
-rw-r--r-- | drivers/w1/slaves/Makefile | 4 | ||||
-rw-r--r-- | drivers/w1/slaves/w1_ds2433.c | 30 |
3 files changed, 15 insertions, 23 deletions
diff --git a/drivers/w1/Makefile b/drivers/w1/Makefile index 93845a2c7c21..6bb0b54965f2 100644 --- a/drivers/w1/Makefile +++ b/drivers/w1/Makefile | |||
@@ -2,10 +2,6 @@ | |||
2 | # Makefile for the Dallas's 1-wire bus. | 2 | # Makefile for the Dallas's 1-wire bus. |
3 | # | 3 | # |
4 | 4 | ||
5 | ifeq ($(CONFIG_W1_DS2433_CRC), y) | ||
6 | EXTRA_CFLAGS += -DCONFIG_W1_F23_CRC | ||
7 | endif | ||
8 | |||
9 | obj-$(CONFIG_W1) += wire.o | 5 | obj-$(CONFIG_W1) += wire.o |
10 | wire-objs := w1.o w1_int.o w1_family.o w1_netlink.o w1_io.o | 6 | wire-objs := w1.o w1_int.o w1_family.o w1_netlink.o w1_io.o |
11 | 7 | ||
diff --git a/drivers/w1/slaves/Makefile b/drivers/w1/slaves/Makefile index 70e21e2d70c3..725dcfdfddb4 100644 --- a/drivers/w1/slaves/Makefile +++ b/drivers/w1/slaves/Makefile | |||
@@ -2,10 +2,6 @@ | |||
2 | # Makefile for the Dallas's 1-wire slaves. | 2 | # Makefile for the Dallas's 1-wire slaves. |
3 | # | 3 | # |
4 | 4 | ||
5 | ifeq ($(CONFIG_W1_SLAVE_DS2433_CRC), y) | ||
6 | EXTRA_CFLAGS += -DCONFIG_W1_F23_CRC | ||
7 | endif | ||
8 | |||
9 | obj-$(CONFIG_W1_SLAVE_THERM) += w1_therm.o | 5 | obj-$(CONFIG_W1_SLAVE_THERM) += w1_therm.o |
10 | obj-$(CONFIG_W1_SLAVE_SMEM) += w1_smem.o | 6 | obj-$(CONFIG_W1_SLAVE_SMEM) += w1_smem.o |
11 | obj-$(CONFIG_W1_SLAVE_DS2433) += w1_ds2433.o | 7 | obj-$(CONFIG_W1_SLAVE_DS2433) += w1_ds2433.o |
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 | ||