static int v4l2_flash_close(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh) { struct v4l2_flash *v4l2_flash = v4l2_subdev_to_v4l2_flash(sd); struct led_classdev_flash *fled_cdev = v4l2_flash->fled_cdev; struct led_classdev *led_cdev = fled_cdev ? &fled_cdev->led_cdev : NULL; struct led_classdev *led_cdev_ind = v4l2_flash->iled_cdev; int ret = 0; if (!v4l2_fh_is_singular(&fh->vfh)) return 0; if (led_cdev) { mutex_lock(&led_cdev->led_access); if (v4l2_flash->ctrls[STROBE_SOURCE]) ret = v4l2_ctrl_s_ctrl( v4l2_flash->ctrls[STROBE_SOURCE], V4L2_FLASH_STROBE_SOURCE_SOFTWARE); led_sysfs_enable(led_cdev); mutex_unlock(&led_cdev->led_access); } if (led_cdev_ind) { mutex_lock(&led_cdev_ind->led_access); led_sysfs_enable(led_cdev_ind); mutex_unlock(&led_cdev_ind->led_access); } return ret; }
static int v4l2_flash_open(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh) { struct v4l2_flash *v4l2_flash = v4l2_subdev_to_v4l2_flash(sd); struct led_classdev_flash *fled_cdev = v4l2_flash->fled_cdev; struct led_classdev *led_cdev = fled_cdev ? &fled_cdev->led_cdev : NULL; struct led_classdev *led_cdev_ind = v4l2_flash->iled_cdev; int ret = 0; if (!v4l2_fh_is_singular(&fh->vfh)) return 0; if (led_cdev) { mutex_lock(&led_cdev->led_access); led_sysfs_disable(led_cdev); led_trigger_remove(led_cdev); mutex_unlock(&led_cdev->led_access); } if (led_cdev_ind) { mutex_lock(&led_cdev_ind->led_access); led_sysfs_disable(led_cdev_ind); led_trigger_remove(led_cdev_ind); mutex_unlock(&led_cdev_ind->led_access); } ret = __sync_device_with_v4l2_controls(v4l2_flash); if (ret < 0) goto out_sync_device; return 0; out_sync_device: if (led_cdev) { mutex_lock(&led_cdev->led_access); led_sysfs_enable(led_cdev); mutex_unlock(&led_cdev->led_access); } if (led_cdev_ind) { mutex_lock(&led_cdev_ind->led_access); led_sysfs_enable(led_cdev_ind); mutex_unlock(&led_cdev_ind->led_access); } return ret; }
static int hwcam_dev_vo_close( struct file* filep) { hwcam_dev_t* cam = NULL; struct v4l2_fh* eq = NULL; cam = (hwcam_dev_t*)video_drvdata(filep); swap(filep->private_data, eq); BUG_ON(!cam || !eq); if (eq) { hwcam_cfgstream_intf_t* stm = NULL; hwcam_user_t* user = VO2USER(eq); swap(user->stream, stm); if (stm) { hwcam_cfgstream_intf_umount(stm); hwcam_cfgstream_intf_put(stm); } if (v4l2_fh_is_singular(eq)) { hwcam_cfgpipeline_intf_t* pl = NULL; swap(cam->pipeline, pl); if (pl) { hwcam_cfgpipeline_intf_umount(pl); hwcam_cfgpipeline_intf_put(pl); } } v4l2_fh_del(eq); v4l2_fh_exit(eq); HWCAM_CFG_INFO("hwcam_dev_vo_close"); hwcam_user_intf_put(&user->intf); } return 0; }