Skip to content

Commit

Permalink
d4xx: Locking on mux open and close
Browse files Browse the repository at this point in the history
  • Loading branch information
Arun-Prasad-V committed Oct 30, 2024
1 parent 315b6ae commit 63e3c09
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions kernel/realsense/d4xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -2827,9 +2827,16 @@ static int ds5_mux_open(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh)
struct ds5 *state = v4l2_get_subdevdata(sd);

dev_dbg(sd->dev, "%s(): %s (%p)\n", __func__, sd->name, fh);

mutex_lock(&state->lock);
if (state->dfu_dev.dfu_state_flag)
{
mutex_unlock(&state->lock);
return -EBUSY;
}

state->dfu_dev.device_open_count++;
mutex_unlock(&state->lock);

return 0;
};
Expand All @@ -2839,7 +2846,9 @@ static int ds5_mux_close(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh)
struct ds5 *state = v4l2_get_subdevdata(sd);

dev_dbg(sd->dev, "%s(): %s (%p)\n", __func__, sd->name, fh);
mutex_lock(&state->lock);
state->dfu_dev.device_open_count--;
mutex_unlock(&state->lock);
return 0;
};

Expand Down

0 comments on commit 63e3c09

Please sign in to comment.