arch/sim: register RTC after clock initialization#19514
Draft
Zepp-Hanzj wants to merge 1 commit into
Draft
Conversation
Registering /dev/rtc0 from up_rtc_initialize() creates the pseudofs inode before clock_inittime() synchronizes CLOCK_REALTIME. Its timestamp is consequently zero and omitted by ls -l. Keep lower-half setup in early RTC initialization, but defer character-device registration to up_initialize(), which runs after clock initialization. Fixes apache#19504 Signed-off-by: hanzhijian <hanzhijian@zepp.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Registering
/dev/rtc0fromup_rtc_initialize()creates itsPseudoFS inode before
clock_inittime()synchronizesCLOCK_REALTIME. As a result, the inode timestamp is zero andls -l /devomits the date forrtc0.Keep the RTC lower-half setup in the early initialization path so it
can still provide the system time. Defer registration of the RTC
character device to
up_initialize(), after clock initialization hascompleted.
Fixes #19504.
Impact
This change only affects the SIM RTC initialization order. The
/dev/rtc0inode now receives a valid creation timestamp. RTC timesynchronization and the RTC driver interface are unchanged.
Testing
Host:
sim:nshThe baseline and fixed builds used identical
.configfiles, verifiedwith
cmp.Before this change on
master:After this change:
Additional checks:
./tools/checkpatch.sh -fpasses for all modified files.sim:nshbuilds successfully.sim:ostest, which does not enable RTC support, builds successfully.