aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-03-21 16:36:41 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-03-21 16:36:41 -0400
commite2a0883e4071237d09b604a342c28b96b44a04b3 (patch)
treeaa56f4d376b5eb1c32358c19c2669c2a94e0e1fd /drivers/usb
parent3a990a52f9f25f45469e272017a31e7a3fda60ed (diff)
parent07c0c5d8b8c122b2f2df9ee574ac3083daefc981 (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull vfs pile 1 from Al Viro: "This is _not_ all; in particular, Miklos' and Jan's stuff is not there yet." * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (64 commits) ext4: initialization of ext4_li_mtx needs to be done earlier debugfs-related mode_t whack-a-mole hfsplus: add an ioctl to bless files hfsplus: change finder_info to u32 hfsplus: initialise userflags qnx4: new helper - try_extent() qnx4: get rid of qnx4_bread/qnx4_getblk take removal of PF_FORKNOEXEC to flush_old_exec() trim includes in inode.c um: uml_dup_mmap() relies on ->mmap_sem being held, but activate_mm() doesn't hold it um: embed ->stub_pages[] into mmu_context gadgetfs: list_for_each_safe() misuse ocfs2: fix leaks on failure exits in module_init ecryptfs: make register_filesystem() the last potential failure exit ntfs: forgets to unregister sysctls on register_filesystem() failure logfs: missing cleanup on register_filesystem() failure jfs: mising cleanup on register_filesystem() failure make configfs_pin_fs() return root dentry on success configfs: configfs_create_dir() has parent dentry in dentry->d_parent configfs: sanitize configfs_create() ...
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/core/inode.c23
-rw-r--r--drivers/usb/gadget/f_fs.c8
-rw-r--r--drivers/usb/gadget/inode.c13
3 files changed, 9 insertions, 35 deletions
diff --git a/drivers/usb/core/inode.c b/drivers/usb/core/inode.c
index 9e186f3da839..cefa0c8b5b6a 100644
--- a/drivers/usb/core/inode.c
+++ b/drivers/usb/core/inode.c
@@ -50,7 +50,6 @@
50static const struct file_operations default_file_operations; 50static const struct file_operations default_file_operations;
51static struct vfsmount *usbfs_mount; 51static struct vfsmount *usbfs_mount;
52static int usbfs_mount_count; /* = 0 */ 52static int usbfs_mount_count; /* = 0 */
53static int ignore_mount = 0;
54 53
55static struct dentry *devices_usbfs_dentry; 54static struct dentry *devices_usbfs_dentry;
56static int num_buses; /* = 0 */ 55static int num_buses; /* = 0 */
@@ -256,7 +255,7 @@ static int remount(struct super_block *sb, int *flags, char *data)
256 * i.e. it's a simple_pin_fs from create_special_files, 255 * i.e. it's a simple_pin_fs from create_special_files,
257 * then ignore it. 256 * then ignore it.
258 */ 257 */
259 if (ignore_mount) 258 if (*flags & MS_KERNMOUNT)
260 return 0; 259 return 0;
261 260
262 if (parse_options(sb, data)) { 261 if (parse_options(sb, data)) {
@@ -454,7 +453,6 @@ static const struct super_operations usbfs_ops = {
454static int usbfs_fill_super(struct super_block *sb, void *data, int silent) 453static int usbfs_fill_super(struct super_block *sb, void *data, int silent)
455{ 454{
456 struct inode *inode; 455 struct inode *inode;
457 struct dentry *root;
458 456
459 sb->s_blocksize = PAGE_CACHE_SIZE; 457 sb->s_blocksize = PAGE_CACHE_SIZE;
460 sb->s_blocksize_bits = PAGE_CACHE_SHIFT; 458 sb->s_blocksize_bits = PAGE_CACHE_SHIFT;
@@ -462,19 +460,11 @@ static int usbfs_fill_super(struct super_block *sb, void *data, int silent)
462 sb->s_op = &usbfs_ops; 460 sb->s_op = &usbfs_ops;
463 sb->s_time_gran = 1; 461 sb->s_time_gran = 1;
464 inode = usbfs_get_inode(sb, S_IFDIR | 0755, 0); 462 inode = usbfs_get_inode(sb, S_IFDIR | 0755, 0);
465 463 sb->s_root = d_make_root(inode);
466 if (!inode) { 464 if (!sb->s_root) {
467 dbg("%s: could not get inode!",__func__);
468 return -ENOMEM;
469 }
470
471 root = d_alloc_root(inode);
472 if (!root) {
473 dbg("%s: could not get root dentry!",__func__); 465 dbg("%s: could not get root dentry!",__func__);
474 iput(inode);
475 return -ENOMEM; 466 return -ENOMEM;
476 } 467 }
477 sb->s_root = root;
478 return 0; 468 return 0;
479} 469}
480 470
@@ -591,11 +581,6 @@ static int create_special_files (void)
591 struct dentry *parent; 581 struct dentry *parent;
592 int retval; 582 int retval;
593 583
594 /* the simple_pin_fs calls will call remount with no options
595 * without this flag that would overwrite the real mount options (if any)
596 */
597 ignore_mount = 1;
598
599 /* create the devices special file */ 584 /* create the devices special file */
600 retval = simple_pin_fs(&usb_fs_type, &usbfs_mount, &usbfs_mount_count); 585 retval = simple_pin_fs(&usb_fs_type, &usbfs_mount, &usbfs_mount_count);
601 if (retval) { 586 if (retval) {
@@ -603,8 +588,6 @@ static int create_special_files (void)
603 goto exit; 588 goto exit;
604 } 589 }
605 590
606 ignore_mount = 0;
607
608 parent = usbfs_mount->mnt_root; 591 parent = usbfs_mount->mnt_root;
609 devices_usbfs_dentry = fs_create_file ("devices", 592 devices_usbfs_dentry = fs_create_file ("devices",
610 listmode | S_IFREG, parent, 593 listmode | S_IFREG, parent,
diff --git a/drivers/usb/gadget/f_fs.c b/drivers/usb/gadget/f_fs.c
index 7f445ec723bc..1cbba70836bc 100644
--- a/drivers/usb/gadget/f_fs.c
+++ b/drivers/usb/gadget/f_fs.c
@@ -1063,13 +1063,9 @@ static int ffs_sb_fill(struct super_block *sb, void *_data, int silent)
1063 &simple_dir_operations, 1063 &simple_dir_operations,
1064 &simple_dir_inode_operations, 1064 &simple_dir_inode_operations,
1065 &data->perms); 1065 &data->perms);
1066 if (unlikely(!inode)) 1066 sb->s_root = d_make_root(inode);
1067 if (unlikely(!sb->s_root))
1067 goto Enomem; 1068 goto Enomem;
1068 sb->s_root = d_alloc_root(inode);
1069 if (unlikely(!sb->s_root)) {
1070 iput(inode);
1071 goto Enomem;
1072 }
1073 1069
1074 /* EP0 file */ 1070 /* EP0 file */
1075 if (unlikely(!ffs_sb_create_file(sb, "ep0", ffs, 1071 if (unlikely(!ffs_sb_create_file(sb, "ep0", ffs,
diff --git a/drivers/usb/gadget/inode.c b/drivers/usb/gadget/inode.c
index 4f18a0e46070..8793f32bab11 100644
--- a/drivers/usb/gadget/inode.c
+++ b/drivers/usb/gadget/inode.c
@@ -1571,20 +1571,18 @@ delegate:
1571 1571
1572static void destroy_ep_files (struct dev_data *dev) 1572static void destroy_ep_files (struct dev_data *dev)
1573{ 1573{
1574 struct list_head *entry, *tmp;
1575
1576 DBG (dev, "%s %d\n", __func__, dev->state); 1574 DBG (dev, "%s %d\n", __func__, dev->state);
1577 1575
1578 /* dev->state must prevent interference */ 1576 /* dev->state must prevent interference */
1579restart: 1577restart:
1580 spin_lock_irq (&dev->lock); 1578 spin_lock_irq (&dev->lock);
1581 list_for_each_safe (entry, tmp, &dev->epfiles) { 1579 while (!list_empty(&dev->epfiles)) {
1582 struct ep_data *ep; 1580 struct ep_data *ep;
1583 struct inode *parent; 1581 struct inode *parent;
1584 struct dentry *dentry; 1582 struct dentry *dentry;
1585 1583
1586 /* break link to FS */ 1584 /* break link to FS */
1587 ep = list_entry (entry, struct ep_data, epfiles); 1585 ep = list_first_entry (&dev->epfiles, struct ep_data, epfiles);
1588 list_del_init (&ep->epfiles); 1586 list_del_init (&ep->epfiles);
1589 dentry = ep->dentry; 1587 dentry = ep->dentry;
1590 ep->dentry = NULL; 1588 ep->dentry = NULL;
@@ -1607,8 +1605,7 @@ restart:
1607 dput (dentry); 1605 dput (dentry);
1608 mutex_unlock (&parent->i_mutex); 1606 mutex_unlock (&parent->i_mutex);
1609 1607
1610 /* fds may still be open */ 1608 spin_lock_irq (&dev->lock);
1611 goto restart;
1612 } 1609 }
1613 spin_unlock_irq (&dev->lock); 1610 spin_unlock_irq (&dev->lock);
1614} 1611}
@@ -2061,10 +2058,8 @@ gadgetfs_fill_super (struct super_block *sb, void *opts, int silent)
2061 if (!inode) 2058 if (!inode)
2062 goto Enomem; 2059 goto Enomem;
2063 inode->i_op = &simple_dir_inode_operations; 2060 inode->i_op = &simple_dir_inode_operations;
2064 if (!(sb->s_root = d_alloc_root (inode))) { 2061 if (!(sb->s_root = d_make_root (inode)))
2065 iput(inode);
2066 goto Enomem; 2062 goto Enomem;
2067 }
2068 2063
2069 /* the ep0 file is named after the controller we expect; 2064 /* the ep0 file is named after the controller we expect;
2070 * user mode code can use it for sanity checks, like we do. 2065 * user mode code can use it for sanity checks, like we do.