[kernel] 2.6.{28,30}: refresh patches
[openwrt.git] / target / linux / goldfish / patches-2.6.30 / 0109-Revert-printk-remove-unused-code-from-kernel-print.patch
1 From fca2519ebf25db61da132932eb3fffeaa1974f43 Mon Sep 17 00:00:00 2001
2 From: =?utf-8?q?Arve=20Hj=C3=B8nnev=C3=A5g?= <arve@android.com>
3 Date: Thu, 15 Jan 2009 19:07:27 -0800
4 Subject: [PATCH 109/134] Revert "printk: remove unused code from kernel/printk.c"
5
6 This reverts commit acff181d3574244e651913df77332e897b88bff4.
7 ---
8 kernel/printk.c | 39 +++++++++++++++++++++++++++++++++++++++
9 1 files changed, 39 insertions(+), 0 deletions(-)
10
11 --- a/kernel/printk.c
12 +++ b/kernel/printk.c
13 @@ -255,6 +255,45 @@ static inline void boot_delay_msec(void)
14 #endif
15
16 /*
17 + * Return the number of unread characters in the log buffer.
18 + */
19 +static int log_buf_get_len(void)
20 +{
21 + return logged_chars;
22 +}
23 +
24 +/*
25 + * Copy a range of characters from the log buffer.
26 + */
27 +int log_buf_copy(char *dest, int idx, int len)
28 +{
29 + int ret, max;
30 + bool took_lock = false;
31 +
32 + if (!oops_in_progress) {
33 + spin_lock_irq(&logbuf_lock);
34 + took_lock = true;
35 + }
36 +
37 + max = log_buf_get_len();
38 + if (idx < 0 || idx >= max) {
39 + ret = -1;
40 + } else {
41 + if (len > max)
42 + len = max;
43 + ret = len;
44 + idx += (log_end - max);
45 + while (len-- > 0)
46 + dest[len] = LOG_BUF(idx + len);
47 + }
48 +
49 + if (took_lock)
50 + spin_unlock_irq(&logbuf_lock);
51 +
52 + return ret;
53 +}
54 +
55 +/*
56 * Commands to do_syslog:
57 *
58 * 0 -- Close the log. Currently a NOP.
This page took 0.054054 seconds and 5 git commands to generate.