Skip to content

Commit a754292

Browse files
committed
Merge tag 'printk-for-5.9' of git://git.kernel.org/pub/scm/linux/kernel/git/printk/linux
Pull printk updates from Petr Mladek: - Herbert Xu made printk header file self-contained. - Andy Shevchenko and Sergey Senozhatsky cleaned up console->setup() error handling. - Andy Shevchenko did some cleanups (e.g. sparse warning) in vsprintf code. - Minor documentation updates. * tag 'printk-for-5.9' of git://git.kernel.org/pub/scm/linux/kernel/git/printk/linux: lib/vsprintf: Force type of flags value for gfp_t lib/vsprintf: Replace custom spec to print decimals with generic one lib/vsprintf: Replace hidden BUILD_BUG_ON() with static_assert() printk: Make linux/printk.h self-contained doc:kmsg: explicitly state the return value in case of SEEK_CUR Replace HTTP links with HTTPS ones: vsprintf hvc: unify console setup naming console: Fix trivia typo 'change' -> 'chance' console: Propagate error code from console ->setup() tty: hvc: Return proper error code from console ->setup() hook serial: sunzilog: Return proper error code from console ->setup() hook serial: sunsab: Return proper error code from console ->setup() hook mips: Return proper error code from console ->setup() hook
2 parents 95ffa67 + 57e60db commit a754292

File tree

13 files changed

+86
-58
lines changed

13 files changed

+86
-58
lines changed

Documentation/ABI/testing/dev-kmsg

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,17 @@ Description: The /dev/kmsg character device node provides userspace access
5656
seek after the last record available at the time
5757
the last SYSLOG_ACTION_CLEAR was issued.
5858

59+
Other seek operations or offsets are not supported because of
60+
the special behavior this device has. The device allows to read
61+
or write only whole variable length messages (records) that are
62+
stored in a ring buffer.
63+
64+
Because of the non-standard behavior also the error values are
65+
non-standard. -ESPIPE is returned for non-zero offset. -EINVAL
66+
is returned for other operations, e.g. SEEK_CUR. This behavior
67+
and values are historical and could not be modified without the
68+
risk of breaking userspace.
69+
5970
The output format consists of a prefix carrying the syslog
6071
prefix including priority and facility, the 64 bit message
6172
sequence number and the monotonic timestamp in microseconds,

Documentation/core-api/printk-formats.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ colon-separators. Leading zeros are always used.
317317

318318
The additional ``c`` specifier can be used with the ``I`` specifier to
319319
print a compressed IPv6 address as described by
320-
http://tools.ietf.org/html/rfc5952
320+
https://tools.ietf.org/html/rfc5952
321321

322322
Passed by reference.
323323

@@ -341,7 +341,7 @@ The additional ``p``, ``f``, and ``s`` specifiers are used to specify port
341341
flowinfo a ``/`` and scope a ``%``, each followed by the actual value.
342342

343343
In case of an IPv6 address the compressed IPv6 address as described by
344-
http://tools.ietf.org/html/rfc5952 is being used if the additional
344+
https://tools.ietf.org/html/rfc5952 is being used if the additional
345345
specifier ``c`` is given. The IPv6 address is surrounded by ``[``, ``]`` in
346346
case of additional specifiers ``p``, ``f`` or ``s`` as suggested by
347347
https://tools.ietf.org/html/draft-ietf-6man-text-addr-representation-07

arch/mips/fw/arc/arc_con.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@ static void prom_console_write(struct console *co, const char *s,
2828

2929
static int prom_console_setup(struct console *co, char *options)
3030
{
31-
return !(prom_flags & PROM_FLAG_USE_AS_CONSOLE);
31+
if (prom_flags & PROM_FLAG_USE_AS_CONSOLE)
32+
return 0;
33+
return -ENODEV;
3234
}
3335

3436
static struct console arc_cons = {

arch/s390/include/asm/bug.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#ifndef _ASM_S390_BUG_H
33
#define _ASM_S390_BUG_H
44

5-
#include <linux/kernel.h>
5+
#include <linux/compiler.h>
66

77
#ifdef CONFIG_BUG
88

drivers/tty/hvc/hvc_xen.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -603,7 +603,7 @@ static void xen_hvm_early_write(uint32_t vtermno, const char *str, int len) { }
603603
#endif
604604

605605
#ifdef CONFIG_EARLY_PRINTK
606-
static int __init xenboot_setup_console(struct console *console, char *string)
606+
static int __init xenboot_console_setup(struct console *console, char *string)
607607
{
608608
static struct xencons_info xenboot;
609609

@@ -647,7 +647,7 @@ static void xenboot_write_console(struct console *console, const char *string,
647647
struct console xenboot_console = {
648648
.name = "xenboot",
649649
.write = xenboot_write_console,
650-
.setup = xenboot_setup_console,
650+
.setup = xenboot_console_setup,
651651
.flags = CON_PRINTBUFFER | CON_BOOT | CON_ANYTIME,
652652
.index = -1,
653653
};

drivers/tty/hvc/hvsi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1128,7 +1128,7 @@ static int __init hvsi_console_setup(struct console *console, char *options)
11281128
int ret;
11291129

11301130
if (console->index < 0 || console->index >= hvsi_count)
1131-
return -1;
1131+
return -EINVAL;
11321132
hp = &hvsi_ports[console->index];
11331133

11341134
/* give the FSP a chance to change the baud rate when we re-open */

drivers/tty/serial/sunsab.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -886,7 +886,7 @@ static int sunsab_console_setup(struct console *con, char *options)
886886
* though...
887887
*/
888888
if (up->port.type != PORT_SUNSAB)
889-
return -1;
889+
return -EINVAL;
890890

891891
printk("Console: ttyS%d (SAB82532)\n",
892892
(sunsab_reg.minor - 64) + con->index);

drivers/tty/serial/sunzilog.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1221,7 +1221,7 @@ static int __init sunzilog_console_setup(struct console *con, char *options)
12211221
int baud, brg;
12221222

12231223
if (up->port.type != PORT_SUNZILOG)
1224-
return -1;
1224+
return -EINVAL;
12251225

12261226
printk(KERN_INFO "Console: ttyS%d (SunZilog zs%d)\n",
12271227
(sunzilog_reg.minor - 64) + con->index, con->index);

include/linux/printk.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include <linux/kern_levels.h>
88
#include <linux/linkage.h>
99
#include <linux/cache.h>
10+
#include <linux/ratelimit_types.h>
1011

1112
extern const char linux_banner[];
1213
extern const char linux_proc_banner[];

include/linux/ratelimit.h

Lines changed: 1 addition & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -2,41 +2,10 @@
22
#ifndef _LINUX_RATELIMIT_H
33
#define _LINUX_RATELIMIT_H
44

5-
#include <linux/param.h>
5+
#include <linux/ratelimit_types.h>
66
#include <linux/sched.h>
77
#include <linux/spinlock.h>
88

9-
#define DEFAULT_RATELIMIT_INTERVAL (5 * HZ)
10-
#define DEFAULT_RATELIMIT_BURST 10
11-
12-
/* issue num suppressed message on exit */
13-
#define RATELIMIT_MSG_ON_RELEASE BIT(0)
14-
15-
struct ratelimit_state {
16-
raw_spinlock_t lock; /* protect the state */
17-
18-
int interval;
19-
int burst;
20-
int printed;
21-
int missed;
22-
unsigned long begin;
23-
unsigned long flags;
24-
};
25-
26-
#define RATELIMIT_STATE_INIT(name, interval_init, burst_init) { \
27-
.lock = __RAW_SPIN_LOCK_UNLOCKED(name.lock), \
28-
.interval = interval_init, \
29-
.burst = burst_init, \
30-
}
31-
32-
#define RATELIMIT_STATE_INIT_DISABLED \
33-
RATELIMIT_STATE_INIT(ratelimit_state, 0, DEFAULT_RATELIMIT_BURST)
34-
35-
#define DEFINE_RATELIMIT_STATE(name, interval_init, burst_init) \
36-
\
37-
struct ratelimit_state name = \
38-
RATELIMIT_STATE_INIT(name, interval_init, burst_init) \
39-
409
static inline void ratelimit_state_init(struct ratelimit_state *rs,
4110
int interval, int burst)
4211
{
@@ -73,9 +42,6 @@ ratelimit_set_flags(struct ratelimit_state *rs, unsigned long flags)
7342

7443
extern struct ratelimit_state printk_ratelimit_state;
7544

76-
extern int ___ratelimit(struct ratelimit_state *rs, const char *func);
77-
#define __ratelimit(state) ___ratelimit(state, __func__)
78-
7945
#ifdef CONFIG_PRINTK
8046

8147
#define WARN_ON_RATELIMIT(condition, state) ({ \

0 commit comments

Comments
 (0)