Changeset 850235d in mainline for uspace/drv/time/cmos-rtc/cmos-rtc.c
- Timestamp:
- 2013-03-10T14:56:21Z (11 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 05bab88
- Parents:
- ea906c29 (diff), 2277e03 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/time/cmos-rtc/cmos-rtc.c
rea906c29 r850235d 40 40 #include <as.h> 41 41 #include <sysinfo.h> 42 #include <libarch/ddi.h>43 42 #include <libarch/barrier.h> 44 43 #include <stdio.h> … … 100 99 static time_t uptime_get(void); 101 100 static bool is_battery_ok(rtc_t *rtc); 101 static int rtc_fun_online(ddf_fun_t *fun); 102 static int rtc_fun_offline(ddf_fun_t *fun); 102 103 103 104 static ddf_dev_ops_t rtc_dev_ops; … … 107 108 .dev_add = rtc_dev_add, 108 109 .dev_remove = rtc_dev_remove, 110 .fun_online = rtc_fun_online, 111 .fun_offline = rtc_fun_offline, 109 112 }; 110 113 … … 406 409 /* Try to normalize the content of the tm structure */ 407 410 time_t r = mktime(t); 408 409 rtc->boottime = r - uptime_get(); 411 int result; 412 413 if (r < 0) 414 result = EINVAL; 415 else { 416 rtc->boottime = r - uptime_get(); 417 result = EOK; 418 } 410 419 411 420 fibril_mutex_unlock(&rtc->mutex); 412 421 413 return r < 0 ? EINVAL : EOK;422 return result; 414 423 } 415 424 … … 638 647 fibril_mutex_unlock(&rtc->mutex); 639 648 649 rc = rtc_fun_offline(rtc->fun); 650 if (rc != EOK) { 651 ddf_msg(LVL_ERROR, "Failed to offline function"); 652 return rc; 653 } 654 640 655 rc = ddf_fun_unbind(rtc->fun); 641 656 if (rc != EOK) { … … 726 741 } 727 742 743 static int 744 rtc_fun_online(ddf_fun_t *fun) 745 { 746 int rc; 747 748 ddf_msg(LVL_DEBUG, "rtc_fun_online()"); 749 750 rc = ddf_fun_online(fun); 751 if (rc == EOK) 752 ddf_fun_add_to_category(fun, "clock"); 753 754 return rc; 755 } 756 757 static int 758 rtc_fun_offline(ddf_fun_t *fun) 759 { 760 ddf_msg(LVL_DEBUG, "rtc_fun_offline()"); 761 return ddf_fun_offline(fun); 762 } 763 728 764 int 729 765 main(int argc, char **argv)
Note:
See TracChangeset
for help on using the changeset viewer.