aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/lguest
diff options
context:
space:
mode:
authorMartin Kepplinger <martink@posteo.de>2015-03-23 21:21:20 -0400
committerRusty Russell <rusty@rustcorp.com.au>2015-03-23 21:22:06 -0400
commit67c50bf292c1c02ec7ca548049c53cc08dc75ed1 (patch)
treed3cd468c7f7a2d7a727f983b7b25b652dabd9d60 /drivers/lguest
parent88ad1a147e2c84d33cb50f5ebff1ece5e0cd4383 (diff)
lguest: explicitly set miscdevice's private_data NULL
There is a proposed change to the miscdevice's behaviour on open(). Currently file->private_data stays NULL, but only because we don't have an open-entry in struct file_operations. This may change so that private_data, more consistently, is always set to struct miscdevice, not only *if* the driver has it's own open() routine and fops-entry, see https://lkml.org/lkml/2014/12/4/939 and commit 94e4fe2cab3d43b3ba7c3f721743006a8c9d913a In short: If we rely on file->private_data being NULL, we should ensure it is NULL ourselves. Signed-off-by: Martin Kepplinger <martink@posteo.de> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'drivers/lguest')
-rw-r--r--drivers/lguest/lguest_user.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/lguest/lguest_user.c b/drivers/lguest/lguest_user.c
index c4c6113eb9a6..30c60687d277 100644
--- a/drivers/lguest/lguest_user.c
+++ b/drivers/lguest/lguest_user.c
@@ -339,6 +339,13 @@ static ssize_t write(struct file *file, const char __user *in,
339 } 339 }
340} 340}
341 341
342static int open(struct inode *inode, struct file *file)
343{
344 file->private_data = NULL;
345
346 return 0;
347}
348
342/*L:060 349/*L:060
343 * The final piece of interface code is the close() routine. It reverses 350 * The final piece of interface code is the close() routine. It reverses
344 * everything done in initialize(). This is usually called because the 351 * everything done in initialize(). This is usually called because the
@@ -409,6 +416,7 @@ static int close(struct inode *inode, struct file *file)
409 */ 416 */
410static const struct file_operations lguest_fops = { 417static const struct file_operations lguest_fops = {
411 .owner = THIS_MODULE, 418 .owner = THIS_MODULE,
419 .open = open,
412 .release = close, 420 .release = close,
413 .write = write, 421 .write = write,
414 .read = read, 422 .read = read,