From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932085AbbCWNAz (ORCPT ); Mon, 23 Mar 2015 09:00:55 -0400 Received: from mx02.posteo.de ([89.146.194.165]:40179 "EHLO mx02.posteo.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752531AbbCWNAw (ORCPT ); Mon, 23 Mar 2015 09:00:52 -0400 From: Martin Kepplinger To: tomvanbraeckel@gmail.com Cc: linux-kernel@vger.kernel.org, gregkh@linuxfoundation.org, arnd@arndb.de, Martin Kepplinger Subject: [PATCH 1/4] char: misc: document behaviour of open() Date: Mon, 23 Mar 2015 13:59:46 +0100 Message-Id: <1427115589-469-2-git-send-email-martink@posteo.de> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1427115589-469-1-git-send-email-martink@posteo.de> References: <1427115589-469-1-git-send-email-martink@posteo.de> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- drivers/char/misc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/char/misc.c b/drivers/char/misc.c index 32ab943..c05e2f4 100644 --- a/drivers/char/misc.c +++ b/drivers/char/misc.c @@ -168,7 +168,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. -- 2.1.4