Merge tag 'printk-for-5.8' of git://git.kernel.org/pub/scm/linux/kernel/git/printk/linux
Pull printk updates from Petr Mladek: - Benjamin Herrenschmidt solved a problem with non-matched console aliases by first checking consoles defined on the command line. It is a more conservative approach than the previous attempts. - Benjamin also made sure that the console accessible via /dev/console always has CON_CONSDEV flag. - Andy Shevchenko added the %ptT modifier for printing struct time64_t. It extends the existing %ptR handling for struct rtc_time. - Bruno Meneguele fixed /dev/kmsg error value returned by unsupported SEEK_CUR. - Tetsuo Handa removed unused pr_cont_once(). ... and a few small fixes. * tag 'printk-for-5.8' of git://git.kernel.org/pub/scm/linux/kernel/git/printk/linux: printk: Remove pr_cont_once() printk: handle blank console arguments passed in. kernel/printk: add kmsg SEEK_CUR handling printk: Fix a typo in comment "interator"->"iterator" usb: pulse8-cec: Switch to use %ptT ARM: bcm2835: Switch to use %ptT lib/vsprintf: Print time64_t in human readable format lib/vsprintf: update comment about simple_strto<foo>() functions printk: Correctly set CON_CONSDEV even when preferred console was not registered printk: Fix preferred console selection with multiple matches printk: Move console matching logic into a separate function printk: Convert a use of sprintf to snprintf in console_unlock
This commit is contained in:
@@ -34,6 +34,7 @@
|
||||
#include <linux/dcache.h>
|
||||
#include <linux/cred.h>
|
||||
#include <linux/rtc.h>
|
||||
#include <linux/time.h>
|
||||
#include <linux/uuid.h>
|
||||
#include <linux/of.h>
|
||||
#include <net/addrconf.h>
|
||||
@@ -58,7 +59,7 @@
|
||||
* @endp: A pointer to the end of the parsed string will be placed here
|
||||
* @base: The number base to use
|
||||
*
|
||||
* This function is obsolete. Please use kstrtoull instead.
|
||||
* This function has caveats. Please use kstrtoull instead.
|
||||
*/
|
||||
unsigned long long simple_strtoull(const char *cp, char **endp, unsigned int base)
|
||||
{
|
||||
@@ -83,7 +84,7 @@ EXPORT_SYMBOL(simple_strtoull);
|
||||
* @endp: A pointer to the end of the parsed string will be placed here
|
||||
* @base: The number base to use
|
||||
*
|
||||
* This function is obsolete. Please use kstrtoul instead.
|
||||
* This function has caveats. Please use kstrtoul instead.
|
||||
*/
|
||||
unsigned long simple_strtoul(const char *cp, char **endp, unsigned int base)
|
||||
{
|
||||
@@ -97,7 +98,7 @@ EXPORT_SYMBOL(simple_strtoul);
|
||||
* @endp: A pointer to the end of the parsed string will be placed here
|
||||
* @base: The number base to use
|
||||
*
|
||||
* This function is obsolete. Please use kstrtol instead.
|
||||
* This function has caveats. Please use kstrtol instead.
|
||||
*/
|
||||
long simple_strtol(const char *cp, char **endp, unsigned int base)
|
||||
{
|
||||
@@ -114,7 +115,7 @@ EXPORT_SYMBOL(simple_strtol);
|
||||
* @endp: A pointer to the end of the parsed string will be placed here
|
||||
* @base: The number base to use
|
||||
*
|
||||
* This function is obsolete. Please use kstrtoll instead.
|
||||
* This function has caveats. Please use kstrtoll instead.
|
||||
*/
|
||||
long long simple_strtoll(const char *cp, char **endp, unsigned int base)
|
||||
{
|
||||
@@ -1826,6 +1827,29 @@ char *rtc_str(char *buf, char *end, const struct rtc_time *tm,
|
||||
return buf;
|
||||
}
|
||||
|
||||
static noinline_for_stack
|
||||
char *time64_str(char *buf, char *end, const time64_t time,
|
||||
struct printf_spec spec, const char *fmt)
|
||||
{
|
||||
struct rtc_time rtc_time;
|
||||
struct tm tm;
|
||||
|
||||
time64_to_tm(time, 0, &tm);
|
||||
|
||||
rtc_time.tm_sec = tm.tm_sec;
|
||||
rtc_time.tm_min = tm.tm_min;
|
||||
rtc_time.tm_hour = tm.tm_hour;
|
||||
rtc_time.tm_mday = tm.tm_mday;
|
||||
rtc_time.tm_mon = tm.tm_mon;
|
||||
rtc_time.tm_year = tm.tm_year;
|
||||
rtc_time.tm_wday = tm.tm_wday;
|
||||
rtc_time.tm_yday = tm.tm_yday;
|
||||
|
||||
rtc_time.tm_isdst = 0;
|
||||
|
||||
return rtc_str(buf, end, &rtc_time, spec, fmt);
|
||||
}
|
||||
|
||||
static noinline_for_stack
|
||||
char *time_and_date(char *buf, char *end, void *ptr, struct printf_spec spec,
|
||||
const char *fmt)
|
||||
@@ -1833,8 +1857,10 @@ char *time_and_date(char *buf, char *end, void *ptr, struct printf_spec spec,
|
||||
switch (fmt[1]) {
|
||||
case 'R':
|
||||
return rtc_str(buf, end, (const struct rtc_time *)ptr, spec, fmt);
|
||||
case 'T':
|
||||
return time64_str(buf, end, *(const time64_t *)ptr, spec, fmt);
|
||||
default:
|
||||
return error_string(buf, end, "(%ptR?)", spec);
|
||||
return error_string(buf, end, "(%pt?)", spec);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2150,8 +2176,9 @@ char *fwnode_string(char *buf, char *end, struct fwnode_handle *fwnode,
|
||||
* - 'd[234]' For a dentry name (optionally 2-4 last components)
|
||||
* - 'D[234]' Same as 'd' but for a struct file
|
||||
* - 'g' For block_device name (gendisk + partition number)
|
||||
* - 't[R][dt][r]' For time and date as represented:
|
||||
* - 't[RT][dt][r]' For time and date as represented by:
|
||||
* R struct rtc_time
|
||||
* T time64_t
|
||||
* - 'C' For a clock, it prints the name (Common Clock Framework) or address
|
||||
* (legacy clock framework) of the clock
|
||||
* - 'Cn' For a clock, it prints the name (Common Clock Framework) or address
|
||||
|
Reference in New Issue
Block a user