Changeset c739102 in mainline for uspace/drv/time/cmos-rtc/cmos-rtc.c
- Timestamp:
- 2012-11-21T23:26:22Z (12 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 0f2c80a
- Parents:
- bebf97d (diff), 1f7753a (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
rbebf97d rc739102 99 99 static time_t uptime_get(void); 100 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); 101 103 102 104 static ddf_dev_ops_t rtc_dev_ops; … … 106 108 .dev_add = rtc_dev_add, 107 109 .dev_remove = rtc_dev_remove, 110 .fun_online = rtc_fun_online, 111 .fun_offline = rtc_fun_offline, 108 112 }; 109 113 … … 405 409 /* Try to normalize the content of the tm structure */ 406 410 time_t r = mktime(t); 407 408 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 } 409 419 410 420 fibril_mutex_unlock(&rtc->mutex); 411 421 412 return r < 0 ? EINVAL : EOK;422 return result; 413 423 } 414 424 … … 637 647 fibril_mutex_unlock(&rtc->mutex); 638 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 639 655 rc = ddf_fun_unbind(rtc->fun); 640 656 if (rc != EOK) { … … 725 741 } 726 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 727 764 int 728 765 main(int argc, char **argv)
Note:
See TracChangeset
for help on using the changeset viewer.