media: atomisp: Add atomisp_pipe_check() helper
authorHans de Goede <hdegoede@redhat.com>
Sat, 3 Sep 2022 12:49:39 +0000 (14:49 +0200)
committerMauro Carvalho Chehab <mchehab@kernel.org>
Sat, 24 Sep 2022 08:06:31 +0000 (10:06 +0200)
commitf315c1acba84fe17cd92a05e6c1c1bf26ee6bd43
treeebdb2565913a6a0f3ba173858a1b1929eb61372a
parent0d51573df3e0d944a644dbe90cdb06afefe77cc4
media: atomisp: Add atomisp_pipe_check() helper

Several of the ioctl handlers all do the same checks
(isp->fatal_error and asd->streaming errors) add
an atomisp_pipe_check() helper for this.

Note this changes the vidioc_s_fmt_vid_cap and vidioc_s_input handlers
to now reject calls made while asd->streaming==STOPPING. This fixes
a possible race where one thread can make this ioctls while
vidioc_streamoff is running from another thread and it has
temporarily released isp->mutex to kill the watchdog timers / work.

Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
drivers/staging/media/atomisp/pci/atomisp_cmd.c
drivers/staging/media/atomisp/pci/atomisp_ioctl.c
drivers/staging/media/atomisp/pci/atomisp_ioctl.h