patch-2.3.51 linux/drivers/usb/inode.c

Next file: linux/drivers/usb/keyspan_pda_fw.h
Previous file: linux/drivers/usb/ibmcam.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.50/linux/drivers/usb/inode.c linux/drivers/usb/inode.c
@@ -36,9 +36,9 @@
 #include <linux/locks.h>
 #include <linux/init.h>
 #include <linux/proc_fs.h>
+#include <linux/usb.h>
 #include <asm/uaccess.h>
 
-#include "usb.h"
 #include "usbdevice_fs.h"
 
 /* --------------------------------------------------------------------- */
@@ -446,22 +446,17 @@
 	INIT_LIST_HEAD(&sb->u.usbdevfs_sb.slist);
 	while (!list_empty(&sb->u.usbdevfs_sb.ilist))
 		free_inode(list_entry(sb->u.usbdevfs_sb.ilist.next, struct inode, u.usbdev_i.slist));
-        MOD_DEC_USE_COUNT;
 }
 
-static int usbdevfs_statfs(struct super_block *sb, struct statfs *buf, int bufsiz)
+static int usbdevfs_statfs(struct super_block *sb, struct statfs *buf)
 {
-        struct statfs tmp;
-
-        tmp.f_type = USBDEVICE_SUPER_MAGIC;
-        tmp.f_bsize = PAGE_SIZE/sizeof(long);   /* ??? */
-        tmp.f_blocks = 0;
-        tmp.f_bfree = 0;
-        tmp.f_bavail = 0;
-        tmp.f_files = 0;
-        tmp.f_ffree = 0;
-        tmp.f_namelen = NAME_MAX;
-        return copy_to_user(buf, &tmp, bufsiz) ? -EFAULT : 0;
+        buf->f_type = USBDEVICE_SUPER_MAGIC;
+        buf->f_bsize = PAGE_SIZE/sizeof(long);   /* ??? */
+        buf->f_bfree = 0;
+        buf->f_bavail = 0;
+        buf->f_ffree = 0;
+        buf->f_namelen = NAME_MAX;
+        return 0;
 }
 
 static struct super_operations usbdevfs_sops = { 
@@ -552,8 +547,6 @@
 		}
 	}
 	/* fill superblock */
-        MOD_INC_USE_COUNT;
-        lock_super(s);
         s->s_blocksize = 1024;
         s->s_blocksize_bits = 10;
         s->s_magic = USBDEVICE_SUPER_MAGIC;
@@ -573,7 +566,6 @@
         if (!s->s_root)
                 goto out_no_root;
 	list_add_tail(&s->u.usbdevfs_sb.slist, &superlist);
-	unlock_super(s);
 	for (i = 0; i < NRSPECIAL; i++) {
 		if (!(inode = iget(s, IROOT+1+i)))
 			continue;
@@ -595,23 +587,14 @@
  out_no_root:
         printk("usbdevfs_read_super: get root inode failed\n");
         iput(root_inode);
-        s->s_dev = 0;
-        unlock_super(s);
-	MOD_DEC_USE_COUNT;
         return NULL;
 
  opterr:
         printk(KERN_WARNING "usbdevfs: mount parameter error\n");
-	s->s_dev = 0;
 	return NULL;
 }
 
-static struct file_system_type usbdevice_fs_type = {
-        "usbdevfs",
-        0,
-        usbdevfs_read_super,
-        NULL
-};
+static DECLARE_FSTYPE(usbdevice_fs_type, "usbdevfs", usbdevfs_read_super, 0);
 
 /* --------------------------------------------------------------------- */
 
@@ -675,7 +658,9 @@
 
 /* --------------------------------------------------------------------- */
 
+#ifdef CONFIG_PROC_FS		
 static struct proc_dir_entry *usbdir = NULL;
+#endif	
 
 int __init usbdevfs_init(void)
 {
@@ -688,8 +673,10 @@
 		return ret;
 	if ((ret = register_filesystem(&usbdevice_fs_type)))
 		usb_deregister(&usbdevfs_driver);
+#ifdef CONFIG_PROC_FS		
 	/* create mount point for usbdevfs */
 	usbdir = proc_mkdir("usb", proc_bus);
+#endif	
 	return ret;
 }
 
@@ -697,8 +684,10 @@
 {
 	usb_deregister(&usbdevfs_driver);
 	unregister_filesystem(&usbdevice_fs_type);
+#ifdef CONFIG_PROC_FS	
         if (usbdir)
                 remove_proc_entry("usb", proc_bus);
+#endif
 }
 
 #if 0

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)