More list_del_init cleanups
Subsystems (6)
PATCH 1/1 More list_del_init cleanups
Clean up some other instances of list_del + INIT_LIST_HEAD.
--
Brian Gerst
drivers/md/md.c +5 -10
@@ -626,8 +626,7 @@MD_BUG ();return ; } -list_del (&rdev->same_set); -INIT_LIST_HEAD (&rdev->same_set); +list_del_init (&rdev->same_set); rdev->mddev->nb_dev--;printk (KERN_INFO "md: unbind<%s,%d>\n" ,partition_name (rdev->dev), rdev->mddev->nb_dev);
@@ -680,13 +679,11 @@MD_BUG ();unlock_rdev (rdev);free_disk_sb (rdev); -list_del (&rdev->all); -INIT_LIST_HEAD (&rdev->all); +list_del_init (&rdev->all);if (rdev->pending.next != &rdev->pending) {printk (KERN_INFO "md: (%s was pending)\n" ,partition_name (rdev->dev)); -list_del (&rdev->pending); -INIT_LIST_HEAD (&rdev->pending); +list_del_init (&rdev->pending); }#ifndef MODULE md_autodetect_dev (rdev->dev);
@@ -745,8 +742,7 @@schedule ();del_mddev_mapping (mddev,mk_kdev (MD_MAJOR ,mdidx (mddev))); -list_del (&mddev->all_mddevs); -INIT_LIST_HEAD (&mddev->all_mddevs); +list_del_init (&mddev->all_mddevs);kfree (mddev);MOD_DEC_USE_COUNT ; }
@@ -1963,8 +1959,7 @@printk (KERN_INFO "md: created md%d\n" ,mdidx (mddev)); ITERATE_RDEV_GENERIC(candidates,pending,rdev,tmp) {bind_rdev_to_array (rdev, mddev); -list_del (&rdev->pending); -INIT_LIST_HEAD (&rdev->pending); +list_del_init (&rdev->pending); }autorun_array (mddev); }
drivers/usb/class/audio.c +1 -2
@@ -3832,8 +3832,7 @@return ; }down (&open_sem); -list_del (&s->audiodev); -INIT_LIST_HEAD (&s->audiodev); +list_del_init (&s->audiodev); s->usbdev =NULL ;/* deregister all audio and mixer devices, so no new processes can open this device */ for (list = s->audiolist.next; list != &s->audiolist; list = list->next) {
drivers/usb/core/devio.c +5 -10
@@ -215,8 +215,7 @@unsigned long flags;spin_lock_irqsave (&ps->lock, flags); -list_del (&as->asynclist); -INIT_LIST_HEAD (&as->asynclist); +list_del_init (&as->asynclist);spin_unlock_irqrestore (&ps->lock, flags); }
@@ -228,8 +227,7 @@spin_lock_irqsave (&ps->lock, flags);if (!list_empty (&ps->async_completed)) { as = list_entry(ps->async_completed.next, struct async, asynclist); -list_del (&as->asynclist); -INIT_LIST_HEAD (&as->asynclist); +list_del_init (&as->asynclist); }spin_unlock_irqrestore (&ps->lock, flags);return as;
@@ -247,8 +245,7 @@ p = p->next;if (as->userurb != userurb)continue ; -list_del (&as->asynclist); -INIT_LIST_HEAD (&as->asynclist); +list_del_init (&as->asynclist);spin_unlock_irqrestore (&ps->lock, flags);return as; }
@@ -284,8 +281,7 @@spin_lock_irqsave (&ps->lock, flags);while (!list_empty (&ps->async_pending)) { as = list_entry(ps->async_pending.next, struct async, asynclist); -list_del (&as->asynclist); -INIT_LIST_HEAD (&as->asynclist); +list_del_init (&as->asynclist);spin_unlock_irqrestore (&ps->lock, flags);/* usb_unlink_urb calls the completion handler with status == -ENOENT */ usb_unlink_urb (as->urb);
@@ -528,8 +524,7 @@unsigned int i;lock_kernel (); -list_del (&ps->list); -INIT_LIST_HEAD (&ps->list); +list_del_init (&ps->list);if (ps->dev) {for (i =0 ; ps->ifclaimed && i <8 *sizeof (ps->ifclaimed); i++)if (test_bit (i, &ps->ifclaimed))
drivers/usb/core/hub.c +5 -10
@@ -499,10 +499,8 @@spin_lock_irqsave (&hub_event_lock, flags);/* Delete it and then reset it */ -list_del (&hub->event_list); -INIT_LIST_HEAD (&hub->event_list); -list_del (&hub->hub_list); -INIT_LIST_HEAD (&hub->hub_list); +list_del_init (&hub->event_list); +list_del_init (&hub->hub_list);spin_unlock_irqrestore (&hub_event_lock, flags);
@@ -519,10 +517,8 @@spin_lock_irqsave (&hub_event_lock, flags);/* Delete it and then reset it */ -list_del (&hub->event_list); -INIT_LIST_HEAD (&hub->event_list); -list_del (&hub->hub_list); -INIT_LIST_HEAD (&hub->hub_list); +list_del_init (&hub->event_list); +list_del_init (&hub->hub_list);spin_unlock_irqrestore (&hub_event_lock, flags);
@@ -946,8 +942,7 @@ hub = list_entry(tmp, struct usb_hub, event_list); dev = hub->dev; -list_del (tmp); -INIT_LIST_HEAD (tmp); +list_del_init (tmp);down (&hub->khubd_sem);/* never blocks, we were on list */ spin_unlock_irqrestore (&hub_event_lock, flags);
drivers/usb/core/inode.c +1 -2
@@ -672,8 +672,7 @@ }while (!list_empty (&dev->filelist)) { ds = list_entry(dev->filelist.next, struct dev_state, list); -list_del (&ds->list); -INIT_LIST_HEAD (&ds->list); +list_del_init (&ds->list);down_write (&ds->devsem); ds->dev =NULL ;up_write (&ds->devsem);
drivers/usb/host/hc_simple.c +2 -4
@@ -560,8 +560,7 @@epd_t *ed = &hci_dev->ed[qu_pipeindex (urb->pipe)];DBGFUNC ("enter qu_next_urb\n" ); -list_del (&urb->urb_list); -INIT_LIST_HEAD (&urb->urb_list); +list_del_init (&urb->urb_list);if (ed->pipe_head == urb) {#ifdef HC_URB_TIMEOUT
@@ -574,8 +573,7 @@if (!list_empty (&ed->urb_queue)) { urb = list_entry (ed->urb_queue.next, struct urb, urb_list); -list_del (&urb->urb_list); -INIT_LIST_HEAD (&urb->urb_list); +list_del_init (&urb->urb_list); ed->pipe_head = urb;qu_queue_active_urb (hci, urb, ed); }else {
drivers/usb/host/hc_sl811.c +1 -2
@@ -1206,8 +1206,7 @@usb_deregister_bus (hci->bus);usb_free_bus (hci->bus); -list_del (&hci->hci_hcd_list); -INIT_LIST_HEAD (&hci->hci_hcd_list); +list_del_init (&hci->hci_hcd_list);kfree (hci); }
drivers/usb/host/usb-ohci.c +1 -2
@@ -2425,8 +2425,7 @@usb_free_bus (ohci->bus); } -list_del (&ohci->ohci_hcd_list); -INIT_LIST_HEAD (&ohci->ohci_hcd_list); +list_del_init (&ohci->ohci_hcd_list);ohci_mem_cleanup (ohci);
fs/dquot.c +3 -6
@@ -190,8 +190,7 @@static inline void remove_dquot_hash (struct dquot *dquot) { -list_del (&dquot->dq_hash); -INIT_LIST_HEAD (&dquot->dq_hash); +list_del_init (&dquot->dq_hash); }static inline struct dquot *find_dquot (unsigned int hashent,struct super_block *sb,unsigned int id,int type)
@@ -232,8 +231,7 @@ {if (list_empty (&dquot->dq_free))return ; -list_del (&dquot->dq_free); -INIT_LIST_HEAD (&dquot->dq_free); +list_del_init (&dquot->dq_free); dqstats.free_dquots--; }
@@ -738,8 +736,7 @@while (act_head != tofree_head) { dquot = list_entry(act_head, struct dquot, dq_free); act_head = act_head->next; -list_del (&dquot->dq_free);/* Remove dquot from the list so we won't have problems... */ -INIT_LIST_HEAD (&dquot->dq_free); +list_del_init (&dquot->dq_free);/* Remove dquot from the list so we won't have problems... */ dqput (dquot); }unlock_kernel ();
fs/hfs/catalog.c +3 -6
@@ -158,8 +158,7 @@static inline void remove_hash (struct hfs_cat_entry *entry) { -list_del (&entry->hash); -INIT_LIST_HEAD (&entry->hash); +list_del_init (&entry->hash); }/*
@@ -223,8 +222,7 @@ {if (!(entry->state &HFS_DELETED )) { entry->state |=HFS_DELETED ; -list_del (&entry->hash); -INIT_LIST_HEAD (&entry->hash); +list_del_init (&entry->hash);if (entry->type ==HFS_CDR_FIL ) {/* free all extents */
@@ -882,8 +880,7 @@ }if (!entry->count) { -list_del (&entry->hash); -INIT_LIST_HEAD (&entry->hash); +list_del_init (&entry->hash);list_del (&entry->list);list_add (&entry->list, dispose);continue ;
fs/inode.c +4 -8
@@ -390,8 +390,7 @@if (atomic_read (&inode->i_count))continue ;list_del (tmp); -list_del (&inode->i_hash); -INIT_LIST_HEAD (&inode->i_hash); +list_del_init (&inode->i_hash);list_add (tmp, freeable); inode->i_state |=I_FREEING ; count++;
@@ -777,8 +776,7 @@void remove_inode_hash (struct inode *inode) {spin_lock (&inode_lock); -list_del (&inode->i_hash); -INIT_LIST_HEAD (&inode->i_hash); +list_del_init (&inode->i_hash);spin_unlock (&inode_lock); }
@@ -786,10 +784,8 @@ {struct super_operations *op = inode->i_sb->s_op; -list_del (&inode->i_hash); -INIT_LIST_HEAD (&inode->i_hash); -list_del (&inode->i_list); -INIT_LIST_HEAD (&inode->i_list); +list_del_init (&inode->i_hash); +list_del_init (&inode->i_list); inode->i_state|=I_FREEING ; inodes_stat.nr_inodes--;spin_unlock (&inode_lock);
fs/intermezzo/psdev.c +2 -4
@@ -162,8 +162,7 @@if (tmp->rq_unique == hdr.unique) { req = tmp;/* unlink here: keeps search length minimal */ -list_del (&req->rq_chain); -INIT_LIST_HEAD (&req->rq_chain); +list_del_init (&req->rq_chain);CDEBUG (D_PSDEV ,"Eureka opc %d uniq %d!\n" , hdr.opcode, hdr.unique);break ;
@@ -1442,8 +1441,7 @@schedule (); } -list_del (&req->rq_chain); -INIT_LIST_HEAD (&req->rq_chain); +list_del_init (&req->rq_chain);remove_wait_queue (&req->rq_sleep, &wait); current->state =TASK_RUNNING ;
fs/locks.c +2 -4
@@ -397,10 +397,8 @@*/ static void locks_delete_block (struct file_lock *waiter) { -list_del (&waiter->fl_block); -INIT_LIST_HEAD (&waiter->fl_block); -list_del (&waiter->fl_link); -INIT_LIST_HEAD (&waiter->fl_link); +list_del_init (&waiter->fl_block); +list_del_init (&waiter->fl_link); waiter->fl_next =NULL ; }
fs/nfs/write.c +1 -2
@@ -338,8 +338,7 @@if (!NFS_WBACK_BUSY (req))printk (KERN_ERR "NFS: unlocked request attempted unhashed!\n" ); inode = req->wb_inode; -list_del (&req->wb_hash); -INIT_LIST_HEAD (&req->wb_hash); +list_del_init (&req->wb_hash); nfsi =NFS_I (inode); nfsi->npages--;if ((nfsi->npages ==0 ) !=list_empty (&nfsi->writeback))
include/linux/dcache.h +1 -2
@@ -156,8 +156,7 @@static __inline__void d_drop (struct dentry * dentry) {spin_lock (&dcache_lock); -list_del (&dentry->d_hash); -INIT_LIST_HEAD (&dentry->d_hash); +list_del_init (&dentry->d_hash);spin_unlock (&dcache_lock); }
Quoted 4 lines · Brian Gerst
Clean up some other instances of
list_del+INIT_LIST_HEAD.--
Brian Gerst
[snip]
fs/hfs/catalog.c line 886
Quoted 6 lines
fs/hfs/catalog.c +1
-2-list_del (&entry->hash); -INIT_LIST_HEAD (&entry->hash); +list_del_init (&entry->hash);list_del (&entry->list);list_add (&entry->list, dispose);continue ;
If we are at it, how about replacing:
list_del(&entry->list); list_add(&entry->list, dispose);
with something like:
list_del_add(&entry->list, dispose);
Signature · 2 lines
Dan Aloni [email protected]
Quoted 9 lines · Dan Aloni
If we are at it, how about replacing:
list_del(&entry->list); list_add(&entry->list, dispose);with something like:
list_del_add(&entry->list, dispose);
Ehh.. Am I the only one who thinks "move()" would make more sense than "del_add()"?
How many such users are there? I don't want to make up new abstractions if they aren't widely used - it's not as if "del + add" is all that hard to understand in itself..
Linus
Hi,
Quoted 6 lines · Linus Torvalds
Ehh.. Am I the only one who thinks "
move()" would make more sense than "del_add()"?How many such users are there? I don't want to make up new abstractions if they aren't widely used - it's not as if "del + add" is all that hard to understand in itself..
There are 57 uses of list_del(); list_add(); plus 1 use of remove_parent(); add_parent().
There are 29 uses of list_del(); list_add_tail();.
Regards,
Thunder
Signature · 4 lines
ship is leaving right on time | Thunder from the hill at ngforever empty harbour, wave goodbye | evacuation of the isle | free inhabitant not directly caveman's paintings drowning | belonging anywhere
Quoted 5 lines · Thunder from the hill
There are 57 uses of
list_del();list_add(); plus 1 use ofremove_parent();add_parent().There are 29 uses of
list_del();list_add_tail();.
Hmm. Sounds like "list_move()" and "list_move_tail()" might be worthwhile.
That's assuming people actually _want_ something like that? Anybody willing to do this, _and_ go through the maintainers of the appropriate sub-systems?
Linus
Hi,
Quoted 3 lines · Linus Torvalds
That's assuming people actually _want_ something like that? Anybody willing to do this, _and_ go through the maintainers of the appropriate sub-systems?
I might have the function, but what do you mean by go through the maintainers of the appropriate sub-systems?
Regards,
Thunder
Signature · 4 lines
ship is leaving right on time | Thunder from the hill at ngforever empty harbour, wave goodbye | evacuation of the isle | free inhabitant not directly caveman's paintings drowning | belonging anywhere
Quoted 3 lines · Thunder from the hill
I might have the function, but what do you mean by go through the maintainers of the appropriate sub-systems?
Basically, send them patches to gauge whether they want the thing or not..
Linus
Hi,
Quoted 1 line · Linus Torvalds
Basically, send them patches to gauge whether they want the thing or not..
OK, will do.
Regards,
Thunder
Signature · 4 lines
ship is leaving right on time | Thunder from the hill at ngforever empty harbour, wave goodbye | evacuation of the isle | free inhabitant not directly caveman's paintings drowning | belonging anywhere
Quoted 9 lines · Linus Torvalds
Quoted 6 lines · Dan Aloni
If we are at it, how about replacing:
list_del(&entry->list); list_add(&entry->list, dispose);
Quoted 6 lines
Quoted 3 lines
with something like:
list_del_add(&entry->list, dispose);Ehh.. Am I the only one who thinks "
move()" would make more sense than "del_add()"?
I was going to suggest list_move(), but then I thought about being consistent with the func1_func2 convention as in list_del_init().
Signature · 2 lines
Dan Aloni [email protected]