diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-07-24 17:55:09 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-07-24 17:55:09 -0400 |
commit | b5684b83b1e1579bbbc80e703e990c0cccf5892c (patch) | |
tree | 3f1b62b2320bce4d658d2ad0d4b77856499ac533 /drivers/ide/ide-disk.c | |
parent | 1481b9109fe771ec8b035d7760f42e36d2bed5d4 (diff) | |
parent | 1b8ebad87b459e2e1333fbf28005977245ff5402 (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/bart/ide-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/bart/ide-2.6: (76 commits)
ide: use proper printk() KERN_* levels in ide-probe.c
ide: fix for EATA SCSI HBA in ATA emulating mode
ide: remove stale comments from drivers/ide/Makefile
ide: enable local IRQs in all handlers for TASKFILE_NO_DATA data phase
ide-scsi: remove kmalloced struct request
ht6560b: remove old history
ht6560b: update email address
ide-cd: fix oops when using growisofs
gayle: release resources on ide_host_add() failure
palm_bk3710: add UltraDMA/100 support
ide: trivial sparse annotations
ide: ide-tape.c sparse annotations and unaligned access removal
ide: drop 'name' parameter from ->init_chipset method
ide: prefix messages from IDE PCI host drivers by driver name
it821x: remove DECLARE_ITE_DEV() macro
it8213: remove DECLARE_ITE_DEV() macro
ide: include PCI device name in messages from IDE PCI host drivers
ide: remove <asm/ide.h> for some archs
ide-generic: remove ide_default_{io_base,irq}() inlines (take 3)
ide-generic: is no longer needed on ppc32
...
Diffstat (limited to 'drivers/ide/ide-disk.c')
-rw-r--r-- | drivers/ide/ide-disk.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c index df5fe5756871..28d85b410f7c 100644 --- a/drivers/ide/ide-disk.c +++ b/drivers/ide/ide-disk.c | |||
@@ -56,23 +56,29 @@ static DEFINE_MUTEX(idedisk_ref_mutex); | |||
56 | #define ide_disk_g(disk) \ | 56 | #define ide_disk_g(disk) \ |
57 | container_of((disk)->private_data, struct ide_disk_obj, driver) | 57 | container_of((disk)->private_data, struct ide_disk_obj, driver) |
58 | 58 | ||
59 | static void ide_disk_release(struct kref *); | ||
60 | |||
59 | static struct ide_disk_obj *ide_disk_get(struct gendisk *disk) | 61 | static struct ide_disk_obj *ide_disk_get(struct gendisk *disk) |
60 | { | 62 | { |
61 | struct ide_disk_obj *idkp = NULL; | 63 | struct ide_disk_obj *idkp = NULL; |
62 | 64 | ||
63 | mutex_lock(&idedisk_ref_mutex); | 65 | mutex_lock(&idedisk_ref_mutex); |
64 | idkp = ide_disk_g(disk); | 66 | idkp = ide_disk_g(disk); |
65 | if (idkp) | 67 | if (idkp) { |
66 | kref_get(&idkp->kref); | 68 | kref_get(&idkp->kref); |
69 | if (ide_device_get(idkp->drive)) { | ||
70 | kref_put(&idkp->kref, ide_disk_release); | ||
71 | idkp = NULL; | ||
72 | } | ||
73 | } | ||
67 | mutex_unlock(&idedisk_ref_mutex); | 74 | mutex_unlock(&idedisk_ref_mutex); |
68 | return idkp; | 75 | return idkp; |
69 | } | 76 | } |
70 | 77 | ||
71 | static void ide_disk_release(struct kref *); | ||
72 | |||
73 | static void ide_disk_put(struct ide_disk_obj *idkp) | 78 | static void ide_disk_put(struct ide_disk_obj *idkp) |
74 | { | 79 | { |
75 | mutex_lock(&idedisk_ref_mutex); | 80 | mutex_lock(&idedisk_ref_mutex); |
81 | ide_device_put(idkp->drive); | ||
76 | kref_put(&idkp->kref, ide_disk_release); | 82 | kref_put(&idkp->kref, ide_disk_release); |
77 | mutex_unlock(&idedisk_ref_mutex); | 83 | mutex_unlock(&idedisk_ref_mutex); |
78 | } | 84 | } |