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.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.c')
| -rw-r--r-- | drivers/ide/ide.c | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/drivers/ide/ide.c b/drivers/ide/ide.c index 60f0ca66aa93..772451600e4d 100644 --- a/drivers/ide/ide.c +++ b/drivers/ide/ide.c | |||
| @@ -618,6 +618,53 @@ set_val: | |||
| 618 | 618 | ||
| 619 | EXPORT_SYMBOL(generic_ide_ioctl); | 619 | EXPORT_SYMBOL(generic_ide_ioctl); |
| 620 | 620 | ||
| 621 | /** | ||
| 622 | * ide_device_get - get an additional reference to a ide_drive_t | ||
| 623 | * @drive: device to get a reference to | ||
| 624 | * | ||
| 625 | * Gets a reference to the ide_drive_t and increments the use count of the | ||
| 626 | * underlying LLDD module. | ||
| 627 | */ | ||
| 628 | int ide_device_get(ide_drive_t *drive) | ||
| 629 | { | ||
| 630 | struct device *host_dev; | ||
| 631 | struct module *module; | ||
| 632 | |||
| 633 | if (!get_device(&drive->gendev)) | ||
| 634 | return -ENXIO; | ||
| 635 | |||
| 636 | host_dev = drive->hwif->host->dev[0]; | ||
| 637 | module = host_dev ? host_dev->driver->owner : NULL; | ||
| 638 | |||
| 639 | if (module && !try_module_get(module)) { | ||
| 640 | put_device(&drive->gendev); | ||
| 641 | return -ENXIO; | ||
| 642 | } | ||
| 643 | |||
| 644 | return 0; | ||
| 645 | } | ||
| 646 | EXPORT_SYMBOL_GPL(ide_device_get); | ||
| 647 | |||
| 648 | /** | ||
| 649 | * ide_device_put - release a reference to a ide_drive_t | ||
| 650 | * @drive: device to release a reference on | ||
| 651 | * | ||
| 652 | * Release a reference to the ide_drive_t and decrements the use count of | ||
| 653 | * the underlying LLDD module. | ||
| 654 | */ | ||
| 655 | void ide_device_put(ide_drive_t *drive) | ||
| 656 | { | ||
| 657 | #ifdef CONFIG_MODULE_UNLOAD | ||
| 658 | struct device *host_dev = drive->hwif->host->dev[0]; | ||
| 659 | struct module *module = host_dev ? host_dev->driver->owner : NULL; | ||
| 660 | |||
| 661 | if (module) | ||
| 662 | module_put(module); | ||
| 663 | #endif | ||
| 664 | put_device(&drive->gendev); | ||
| 665 | } | ||
| 666 | EXPORT_SYMBOL_GPL(ide_device_put); | ||
| 667 | |||
| 621 | static int ide_bus_match(struct device *dev, struct device_driver *drv) | 668 | static int ide_bus_match(struct device *dev, struct device_driver *drv) |
| 622 | { | 669 | { |
| 623 | return 1; | 670 | return 1; |
