int VDev::close(file_t *filep) { PX4_DEBUG("VDev::close"); int ret = PX4_OK; lock(); if (_open_count > 0) { /* decrement the open count */ _open_count--; /* callback cannot decline the close */ if (_open_count == 0) { ret = close_last(filep); } } else { ret = -EBADF; } unlock(); return ret; }
int CDev::close(struct file *filp) { int ret = OK; lock(); if (_open_count > 0) { /* decrement the open count */ _open_count--; /* callback cannot decline the close */ if (_open_count == 0) ret = close_last(filp); } else { ret = -EBADF; } unlock(); return ret; }