Re: [RFC] device_initialize()

Greg KH (greg@kroah.com)
Mon, 14 Oct 2002 11:03:25 -0700


On Mon, Oct 14, 2002 at 10:24:22AM -0700, Greg KH wrote:
> +/**
> * device_register - register a device
> * @dev: pointer to the device structure
> *
> @@ -167,15 +188,10 @@
> if (!dev || !strlen(dev->bus_id))
> return -EINVAL;
>
> - INIT_LIST_HEAD(&dev->node);
> - INIT_LIST_HEAD(&dev->children);
> - INIT_LIST_HEAD(&dev->g_list);
> - INIT_LIST_HEAD(&dev->driver_list);
> - INIT_LIST_HEAD(&dev->bus_list);
> - INIT_LIST_HEAD(&dev->intf_list);
> - spin_lock_init(&dev->lock);
> - atomic_set(&dev->refcount,2);
> - dev->present = 1;
> + if (dev->state != DEVICE_INITIALIZED)
> + return -EINVAL;
> +
> + get_device(dev);
> spin_lock(&device_lock);
> if (dev->parent) {
> get_device_locked(dev->parent);
> @@ -212,6 +228,7 @@
> if (dev->parent)
> put_device(dev->parent);
> }
> + dev->state = DEVICE_INITIALIZED;

As someone just kindly pointed out to me, this should be
DEVICE_REGISTERED. Sorry about that.

thanks,

greg k-h
-
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/