Re: PCI PM & compatibility

From: Russell King
Date: Thu Aug 28 2003 - 16:47:21 EST


On Wed, Aug 27, 2003 at 03:57:14PM -0700, Patrick Mochel wrote:
> Bah, sorry, I overlooked that. The patch below will add the device before
> calling bus_add_device(). Sorry about the confusion.

For the record, this patch solves the problem, thanks.

> ===== 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);
> -
> }
>
> /**
>

--
Russell King (rmk@xxxxxxxxxxxxxxxx) The developer of ARM Linux
http://www.arm.linux.org.uk/personal/aboutme.html

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