From: Arjan van de Ven <arjan@infradead.org>
To: gregkh@suse.de
Cc: Arjan van de Ven <arjan@infradead.org>, linux-kernel@vger.kernel.org
Subject: [PATCH 2/3] tty: make the ptmx_fops initialized at compile time
Date: Sun, 30 Oct 2011 09:41:42 -0700 [thread overview]
Message-ID: <20111030094142.06da0eb6@infradead.org> (raw)
In-Reply-To: <20111030094038.7046d529@infradead.org>
>From 0d4c4ba964e65485fe87c4ce439522588956133c Mon Sep 17 00:00:00 2001
From: Arjan van de Ven <arjan@linux.intel.com>
Date: Sat, 29 Oct 2011 10:43:57 -0700
Subject: [PATCH 2/3] tty: make the ptmx_fops initialized at compile time
Now that the tty file operations functions are no longer static,
the pty code can do compile time initialization of the ptmx_fops
struct, which then also allows it to be marked "const".
Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>
---
drivers/tty/pty.c | 16 ++++++++++++----
1 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/drivers/tty/pty.c b/drivers/tty/pty.c
index e809e9d..54e0e56 100644
--- a/drivers/tty/pty.c
+++ b/drivers/tty/pty.c
@@ -713,7 +713,18 @@ out:
return retval;
}
-static struct file_operations ptmx_fops;
+static const struct file_operations ptmx_fops =
+{
+ .llseek = no_llseek,
+ .read = tty_read,
+ .write = tty_write,
+ .poll = tty_poll,
+ .unlocked_ioctl = tty_ioctl,
+ .compat_ioctl = tty_compat_ioctl,
+ .open = ptmx_open,
+ .release = tty_release,
+ .fasync = tty_fasync,
+};
static void __init unix98_pty_init(void)
{
@@ -767,9 +778,6 @@ static void __init unix98_pty_init(void)
register_sysctl_table(pty_root_table);
/* Now create the /dev/ptmx special device */
- tty_default_fops(&ptmx_fops);
- ptmx_fops.open = ptmx_open;
-
cdev_init(&ptmx_cdev, &ptmx_fops);
if (cdev_add(&ptmx_cdev, MKDEV(TTYAUX_MAJOR, 2), 1) ||
register_chrdev_region(MKDEV(TTYAUX_MAJOR, 2), 1, "/dev/ptmx") < 0)
--
1.7.6
next prev parent reply other threads:[~2011-10-30 16:38 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-30 16:40 [PATCH 1/3] tty: make several fops functions non-static so that the pty code can use them Arjan van de Ven
2011-10-30 16:41 ` Arjan van de Ven [this message]
2011-10-30 16:42 ` [PATCH 3/3] tty: remove the (now) unused tty_default_fops() function Arjan van de Ven
2011-11-15 20:18 ` [PATCH 1/3] tty: make several fops functions non-static so that the pty code can use them Greg KH
2011-11-15 20:21 ` Greg KH
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20111030094142.06da0eb6@infradead.org \
--to=arjan@infradead.org \
--cc=gregkh@suse.de \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome