lkml.org 
[lkml]   [2011]   [Oct]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH 2/3] tty: make the ptmx_fops initialized at compile time
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


\
 
 \ /
  Last update: 2011-10-30 17:41    [from the cache]
©2003-2011 Jasper Spaans