aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/ide-floppy.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-07-24 17:55:09 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-07-24 17:55:09 -0400
commitb5684b83b1e1579bbbc80e703e990c0cccf5892c (patch)
tree3f1b62b2320bce4d658d2ad0d4b77856499ac533 /drivers/ide/ide-floppy.c
parent1481b9109fe771ec8b035d7760f42e36d2bed5d4 (diff)
parent1b8ebad87b459e2e1333fbf28005977245ff5402 (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-floppy.c')
-rw-r--r--drivers/ide/ide-floppy.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c
index 3d8e6dd0f41e..ca11a26746f1 100644
--- a/drivers/ide/ide-floppy.c
+++ b/drivers/ide/ide-floppy.c
@@ -158,23 +158,29 @@ static DEFINE_MUTEX(idefloppy_ref_mutex);
158#define ide_floppy_g(disk) \ 158#define ide_floppy_g(disk) \
159 container_of((disk)->private_data, struct ide_floppy_obj, driver) 159 container_of((disk)->private_data, struct ide_floppy_obj, driver)
160 160
161static void idefloppy_cleanup_obj(struct kref *);
162
161static struct ide_floppy_obj *ide_floppy_get(struct gendisk *disk) 163static struct ide_floppy_obj *ide_floppy_get(struct gendisk *disk)
162{ 164{
163 struct ide_floppy_obj *floppy = NULL; 165 struct ide_floppy_obj *floppy = NULL;
164 166
165 mutex_lock(&idefloppy_ref_mutex); 167 mutex_lock(&idefloppy_ref_mutex);
166 floppy = ide_floppy_g(disk); 168 floppy = ide_floppy_g(disk);
167 if (floppy) 169 if (floppy) {
168 kref_get(&floppy->kref); 170 kref_get(&floppy->kref);
171 if (ide_device_get(floppy->drive)) {
172 kref_put(&floppy->kref, idefloppy_cleanup_obj);
173 floppy = NULL;
174 }
175 }
169 mutex_unlock(&idefloppy_ref_mutex); 176 mutex_unlock(&idefloppy_ref_mutex);
170 return floppy; 177 return floppy;
171} 178}
172 179
173static void idefloppy_cleanup_obj(struct kref *);
174
175static void ide_floppy_put(struct ide_floppy_obj *floppy) 180static void ide_floppy_put(struct ide_floppy_obj *floppy)
176{ 181{
177 mutex_lock(&idefloppy_ref_mutex); 182 mutex_lock(&idefloppy_ref_mutex);
183 ide_device_put(floppy->drive);
178 kref_put(&floppy->kref, idefloppy_cleanup_obj); 184 kref_put(&floppy->kref, idefloppy_cleanup_obj);
179 mutex_unlock(&idefloppy_ref_mutex); 185 mutex_unlock(&idefloppy_ref_mutex);
180} 186}