Lines Matching refs:debug_log

41 static char *batadv_log_char_addr(struct batadv_priv_debug_log *debug_log,  in batadv_log_char_addr()  argument
44 return &debug_log->log_buff[idx & BATADV_LOG_BUFF_MASK]; in batadv_log_char_addr()
47 static void batadv_emit_log_char(struct batadv_priv_debug_log *debug_log, in batadv_emit_log_char() argument
52 char_addr = batadv_log_char_addr(debug_log, debug_log->log_end); in batadv_emit_log_char()
54 debug_log->log_end++; in batadv_emit_log_char()
56 if (debug_log->log_end - debug_log->log_start > batadv_log_buff_len) in batadv_emit_log_char()
57 debug_log->log_start = debug_log->log_end - batadv_log_buff_len; in batadv_emit_log_char()
61 static int batadv_fdebug_log(struct batadv_priv_debug_log *debug_log, in batadv_fdebug_log() argument
68 if (!debug_log) in batadv_fdebug_log()
71 spin_lock_bh(&debug_log->lock); in batadv_fdebug_log()
77 batadv_emit_log_char(debug_log, *p); in batadv_fdebug_log()
79 spin_unlock_bh(&debug_log->lock); in batadv_fdebug_log()
81 wake_up(&debug_log->queue_wait); in batadv_fdebug_log()
93 batadv_fdebug_log(bat_priv->debug_log, "[%10u] %s", in batadv_debug_log()
116 static int batadv_log_empty(struct batadv_priv_debug_log *debug_log) in batadv_log_empty() argument
118 return !(debug_log->log_start - debug_log->log_end); in batadv_log_empty()
125 struct batadv_priv_debug_log *debug_log = bat_priv->debug_log; in batadv_log_read() local
130 if ((file->f_flags & O_NONBLOCK) && batadv_log_empty(debug_log)) in batadv_log_read()
142 error = wait_event_interruptible(debug_log->queue_wait, in batadv_log_read()
143 (!batadv_log_empty(debug_log))); in batadv_log_read()
148 spin_lock_bh(&debug_log->lock); in batadv_log_read()
151 (debug_log->log_start != debug_log->log_end)) { in batadv_log_read()
152 char_addr = batadv_log_char_addr(debug_log, in batadv_log_read()
153 debug_log->log_start); in batadv_log_read()
156 debug_log->log_start++; in batadv_log_read()
158 spin_unlock_bh(&debug_log->lock); in batadv_log_read()
162 spin_lock_bh(&debug_log->lock); in batadv_log_read()
168 spin_unlock_bh(&debug_log->lock); in batadv_log_read()
179 struct batadv_priv_debug_log *debug_log = bat_priv->debug_log; in batadv_log_poll() local
181 poll_wait(file, &debug_log->queue_wait, wait); in batadv_log_poll()
183 if (!batadv_log_empty(debug_log)) in batadv_log_poll()
204 bat_priv->debug_log = kzalloc(sizeof(*bat_priv->debug_log), GFP_ATOMIC); in batadv_debug_log_setup()
205 if (!bat_priv->debug_log) in batadv_debug_log_setup()
208 spin_lock_init(&bat_priv->debug_log->lock); in batadv_debug_log_setup()
209 init_waitqueue_head(&bat_priv->debug_log->queue_wait); in batadv_debug_log_setup()
225 kfree(bat_priv->debug_log); in batadv_debug_log_cleanup()
226 bat_priv->debug_log = NULL; in batadv_debug_log_cleanup()