[PATCH] GenWQE: Change default access rights for device node
From: Frank Haverkamp
Date: Wed Jun 29 2016 - 09:49:31 EST
Since it should always be ok for normal users to operate the accelerator,
it makes sense to change it in our driver, rather than adding udev rules
for all Linux distributions.
Signed-off-by: Frank Haverkamp <haver@xxxxxxxxxxxxxxxxxx>
---
drivers/misc/genwqe/card_base.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/drivers/misc/genwqe/card_base.c b/drivers/misc/genwqe/card_base.c
index 4cf8f82..768a057 100644
--- a/drivers/misc/genwqe/card_base.c
+++ b/drivers/misc/genwqe/card_base.c
@@ -1355,6 +1355,19 @@ static struct pci_driver genwqe_driver = {
};
/**
+ * genwqe_devnode() - Set default access mode for genwqe devices.
+ *
+ * Default mode should be rw for everybody. Do not change default
+ * device name.
+ */
+static char *genwqe_devnode(struct device *dev, umode_t *mode)
+{
+ if (mode)
+ *mode = 0666;
+ return NULL;
+}
+
+/**
* genwqe_init_module() - Driver registration and initialization
*/
static int __init genwqe_init_module(void)
@@ -1367,6 +1380,8 @@ static int __init genwqe_init_module(void)
return -ENOMEM;
}
+ class_genwqe->devnode = genwqe_devnode;
+
debugfs_genwqe = debugfs_create_dir(GENWQE_DEVNAME, NULL);
if (!debugfs_genwqe) {
rc = -ENOMEM;
--
2.7.4