Fedora kernel-2.6.17-1.2142_FC4 patched with stable patch-2.6.17.4-vs2.0.2-rc26.diff
[linux-2.6.git] / drivers / isdn / hysdn / hysdn_procconf.c
index 2a312de..8e2b038 100644 (file)
@@ -12,7 +12,6 @@
  */
 
 #include <linux/module.h>
-#include <linux/version.h>
 #include <linux/poll.h>
 #include <linux/proc_fs.h>
 #include <linux/pci.h>
@@ -37,9 +36,9 @@ struct conf_writedata {
        int buf_size;           /* actual number of bytes in the buffer */
        int needed_size;        /* needed size when reading pof */
        int state;              /* actual interface states from above constants */
-       uchar conf_line[CONF_LINE_LEN];         /* buffered conf line */
-       word channel;           /* active channel number */
-       uchar *pof_buffer;      /* buffer when writing pof */
+       unsigned char conf_line[CONF_LINE_LEN]; /* buffered conf line */
+       unsigned short channel;         /* active channel number */
+       unsigned char *pof_buffer;      /* buffer when writing pof */
 };
 
 /***********************************************************************/
@@ -50,7 +49,7 @@ struct conf_writedata {
 static int
 process_line(struct conf_writedata *cnf)
 {
-       uchar *cp = cnf->conf_line;
+       unsigned char *cp = cnf->conf_line;
        int i;
 
        if (cnf->card->debug_flags & LOG_CNF_LINE)
@@ -89,14 +88,12 @@ process_line(struct conf_writedata *cnf)
 /* write conf file -> boot or send cfg line to card */
 /****************************************************/
 static ssize_t
-hysdn_conf_write(struct file *file, const char *buf, size_t count, loff_t * off)
+hysdn_conf_write(struct file *file, const char __user *buf, size_t count, loff_t * off)
 {
        struct conf_writedata *cnf;
        int i;
-       uchar ch, *cp;
+       unsigned char ch, *cp;
 
-       if (&file->f_pos != off)        /* fs error check */
-               return (-ESPIPE);
        if (!count)
                return (0);     /* nothing to handle */
 
@@ -209,14 +206,11 @@ hysdn_conf_write(struct file *file, const char *buf, size_t count, loff_t * off)
 /* read conf file -> output card info data */
 /*******************************************/
 static ssize_t
-hysdn_conf_read(struct file *file, char *buf, size_t count, loff_t * off)
+hysdn_conf_read(struct file *file, char __user *buf, size_t count, loff_t * off)
 {
        char *cp;
        int i;
 
-       if (off != &file->f_pos)        /* fs error check */
-               return -ESPIPE;
-
        if (file->f_mode & FMODE_READ) {
                if (!(cp = file->private_data))
                        return (-EFAULT);       /* should never happen */
@@ -320,7 +314,7 @@ hysdn_conf_open(struct inode *ino, struct file *filep)
                return (-EPERM);        /* no permission this time */
        }
        unlock_kernel();
-       return (0);
+       return nonseekable_open(ino, filep);
 }                              /* hysdn_conf_open */
 
 /***************************/
@@ -364,8 +358,7 @@ hysdn_conf_close(struct inode *ino, struct file *filep)
        } else if ((filep->f_mode & (FMODE_READ | FMODE_WRITE)) == FMODE_READ) {
                /* read access -> output card info data */
 
-               if (filep->private_data)
-                       kfree(filep->private_data);     /* release memory */
+               kfree(filep->private_data);     /* release memory */
        }
        unlock_kernel();
        return (retval);
@@ -397,9 +390,9 @@ int
 hysdn_procconf_init(void)
 {
        hysdn_card *card;
-       uchar conf_name[20];
+       unsigned char conf_name[20];
 
-       hysdn_proc_entry = create_proc_entry(PROC_SUBDIR_NAME, S_IFDIR | S_IRUGO | S_IXUGO, proc_net);
+       hysdn_proc_entry = proc_mkdir(PROC_SUBDIR_NAME, proc_net);
        if (!hysdn_proc_entry) {
                printk(KERN_ERR "HYSDN: unable to create hysdn subdir\n");
                return (-1);
@@ -430,7 +423,7 @@ void
 hysdn_procconf_release(void)
 {
        hysdn_card *card;
-       uchar conf_name[20];
+       unsigned char conf_name[20];
 
        card = card_root;       /* start with first card */
        while (card) {