Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Unverified Commit 7108a370 authored by derfelot's avatar derfelot
Browse files

kernel: Add trace_printk from Sony kernel

Taken from Sony 47.2.A.10.107 stock kernel
parent 012c2ddf
Loading
Loading
Loading
Loading
+20 −0
Original line number Original line Diff line number Diff line
/*
 * NOTE: This file has been modified by Sony Mobile Communications Inc.
 * Modifications are Copyright (c) 2016 Sony Mobile Communications Inc,
 * and licensed under the license of the file.
 */
#ifndef _LINUX_KERNEL_H
#ifndef _LINUX_KERNEL_H
#define _LINUX_KERNEL_H
#define _LINUX_KERNEL_H


@@ -565,6 +570,7 @@ void tracing_snapshot_alloc(void);
extern void tracing_start(void);
extern void tracing_start(void);
extern void tracing_stop(void);
extern void tracing_stop(void);


#ifdef CONFIG_TRACE_PRINTK
static inline __printf(1, 2)
static inline __printf(1, 2)
void ____trace_printk_check_format(const char *fmt, ...)
void ____trace_printk_check_format(const char *fmt, ...)
{
{
@@ -634,6 +640,20 @@ int __trace_bprintk(unsigned long ip, const char *fmt, ...);
extern __printf(2, 3)
extern __printf(2, 3)
int __trace_printk(unsigned long ip, const char *fmt, ...);
int __trace_printk(unsigned long ip, const char *fmt, ...);


#else
static inline __printf(1, 2)
int trace_printk(const char *fmt, ...)
{
	return 0;
}

static inline int
ftrace_vprintk(const char *fmt, va_list ap)
{
	return 0;
}
#endif /* CONFIG_TRACE_PRINTK */

/**
/**
 * trace_puts - write a string into the ftrace buffer
 * trace_puts - write a string into the ftrace buffer
 * @str: the string to record
 * @str: the string to record
+5 −0
Original line number Original line Diff line number Diff line
@@ -132,6 +132,11 @@ config TRACING
	select EVENT_TRACING
	select EVENT_TRACING
	select TRACE_CLOCK
	select TRACE_CLOCK


config TRACE_PRINTK
	bool "Enable trace_printk"
	depends on TRACING
	default y

config GENERIC_TRACER
config GENERIC_TRACER
	bool
	bool
	select TRACING
	select TRACING
+11 −0
Original line number Original line Diff line number Diff line
@@ -11,6 +11,11 @@
 *  Copyright (C) 2004-2006 Ingo Molnar
 *  Copyright (C) 2004-2006 Ingo Molnar
 *  Copyright (C) 2004 Nadia Yvette Chambers
 *  Copyright (C) 2004 Nadia Yvette Chambers
 */
 */
/*
 * NOTE: This file has been modified by Sony Mobile Communications Inc.
 * Modifications are Copyright (c) 2016 Sony Mobile Communications Inc,
 * and licensed under the license of the file.
 */
#include <linux/ring_buffer.h>
#include <linux/ring_buffer.h>
#include <generated/utsrelease.h>
#include <generated/utsrelease.h>
#include <linux/stacktrace.h>
#include <linux/stacktrace.h>
@@ -2092,6 +2097,7 @@ static char *get_trace_buf(void)
	return this_cpu_ptr(&percpu_buffer->buffer[0]);
	return this_cpu_ptr(&percpu_buffer->buffer[0]);
}
}


#ifdef CONFIG_TRACE_PRINTK
static int alloc_percpu_trace_buffer(void)
static int alloc_percpu_trace_buffer(void)
{
{
	struct trace_buffer_struct *buffers;
	struct trace_buffer_struct *buffers;
@@ -2132,11 +2138,13 @@ static int alloc_percpu_trace_buffer(void)
	WARN(1, "Could not allocate percpu trace_printk buffer");
	WARN(1, "Could not allocate percpu trace_printk buffer");
	return -ENOMEM;
	return -ENOMEM;
}
}
#endif


static int buffers_allocated;
static int buffers_allocated;


void trace_printk_init_buffers(void)
void trace_printk_init_buffers(void)
{
{
#ifdef CONFIG_TRACE_PRINTK
	if (buffers_allocated)
	if (buffers_allocated)
		return;
		return;


@@ -2173,6 +2181,9 @@ void trace_printk_init_buffers(void)
	 */
	 */
	if (global_trace.trace_buffer.buffer)
	if (global_trace.trace_buffer.buffer)
		tracing_start_cmdline_record();
		tracing_start_cmdline_record();
#else
	return;
#endif
}
}


void trace_printk_start_comm(void)
void trace_printk_start_comm(void)