mirror of
https://gitee.com/bianbu-linux/linux-6.6
synced 2025-06-29 23:43:21 -04:00
k1📷 fix the issue where udev scans nodes to release subdev node resource when the camera in use
Change-Id: Ia1a058965c379875e3f0ff91d5a4a87774dcd34e Signed-off-by: lizhirong <zhirong.li@spacemit.com>
This commit is contained in:
parent
563969041a
commit
f491cb1513
2 changed files with 20 additions and 11 deletions
|
@ -16,7 +16,11 @@
|
|||
static int spm_subdev_open(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh)
|
||||
{
|
||||
struct spm_camera_subdev *sc_subdev = v4l2_subdev_to_sc_subdev(sd);
|
||||
cam_dbg("%s(%s) enter.", __func__, sc_subdev->name);
|
||||
cam_dbg("%s(%s) enter. cnt:%d", __func__, sc_subdev->name, atomic_read(&sc_subdev->ref_cnt));
|
||||
|
||||
if (atomic_inc_return(&sc_subdev->ref_cnt) != 1)
|
||||
cam_warn("subdev(%s) was already openned.", sc_subdev->name);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -28,7 +32,9 @@ static int spm_subdev_close(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh)
|
|||
struct spm_camera_subdev *sc_subdev = v4l2_subdev_to_sc_subdev(sd);
|
||||
struct media_pipeline *pipe = media_entity_pipeline(me);
|
||||
|
||||
cam_dbg("%s(%s) enter.", __func__, sc_subdev->name);
|
||||
cam_dbg("%s(%s) enter. cnt:%d", __func__, sc_subdev->name, atomic_read(&sc_subdev->ref_cnt));
|
||||
|
||||
if (atomic_dec_and_test(&sc_subdev->ref_cnt)) {
|
||||
mutex_lock(&mdev->graph_mutex);
|
||||
if (pipe) {
|
||||
sc_pipeline = media_pipeline_to_sc_pipeline(pipe);
|
||||
|
@ -40,6 +46,8 @@ static int spm_subdev_close(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh)
|
|||
}
|
||||
}
|
||||
mutex_unlock(&mdev->graph_mutex);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -36,6 +36,7 @@ struct spm_camera_subdev {
|
|||
struct notifier_block vnode_nb;
|
||||
uint32_t pads_stream_enable;
|
||||
int is_resetting;
|
||||
atomic_t ref_cnt;
|
||||
long (*ioctl)(struct v4l2_subdev *sd, unsigned int cmd, void *arg);
|
||||
void (*release)(struct spm_camera_subdev *sc_subdev);
|
||||
void (*notify)(struct spm_camera_subdev *sc_subdev, unsigned int notification,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue