Changes in / [c99d470:0d8322da] in mainline


Ignore:
File:
1 edited

Legend:

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

    rc99d470 r0d8322da  
    9999static void rtc_register_write(rtc_t *rtc, int reg, int data);
    100100static time_t uptime_get(void);
    101 static bool is_battery_ok(rtc_t *rtc);
    102101
    103102static ddf_dev_ops_t rtc_dev_ops;
     
    335334        }
    336335
    337         /* Check if the RTC battery is OK */
    338         if (!is_battery_ok(rtc)) {
    339                 fibril_mutex_unlock(&rtc->mutex);
    340                 return EIO;
    341         }
    342 
    343336        /* now read the registers */
    344337        do {
     
    443436
    444437        fibril_mutex_lock(&rtc->mutex);
    445 
    446         if (!is_battery_ok(rtc)) {
    447                 fibril_mutex_unlock(&rtc->mutex);
    448                 return EIO;
    449         }
    450438
    451439        /* boottime must be recomputed */
     
    528516{
    529517        rtc_t *rtc = fun_rtc(fun);
    530 
    531         fibril_mutex_lock(&rtc->mutex);
    532         const bool batt_ok = is_battery_ok(rtc);
    533         fibril_mutex_unlock(&rtc->mutex);
     518        const bool batt_ok = rtc_register_read(rtc, RTC_STATUS_D) &
     519            RTC_D_BATTERY_OK;
    534520
    535521        *status = batt_ok ? BATTERY_OK : BATTERY_LOW;
    536522
    537523        return EOK;
    538 }
    539 
    540 /** Check if the battery is working properly or not.
    541  *  The caller already holds the rtc->mutex lock.
    542  *
    543  *  @param rtc   The RTC instance.
    544  *
    545  *  @return      true if the battery is ok, false otherwise.
    546  */
    547 static bool
    548 is_battery_ok(rtc_t *rtc)
    549 {
    550         return rtc_register_read(rtc, RTC_STATUS_D) & RTC_D_BATTERY_OK;
    551524}
    552525
Note: See TracChangeset for help on using the changeset viewer.