usb: xhci: tegra: use time64_t for printing timestamp
Subsystems (3)
PATCH 1/1 usb: xhci: tegra: use time64_t for printing timestamp
The time_t type and time_to_tm() function are deprecated because of y2038 problems. In this driver, they are used to pretty-print the timestamp of the firmware build. This is fine as long as we don't get a firmware build past 2038.
Converting to time64_t and time64_to_tm() avoids the deprecated interfaces and works until 2106, when the firmware-defined data structure overflows.
--- drivers/usb/host/xhci-tegra.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/usb/host/xhci-tegra.c +2 -2
@@ -771,7 +771,7 @@ static int tegra_xusb_load_firmware(struct tegra_xusb *tegra)struct device *dev = tegra->dev;const struct firmware *fw;unsigned long timeout; -time_t timestamp; +time64_t timestamp;struct tm time;u64 address;u32 value;
@@ -877,7 +877,7 @@ static int tegra_xusb_load_firmware(struct tegra_xusb *tegra) } timestamp =le32_to_cpu (header->fwimg_created_time); -time_to_tm (timestamp,0 , &time); +time64_to_tm (timestamp,0 , &time); dev_info(dev, "Firmware timestamp: %ld-%02d-%02d %02d:%02d:%02d UTC\n", time.tm_year + 1900, time.tm_mon + 1, time.tm_mday,
Signature · 1 line
2.9.0
Mathias Nyman
maintainerQuoted 29 lines · Arnd Bergmann
The
time_ttype andtime_to_tm()function are deprecated because of y2038 problems. In this driver, they are used to pretty-print the timestamp of the firmware build. This is fine as long as we don't get a firmware build past 2038.Converting to
time64_tandtime64_to_tm()avoids the deprecated interfaces and works until 2106, when the firmware-defined data structure overflows.Signed-off-by Arnd Bergmann <[email protected]>--- drivers/usb/host/xhci-tegra.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/usb/host/xhci-tegra.c +1
-1@@ -771,7 +771,7 @@ static int tegra_xusb_load_firmware(struct tegra_xusb *tegra)struct device *dev = tegra->dev;const struct firmware *fw;unsigned long timeout; -time_t timestamp; +time64_t timestamp;struct tm time;u64 address;u32 value;
drivers/usb/host/xhci-tegra.c static int tegra_xusb_load_firmware(struct tegra_xusb *tegra) · line 883
Quoted 8 lines
drivers/usb/host/xhci-tegra.c +1
-1@@ -877,7 +877,7 @@ static int tegra_xusb_load_firmware(struct tegra_xusb *tegra) } timestamp =le32_to_cpu (header->fwimg_created_time); -time_to_tm (timestamp,0 , &time); +time64_to_tm (timestamp,0 , &time); dev_info(dev, "Firmware timestamp: %ld-%02d-%02d %02d:%02d:%02d UTC\n", time.tm_year + 1900, time.tm_mon + 1, time.tm_mday,
Thanks, adding to queue
-Mathias