media: atomisp: Move atomisp_streaming_count() check into __atomisp_css_recover()
authorHans de Goede <hdegoede@redhat.com>
Sat, 3 Sep 2022 21:36:01 +0000 (23:36 +0200)
committerMauro Carvalho Chehab <mchehab@kernel.org>
Sat, 24 Sep 2022 08:08:00 +0000 (10:08 +0200)
Both callers of __atomisp_css_recover() check atomisp_streaming_count()
first, move the check into __atomisp_css_recover().

And __atomisp_css_recover() already calls lockdep_assert_held(&isp->mutex),
so drop that from atomisp_css_flush().

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

index 4b459c4..a96a465 100644 (file)
@@ -1282,6 +1282,9 @@ static void __atomisp_css_recover(struct atomisp_device *isp, bool isp_timeout)
 
        lockdep_assert_held(&isp->mutex);
 
+       if (!atomisp_streaming_count(isp))
+               return;
+
        atomisp_css_irq_enable(isp, IA_CSS_IRQ_INFO_CSS_RECEIVER_SOF, false);
 
        BUG_ON(isp->num_of_streams > MAX_STREAM_NUM);
@@ -1434,20 +1437,12 @@ void atomisp_assert_recovery_work(struct work_struct *work)
                                                  assert_recovery_work);
 
        mutex_lock(&isp->mutex);
-
-       if (atomisp_streaming_count(isp))
-               __atomisp_css_recover(isp, true);
-
+       __atomisp_css_recover(isp, true);
        mutex_unlock(&isp->mutex);
 }
 
 void atomisp_css_flush(struct atomisp_device *isp)
 {
-       lockdep_assert_held(&isp->mutex);
-
-       if (!atomisp_streaming_count(isp))
-               return;
-
        /* Start recover */
        __atomisp_css_recover(isp, false);