@@ -29,8 +29,6 @@ static ssize_t w1_f12_read_state(
29
29
{
30
30
u8 w1_buf [6 ] = {W1_F12_FUNC_READ_STATUS , 7 , 0 , 0 , 0 , 0 };
31
31
struct w1_slave * sl = kobj_to_w1_slave (kobj );
32
- u16 crc = 0 ;
33
- int i ;
34
32
ssize_t rtnval = 1 ;
35
33
36
34
if (off != 0 )
@@ -47,9 +45,7 @@ static ssize_t w1_f12_read_state(
47
45
48
46
w1_write_block (sl -> master , w1_buf , 3 );
49
47
w1_read_block (sl -> master , w1_buf + 3 , 3 );
50
- for (i = 0 ; i < 6 ; i ++ )
51
- crc = crc16_byte (crc , w1_buf [i ]);
52
- if (crc == 0xb001 ) /* good read? */
48
+ if (crc16 (0 , w1_buf , sizeof (w1_buf )) == 0xb001 ) /* good read? */
53
49
* buf = ((w1_buf [3 ]>>5 )& 3 )|0x30 ;
54
50
else
55
51
rtnval = - EIO ;
@@ -66,8 +62,6 @@ static ssize_t w1_f12_write_output(
66
62
{
67
63
struct w1_slave * sl = kobj_to_w1_slave (kobj );
68
64
u8 w1_buf [6 ] = {W1_F12_FUNC_WRITE_STATUS , 7 , 0 , 0 , 0 , 0 };
69
- u16 crc = 0 ;
70
- int i ;
71
65
ssize_t rtnval = 1 ;
72
66
73
67
if (count != 1 || off != 0 )
@@ -83,9 +77,7 @@ static ssize_t w1_f12_write_output(
83
77
w1_buf [3 ] = (((* buf )& 3 )<<5 )|0x1F ;
84
78
w1_write_block (sl -> master , w1_buf , 4 );
85
79
w1_read_block (sl -> master , w1_buf + 4 , 2 );
86
- for (i = 0 ; i < 6 ; i ++ )
87
- crc = crc16_byte (crc , w1_buf [i ]);
88
- if (crc == 0xb001 ) /* good read? */
80
+ if (crc16 (0 , w1_buf , sizeof (w1_buf )) == 0xb001 ) /* good read? */
89
81
w1_write_8 (sl -> master , 0xFF );
90
82
else
91
83
rtnval = - EIO ;
0 commit comments