summaryrefslogtreecommitdiff
path: root/cookie.c
blob: 9ee1ac6aebc5cc2f9a46482f095c249ee2dbfb8a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#define _GNU_SOURCE
#include <stdio.h>
#include <string.h>
#include <syslog.h>

#include "cookie.h"

static char const *priov[] = {
	[LOG_EMERG]	=	"EMERG:",
	[LOG_ALERT]	=	"ALERT:",
	[LOG_CRIT]	=	"CRIT:",
	[LOG_ERR]	=	"ERR:",
	[LOG_WARNING]	=	"WARNING:",
	[LOG_NOTICE]	=	"NOTICE:",
	[LOG_INFO]	=	"INFO:",
	[LOG_DEBUG]	=	"DEBUG:",
};

static ssize_t cookie_writer(void *cookie, char const *data, size_t leng)
{
	int prio = LOG_DEBUG, len;

	do {
		len = strlen(priov[prio]);
	} while (memcmp(data, priov[prio], len) && --prio >= 0);

	if (prio < 0) {
		prio = LOG_INFO;
	} else {
		data += len;
		leng -= len;
	}

	while (*data == ' ') {
		 ++data;
		--leng;
	}

	syslog(prio, "%.*s", (int) leng, data);

	return leng;
}

static cookie_io_functions_t cookie_log = {
	.write		=	cookie_writer,
};

void to_std_log(FILE **fp)
{
	setvbuf(*fp = fopencookie(NULL, "w", cookie_log), NULL, _IOLBF, 0);
}
5a4006fb23df8e54dc4a50e01732d9'>diff)
greybus: connection: drop the svc quiescing operation
Connection tear down is being reworked, and the SVC quiescing operation is going away. Let's remove this operation now along with the coupled second ping from our intermediate tear down implementation. This both avoids unnecessary noise in the logs resulting from the fact that the SVC side of the quiescing operation was never merged, and speeds up connection tear down slightly. Testing done: Tested on EVT2 using runtime PM. Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org> Acked-by: Sandeep Patil <sspatil@google.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/staging/greybus/connection.c19
-rw-r--r--drivers/staging/greybus/greybus_protocols.h12
-rw-r--r--drivers/staging/greybus/svc.c31
-rw-r--r--drivers/staging/greybus/svc.h2
4 files changed, 0 insertions, 64 deletions
diff --git a/drivers/staging/greybus/connection.c b/drivers/staging/greybus/connection.c