Commit db9571a6 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull printk updates from Petr Mladek:

 - Check all mandatory callbacks when registering nbcon consoles

 - Fix some compiler warnings

* tag 'printk-for-7.0' of git://git.kernel.org/pub/scm/linux/kernel/git/printk/linux:
  vsnprintf: drop __printf() attributes on binary printing functions
  printf: convert test_hashed into macro
  printk: nbcon: Check for device_{lock,unlock} callbacks
parents 148f95f7 9abbecf4
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -181,7 +181,6 @@ int seq_open_private(struct file *, const struct seq_operations *, int);
int seq_release_private(struct inode *, struct file *);

#ifdef CONFIG_BINARY_PRINTF
__printf(2, 0)
void seq_bprintf(struct seq_file *m, const char *f, const u32 *binary);
#endif

+2 −2
Original line number Diff line number Diff line
@@ -336,8 +336,8 @@ int __sysfs_match_string(const char * const *array, size_t n, const char *s);
#define sysfs_match_string(_a, _s) __sysfs_match_string(_a, ARRAY_SIZE(_a), _s)

#ifdef CONFIG_BINARY_PRINTF
__printf(3, 0) int vbin_printf(u32 *bin_buf, size_t size, const char *fmt, va_list args);
__printf(3, 0) int bstr_printf(char *buf, size_t size, const char *fmt, const u32 *bin_buf);
int vbin_printf(u32 *bin_buf, size_t size, const char *fmt, va_list args);
int bstr_printf(char *buf, size_t size, const char *fmt, const u32 *bin_buf);
#endif

extern ssize_t memory_read_from_buffer(void *to, size_t count, loff_t *ppos,
+5 −2
Original line number Diff line number Diff line
@@ -1758,9 +1758,12 @@ bool nbcon_alloc(struct console *con)
	/* Synchronize the kthread start. */
	lockdep_assert_console_list_lock_held();

	/* The write_thread() callback is mandatory. */
	if (WARN_ON(!con->write_thread))
	/* Check for mandatory nbcon callbacks. */
	if (WARN_ON(!con->write_thread ||
		    !con->device_lock ||
		    !con->device_unlock)) {
		return false;
	}

	rcuwait_init(&con->rcuwait);
	init_irq_work(&con->irq_work, nbcon_irq_work);
+11 −9
Original line number Diff line number Diff line
@@ -266,15 +266,17 @@ hash_pointer(struct kunit *kunittest)
	KUNIT_EXPECT_MEMNEQ(kunittest, buf, PTR_STR, PTR_WIDTH);
}

static void
test_hashed(struct kunit *kunittest, const char *fmt, const void *p)
{
	char buf[PLAIN_BUF_SIZE];

	plain_hash_to_buffer(kunittest, p, buf, PLAIN_BUF_SIZE);

	test(buf, fmt, p);
}
/*
 * This is a macro so that the compiler can compare its arguments to the
 * __printf() attribute on __test(). This cannot be a function with a __printf()
 * attribute because GCC requires __printf() functions to be variadic.
 */
#define test_hashed(kunittest, fmt, p)						\
	do {									\
		char buf[PLAIN_BUF_SIZE];					\
		plain_hash_to_buffer(kunittest, p, buf, PLAIN_BUF_SIZE);	\
		test(buf, fmt, p);						\
	} while (0)

/*
 * NULL pointers aren't hashed.