Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
8b390ab7
Commit
8b390ab7
authored
Jun 01, 2020
by
Petr Mladek
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'for-5.8-printf-time64_t' into for-linus
parents
d053cf0d
5f1fcf8c
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
55 additions
and
29 deletions
+55
-29
Documentation/core-api/printk-formats.rst
Documentation/core-api/printk-formats.rst
+12
-10
drivers/firmware/raspberrypi.c
drivers/firmware/raspberrypi.c
+3
-9
drivers/media/usb/pulse8-cec/pulse8-cec.c
drivers/media/usb/pulse8-cec/pulse8-cec.c
+1
-5
lib/test_printf.c
lib/test_printf.c
+10
-3
lib/vsprintf.c
lib/vsprintf.c
+29
-2
No files found.
Documentation/core-api/printk-formats.rst
View file @
8b390ab7
...
@@ -468,21 +468,23 @@ Examples (OF)::
...
@@ -468,21 +468,23 @@ Examples (OF)::
%pfwf /ocp@68000000/i2c@48072000/camera@10/port/endpoint - Full name
%pfwf /ocp@68000000/i2c@48072000/camera@10/port/endpoint - Full name
%pfwP endpoint - Node name
%pfwP endpoint - Node name
Time and date
(struct rtc_time)
Time and date
-------------
------------------
-------------
::
::
%pt
R
YYYY-mm-ddTHH:MM:SS
%pt
[RT]
YYYY-mm-ddTHH:MM:SS
%pt
R
d YYYY-mm-dd
%pt
[RT]
d YYYY-mm-dd
%pt
R
t HH:MM:SS
%pt
[RT]
t HH:MM:SS
%pt
R
[dt][r]
%pt
[RT]
[dt][r]
For printing date and time as represented by struct rtc_time structure in
For printing date and time as represented by
human readable format.
R struct rtc_time structure
T time64_t type
in human readable format.
By default year will be incremented by 1900 and month by 1.
Use %ptRr (raw)
By default year will be incremented by 1900 and month by 1.
to suppress this behaviour.
Use %pt[RT]r (raw)
to suppress this behaviour.
Passed by reference.
Passed by reference.
...
...
drivers/firmware/raspberrypi.c
View file @
8b390ab7
...
@@ -182,16 +182,10 @@ rpi_firmware_print_firmware_revision(struct rpi_firmware *fw)
...
@@ -182,16 +182,10 @@ rpi_firmware_print_firmware_revision(struct rpi_firmware *fw)
RPI_FIRMWARE_GET_FIRMWARE_REVISION
,
RPI_FIRMWARE_GET_FIRMWARE_REVISION
,
&
packet
,
sizeof
(
packet
));
&
packet
,
sizeof
(
packet
));
if
(
ret
==
0
)
{
if
(
ret
)
struct
tm
tm
;
return
;
time64_to_tm
(
packet
,
0
,
&
tm
);
dev_info
(
fw
->
cl
.
dev
,
dev_info
(
fw
->
cl
.
dev
,
"Attached to firmware from %ptT
\n
"
,
&
packet
);
"Attached to firmware from %04ld-%02d-%02d %02d:%02d
\n
"
,
tm
.
tm_year
+
1900
,
tm
.
tm_mon
+
1
,
tm
.
tm_mday
,
tm
.
tm_hour
,
tm
.
tm_min
);
}
}
}
static
void
static
void
...
...
drivers/media/usb/pulse8-cec/pulse8-cec.c
View file @
8b390ab7
...
@@ -661,7 +661,6 @@ static int pulse8_setup(struct pulse8 *pulse8, struct serio *serio,
...
@@ -661,7 +661,6 @@ static int pulse8_setup(struct pulse8 *pulse8, struct serio *serio,
u8
*
data
=
pulse8
->
data
+
1
;
u8
*
data
=
pulse8
->
data
+
1
;
u8
cmd
[
2
];
u8
cmd
[
2
];
int
err
;
int
err
;
struct
tm
tm
;
time64_t
date
;
time64_t
date
;
pulse8
->
vers
=
0
;
pulse8
->
vers
=
0
;
...
@@ -682,10 +681,7 @@ static int pulse8_setup(struct pulse8 *pulse8, struct serio *serio,
...
@@ -682,10 +681,7 @@ static int pulse8_setup(struct pulse8 *pulse8, struct serio *serio,
if
(
err
)
if
(
err
)
return
err
;
return
err
;
date
=
(
data
[
0
]
<<
24
)
|
(
data
[
1
]
<<
16
)
|
(
data
[
2
]
<<
8
)
|
data
[
3
];
date
=
(
data
[
0
]
<<
24
)
|
(
data
[
1
]
<<
16
)
|
(
data
[
2
]
<<
8
)
|
data
[
3
];
time64_to_tm
(
date
,
0
,
&
tm
);
dev_info
(
pulse8
->
dev
,
"Firmware build date %ptT
\n
"
,
&
date
);
dev_info
(
pulse8
->
dev
,
"Firmware build date %04ld.%02d.%02d %02d:%02d:%02d
\n
"
,
tm
.
tm_year
+
1900
,
tm
.
tm_mon
+
1
,
tm
.
tm_mday
,
tm
.
tm_hour
,
tm
.
tm_min
,
tm
.
tm_sec
);
dev_dbg
(
pulse8
->
dev
,
"Persistent config:
\n
"
);
dev_dbg
(
pulse8
->
dev
,
"Persistent config:
\n
"
);
cmd
[
0
]
=
MSGCODE_GET_AUTO_ENABLED
;
cmd
[
0
]
=
MSGCODE_GET_AUTO_ENABLED
;
...
...
lib/test_printf.c
View file @
8b390ab7
...
@@ -478,7 +478,7 @@ struct_va_format(void)
...
@@ -478,7 +478,7 @@ struct_va_format(void)
}
}
static
void
__init
static
void
__init
struct_rtc_tim
e
(
void
)
time_and_dat
e
(
void
)
{
{
/* 1543210543 */
/* 1543210543 */
const
struct
rtc_time
tm
=
{
const
struct
rtc_time
tm
=
{
...
@@ -489,14 +489,21 @@ struct_rtc_time(void)
...
@@ -489,14 +489,21 @@ struct_rtc_time(void)
.
tm_mon
=
10
,
.
tm_mon
=
10
,
.
tm_year
=
118
,
.
tm_year
=
118
,
};
};
/* 2019-01-04T15:32:23 */
time64_t
t
=
1546615943
;
test
(
"(%pt
R
?)"
,
"%pt"
,
&
tm
);
test
(
"(%pt?)"
,
"%pt"
,
&
tm
);
test
(
"2018-11-26T05:35:43"
,
"%ptR"
,
&
tm
);
test
(
"2018-11-26T05:35:43"
,
"%ptR"
,
&
tm
);
test
(
"0118-10-26T05:35:43"
,
"%ptRr"
,
&
tm
);
test
(
"0118-10-26T05:35:43"
,
"%ptRr"
,
&
tm
);
test
(
"05:35:43|2018-11-26"
,
"%ptRt|%ptRd"
,
&
tm
,
&
tm
);
test
(
"05:35:43|2018-11-26"
,
"%ptRt|%ptRd"
,
&
tm
,
&
tm
);
test
(
"05:35:43|0118-10-26"
,
"%ptRtr|%ptRdr"
,
&
tm
,
&
tm
);
test
(
"05:35:43|0118-10-26"
,
"%ptRtr|%ptRdr"
,
&
tm
,
&
tm
);
test
(
"05:35:43|2018-11-26"
,
"%ptRttr|%ptRdtr"
,
&
tm
,
&
tm
);
test
(
"05:35:43|2018-11-26"
,
"%ptRttr|%ptRdtr"
,
&
tm
,
&
tm
);
test
(
"05:35:43 tr|2018-11-26 tr"
,
"%ptRt tr|%ptRd tr"
,
&
tm
,
&
tm
);
test
(
"05:35:43 tr|2018-11-26 tr"
,
"%ptRt tr|%ptRd tr"
,
&
tm
,
&
tm
);
test
(
"2019-01-04T15:32:23"
,
"%ptT"
,
&
t
);
test
(
"0119-00-04T15:32:23"
,
"%ptTr"
,
&
t
);
test
(
"15:32:23|2019-01-04"
,
"%ptTt|%ptTd"
,
&
t
,
&
t
);
test
(
"15:32:23|0119-00-04"
,
"%ptTtr|%ptTdr"
,
&
t
,
&
t
);
}
}
static
void
__init
static
void
__init
...
@@ -661,7 +668,7 @@ test_pointer(void)
...
@@ -661,7 +668,7 @@ test_pointer(void)
uuid
();
uuid
();
dentry
();
dentry
();
struct_va_format
();
struct_va_format
();
struct_rtc_tim
e
();
time_and_dat
e
();
struct_clk
();
struct_clk
();
bitmap
();
bitmap
();
netdev_features
();
netdev_features
();
...
...
lib/vsprintf.c
View file @
8b390ab7
...
@@ -34,6 +34,7 @@
...
@@ -34,6 +34,7 @@
#include <linux/dcache.h>
#include <linux/dcache.h>
#include <linux/cred.h>
#include <linux/cred.h>
#include <linux/rtc.h>
#include <linux/rtc.h>
#include <linux/time.h>
#include <linux/uuid.h>
#include <linux/uuid.h>
#include <linux/of.h>
#include <linux/of.h>
#include <net/addrconf.h>
#include <net/addrconf.h>
...
@@ -1819,6 +1820,29 @@ char *rtc_str(char *buf, char *end, const struct rtc_time *tm,
...
@@ -1819,6 +1820,29 @@ char *rtc_str(char *buf, char *end, const struct rtc_time *tm,
return
buf
;
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
static
noinline_for_stack
char
*
time_and_date
(
char
*
buf
,
char
*
end
,
void
*
ptr
,
struct
printf_spec
spec
,
char
*
time_and_date
(
char
*
buf
,
char
*
end
,
void
*
ptr
,
struct
printf_spec
spec
,
const
char
*
fmt
)
const
char
*
fmt
)
...
@@ -1826,8 +1850,10 @@ char *time_and_date(char *buf, char *end, void *ptr, struct printf_spec spec,
...
@@ -1826,8 +1850,10 @@ char *time_and_date(char *buf, char *end, void *ptr, struct printf_spec spec,
switch
(
fmt
[
1
])
{
switch
(
fmt
[
1
])
{
case
'R'
:
case
'R'
:
return
rtc_str
(
buf
,
end
,
(
const
struct
rtc_time
*
)
ptr
,
spec
,
fmt
);
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:
default:
return
error_string
(
buf
,
end
,
"(%pt
R
?)"
,
spec
);
return
error_string
(
buf
,
end
,
"(%pt?)"
,
spec
);
}
}
}
}
...
@@ -2143,8 +2169,9 @@ char *fwnode_string(char *buf, char *end, struct fwnode_handle *fwnode,
...
@@ -2143,8 +2169,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]' For a dentry name (optionally 2-4 last components)
* - 'D[234]' Same as 'd' but for a struct file
* - 'D[234]' Same as 'd' but for a struct file
* - 'g' For block_device name (gendisk + partition number)
* - 'g' For block_device name (gendisk + partition number)
* - 't[R
][dt][r]' For time and date as represented
:
* - 't[R
T][dt][r]' For time and date as represented by
:
* R struct rtc_time
* R struct rtc_time
* T time64_t
* - 'C' For a clock, it prints the name (Common Clock Framework) or address
* - 'C' For a clock, it prints the name (Common Clock Framework) or address
* (legacy clock framework) of the clock
* (legacy clock framework) of the clock
* - 'Cn' For a clock, it prints the name (Common Clock Framework) or address
* - 'Cn' For a clock, it prints the name (Common Clock Framework) or address
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment