msm: camera: jpeg: Use spin lock irqsave to avoid preemption
Use spin_lock_irqsave utility to avoid preemtpion of process_cmd thread in jpeg. This can come in rare conditions when IRQ is received on same CPU which is handling the thread. Such cases will result in deadlock conditions. CRs-Fixed: 3712176 Change-Id: Ib0d9997495272ab49a75b0419eb1e0fd84b1962c Signed-off-by: Dharmender Sharma <quic_dharshar@quicinc.com>
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
* Copyright (c) 2017-2021, The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2022-2023, Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
* Copyright (c) 2022-2024, Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
*/
|
||||
|
||||
#include <linux/of.h>
|
||||
@@ -693,6 +693,7 @@ int cam_jpeg_dma_process_cmd(void *device_priv, uint32_t cmd_type,
|
||||
uint32_t *num_pid = NULL;
|
||||
struct cam_hw_soc_info *soc_info = NULL;
|
||||
int i, rc = 0;
|
||||
unsigned long flags = 0;
|
||||
|
||||
if (!device_priv) {
|
||||
CAM_ERR(CAM_JPEG, "Invalid arguments");
|
||||
@@ -723,7 +724,7 @@ int cam_jpeg_dma_process_cmd(void *device_priv, uint32_t cmd_type,
|
||||
}
|
||||
|
||||
irq_cb_data = &irq_cb->irq_cb_data;
|
||||
spin_lock(&jpeg_dma_dev->hw_lock);
|
||||
spin_lock_irqsave(&jpeg_dma_dev->hw_lock, flags);
|
||||
if (irq_cb->b_set_cb) {
|
||||
core_info->irq_cb.jpeg_hw_mgr_cb =
|
||||
irq_cb->jpeg_hw_mgr_cb;
|
||||
@@ -734,7 +735,7 @@ int cam_jpeg_dma_process_cmd(void *device_priv, uint32_t cmd_type,
|
||||
core_info->irq_cb.irq_cb_data.jpeg_req = NULL;
|
||||
core_info->irq_cb.irq_cb_data.private_data = NULL;
|
||||
}
|
||||
spin_unlock(&jpeg_dma_dev->hw_lock);
|
||||
spin_unlock_irqrestore(&jpeg_dma_dev->hw_lock, flags);
|
||||
rc = 0;
|
||||
break;
|
||||
}
|
||||
|
@@ -1,7 +1,7 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
* Copyright (c) 2017-2021, The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2022-2023, Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
* Copyright (c) 2022-2024, Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
*/
|
||||
|
||||
#include <linux/of.h>
|
||||
@@ -784,6 +784,7 @@ int cam_jpeg_enc_process_cmd(void *device_priv, uint32_t cmd_type,
|
||||
uint32_t *num_pid = NULL;
|
||||
struct cam_hw_soc_info *soc_info = NULL;
|
||||
int i, rc = 0;
|
||||
unsigned long flags = 0;
|
||||
|
||||
if (!device_priv) {
|
||||
CAM_ERR(CAM_JPEG, "Invalid arguments");
|
||||
@@ -813,7 +814,7 @@ int cam_jpeg_enc_process_cmd(void *device_priv, uint32_t cmd_type,
|
||||
}
|
||||
|
||||
irq_cb_data = &irq_cb->irq_cb_data;
|
||||
spin_lock(&jpeg_enc_dev->hw_lock);
|
||||
spin_lock_irqsave(&jpeg_enc_dev->hw_lock, flags);
|
||||
|
||||
if (irq_cb->b_set_cb) {
|
||||
core_info->irq_cb.jpeg_hw_mgr_cb = irq_cb->jpeg_hw_mgr_cb;
|
||||
@@ -824,7 +825,7 @@ int cam_jpeg_enc_process_cmd(void *device_priv, uint32_t cmd_type,
|
||||
core_info->irq_cb.irq_cb_data.private_data = NULL;
|
||||
core_info->irq_cb.irq_cb_data.jpeg_req = NULL;
|
||||
}
|
||||
spin_unlock(&jpeg_enc_dev->hw_lock);
|
||||
spin_unlock_irqrestore(&jpeg_enc_dev->hw_lock, flags);
|
||||
rc = 0;
|
||||
break;
|
||||
}
|
||||
|
Reference in New Issue
Block a user