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
nexedi
linux
Commits
44f5ca29
Commit
44f5ca29
authored
Mar 06, 2005
by
Russell King
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[ARM] Add validation function for struct rtc_time
Signed-off-by:
Russell King
<
rmk@arm.linux.org.uk
>
parent
e2c5ce04
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
9 deletions
+21
-9
arch/arm/common/rtctime.c
arch/arm/common/rtctime.c
+20
-9
include/asm-arm/rtc.h
include/asm-arm/rtc.h
+1
-0
No files found.
arch/arm/common/rtctime.c
View file @
44f5ca29
...
@@ -94,15 +94,11 @@ void rtc_time_to_tm(unsigned long time, struct rtc_time *tm)
...
@@ -94,15 +94,11 @@ void rtc_time_to_tm(unsigned long time, struct rtc_time *tm)
EXPORT_SYMBOL
(
rtc_time_to_tm
);
EXPORT_SYMBOL
(
rtc_time_to_tm
);
/*
/*
*
Convert Gregorian date to seconds since 01-01-1970 00:00:00.
*
Does the rtc_time represent a valid date/time?
*/
*/
int
rtc_
tm_to_time
(
struct
rtc_time
*
tm
,
unsigned
long
*
time
)
int
rtc_
valid_tm
(
struct
rtc_time
*
tm
)
{
{
unsigned
int
yrs
=
tm
->
tm_year
+
1900
;
if
(
tm
->
tm_year
<
70
||
*
time
=
0
;
if
(
yrs
<
1970
||
tm
->
tm_mon
>=
12
||
tm
->
tm_mon
>=
12
||
tm
->
tm_mday
<
1
||
tm
->
tm_mday
<
1
||
tm
->
tm_mday
>
month_days
(
tm
->
tm_mon
,
yrs
)
||
tm
->
tm_mday
>
month_days
(
tm
->
tm_mon
,
yrs
)
||
...
@@ -111,7 +107,16 @@ int rtc_tm_to_time(struct rtc_time *tm, unsigned long *time)
...
@@ -111,7 +107,16 @@ int rtc_tm_to_time(struct rtc_time *tm, unsigned long *time)
tm
->
tm_sec
>=
60
)
tm
->
tm_sec
>=
60
)
return
-
EINVAL
;
return
-
EINVAL
;
*
time
=
mktime
(
yrs
,
tm
->
tm_mon
+
1
,
tm
->
tm_mday
,
return
0
;
}
EXPORT_SYMBOL
(
rtc_valid_tm
);
/*
* Convert Gregorian date to seconds since 01-01-1970 00:00:00.
*/
int
rtc_tm_to_time
(
struct
rtc_time
*
tm
,
unsigned
long
*
time
)
{
*
time
=
mktime
(
tm
->
tm_year
+
1900
,
tm
->
tm_mon
+
1
,
tm
->
tm_mday
,
tm
->
tm_hour
,
tm
->
tm_min
,
tm
->
tm_sec
);
tm
->
tm_hour
,
tm
->
tm_min
,
tm
->
tm_sec
);
return
0
;
return
0
;
...
@@ -144,7 +149,13 @@ static inline void rtc_read_time(struct rtc_ops *ops, struct rtc_time *tm)
...
@@ -144,7 +149,13 @@ static inline void rtc_read_time(struct rtc_ops *ops, struct rtc_time *tm)
static
inline
int
rtc_set_time
(
struct
rtc_ops
*
ops
,
struct
rtc_time
*
tm
)
static
inline
int
rtc_set_time
(
struct
rtc_ops
*
ops
,
struct
rtc_time
*
tm
)
{
{
return
ops
->
set_time
(
tm
);
int
ret
;
ret
=
rtc_valid_tm
(
tm
);
if
(
ret
==
0
)
ret
=
ops
->
set_time
(
tm
);
return
ret
;
}
}
static
inline
int
rtc_read_alarm
(
struct
rtc_ops
*
ops
,
struct
rtc_wkalrm
*
alrm
)
static
inline
int
rtc_read_alarm
(
struct
rtc_ops
*
ops
,
struct
rtc_wkalrm
*
alrm
)
...
...
include/asm-arm/rtc.h
View file @
44f5ca29
...
@@ -27,6 +27,7 @@ struct rtc_ops {
...
@@ -27,6 +27,7 @@ struct rtc_ops {
void
rtc_time_to_tm
(
unsigned
long
,
struct
rtc_time
*
);
void
rtc_time_to_tm
(
unsigned
long
,
struct
rtc_time
*
);
int
rtc_tm_to_time
(
struct
rtc_time
*
,
unsigned
long
*
);
int
rtc_tm_to_time
(
struct
rtc_time
*
,
unsigned
long
*
);
int
rtc_valid_tm
(
struct
rtc_time
*
);
void
rtc_next_alarm_time
(
struct
rtc_time
*
,
struct
rtc_time
*
,
struct
rtc_time
*
);
void
rtc_next_alarm_time
(
struct
rtc_time
*
,
struct
rtc_time
*
,
struct
rtc_time
*
);
void
rtc_update
(
unsigned
long
,
unsigned
long
);
void
rtc_update
(
unsigned
long
,
unsigned
long
);
int
register_rtc
(
struct
rtc_ops
*
);
int
register_rtc
(
struct
rtc_ops
*
);
...
...
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