diff options
author | Aurelian Zanoschi <Aurelian.Zanoschi@freescale.com> | 2013-05-14 11:32:41 (GMT) |
---|---|---|
committer | Fleming Andrew-AFLEMING <AFLEMING@freescale.com> | 2013-07-18 15:39:28 (GMT) |
commit | 943c9fd9774ddadda953ea08c0b197489f8fa0ba (patch) | |
tree | c9bf097c8ba2665d7889d13d30da7b1d27210be1 /drivers/staging | |
parent | 17a88bbbadb880d5fec537e8be597f9e9a7c77f6 (diff) | |
download | linux-fsl-qoriq-943c9fd9774ddadda953ea08c0b197489f8fa0ba.tar.xz |
dpa_offload: Add DPA Stats driver support for udev devices
The device file in the file system is created automatically at init by
the driver without need of any mknod commands.
Change-Id: Ib0d5d4a47d3e92ec3d7a8813223017e0c24503a5
Signed-off-by: Aurelian Zanoschi <Aurelian.Zanoschi@freescale.com>
Reviewed-on: http://git.am.freescale.net:8181/2881
Reviewed-by: Varvara Andrei-B21317 <andrei.varvara@freescale.com>
Reviewed-by: Floarea Anca Jeanina-B12569 <anca.floarea@freescale.com>
Reviewed-by: Chereji Marian-Cornel-R27762 <marian.chereji@freescale.com>
Reviewed-by: Bulie Radu-Andrei-B37577 <Radu.Bulie@freescale.com>
Reviewed-by: Fleming Andrew-AFLEMING <AFLEMING@freescale.com>
Tested-by: Fleming Andrew-AFLEMING <AFLEMING@freescale.com>
Diffstat (limited to 'drivers/staging')
-rw-r--r-- | drivers/staging/fsl_dpa_offload/wrp_dpa_stats.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/drivers/staging/fsl_dpa_offload/wrp_dpa_stats.c b/drivers/staging/fsl_dpa_offload/wrp_dpa_stats.c index 4903afc..5c2cb90 100644 --- a/drivers/staging/fsl_dpa_offload/wrp_dpa_stats.c +++ b/drivers/staging/fsl_dpa_offload/wrp_dpa_stats.c @@ -67,6 +67,8 @@ static const struct file_operations dpa_stats_fops = { DECLARE_CRC8_TABLE(crc8_table); static int dpa_stats_cdev_major = -1; +static struct class *stats_class; +static struct device *stats_dev; struct wrp_dpa_stats_cb wrp_dpa_stats; @@ -177,6 +179,24 @@ int wrp_dpa_stats_init(void) return dpa_stats_cdev_major; } + stats_class = class_create(THIS_MODULE, DPA_STATS_CDEV); + if (IS_ERR(stats_class)) { + log_err("Cannot create DPA Stats class device\n"); + unregister_chrdev(dpa_stats_cdev_major, DPA_STATS_CDEV); + dpa_stats_cdev_major = -1; + return PTR_ERR(stats_class); + } + + stats_dev = device_create(stats_class, NULL, + MKDEV(dpa_stats_cdev_major, 0), NULL, DPA_STATS_CDEV); + if (IS_ERR(stats_dev)) { + log_err("Cannot create DPA Stats device\n"); + class_destroy(stats_class); + unregister_chrdev(dpa_stats_cdev_major, DPA_STATS_CDEV); + dpa_stats_cdev_major = -1; + return PTR_ERR(stats_dev); + } + /* Initialize the event queue */ wrp_dpa_stats_event_queue_init(&wrp_dpa_stats.ev_queue); @@ -187,6 +207,8 @@ int wrp_dpa_stats_exit(void) { if (dpa_stats_cdev_major < 0) return 0; + device_destroy(stats_class, MKDEV(dpa_stats_cdev_major, 0)); + class_destroy(stats_class); unregister_chrdev(dpa_stats_cdev_major, DPA_STATS_CDEV); dpa_stats_cdev_major = -1; |