Re: [PATCH] Driver Core update for 2.6.3-rc1

From: Greg KH (greg_at_kroah.com)
Date: 02/10/04

  • Next message: Greg KH: "Re: [PATCH] Driver Core update for 2.6.3-rc1"
    Date:	Mon, 9 Feb 2004 15:25:41 -0800
    To: linux-kernel@vger.kernel.org
    
    

    ChangeSet 1.1607, 2004/02/09 14:01:07-08:00, greg@kroah.com

    Driver Core: fix up list_for_each() calls to list_for_each_entry()

    Now this should get that Rusty^Wmonkey off my back...

     drivers/base/class.c | 25 +++++++------------------
     drivers/base/class_simple.c | 4 +---
     2 files changed, 8 insertions(+), 21 deletions(-)

    diff -Nru a/drivers/base/class.c b/drivers/base/class.c
    --- a/drivers/base/class.c Mon Feb 9 15:08:55 2004
    +++ b/drivers/base/class.c Mon Feb 9 15:08:55 2004
    @@ -3,8 +3,8 @@
      *
      * Copyright (c) 2002-3 Patrick Mochel
      * Copyright (c) 2002-3 Open Source Development Labs
    - * Copyright (c) 2003 Greg Kroah-Hartman
    - * Copyright (c) 2003 IBM Corp.
    + * Copyright (c) 2003-2004 Greg Kroah-Hartman
    + * Copyright (c) 2003-2004 IBM Corp.
      *
      * This file is released under the GPLv2
      *
    @@ -278,7 +278,6 @@
     {
             struct class * parent;
             struct class_interface * class_intf;
    - struct list_head * entry;
             int error;
     
             class_dev = class_device_get(class_dev);
    @@ -302,11 +301,9 @@
             if (parent) {
                     down_write(&parent->subsys.rwsem);
                     list_add_tail(&class_dev->node, &parent->children);
    - list_for_each(entry, &parent->interfaces) {
    - class_intf = container_of(entry, struct class_interface, node);
    + list_for_each_entry(class_intf, &parent->interfaces, node)
                             if (class_intf->add)
                                     class_intf->add(class_dev);
    - }
                     up_write(&parent->subsys.rwsem);
             }
     
    @@ -330,16 +327,13 @@
     {
             struct class * parent = class_dev->class;
             struct class_interface * class_intf;
    - struct list_head * entry;
     
             if (parent) {
                     down_write(&parent->subsys.rwsem);
                     list_del_init(&class_dev->node);
    - list_for_each(entry, &parent->interfaces) {
    - class_intf = container_of(entry, struct class_interface, node);
    + list_for_each_entry(class_intf, &parent->interfaces, node)
                             if (class_intf->remove)
                                     class_intf->remove(class_dev);
    - }
                     up_write(&parent->subsys.rwsem);
             }
     
    @@ -395,7 +389,6 @@
     {
             struct class * parent;
             struct class_device * class_dev;
    - struct list_head * entry;
     
             if (!class_intf || !class_intf->class)
                     return -ENODEV;
    @@ -408,10 +401,8 @@
             list_add_tail(&class_intf->node, &parent->interfaces);
     
             if (class_intf->add) {
    - list_for_each(entry, &parent->children) {
    - class_dev = container_of(entry, struct class_device, node);
    + list_for_each_entry(class_dev, &parent->children, node)
                             class_intf->add(class_dev);
    - }
             }
             up_write(&parent->subsys.rwsem);
     
    @@ -421,7 +412,7 @@
     void class_interface_unregister(struct class_interface *class_intf)
     {
             struct class * parent = class_intf->class;
    - struct list_head * entry;
    + struct class_device *class_dev;
     
             if (!parent)
                     return;
    @@ -430,10 +421,8 @@
             list_del_init(&class_intf->node);
     
             if (class_intf->remove) {
    - list_for_each(entry, &parent->children) {
    - struct class_device *class_dev = container_of(entry, struct class_device, node);
    + list_for_each_entry(class_dev, &parent->children, node)
                             class_intf->remove(class_dev);
    - }
             }
             up_write(&parent->subsys.rwsem);
     
    diff -Nru a/drivers/base/class_simple.c b/drivers/base/class_simple.c
    --- a/drivers/base/class_simple.c Mon Feb 9 15:08:55 2004
    +++ b/drivers/base/class_simple.c Mon Feb 9 15:08:55 2004
    @@ -197,12 +197,10 @@
     void class_simple_device_remove(dev_t dev)
     {
             struct simple_dev *s_dev = NULL;
    - struct list_head *tmp;
             int found = 0;
     
             spin_lock(&simple_dev_list_lock);
    - list_for_each(tmp, &simple_dev_list) {
    - s_dev = list_entry(tmp, struct simple_dev, node);
    + list_for_each_entry(s_dev, &simple_dev_list, node) {
                     if (s_dev->dev == dev) {
                             found = 1;
                             break;

    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/


  • Next message: Greg KH: "Re: [PATCH] Driver Core update for 2.6.3-rc1"

    Relevant Pages

    • Re: PCI PM & compatibility
      ... On Thu, 2003-08-28 at 01:29, Patrick Mochel wrote: ... > so as long as all the children go done, so will the parent device. ... send the line "unsubscribe linux-kernel" in ... More majordomo info at http://vger.kernel.org/majordomo-info.html ...
      (Linux-Kernel)
    • [PATCH 2.6.9-rc2-mm4 zr36120.c][5/8] Convert pci_find_device to pci_dev_present
      ... The dev was not used from pci_find_device so it was acceptable to replace ... There was no need for it to be in a while loop originally. ... send the line "unsubscribe linux-kernel" in ... More majordomo info at http://vger.kernel.org/majordomo-info.html ...
      (Linux-Kernel)
    • Re: pm: Revert swsusp to 2.6.0-test3
      ... On Mon, 29 Sep 2003, Patrick Mochel wrote: ... I just started playing with it and, although it suspends ... Next power press reboots.) ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • RE: suspend/resume support for driver requires an external firmware
      ... Patrick Mochel wrote: ... > We talked about this in Ottawa a few months ago, ... But all current drivers need to be rewritten. ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • swsusp: kill useless exports
      ... These exports seem totally unneccessary as swsusp can't be module ... Idea by Patrick Mochel. ... People were complaining that M$ turns users into beta-testers... ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)