Re: [patch] IDE driver model update

From: Patrick Mochel (mochel@osdl.org)
Date: Mon Oct 07 2002 - 17:51:06 EST


On Mon, 7 Oct 2002, Alexander Viro wrote:

>
>
> On Mon, 7 Oct 2002, Patrick Mochel wrote:
>
> > --- a/drivers/ide/ide-probe.c Mon Oct 7 12:19:11 2002
> > +++ b/drivers/ide/ide-probe.c Mon Oct 7 12:19:11 2002
> > @@ -952,6 +952,15 @@
> >
> > EXPORT_SYMBOL(init_irq);
> >
> > +static void ide_device_release(struct device * dev)
> > +{
> > + ide_drive_t * drive = dev->driver_data;
> > + ide_driver_t * driver = drive->driver;
> > +
> > + if (driver && driver->cleanup)
> > + driver->cleanup(drive);
> > +}
> > +
> > /*
> > * init_gendisk() (as opposed to ide_geninit) is called for each major device,
> > * after probing for drives, to allocate partition tables and other data
> > @@ -986,6 +995,8 @@
> > "%s","IDE Drive");
> > disk->disk_dev.parent = &hwif->gendev;
> > disk->disk_dev.bus = &ide_bus_type;
> > + disk->disk_dev.driver_data = &hwif->drives[unit];
> > + disk->disk_dev.release = ide_device_release;
>
> That is Wrong(tm). Logics around ->cleanup() doesn't belong to driverfs.
> As far as IDE code is concerned, any outside calls of ->cleanup() are
> illegal. What are you trying to achieve with that?

It's the desctrutor for the device object. ->release() is the last thing
called when the last reference to the device goes away. That's the only
time it's called.

        -pat

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



This archive was generated by hypermail 2b29 : Mon Oct 07 2002 - 22:01:01 EST