1313#include <linux/device.h>
1414#include <linux/types.h>
1515#include <linux/delay.h>
16- #ifdef CONFIG_W1_F23_CRC
16+ #ifdef CONFIG_W1_SLAVE_DS2433_CRC
1717#include <linux/crc16.h>
1818
1919#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)
6262 return count ;
6363}
6464
65- #ifdef CONFIG_W1_F23_CRC
65+ #ifdef CONFIG_W1_SLAVE_DS2433_CRC
6666static int w1_f23_refresh_block (struct w1_slave * sl , struct w1_f23_data * data ,
6767 int block )
6868{
@@ -89,13 +89,13 @@ static int w1_f23_refresh_block(struct w1_slave *sl, struct w1_f23_data *data,
8989
9090 return 0 ;
9191}
92- #endif /* CONFIG_W1_F23_CRC */
92+ #endif /* CONFIG_W1_SLAVE_DS2433_CRC */
9393
9494static ssize_t w1_f23_read_bin (struct kobject * kobj , char * buf , loff_t off ,
9595 size_t count )
9696{
9797 struct w1_slave * sl = kobj_to_w1_slave (kobj );
98- #ifdef CONFIG_W1_F23_CRC
98+ #ifdef CONFIG_W1_SLAVE_DS2433_CRC
9999 struct w1_f23_data * data = sl -> family_data ;
100100 int i , min_page , max_page ;
101101#else
@@ -107,7 +107,7 @@ static ssize_t w1_f23_read_bin(struct kobject *kobj, char *buf, loff_t off,
107107
108108 mutex_lock (& sl -> master -> mutex );
109109
110- #ifdef CONFIG_W1_F23_CRC
110+ #ifdef CONFIG_W1_SLAVE_DS2433_CRC
111111
112112 min_page = (off >> W1_PAGE_BITS );
113113 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,
119119 }
120120 memcpy (buf , & data -> memory [off ], count );
121121
122- #else /* CONFIG_W1_F23_CRC */
122+ #else /* CONFIG_W1_SLAVE_DS2433_CRC */
123123
124124 /* read directly from the EEPROM */
125125 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,
133133 w1_write_block (sl -> master , wrbuf , 3 );
134134 w1_read_block (sl -> master , buf , count );
135135
136- #endif /* CONFIG_W1_F23_CRC */
136+ #endif /* CONFIG_W1_SLAVE_DS2433_CRC */
137137
138138out_up :
139139 mutex_unlock (& sl -> master -> mutex );
@@ -208,7 +208,7 @@ static ssize_t w1_f23_write_bin(struct kobject *kobj, char *buf, loff_t off,
208208 if ((count = w1_f23_fix_count (off , count , W1_EEPROM_SIZE )) == 0 )
209209 return 0 ;
210210
211- #ifdef CONFIG_W1_F23_CRC
211+ #ifdef CONFIG_W1_SLAVE_DS2433_CRC
212212 /* can only write full blocks in cached mode */
213213 if ((off & W1_PAGE_MASK ) || (count & W1_PAGE_MASK )) {
214214 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,
223223 return - EINVAL ;
224224 }
225225 }
226- #endif /* CONFIG_W1_F23_CRC */
226+ #endif /* CONFIG_W1_SLAVE_DS2433_CRC */
227227
228228 mutex_lock (& sl -> master -> mutex );
229229
@@ -262,7 +262,7 @@ static struct bin_attribute w1_f23_bin_attr = {
262262static int w1_f23_add_slave (struct w1_slave * sl )
263263{
264264 int err ;
265- #ifdef CONFIG_W1_F23_CRC
265+ #ifdef CONFIG_W1_SLAVE_DS2433_CRC
266266 struct w1_f23_data * data ;
267267
268268 data = kmalloc (sizeof (struct w1_f23_data ), GFP_KERNEL );
@@ -271,24 +271,24 @@ static int w1_f23_add_slave(struct w1_slave *sl)
271271 memset (data , 0 , sizeof (struct w1_f23_data ));
272272 sl -> family_data = data ;
273273
274- #endif /* CONFIG_W1_F23_CRC */
274+ #endif /* CONFIG_W1_SLAVE_DS2433_CRC */
275275
276276 err = sysfs_create_bin_file (& sl -> dev .kobj , & w1_f23_bin_attr );
277277
278- #ifdef CONFIG_W1_F23_CRC
278+ #ifdef CONFIG_W1_SLAVE_DS2433_CRC
279279 if (err )
280280 kfree (data );
281- #endif /* CONFIG_W1_F23_CRC */
281+ #endif /* CONFIG_W1_SLAVE_DS2433_CRC */
282282
283283 return err ;
284284}
285285
286286static void w1_f23_remove_slave (struct w1_slave * sl )
287287{
288- #ifdef CONFIG_W1_F23_CRC
288+ #ifdef CONFIG_W1_SLAVE_DS2433_CRC
289289 kfree (sl -> family_data );
290290 sl -> family_data = NULL ;
291- #endif /* CONFIG_W1_F23_CRC */
291+ #endif /* CONFIG_W1_SLAVE_DS2433_CRC */
292292 sysfs_remove_bin_file (& sl -> dev .kobj , & w1_f23_bin_attr );
293293}
294294
0 commit comments