diff options
author | Marian Chereji <marian.chereji@freescale.com> | 2013-05-21 08:00:57 (GMT) |
---|---|---|
committer | Fleming Andrew-AFLEMING <AFLEMING@freescale.com> | 2013-07-05 21:29:42 (GMT) |
commit | 834ee5dfe0a48ee95f75eefc4c844ea8fecfa533 (patch) | |
tree | 93583b352b9e23d4624ffa3e4be87196498572be /drivers/staging | |
parent | 36fa661f531051e4bd5872ec325747bc54396f13 (diff) | |
download | linux-fsl-qoriq-834ee5dfe0a48ee95f75eefc4c844ea8fecfa533.tar.xz |
dpa_offload: Add udev support for dpa_classifier
Added udev support so that the device file /dev/dpa_classifier
gets created automatically at boot up instead of the user
needing to create it manually using mknod commands.
Change-Id: Icb2212a3232fe7eddba750617059f8d8b0ba87b5
Signed-off-by: Marian Chereji <marian.chereji@freescale.com>
Reviewed-on: http://git.am.freescale.net:8181/3009
Tested-by: Review Code-CDREVIEW <CDREVIEW@freescale.com>
Reviewed-by: Varvara Andrei-B21317 <andrei.varvara@freescale.com>
Reviewed-by: Zanoschi Aurelian-B43522 <Aurelian.Zanoschi@freescale.com>
Reviewed-by: Fleming Andrew-AFLEMING <AFLEMING@freescale.com>
Diffstat (limited to 'drivers/staging')
-rw-r--r-- | drivers/staging/fsl_dpa_offload/wrp_dpa_classifier.c | 26 | ||||
-rw-r--r-- | drivers/staging/fsl_dpa_offload/wrp_dpa_classifier.h | 1 |
2 files changed, 27 insertions, 0 deletions
diff --git a/drivers/staging/fsl_dpa_offload/wrp_dpa_classifier.c b/drivers/staging/fsl_dpa_offload/wrp_dpa_classifier.c index cc67eef..d9c18b5 100644 --- a/drivers/staging/fsl_dpa_offload/wrp_dpa_classifier.c +++ b/drivers/staging/fsl_dpa_offload/wrp_dpa_classifier.c @@ -211,6 +211,8 @@ static const struct file_operations dpa_classif_fops = { }; static int dpa_cls_cdev_major = -1; +static struct class *classifier_class; +static struct device *classifier_dev; int wrp_dpa_classif_init(void) @@ -229,6 +231,27 @@ int wrp_dpa_classif_init(void) return -EBUSY; } + classifier_class = class_create(THIS_MODULE, WRP_DPA_CLS_CLASS_NAME); + if (IS_ERR(classifier_class)) { + log_err("Failed to create the DPA classifier class device\n"); + unregister_chrdev(dpa_cls_cdev_major, WRP_DPA_CLS_CDEVNAME); + dpa_cls_cdev_major = -1; + return PTR_ERR(classifier_class); + } + + classifier_dev = device_create( classifier_class, + NULL, + MKDEV(dpa_cls_cdev_major, 0), + NULL, + WRP_DPA_CLS_CDEVNAME); + if (IS_ERR(classifier_dev)) { + log_err("Failed to create the DPA Classifier device\n"); + class_destroy(classifier_class); + unregister_chrdev(dpa_cls_cdev_major, WRP_DPA_CLS_CDEVNAME); + dpa_cls_cdev_major = -1; + return PTR_ERR(classifier_dev); + } + return 0; } @@ -238,6 +261,9 @@ int wrp_dpa_classif_exit(void) if (dpa_cls_cdev_major < 0) return 0; + device_destroy(classifier_class, MKDEV(dpa_cls_cdev_major, 0)); + class_destroy(classifier_class); + unregister_chrdev(dpa_cls_cdev_major, WRP_DPA_CLS_CDEVNAME); dpa_cls_cdev_major = -1; diff --git a/drivers/staging/fsl_dpa_offload/wrp_dpa_classifier.h b/drivers/staging/fsl_dpa_offload/wrp_dpa_classifier.h index 411a332..c2d441e 100644 --- a/drivers/staging/fsl_dpa_offload/wrp_dpa_classifier.h +++ b/drivers/staging/fsl_dpa_offload/wrp_dpa_classifier.h @@ -43,6 +43,7 @@ #define WRP_DPA_CLS_CDEVNAME "dpa_classifier" +#define WRP_DPA_CLS_CLASS_NAME "dpa_classifier" int wrp_dpa_classif_init(void); |