include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit...
[safe/jmp/linux-2.6] / drivers / isdn / hysdn / hysdn_proclog.c
index fcd4992..e83f6fd 100644 (file)
@@ -13,7 +13,8 @@
 #include <linux/module.h>
 #include <linux/poll.h>
 #include <linux/proc_fs.h>
-#include <linux/pci.h>
+#include <linux/sched.h>
+#include <linux/slab.h>
 #include <linux/smp_lock.h>
 
 #include "hysdn_defs.h"
@@ -111,7 +112,7 @@ put_log_buffer(hysdn_card * card, char *cp)
        if (pd->if_used <= 0)
                return;         /* no open file for read */
 
-       if (!(ib = (struct log_data *) kmalloc(sizeof(struct log_data) + strlen(cp), GFP_ATOMIC)))
+       if (!(ib = kmalloc(sizeof(struct log_data) + strlen(cp), GFP_ATOMIC)))
                 return;        /* no memory */
        strcpy(ib->log_start, cp);      /* set output string */
        ib->next = NULL;
@@ -204,7 +205,7 @@ hysdn_log_read(struct file *file, char __user *buf, size_t count, loff_t * off)
 {
        struct log_data *inf;
        int len;
-       struct proc_dir_entry *pde = PDE(file->f_dentry->d_inode);
+       struct proc_dir_entry *pde = PDE(file->f_path.dentry->d_inode);
        struct procdata *pd = NULL;
        hysdn_card *card;
 
@@ -298,8 +299,6 @@ hysdn_log_close(struct inode *ino, struct file *filep)
        struct procdata *pd;
        hysdn_card *card;
        int retval = 0;
-       unsigned long flags;
-       spinlock_t hysdn_lock = SPIN_LOCK_UNLOCKED;
 
        lock_kernel();
        if ((filep->f_mode & (FMODE_READ | FMODE_WRITE)) == FMODE_WRITE) {
@@ -309,7 +308,6 @@ hysdn_log_close(struct inode *ino, struct file *filep)
                /* read access -> log/debug read, mark one further file as closed */
 
                pd = NULL;
-               spin_lock_irqsave(&hysdn_lock, flags);
                inf = *((struct log_data **) filep->private_data);      /* get first log entry */
                if (inf)
                        pd = (struct procdata *) inf->proc_ctrl;        /* still entries there */
@@ -332,7 +330,6 @@ hysdn_log_close(struct inode *ino, struct file *filep)
                        inf->usage_cnt--;       /* decrement usage count for buffers */
                        inf = inf->next;
                }
-               spin_unlock_irqrestore(&hysdn_lock, flags);
 
                if (pd)
                        if (pd->if_used <= 0)   /* delete buffers if last file closed */
@@ -354,7 +351,7 @@ static unsigned int
 hysdn_log_poll(struct file *file, poll_table * wait)
 {
        unsigned int mask = 0;
-       struct proc_dir_entry *pde = PDE(file->f_dentry->d_inode);
+       struct proc_dir_entry *pde = PDE(file->f_path.dentry->d_inode);
        hysdn_card *card;
        struct procdata *pd = NULL;
 
@@ -383,8 +380,9 @@ hysdn_log_poll(struct file *file, poll_table * wait)
 /**************************************************/
 /* table for log filesystem functions defined above. */
 /**************************************************/
-static struct file_operations log_fops =
+static const struct file_operations log_fops =
 {
+       .owner          = THIS_MODULE,
        .llseek         = no_llseek,
        .read           = hysdn_log_read,
        .write          = hysdn_log_write,
@@ -405,13 +403,11 @@ hysdn_proclog_init(hysdn_card * card)
 
        /* create a cardlog proc entry */
 
-       if ((pd = (struct procdata *) kmalloc(sizeof(struct procdata), GFP_KERNEL)) != NULL) {
-               memset(pd, 0, sizeof(struct procdata));
+       if ((pd = kzalloc(sizeof(struct procdata), GFP_KERNEL)) != NULL) {
                sprintf(pd->log_name, "%s%d", PROC_LOG_BASENAME, card->myid);
-               if ((pd->log = create_proc_entry(pd->log_name, S_IFREG | S_IRUGO | S_IWUSR, hysdn_proc_entry)) != NULL) {
-                       pd->log->proc_fops = &log_fops; 
-                       pd->log->owner = THIS_MODULE;
-               }
+               pd->log = proc_create(pd->log_name,
+                               S_IFREG | S_IRUGO | S_IWUSR, hysdn_proc_entry,
+                               &log_fops);
 
                init_waitqueue_head(&(pd->rd_queue));