void rtc72421_destroy(rtc_72421_t *context, int save) { if (save) { if (context->old_offset != context->offset) { rtc_save_context(NULL, 0, NULL, 0, context->device, context->offset); } } lib_free(context->device); lib_free(context); }
void ds1216e_destroy(rtc_ds1216e_t *context, int save) { if (save) { if (memcmp(context->clock_regs, context->old_clock_regs, DS1216E_REG_SIZE) || context->offset != context->old_offset) { rtc_save_context(NULL, 0, context->clock_regs, DS1216E_REG_SIZE, context->device, context->offset); } } lib_free(context->clock_regs); lib_free(context->device); lib_free(context); }
void pcf8583_destroy(rtc_pcf8583_t *context, int save) { if (save) { if (memcmp(context->ram, context->old_ram, PCF8583_RAM_SIZE) || memcmp(context->clock_regs, context->old_clock_regs, PCF8583_REG_SIZE) || context->offset != context->old_offset) { rtc_save_context(context->ram, PCF8583_RAM_SIZE, context->clock_regs, PCF8583_REG_SIZE, context->device, context->offset); } } lib_free(context->ram); lib_free(context->clock_regs); lib_free(context->device); lib_free(context); }