Changes in uspace/drv/time/cmos-rtc/cmos-rtc.c [1ae74c6:a582dff] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/time/cmos-rtc/cmos-rtc.c
r1ae74c6 ra582dff 40 40 #include <as.h> 41 41 #include <sysinfo.h> 42 #include <libarch/ddi.h> 42 43 #include <libarch/barrier.h> 43 44 #include <stdio.h> … … 99 100 static time_t uptime_get(void); 100 101 static bool is_battery_ok(rtc_t *rtc); 102 static int rtc_fun_online(ddf_fun_t *fun); 103 static int rtc_fun_offline(ddf_fun_t *fun); 101 104 102 105 static ddf_dev_ops_t rtc_dev_ops; … … 106 109 .dev_add = rtc_dev_add, 107 110 .dev_remove = rtc_dev_remove, 111 .fun_online = rtc_fun_online, 112 .fun_offline = rtc_fun_offline, 108 113 }; 109 114 … … 405 410 /* Try to normalize the content of the tm structure */ 406 411 time_t r = mktime(t); 407 408 rtc->boottime = r - uptime_get(); 412 int result; 413 414 if (r < 0) 415 result = EINVAL; 416 else { 417 rtc->boottime = r - uptime_get(); 418 result = EOK; 419 } 409 420 410 421 fibril_mutex_unlock(&rtc->mutex); 411 422 412 return r < 0 ? EINVAL : EOK;423 return result; 413 424 } 414 425 … … 637 648 fibril_mutex_unlock(&rtc->mutex); 638 649 650 rc = rtc_fun_offline(rtc->fun); 651 if (rc != EOK) { 652 ddf_msg(LVL_ERROR, "Failed to offline function"); 653 return rc; 654 } 655 639 656 rc = ddf_fun_unbind(rtc->fun); 640 657 if (rc != EOK) { … … 725 742 } 726 743 744 static int 745 rtc_fun_online(ddf_fun_t *fun) 746 { 747 int rc; 748 749 ddf_msg(LVL_DEBUG, "rtc_fun_online()"); 750 751 rc = ddf_fun_online(fun); 752 if (rc == EOK) 753 ddf_fun_add_to_category(fun, "clock"); 754 755 return rc; 756 } 757 758 static int 759 rtc_fun_offline(ddf_fun_t *fun) 760 { 761 ddf_msg(LVL_DEBUG, "rtc_fun_offline()"); 762 return ddf_fun_offline(fun); 763 } 764 727 765 int 728 766 main(int argc, char **argv)
Note:
See TracChangeset
for help on using the changeset viewer.