Changes in / [82d062d8:f220e25] in mainline


Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/time/cmos-rtc/cmos-rtc.c

    r82d062d8 rf220e25  
    100100static time_t uptime_get(void);
    101101static bool is_battery_ok(rtc_t *rtc);
     102static int  rtc_fun_online(ddf_fun_t *fun);
     103static int  rtc_fun_offline(ddf_fun_t *fun);
    102104
    103105static ddf_dev_ops_t rtc_dev_ops;
     
    107109        .dev_add = rtc_dev_add,
    108110        .dev_remove = rtc_dev_remove,
     111        .fun_online = rtc_fun_online,
     112        .fun_offline = rtc_fun_offline,
    109113};
    110114
     
    406410        /* Try to normalize the content of the tm structure */
    407411        time_t r = mktime(t);
    408 
    409         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        }
    410420
    411421        fibril_mutex_unlock(&rtc->mutex);
    412422
    413         return r < 0 ? EINVAL : EOK;
     423        return result;
    414424}
    415425
     
    638648        fibril_mutex_unlock(&rtc->mutex);
    639649
     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
    640656        rc = ddf_fun_unbind(rtc->fun);
    641657        if (rc != EOK) {
     
    726742}
    727743
     744static int
     745rtc_fun_online(ddf_fun_t *fun)
     746{
     747        ddf_msg(LVL_DEBUG, "rtc_fun_online()");
     748        return ddf_fun_online(fun);
     749}
     750
     751static int
     752rtc_fun_offline(ddf_fun_t *fun)
     753{
     754        ddf_msg(LVL_DEBUG, "rtc_fun_offline()");
     755        return ddf_fun_offline(fun);
     756}
     757
    728758int
    729759main(int argc, char **argv)
Note: See TracChangeset for help on using the changeset viewer.