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