]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
char: misc: document behaviour of open()
authorMartin Kepplinger <martink@posteo.de>
Mon, 23 Mar 2015 12:59:46 +0000 (13:59 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 25 Mar 2015 10:36:38 +0000 (11:36 +0100)
an open syscall now assignes file->private_data to a pointer to the
miscdevice structure. This reminds people not to duplicate code if
they want this and not to depend on it being NULL.

Signed-off-by: Martin Kepplinger <martink@posteo.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/char/misc.c

index ffa97d261cf3322615bc403931d99c71d1896a50..c892c296a4dea06c07cc7ecfc206e87ba4baab56 100644 (file)
@@ -169,7 +169,9 @@ static const struct file_operations misc_fops = {
  *     the minor number requested is used.
  *
  *     The structure passed is linked into the kernel and may not be
- *     destroyed until it has been unregistered.
+ *     destroyed until it has been unregistered. By default, an open()
+ *     syscall to the device sets file->private_data to point to the
+ *     structure. Drivers don't need open in fops for this.
  *
  *     A zero is returned on success and a negative errno code for
  *     failure.