/* Unregisters the callback that happens when new sensor data is received.  */
inv_error_t inv_unregister_data_cb(inv_error_t(*func)(struct inv_sensor_cal_t *data))
/* Unregisters the callback that happens when new sensor data is received.  */
inv_error_t inv_unregister_data_cb(inv_error_t(*func)(struct inv_sensor_cal_t *data))
{
    int kk, nn;
    for (kk = 0; kk < inv_data_builder.num_cb; ++kk) {
        if (inv_data_builder.process[kk].func == func) {
            for (nn = kk + 1; nn < inv_data_builder.num_cb; ++nn) {
                inv_data_builder.process[nn - 1] =
                    inv_data_builder.process[nn];
            }
            inv_data_builder.num_cb--;
            return INV_SUCCESS;
        }
    }
    return INV_SUCCESS;
}