[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <00e3bd13-eab8-47b0-b577-dfdb3bd5900e@kernel.org>
Date: Tue, 3 Dec 2024 08:57:57 +0100
From: Krzysztof Kozlowski <krzk@...nel.org>
To: Amirreza Zarrabi <quic_azarrabi@...cinc.com>,
Jens Wiklander <jens.wiklander@...aro.org>,
Sumit Garg <sumit.garg@...aro.org>, Bjorn Andersson <andersson@...nel.org>,
Konrad Dybcio <konradybcio@...nel.org>, Rob Herring <robh@...nel.org>,
Krzysztof Kozlowski <krzk+dt@...nel.org>, Conor Dooley
<conor+dt@...nel.org>, Bartosz Golaszewski <bartosz.golaszewski@...aro.org>,
Srinivas Kandagatla <srinivas.kandagatla@...aro.org>
Cc: linux-arm-msm@...r.kernel.org, op-tee@...ts.trustedfirmware.org,
linux-kernel@...r.kernel.org, devicetree@...r.kernel.org,
linux-doc@...r.kernel.org
Subject: Re: [PATCH 08/10] tee: add Qualcomm TEE driver
On 03/12/2024 05:19, Amirreza Zarrabi wrote:
> +static const struct tee_desc qcom_tee_desc = {
> + .name = "qcom_tee",
> + .ops = &qcom_tee_ops,
> + .owner = THIS_MODULE,
> +};
> +
> +static int qcom_tee_probe(struct platform_device *pdev)
> +{
> + struct tee_device *teedev;
> + int err;
> +
> + if (!qcom_scm_is_available())
> + return -EPROBE_DEFER;
So this is part of SCM? Instantiate it there instead of creating fake
DTS nodes.
> +
> + teedev = tee_device_alloc(&qcom_tee_desc, NULL, NULL, NULL);
> + if (IS_ERR(teedev))
> + return PTR_ERR(teedev);
> +
> + err = tee_device_register(teedev);
> + if (err)
> + goto err_unreg_teedev;
> +
> + platform_set_drvdata(pdev, teedev);
> + return 0;
> +
> +err_unreg_teedev:
> + tee_device_unregister(teedev);
> +
> + return err;
> +}
> +
> +static void qcom_tee_remove(struct platform_device *pdev)
> +{
> + struct tee_device *teedev = platform_get_drvdata(pdev);
> +
> + /* Keep a copy, tee_device_unregister() sets it to NULL. */
> + struct tee_shm_pool *pool = teedev->pool;
> +
> + /* Wait for users to go away. */
> + tee_device_unregister(teedev);
> + tee_shm_pool_free(pool);
> +}
> +
> +static const struct of_device_id qcom_tee_dt_match[] = {
> + { .compatible = "qcom,tee" },
> + {},
> +};
> +MODULE_DEVICE_TABLE(of, qcom_tee_dt_match);
> +
> +static struct platform_driver qcom_tee_platform_driver = {
> + .probe = qcom_tee_probe,
> + .remove = qcom_tee_remove,
> + .driver = {
> + .name = "qcom_tee",
> + .of_match_table = qcom_tee_dt_match,
> + },
> +};
> +
> +int qcom_tee_driver_register(void)
> +{
> + return platform_driver_register(&qcom_tee_platform_driver);
> +}
> +
> +void qcom_tee_driver_unregister(void)
> +{
> + platform_driver_unregister(&qcom_tee_platform_driver);
> +}
Why open-coding typical module platform driver macro?
Best regards,
Krzysztof
Powered by blists - more mailing lists