[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <e97f7bfc-a3c2-92a9-953e-572d9438d020@ti.com>
Date: Mon, 4 Feb 2019 09:26:02 -0600
From: "Andrew F. Davis" <afd@...com>
To: Roger Quadros <rogerq@...com>, <tony@...mide.com>,
<ohad@...ery.com>, <bjorn.andersson@...aro.org>
CC: <s-anna@...com>, <david@...hnology.com>, <nsekhar@...com>,
<t-kristo@...com>, <nsaulnier@...com>, <jreeder@...com>,
<m-karicheri2@...com>, <woods.technical@...il.com>,
<linux-omap@...r.kernel.org>, <linux-remoteproc@...r.kernel.org>,
<linux-kernel@...r.kernel.org>, <devicetree@...r.kernel.org>
Subject: Re: [PATCH v2 14/14] rpmsg: pru: add a PRU RPMsg driver
On 2/4/19 8:22 AM, Roger Quadros wrote:
> From: Jason Reeder <jreeder@...com>
>
[...]
> +/* .name matches on RPMsg Channels and causes a probe */
> +static const struct rpmsg_device_id rpmsg_driver_pru_id_table[] = {
> + { .name = "rpmsg-pru" },
> + { },
> +};
> +MODULE_DEVICE_TABLE(rpmsg, rpmsg_driver_pru_id_table);
> +
> +static struct rpmsg_driver rpmsg_pru_driver = {
> + .drv.name = KBUILD_MODNAME,
> + .id_table = rpmsg_driver_pru_id_table,
> + .probe = rpmsg_pru_probe,
> + .callback = rpmsg_pru_cb,
> + .remove = rpmsg_pru_remove,
> +};
> +
> +static int __init rpmsg_pru_init(void)
> +{
> + int ret;
> +
> + rpmsg_pru_class = class_create(THIS_MODULE, "rpmsg_pru");
> + if (IS_ERR(rpmsg_pru_class)) {
> + pr_err("Unable to create class\n");
> + ret = PTR_ERR(rpmsg_pru_class);
> + goto fail_create_class;
> + }
> +
> + ret = alloc_chrdev_region(&rpmsg_pru_devt, 0, PRU_MAX_DEVICES,
> + "rpmsg_pru");
> + if (ret) {
> + pr_err("Unable to allocate chrdev region\n");
> + goto fail_alloc_region;
> + }
> +
> + ret = register_rpmsg_driver(&rpmsg_pru_driver);
> + if (ret) {
> + pr_err("Unable to register rpmsg driver");
> + goto fail_register_rpmsg_driver;
> + }
> +
> + return 0;
> +
> +fail_register_rpmsg_driver:
> + unregister_chrdev_region(rpmsg_pru_devt, PRU_MAX_DEVICES);
> +fail_alloc_region:
> + class_destroy(rpmsg_pru_class);
> +fail_create_class:
> + return ret;
> +}
> +
> +static void __exit rpmsg_pru_exit(void)
> +{
> + unregister_rpmsg_driver(&rpmsg_pru_driver);
> + idr_destroy(&rpmsg_pru_minors);
> + mutex_destroy(&rpmsg_pru_lock);
> + class_destroy(rpmsg_pru_class);
> + unregister_chrdev_region(rpmsg_pru_devt, PRU_MAX_DEVICES);
> +}
> +
> +module_init(rpmsg_pru_init);
> +module_exit(rpmsg_pru_exit);
> +
> +MODULE_AUTHOR("Jason Reeder <jreeder@...com>");
> +MODULE_ALIAS("rpmsg:rpmsg-pru");
MODULE_ALIAS not needed, MODULE_DEVICE_TABLE will generate the alias.
Andrew
> +MODULE_DESCRIPTION("PRU Remote Processor Messaging Driver");
> +MODULE_LICENSE("GPL v2");
>
Powered by blists - more mailing lists