lkml.org 
[lkml]   [2003]   [Aug]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: PCI PM & compatibility

On Tue, 26 Aug 2003, Russell King wrote:

> On Tue, Aug 26, 2003 at 08:31:55AM -0700, Patrick Mochel wrote:
> > > So in one case, we have PARENT SIBLING SIBLING SIBLING and in the
> > > other case we have SIBLING SIBLING SIBLING PARENT.
> >
> > I haven't been ignoring you. I've been trying to figure exactly what
> > you're talking about. Do you have a concrete example? Is it some PCMCIA
> > driver, or some platform driver?
>
> It's a multi-function chip (again):
>
> sa1111 bus
> SA1111------+-------Interrupt controller
> +-------USB host
> +-------PS/2 ports
>
> The SA1111 probe function registers devices whose parent is the SA1111
> device.
>
> In this case, we end up placing these devices on the list in the wrong
> order.
>
> At the point where the SA1111 probe function is called, the SA1111 device
> is not on the dpm lists, because of the ordering in device_add().

Bah, sorry, I overlooked that. The patch below will add the device before
calling bus_add_device(). Sorry about the confusion.


Pat


===== drivers/base/core.c 1.73 vs edited =====
--- 1.73/drivers/base/core.c Fri Aug 15 10:27:01 2003
+++ edited/drivers/base/core.c Wed Aug 27 15:49:08 2003
@@ -225,28 +225,30 @@
dev->kobj.parent = &parent->kobj;

if ((error = kobject_add(&dev->kobj)))
- goto register_done;
-
- /* now take care of our own registration */
-
+ goto Error;
+ if ((error = device_pm_add(dev)))
+ goto PMError;
+ if ((error = bus_add_device(dev)))
+ goto BusError;
down_write(&devices_subsys.rwsem);
if (parent)
list_add_tail(&dev->node,&parent->children);
up_write(&devices_subsys.rwsem);

- bus_add_device(dev);
-
- device_pm_add(dev);
-
/* notify platform of device entry */
if (platform_notify)
platform_notify(dev);
-
- register_done:
- if (error && parent)
- put_device(parent);
+ Done:
put_device(dev);
return error;
+ BusError:
+ device_pm_remove(dev);
+ PMError:
+ kobject_unregister(&dev->kobj);
+ Error:
+ if (parent)
+ put_device(parent);
+ goto Done;
}


@@ -312,8 +314,6 @@
{
struct device * parent = dev->parent;

- device_pm_remove(dev);
-
down_write(&devices_subsys.rwsem);
if (parent)
list_del_init(&dev->node);
@@ -324,14 +324,11 @@
*/
if (platform_notify_remove)
platform_notify_remove(dev);
-
bus_remove_device(dev);
-
+ device_pm_remove(dev);
kobject_del(&dev->kobj);
-
if (parent)
put_device(parent);
-
}

/**
-
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/

\
 
 \ /
  Last update: 2005-03-22 13:48    [W:0.093 / U:8.128 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site