]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - fs/seq_file.c
h63xx: tsc2101 alsa sound support
[linux-2.6-omap-h63xx.git] / fs / seq_file.c
index 38ef913767ffd3f839df2d27f2c581d6071c05cd..7c40570b71dc02317a6963a1beed8d983700669a 100644 (file)
  */
 int seq_open(struct file *file, struct seq_operations *op)
 {
-       struct seq_file *p = kmalloc(sizeof(*p), GFP_KERNEL);
-       if (!p)
-               return -ENOMEM;
+       struct seq_file *p = file->private_data;
+
+       if (!p) {
+               p = kmalloc(sizeof(*p), GFP_KERNEL);
+               if (!p)
+                       return -ENOMEM;
+               file->private_data = p;
+       }
        memset(p, 0, sizeof(*p));
        sema_init(&p->sem, 1);
        p->op = op;
-       file->private_data = p;
 
        /*
         * Wrappers around seq_open(e.g. swaps_open) need to be