]> git.baikalelectronics.ru Git - kernel.git/commit
char: misc: assign file->private_data in all cases
authorThomas Petazzoni <thomas.petazzoni@free-electrons.com>
Fri, 21 Jun 2013 13:01:05 +0000 (15:01 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 24 Jun 2013 23:25:11 +0000 (16:25 -0700)
commit40ed46abf3fd1031988a5f2d26757aa2cc921f9a
tree6465f91dcd97507e8aaa4ee7fc1a793c1c7c2a38
parent7d461f04420f1083ee080d6def3bb38fddb175ef
char: misc: assign file->private_data in all cases

In cd67b90bdd6 ("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>
drivers/char/misc.c