public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Frank Haverkamp <haver@linux.vnet.ibm.com>
To: gregkh@linuxfoundation.org
Cc: sebott@linux.vnet.ibm.com, geliangtang@163.com,
	linux-kernel@vger.kernel.org, bhelgaas@google.com,
	esa@linux.vnet.ibm.com, haver@linux.vnet.ibm.com,
	breno.leitao@gmail.com, schwidefsky@de.ibm.com,
	krisman@linux.vnet.ibm.com
Subject: [PATCH] GenWQE: Change default access rights for device node
Date: Wed, 29 Jun 2016 15:47:43 +0200	[thread overview]
Message-ID: <20160629134743.12424-2-haver@linux.vnet.ibm.com> (raw)
In-Reply-To: <20160629134743.12424-1-haver@linux.vnet.ibm.com>

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@linux.vnet.ibm.com>
---
 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

  reply	other threads:[~2016-06-29 13:49 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-29 13:47 [PATCH] GenWQE: Change device access rights Frank Haverkamp
2016-06-29 13:47 ` Frank Haverkamp [this message]
2016-06-29 20:50   ` [PATCH] GenWQE: Change default access rights for device node Gabriel Krisman Bertazi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160629134743.12424-2-haver@linux.vnet.ibm.com \
    --to=haver@linux.vnet.ibm.com \
    --cc=bhelgaas@google.com \
    --cc=breno.leitao@gmail.com \
    --cc=esa@linux.vnet.ibm.com \
    --cc=geliangtang@163.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=krisman@linux.vnet.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=schwidefsky@de.ibm.com \
    --cc=sebott@linux.vnet.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox