@@ -154,13 +154,13 @@ static int hardwareInit(void)
154
154
/* Reset and wait until rngb is sleeping */
155
155
* (common_rngb .base + rng_cmd ) = 0x40 ;
156
156
do {
157
- err = * (common_rngb .base + rng_sr ) & 0x04 ;
157
+ err = * (common_rngb .base + rng_sr ) & 0x4 ;
158
158
} while (err == 0 );
159
159
160
160
interrupt (RNGB_IRQ , rngb_intr , NULL , common_rngb .cond , NULL );
161
161
162
162
/* Run self test */
163
- * (common_rngb .base + rng_cmd ) = 0x01 ;
163
+ * (common_rngb .base + rng_cmd ) = 0x1 ;
164
164
mutexLock (common_rngb .lock );
165
165
while (common_rngb .intr_st == 0 ) {
166
166
condWait (common_rngb .cond , common_rngb .lock , 3000 );
@@ -177,7 +177,7 @@ static int hardwareInit(void)
177
177
common_rngb .intr_st = 0 ;
178
178
179
179
/* Run seeding */
180
- * (common_rngb .base + rng_cmd ) = 0x02 ;
180
+ * (common_rngb .base + rng_cmd ) = 0x2 ;
181
181
mutexLock (common_rngb .lock );
182
182
while (common_rngb .intr_st == 0 ) {
183
183
condWait (common_rngb .cond , common_rngb .lock , 3000 );
@@ -196,7 +196,7 @@ static int hardwareInit(void)
196
196
/* Enable automatic seeding */
197
197
* (common_rngb .base + rng_cr ) = 0x10 ;
198
198
199
- printf ("imx6ull-rngb: initialized\n" );
199
+ printf ("imx6ull-rngb: initialized\n" );
200
200
201
201
return 0 ;
202
202
}
@@ -220,7 +220,7 @@ static int readRandoms(char *buff, size_t size, unsigned mode)
220
220
while (i < size ) {
221
221
if ((i % sizeof (uint32_t )) == 0 ) {
222
222
status = * (common_rngb .base + rng_sr );
223
- if ((status & ( 1 << 16 )) == 1 ) {
223
+ if ((( status >> 16 ) & 1U ) == 1 ) {
224
224
mutexUnlock (common_rngb .lock );
225
225
return - EIO ;
226
226
}
0 commit comments