Re: [PATCH v4 06/11] firmware: qcom: scm: remove unused arguments to the shm_brige

From: Kuldeep Singh
Date: Mon May 05 2025 - 06:59:42 EST




On 4/29/2025 11:36 AM, Amirreza Zarrabi wrote:
> shm_bridge create/delete functions always use the scm device.
> There is no need to pass it as an argument.
>
> Signed-off-by: Amirreza Zarrabi <amirreza.zarrabi@xxxxxxxxxxxxxxxx>


There are 2 type of APIs exposed by tzmem driver for pool creation.
devm_qcom_tzmem_pool_new and qcom_tzmem_pool_new.

Device managed pool is created with devm_qcom_tzmem_pool_new but
currently qcom_scm is using it's own dev to create/delete bridge which
is problamatic here.

https://elixir.bootlin.com/linux/v6.14.5/source/drivers/firmware/qcom/qcom_scm.c#L1653

If pool is device managed, same dev should be used in qcom_scm to
create/delete bridge rather than using qcom_scm dev.
The dev passed as an argument to function should be used instead of
__scm->dev.
https://elixir.bootlin.com/linux/v6.14.5/source/drivers/firmware/qcom/qcom_scm.c#L1634

To summarize, I believe correct solution should be to pass corresponding
dev to bridge create/delete APIs instead of always assuming to be
qcom_scm dev for devm_qcom_tzmem_pool_new scenarios.
For qcom_tzmem_pool_new, qcom_scm/qcom_tzmem_dev can be used.

Bartosz/Amirreza, please share your thoughts as well.

--
Regards
Kuldeep