Lines Matching refs:debug_log
37 #define LOG_BUFF(idx) (debug_log->log_buff[(idx) & LOG_BUFF_MASK])
41 static void emit_log_char(struct debug_log *debug_log, char c)
43 LOG_BUFF(debug_log->log_end) = c;
44 debug_log->log_end++;
46 if (debug_log->log_end - debug_log->log_start > log_buff_len)
47 debug_log->log_start = debug_log->log_end - log_buff_len;
50 static int fdebug_log(struct debug_log *debug_log, char *fmt, ...)
58 if (!debug_log)
61 spin_lock_irqsave(&debug_log->lock, flags);
68 emit_log_char(debug_log, *p);
70 spin_unlock_irqrestore(&debug_log->lock, flags);
72 wake_up(&debug_log->queue_wait);
77 int debug_log(struct bat_priv *bat_priv, char *fmt, ...)
84 fdebug_log(bat_priv->debug_log, "[%10u] %s",
108 struct debug_log *debug_log = bat_priv->debug_log;
114 !(debug_log->log_end - debug_log->log_start))
126 error = wait_event_interruptible(debug_log->queue_wait,
127 (debug_log->log_start - debug_log->log_end));
132 spin_lock_irqsave(&debug_log->lock, flags);
135 (debug_log->log_start != debug_log->log_end)) {
136 c = LOG_BUFF(debug_log->log_start);
138 debug_log->log_start++;
140 spin_unlock_irqrestore(&debug_log->lock, flags);
144 spin_lock_irqsave(&debug_log->lock, flags);
151 spin_unlock_irqrestore(&debug_log->lock, flags);
162 struct debug_log *debug_log = bat_priv->debug_log;
164 poll_wait(file, &debug_log->queue_wait, wait);
166 if (debug_log->log_end - debug_log->log_start)
186 bat_priv->debug_log = kzalloc(sizeof(struct debug_log), GFP_ATOMIC);
187 if (!bat_priv->debug_log)
190 spin_lock_init(&bat_priv->debug_log->lock);
191 init_waitqueue_head(&bat_priv->debug_log->queue_wait);
206 kfree(bat_priv->debug_log);
207 bat_priv->debug_log = NULL;
212 bat_priv->debug_log = NULL;