/* * Default implementations of the character device interface */ int CDev::open(struct file *filp) { int ret = OK; lock(); /* increment the open count */ _open_count++; if (_open_count == 1) { /* first-open callback may decline the open */ ret = open_first(filp); if (ret != OK) _open_count--; } unlock(); return ret; }
/* * Default implementations of the character device interface */ int VDev::open(file_t *filep) { PX4_DEBUG("VDev::open"); int ret = PX4_OK; lock(); /* increment the open count */ _open_count++; if (_open_count == 1) { /* first-open callback may decline the open */ ret = open_first(filep); if (ret != PX4_OK) _open_count--; } unlock(); return ret; }