From: Frank Haverkamp Date: Wed, 29 Jun 2016 13:47:43 +0000 (+0200) Subject: GenWQE: Change default access rights for device node X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=5ed22cebbacc3d434fe4df5e7178cb2b79042d41;p=linux-beck.git GenWQE: Change default access rights for device node 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 Reviewed-by: Gabriel Krisman Bertazi Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/misc/genwqe/card_base.c b/drivers/misc/genwqe/card_base.c index a70b853fa2c9..6c1f49a85023 100644 --- a/drivers/misc/genwqe/card_base.c +++ b/drivers/misc/genwqe/card_base.c @@ -1350,6 +1350,19 @@ static struct pci_driver genwqe_driver = { .err_handler = &genwqe_err_handler, }; +/** + * 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 */ @@ -1363,6 +1376,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;