Merge "mm-drivers: hw_fence: silently fail registration when feature disabled"
This commit is contained in:

committed by
Gerrit - the friendly Code Review server

commit
121ee6c421
@@ -1,6 +1,6 @@
|
|||||||
// SPDX-License-Identifier: GPL-2.0-only
|
// SPDX-License-Identifier: GPL-2.0-only
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
|
* Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <linux/io.h>
|
#include <linux/io.h>
|
||||||
@@ -24,6 +24,9 @@ void *msm_hw_fence_register(enum hw_fence_client_id client_id_ext,
|
|||||||
enum hw_fence_client_id client_id;
|
enum hw_fence_client_id client_id;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
if (!hw_fence_driver_enable)
|
||||||
|
return ERR_PTR(-ENODEV);
|
||||||
|
|
||||||
HWFNC_DBG_H("++ client_id_ext:%d\n", client_id_ext);
|
HWFNC_DBG_H("++ client_id_ext:%d\n", client_id_ext);
|
||||||
|
|
||||||
if (IS_ERR_OR_NULL(hw_fence_drv_data) || !hw_fence_drv_data->resources_ready) {
|
if (IS_ERR_OR_NULL(hw_fence_drv_data) || !hw_fence_drv_data->resources_ready) {
|
||||||
@@ -500,15 +503,26 @@ static int msm_hw_fence_probe_init(struct platform_device *pdev)
|
|||||||
dev_set_drvdata(&pdev->dev, hw_fence_drv_data);
|
dev_set_drvdata(&pdev->dev, hw_fence_drv_data);
|
||||||
hw_fence_drv_data->dev = &pdev->dev;
|
hw_fence_drv_data->dev = &pdev->dev;
|
||||||
|
|
||||||
/* Initialize HW Fence Driver resources */
|
if (hw_fence_driver_enable) {
|
||||||
rc = hw_fence_init(hw_fence_drv_data);
|
/* Initialize HW Fence Driver resources */
|
||||||
if (rc)
|
rc = hw_fence_init(hw_fence_drv_data);
|
||||||
goto error;
|
if (rc)
|
||||||
|
goto error;
|
||||||
|
|
||||||
mutex_init(&hw_fence_drv_data->clients_register_lock);
|
mutex_init(&hw_fence_drv_data->clients_register_lock);
|
||||||
|
|
||||||
/* set ready ealue so clients can register */
|
/* set ready value so clients can register */
|
||||||
hw_fence_drv_data->resources_ready = true;
|
hw_fence_drv_data->resources_ready = true;
|
||||||
|
} else {
|
||||||
|
/* Allocate hw fence driver mem pool and share it with HYP */
|
||||||
|
rc = hw_fence_utils_alloc_mem(hw_fence_drv_data);
|
||||||
|
if (rc) {
|
||||||
|
HWFNC_ERR("failed to alloc base memory\n");
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
|
HWFNC_DBG_INFO("hw fence driver not enabled\n");
|
||||||
|
}
|
||||||
|
|
||||||
HWFNC_DBG_H("-\n");
|
HWFNC_DBG_H("-\n");
|
||||||
|
|
||||||
@@ -534,11 +548,6 @@ static int msm_hw_fence_probe(struct platform_device *pdev)
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!hw_fence_driver_enable) {
|
|
||||||
HWFNC_DBG_INFO("hw fence driver not enabled\n");
|
|
||||||
return -EOPNOTSUPP;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (of_device_is_compatible(pdev->dev.of_node, "qcom,msm-hw-fence"))
|
if (of_device_is_compatible(pdev->dev.of_node, "qcom,msm-hw-fence"))
|
||||||
rc = msm_hw_fence_probe_init(pdev);
|
rc = msm_hw_fence_probe_init(pdev);
|
||||||
if (rc)
|
if (rc)
|
||||||
|
Reference in New Issue
Block a user