@@ -69,13 +69,14 @@ static void produce_data(unsigned char val)
69
69
if (kfifo_is_full (& rx_fifo )) {
70
70
unsigned char dummy ;
71
71
len = kfifo_out (& rx_fifo , & dummy , sizeof (dummy ));
72
- if (len != sizeof (dummy ))
73
- pr_warn ("Failed to remove the oldest element (%u bytes)\n" , len );
72
+ if (unlikely (len != sizeof (dummy )))
73
+ pr_warn_ratelimited (
74
+ "Failed to remove the oldest element (%u bytes)\n" , len );
74
75
}
75
-
76
76
len = kfifo_in (& rx_fifo , & val , sizeof (val ));
77
- if (unlikely (len < sizeof (val )) && printk_ratelimit ())
78
- pr_warn ("%s: %zu bytes dropped\n" , __func__ , sizeof (val ) - len );
77
+ if (unlikely (len < sizeof (val )))
78
+ pr_warn_ratelimited ("%s: %zu bytes dropped\n" , __func__ ,
79
+ sizeof (val ) - len );
79
80
80
81
pr_debug ("simrupt: %s: in %u/%u bytes\n" , __func__ , len ,
81
82
kfifo_len (& rx_fifo ));
@@ -225,8 +226,8 @@ static void process_data(void)
225
226
226
227
pr_info ("simrupt: [CPU#%d] produce data\n" , smp_processor_id ());
227
228
int ret = fast_buf_put (update_simrupt_data ());
228
- if (unlikely (ret < 0 ) && printk_ratelimit () )
229
- pr_warn ("simrupt: fast_buf is full, dropping data\n" );
229
+ if (unlikely (ret < 0 ))
230
+ pr_warn_ratelimited ("simrupt: fast_buf is full, dropping data\n" );
230
231
231
232
pr_info ("simrupt: [CPU#%d] scheduling tasklet\n" , smp_processor_id ());
232
233
tasklet_schedule (& simrupt_tasklet );
0 commit comments