aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Petazzoni <thomas.petazzoni@free-electrons.com>2013-06-21 09:01:05 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-06-24 19:25:11 -0400
commit585d98e00ba7a5e2abe65f7a1eff631cb612289b (patch)
tree6465f91dcd97507e8aaa4ee7fc1a793c1c7c2a38
parent2608fb653103419ac163206ff6d51b7b6528e2d9 (diff)
char: misc: assign file->private_data in all cases
In fa1f68db6ca ("drivers: misc: pass miscdevice pointer via file private data"), the misc driver infrastructure was changed to assigned file->private_data as a pointer to the 'struct miscdevice' that corresponds to the device being opened. However, this assignment was only done when the misc driver was declaring a driver-specific ->open() operation in its file_operations. This doesn't make sense, as the driver may not necessarily have a custom ->open() operation, and might still be interested in having file->private_data properly set for use in its ->read() and write() operations. Therefore, we move the assignment of file->private_data outside of the condition that tests whether a driver-specific ->open() operation was defined. Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Acked-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/char/misc.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/char/misc.c b/drivers/char/misc.c
index 190d4423653f..fd504d358596 100644
--- a/drivers/char/misc.c
+++ b/drivers/char/misc.c
@@ -143,8 +143,8 @@ static int misc_open(struct inode * inode, struct file * file)
143 err = 0; 143 err = 0;
144 old_fops = file->f_op; 144 old_fops = file->f_op;
145 file->f_op = new_fops; 145 file->f_op = new_fops;
146 file->private_data = c;
146 if (file->f_op->open) { 147 if (file->f_op->open) {
147 file->private_data = c;
148 err=file->f_op->open(inode,file); 148 err=file->f_op->open(inode,file);
149 if (err) { 149 if (err) {
150 fops_put(file->f_op); 150 fops_put(file->f_op);