Re: [patch] IDE driver model update

Alexander Viro
2002-10-07T22:53:00Z

On Mon, 7 Oct 2002, Patrick Mochel 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.

???

Details, please. When can it happen and what normally holds that object
pinned?