Lines Matching refs:debug_log
40 static char *batadv_log_char_addr(struct batadv_priv_debug_log *debug_log, in batadv_log_char_addr() argument
43 return &debug_log->log_buff[idx & BATADV_LOG_BUFF_MASK]; in batadv_log_char_addr()
46 static void batadv_emit_log_char(struct batadv_priv_debug_log *debug_log, in batadv_emit_log_char() argument
51 char_addr = batadv_log_char_addr(debug_log, debug_log->log_end); in batadv_emit_log_char()
53 debug_log->log_end++; in batadv_emit_log_char()
55 if (debug_log->log_end - debug_log->log_start > batadv_log_buff_len) in batadv_emit_log_char()
56 debug_log->log_start = debug_log->log_end - batadv_log_buff_len; in batadv_emit_log_char()
60 static int batadv_fdebug_log(struct batadv_priv_debug_log *debug_log, in batadv_fdebug_log() argument
67 if (!debug_log) in batadv_fdebug_log()
70 spin_lock_bh(&debug_log->lock); in batadv_fdebug_log()
76 batadv_emit_log_char(debug_log, *p); in batadv_fdebug_log()
78 spin_unlock_bh(&debug_log->lock); in batadv_fdebug_log()
80 wake_up(&debug_log->queue_wait); in batadv_fdebug_log()
104 static bool batadv_log_empty(struct batadv_priv_debug_log *debug_log) in batadv_log_empty() argument
106 return !(debug_log->log_start - debug_log->log_end); in batadv_log_empty()
113 struct batadv_priv_debug_log *debug_log = bat_priv->debug_log; in batadv_log_read() local
118 if ((file->f_flags & O_NONBLOCK) && batadv_log_empty(debug_log)) in batadv_log_read()
130 error = wait_event_interruptible(debug_log->queue_wait, in batadv_log_read()
131 (!batadv_log_empty(debug_log))); in batadv_log_read()
136 spin_lock_bh(&debug_log->lock); in batadv_log_read()
139 (debug_log->log_start != debug_log->log_end)) { in batadv_log_read()
140 char_addr = batadv_log_char_addr(debug_log, in batadv_log_read()
141 debug_log->log_start); in batadv_log_read()
144 debug_log->log_start++; in batadv_log_read()
146 spin_unlock_bh(&debug_log->lock); in batadv_log_read()
150 spin_lock_bh(&debug_log->lock); in batadv_log_read()
156 spin_unlock_bh(&debug_log->lock); in batadv_log_read()
167 struct batadv_priv_debug_log *debug_log = bat_priv->debug_log; in batadv_log_poll() local
169 poll_wait(file, &debug_log->queue_wait, wait); in batadv_log_poll()
171 if (!batadv_log_empty(debug_log)) in batadv_log_poll()
194 bat_priv->debug_log = kzalloc(sizeof(*bat_priv->debug_log), GFP_ATOMIC); in batadv_debug_log_setup()
195 if (!bat_priv->debug_log) in batadv_debug_log_setup()
198 spin_lock_init(&bat_priv->debug_log->lock); in batadv_debug_log_setup()
199 init_waitqueue_head(&bat_priv->debug_log->queue_wait); in batadv_debug_log_setup()
212 kfree(bat_priv->debug_log); in batadv_debug_log_cleanup()
213 bat_priv->debug_log = NULL; in batadv_debug_log_cleanup()
236 batadv_fdebug_log(bat_priv->debug_log, "[%10u] %pV", in batadv_debug_log()