diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2009-02-25 14:28:24 -0500 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2009-02-25 14:28:24 -0500 |
commit | 8fed43684174b68f04d01d1210fd00536af790df (patch) | |
tree | df8d5f87c68526267d0ae320173814ed3f417fd5 /drivers/ide/ide-cd.h | |
parent | d3dd7107f4d843d0f01d0f77d49a7c5449130577 (diff) |
ide: fix refcounting in device drivers
During host driver module removal del_gendisk() results in a final
put on drive->gendev and freeing the drive by drive_release_dev().
Convert device drivers from using struct kref to use struct device
so device driver's object holds reference on ->gendev and prevents
drive from prematurely going away.
Also fix ->remove methods to not erroneously drop reference on a
host driver by using only put_device() instead of ide*_put().
Reported-by: Stanislaw Gruszka <stf_xl@wp.pl>
Tested-by: Stanislaw Gruszka <stf_xl@wp.pl>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/ide-cd.h')
-rw-r--r-- | drivers/ide/ide-cd.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/ide/ide-cd.h b/drivers/ide/ide-cd.h index ac40d6cb90a2..c878bfcf1116 100644 --- a/drivers/ide/ide-cd.h +++ b/drivers/ide/ide-cd.h | |||
@@ -80,7 +80,7 @@ struct cdrom_info { | |||
80 | ide_drive_t *drive; | 80 | ide_drive_t *drive; |
81 | struct ide_driver *driver; | 81 | struct ide_driver *driver; |
82 | struct gendisk *disk; | 82 | struct gendisk *disk; |
83 | struct kref kref; | 83 | struct device dev; |
84 | 84 | ||
85 | /* Buffer for table of contents. NULL if we haven't allocated | 85 | /* Buffer for table of contents. NULL if we haven't allocated |
86 | a TOC buffer for this device yet. */ | 86 | a TOC buffer for this device yet. */ |