@@ -470,12 +470,6 @@ static bool tcpm_port_is_disconnected(struct tcpm_port *port)
#ifdef CONFIG_DEBUG_FS
-static bool tcpm_log_full(struct tcpm_port *port)
-{
- return port->logbuffer_tail ==
- (port->logbuffer_head + 1) % LOG_BUFFER_ENTRIES;
-}
-
__printf(2, 0)
static void _tcpm_log(struct tcpm_port *port, const char *fmt, va_list args)
{
@@ -495,11 +489,6 @@ static void _tcpm_log(struct tcpm_port *port, const char *fmt, va_list args)
vsnprintf(tmpbuffer, sizeof(tmpbuffer), fmt, args);
- if (tcpm_log_full(port)) {
- port->logbuffer_head = max(port->logbuffer_head - 1, 0);
- strcpy(tmpbuffer, "overflow");
- }
-
if (port->logbuffer_head < 0 ||
port->logbuffer_head >= LOG_BUFFER_ENTRIES) {
dev_warn(port->dev,
@@ -519,6 +508,9 @@ static void _tcpm_log(struct tcpm_port *port, const char *fmt, va_list args)
(unsigned long)ts_nsec, rem_nsec / 1000,
tmpbuffer);
port->logbuffer_head = (port->logbuffer_head + 1) % LOG_BUFFER_ENTRIES;
+ if (port->logbuffer_head == port->logbuffer_tail)
+ port->logbuffer_tail =
+ (port->logbuffer_tail + 1) % LOG_BUFFER_ENTRIES;
abort:
mutex_unlock(&port->logbuffer_lock);
@@ -622,8 +614,6 @@ static int tcpm_debug_show(struct seq_file *s, void *v)
seq_printf(s, "%s\n", port->logbuffer[tail]);
tail = (tail + 1) % LOG_BUFFER_ENTRIES;
}
- if (!seq_has_overflowed(s))
- port->logbuffer_tail = tail;
mutex_unlock(&port->logbuffer_lock);
return 0;