mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-28 23:24:50 +00:00
06991c28f3
Here is the big driver core merge for 3.9-rc1 There are two major series here, both of which touch lots of drivers all over the kernel, and will cause you some merge conflicts: - add a new function called devm_ioremap_resource() to properly be able to check return values. - remove CONFIG_EXPERIMENTAL If you need me to provide a merged tree to handle these resolutions, please let me know. Other than those patches, there's not much here, some minor fixes and updates. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (GNU/Linux) iEYEABECAAYFAlEmV0cACgkQMUfUDdst+yncCQCfbmnQZju7kzWXk6PjdFuKspT9 weAAoMCzcAtEzzc4LXuUxxG/sXBVBCjW =yWAQ -----END PGP SIGNATURE----- Merge tag 'driver-core-3.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core Pull driver core patches from Greg Kroah-Hartman: "Here is the big driver core merge for 3.9-rc1 There are two major series here, both of which touch lots of drivers all over the kernel, and will cause you some merge conflicts: - add a new function called devm_ioremap_resource() to properly be able to check return values. - remove CONFIG_EXPERIMENTAL Other than those patches, there's not much here, some minor fixes and updates" Fix up trivial conflicts * tag 'driver-core-3.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core: (221 commits) base: memory: fix soft/hard_offline_page permissions drivercore: Fix ordering between deferred_probe and exiting initcalls backlight: fix class_find_device() arguments TTY: mark tty_get_device call with the proper const values driver-core: constify data for class_find_device() firmware: Ignore abort check when no user-helper is used firmware: Reduce ifdef CONFIG_FW_LOADER_USER_HELPER firmware: Make user-mode helper optional firmware: Refactoring for splitting user-mode helper code Driver core: treat unregistered bus_types as having no devices watchdog: Convert to devm_ioremap_resource() thermal: Convert to devm_ioremap_resource() spi: Convert to devm_ioremap_resource() power: Convert to devm_ioremap_resource() mtd: Convert to devm_ioremap_resource() mmc: Convert to devm_ioremap_resource() mfd: Convert to devm_ioremap_resource() media: Convert to devm_ioremap_resource() iommu: Convert to devm_ioremap_resource() drm: Convert to devm_ioremap_resource() ...
353 lines
9.7 KiB
C
353 lines
9.7 KiB
C
#ifndef __KERNEL_PRINTK__
|
|
#define __KERNEL_PRINTK__
|
|
|
|
#include <linux/init.h>
|
|
#include <linux/kern_levels.h>
|
|
|
|
extern const char linux_banner[];
|
|
extern const char linux_proc_banner[];
|
|
|
|
static inline int printk_get_level(const char *buffer)
|
|
{
|
|
if (buffer[0] == KERN_SOH_ASCII && buffer[1]) {
|
|
switch (buffer[1]) {
|
|
case '0' ... '7':
|
|
case 'd': /* KERN_DEFAULT */
|
|
return buffer[1];
|
|
}
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
static inline const char *printk_skip_level(const char *buffer)
|
|
{
|
|
if (printk_get_level(buffer)) {
|
|
switch (buffer[1]) {
|
|
case '0' ... '7':
|
|
case 'd': /* KERN_DEFAULT */
|
|
return buffer + 2;
|
|
}
|
|
}
|
|
return buffer;
|
|
}
|
|
|
|
extern int console_printk[];
|
|
|
|
#define console_loglevel (console_printk[0])
|
|
#define default_message_loglevel (console_printk[1])
|
|
#define minimum_console_loglevel (console_printk[2])
|
|
#define default_console_loglevel (console_printk[3])
|
|
|
|
static inline void console_silent(void)
|
|
{
|
|
console_loglevel = 0;
|
|
}
|
|
|
|
static inline void console_verbose(void)
|
|
{
|
|
if (console_loglevel)
|
|
console_loglevel = 15;
|
|
}
|
|
|
|
struct va_format {
|
|
const char *fmt;
|
|
va_list *va;
|
|
};
|
|
|
|
/*
|
|
* FW_BUG
|
|
* Add this to a message where you are sure the firmware is buggy or behaves
|
|
* really stupid or out of spec. Be aware that the responsible BIOS developer
|
|
* should be able to fix this issue or at least get a concrete idea of the
|
|
* problem by reading your message without the need of looking at the kernel
|
|
* code.
|
|
*
|
|
* Use it for definite and high priority BIOS bugs.
|
|
*
|
|
* FW_WARN
|
|
* Use it for not that clear (e.g. could the kernel messed up things already?)
|
|
* and medium priority BIOS bugs.
|
|
*
|
|
* FW_INFO
|
|
* Use this one if you want to tell the user or vendor about something
|
|
* suspicious, but generally harmless related to the firmware.
|
|
*
|
|
* Use it for information or very low priority BIOS bugs.
|
|
*/
|
|
#define FW_BUG "[Firmware Bug]: "
|
|
#define FW_WARN "[Firmware Warn]: "
|
|
#define FW_INFO "[Firmware Info]: "
|
|
|
|
/*
|
|
* HW_ERR
|
|
* Add this to a message for hardware errors, so that user can report
|
|
* it to hardware vendor instead of LKML or software vendor.
|
|
*/
|
|
#define HW_ERR "[Hardware Error]: "
|
|
|
|
/*
|
|
* Dummy printk for disabled debugging statements to use whilst maintaining
|
|
* gcc's format and side-effect checking.
|
|
*/
|
|
static inline __printf(1, 2)
|
|
int no_printk(const char *fmt, ...)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
extern asmlinkage __printf(1, 2)
|
|
void early_printk(const char *fmt, ...);
|
|
|
|
#ifdef CONFIG_PRINTK
|
|
asmlinkage __printf(5, 0)
|
|
int vprintk_emit(int facility, int level,
|
|
const char *dict, size_t dictlen,
|
|
const char *fmt, va_list args);
|
|
|
|
asmlinkage __printf(1, 0)
|
|
int vprintk(const char *fmt, va_list args);
|
|
|
|
asmlinkage __printf(5, 6) __cold
|
|
asmlinkage int printk_emit(int facility, int level,
|
|
const char *dict, size_t dictlen,
|
|
const char *fmt, ...);
|
|
|
|
asmlinkage __printf(1, 2) __cold
|
|
int printk(const char *fmt, ...);
|
|
|
|
/*
|
|
* Special printk facility for scheduler use only, _DO_NOT_USE_ !
|
|
*/
|
|
__printf(1, 2) __cold int printk_sched(const char *fmt, ...);
|
|
|
|
/*
|
|
* Please don't use printk_ratelimit(), because it shares ratelimiting state
|
|
* with all other unrelated printk_ratelimit() callsites. Instead use
|
|
* printk_ratelimited() or plain old __ratelimit().
|
|
*/
|
|
extern int __printk_ratelimit(const char *func);
|
|
#define printk_ratelimit() __printk_ratelimit(__func__)
|
|
extern bool printk_timed_ratelimit(unsigned long *caller_jiffies,
|
|
unsigned int interval_msec);
|
|
|
|
extern int printk_delay_msec;
|
|
extern int dmesg_restrict;
|
|
extern int kptr_restrict;
|
|
|
|
void log_buf_kexec_setup(void);
|
|
void __init setup_log_buf(int early);
|
|
#else
|
|
static inline __printf(1, 0)
|
|
int vprintk(const char *s, va_list args)
|
|
{
|
|
return 0;
|
|
}
|
|
static inline __printf(1, 2) __cold
|
|
int printk(const char *s, ...)
|
|
{
|
|
return 0;
|
|
}
|
|
static inline __printf(1, 2) __cold
|
|
int printk_sched(const char *s, ...)
|
|
{
|
|
return 0;
|
|
}
|
|
static inline int printk_ratelimit(void)
|
|
{
|
|
return 0;
|
|
}
|
|
static inline bool printk_timed_ratelimit(unsigned long *caller_jiffies,
|
|
unsigned int interval_msec)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
static inline void log_buf_kexec_setup(void)
|
|
{
|
|
}
|
|
|
|
static inline void setup_log_buf(int early)
|
|
{
|
|
}
|
|
#endif
|
|
|
|
extern void dump_stack(void) __cold;
|
|
|
|
#ifndef pr_fmt
|
|
#define pr_fmt(fmt) fmt
|
|
#endif
|
|
|
|
#define pr_emerg(fmt, ...) \
|
|
printk(KERN_EMERG pr_fmt(fmt), ##__VA_ARGS__)
|
|
#define pr_alert(fmt, ...) \
|
|
printk(KERN_ALERT pr_fmt(fmt), ##__VA_ARGS__)
|
|
#define pr_crit(fmt, ...) \
|
|
printk(KERN_CRIT pr_fmt(fmt), ##__VA_ARGS__)
|
|
#define pr_err(fmt, ...) \
|
|
printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
|
|
#define pr_warning(fmt, ...) \
|
|
printk(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__)
|
|
#define pr_warn pr_warning
|
|
#define pr_notice(fmt, ...) \
|
|
printk(KERN_NOTICE pr_fmt(fmt), ##__VA_ARGS__)
|
|
#define pr_info(fmt, ...) \
|
|
printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
|
|
#define pr_cont(fmt, ...) \
|
|
printk(KERN_CONT fmt, ##__VA_ARGS__)
|
|
|
|
/* pr_devel() should produce zero code unless DEBUG is defined */
|
|
#ifdef DEBUG
|
|
#define pr_devel(fmt, ...) \
|
|
printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
|
|
#else
|
|
#define pr_devel(fmt, ...) \
|
|
no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
|
|
#endif
|
|
|
|
/* If you are writing a driver, please use dev_dbg instead */
|
|
#if defined(CONFIG_DYNAMIC_DEBUG)
|
|
/* dynamic_pr_debug() uses pr_fmt() internally so we don't need it here */
|
|
#define pr_debug(fmt, ...) \
|
|
dynamic_pr_debug(fmt, ##__VA_ARGS__)
|
|
#elif defined(DEBUG)
|
|
#define pr_debug(fmt, ...) \
|
|
printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
|
|
#else
|
|
#define pr_debug(fmt, ...) \
|
|
no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
|
|
#endif
|
|
|
|
/*
|
|
* Print a one-time message (analogous to WARN_ONCE() et al):
|
|
*/
|
|
|
|
#ifdef CONFIG_PRINTK
|
|
#define printk_once(fmt, ...) \
|
|
({ \
|
|
static bool __print_once; \
|
|
\
|
|
if (!__print_once) { \
|
|
__print_once = true; \
|
|
printk(fmt, ##__VA_ARGS__); \
|
|
} \
|
|
})
|
|
#else
|
|
#define printk_once(fmt, ...) \
|
|
no_printk(fmt, ##__VA_ARGS__)
|
|
#endif
|
|
|
|
#define pr_emerg_once(fmt, ...) \
|
|
printk_once(KERN_EMERG pr_fmt(fmt), ##__VA_ARGS__)
|
|
#define pr_alert_once(fmt, ...) \
|
|
printk_once(KERN_ALERT pr_fmt(fmt), ##__VA_ARGS__)
|
|
#define pr_crit_once(fmt, ...) \
|
|
printk_once(KERN_CRIT pr_fmt(fmt), ##__VA_ARGS__)
|
|
#define pr_err_once(fmt, ...) \
|
|
printk_once(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
|
|
#define pr_warn_once(fmt, ...) \
|
|
printk_once(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__)
|
|
#define pr_notice_once(fmt, ...) \
|
|
printk_once(KERN_NOTICE pr_fmt(fmt), ##__VA_ARGS__)
|
|
#define pr_info_once(fmt, ...) \
|
|
printk_once(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
|
|
#define pr_cont_once(fmt, ...) \
|
|
printk_once(KERN_CONT pr_fmt(fmt), ##__VA_ARGS__)
|
|
/* If you are writing a driver, please use dev_dbg instead */
|
|
#if defined(DEBUG)
|
|
#define pr_debug_once(fmt, ...) \
|
|
printk_once(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
|
|
#else
|
|
#define pr_debug_once(fmt, ...) \
|
|
no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
|
|
#endif
|
|
|
|
/*
|
|
* ratelimited messages with local ratelimit_state,
|
|
* no local ratelimit_state used in the !PRINTK case
|
|
*/
|
|
#ifdef CONFIG_PRINTK
|
|
#define printk_ratelimited(fmt, ...) \
|
|
({ \
|
|
static DEFINE_RATELIMIT_STATE(_rs, \
|
|
DEFAULT_RATELIMIT_INTERVAL, \
|
|
DEFAULT_RATELIMIT_BURST); \
|
|
\
|
|
if (__ratelimit(&_rs)) \
|
|
printk(fmt, ##__VA_ARGS__); \
|
|
})
|
|
#else
|
|
#define printk_ratelimited(fmt, ...) \
|
|
no_printk(fmt, ##__VA_ARGS__)
|
|
#endif
|
|
|
|
#define pr_emerg_ratelimited(fmt, ...) \
|
|
printk_ratelimited(KERN_EMERG pr_fmt(fmt), ##__VA_ARGS__)
|
|
#define pr_alert_ratelimited(fmt, ...) \
|
|
printk_ratelimited(KERN_ALERT pr_fmt(fmt), ##__VA_ARGS__)
|
|
#define pr_crit_ratelimited(fmt, ...) \
|
|
printk_ratelimited(KERN_CRIT pr_fmt(fmt), ##__VA_ARGS__)
|
|
#define pr_err_ratelimited(fmt, ...) \
|
|
printk_ratelimited(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
|
|
#define pr_warn_ratelimited(fmt, ...) \
|
|
printk_ratelimited(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__)
|
|
#define pr_notice_ratelimited(fmt, ...) \
|
|
printk_ratelimited(KERN_NOTICE pr_fmt(fmt), ##__VA_ARGS__)
|
|
#define pr_info_ratelimited(fmt, ...) \
|
|
printk_ratelimited(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
|
|
/* no pr_cont_ratelimited, don't do that... */
|
|
/* If you are writing a driver, please use dev_dbg instead */
|
|
#if defined(DEBUG)
|
|
#define pr_debug_ratelimited(fmt, ...) \
|
|
printk_ratelimited(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
|
|
#else
|
|
#define pr_debug_ratelimited(fmt, ...) \
|
|
no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
|
|
#endif
|
|
|
|
extern const struct file_operations kmsg_fops;
|
|
|
|
enum {
|
|
DUMP_PREFIX_NONE,
|
|
DUMP_PREFIX_ADDRESS,
|
|
DUMP_PREFIX_OFFSET
|
|
};
|
|
extern void hex_dump_to_buffer(const void *buf, size_t len,
|
|
int rowsize, int groupsize,
|
|
char *linebuf, size_t linebuflen, bool ascii);
|
|
#ifdef CONFIG_PRINTK
|
|
extern void print_hex_dump(const char *level, const char *prefix_str,
|
|
int prefix_type, int rowsize, int groupsize,
|
|
const void *buf, size_t len, bool ascii);
|
|
#if defined(CONFIG_DYNAMIC_DEBUG)
|
|
#define print_hex_dump_bytes(prefix_str, prefix_type, buf, len) \
|
|
dynamic_hex_dump(prefix_str, prefix_type, 16, 1, buf, len, true)
|
|
#else
|
|
extern void print_hex_dump_bytes(const char *prefix_str, int prefix_type,
|
|
const void *buf, size_t len);
|
|
#endif /* defined(CONFIG_DYNAMIC_DEBUG) */
|
|
#else
|
|
static inline void print_hex_dump(const char *level, const char *prefix_str,
|
|
int prefix_type, int rowsize, int groupsize,
|
|
const void *buf, size_t len, bool ascii)
|
|
{
|
|
}
|
|
static inline void print_hex_dump_bytes(const char *prefix_str, int prefix_type,
|
|
const void *buf, size_t len)
|
|
{
|
|
}
|
|
|
|
#endif
|
|
|
|
#if defined(CONFIG_DYNAMIC_DEBUG)
|
|
#define print_hex_dump_debug(prefix_str, prefix_type, rowsize, \
|
|
groupsize, buf, len, ascii) \
|
|
dynamic_hex_dump(prefix_str, prefix_type, rowsize, \
|
|
groupsize, buf, len, ascii)
|
|
#else
|
|
#define print_hex_dump_debug(prefix_str, prefix_type, rowsize, \
|
|
groupsize, buf, len, ascii) \
|
|
print_hex_dump(KERN_DEBUG, prefix_str, prefix_type, rowsize, \
|
|
groupsize, buf, len, ascii)
|
|
#endif /* defined(CONFIG_DYNAMIC_DEBUG) */
|
|
|
|
#endif
|