diff options
author | Jeff Garzik <jgarzik@pretzel.yyz.us> | 2005-06-26 17:11:03 -0400 |
---|---|---|
committer | Jeff Garzik <jgarzik@pobox.com> | 2005-06-26 17:11:03 -0400 |
commit | 8b0ee07e108b2eefdab5bb73f33223f18926c3b2 (patch) | |
tree | f68ca04180c5488301a40ec212ef2eb2467cf56c /drivers/ide/ide-tape.c | |
parent | 4638aef40ba9ebb9734caeed1f373c24015259fd (diff) | |
parent | 8678887e7fb43cd6c9be6c9807b05e77848e0920 (diff) |
Merge upstream (approx. 2.6.12-git8) into 'janitor' branch of netdev-2.6.
Diffstat (limited to 'drivers/ide/ide-tape.c')
-rw-r--r-- | drivers/ide/ide-tape.c | 51 |
1 files changed, 19 insertions, 32 deletions
diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c index 482544854985..5a3dc46008e6 100644 --- a/drivers/ide/ide-tape.c +++ b/drivers/ide/ide-tape.c | |||
@@ -4681,21 +4681,12 @@ static void idetape_setup (ide_drive_t *drive, idetape_tape_t *tape, int minor) | |||
4681 | idetape_add_settings(drive); | 4681 | idetape_add_settings(drive); |
4682 | } | 4682 | } |
4683 | 4683 | ||
4684 | static int idetape_cleanup (ide_drive_t *drive) | 4684 | static int ide_tape_remove(struct device *dev) |
4685 | { | 4685 | { |
4686 | ide_drive_t *drive = to_ide_device(dev); | ||
4686 | idetape_tape_t *tape = drive->driver_data; | 4687 | idetape_tape_t *tape = drive->driver_data; |
4687 | unsigned long flags; | ||
4688 | |||
4689 | spin_lock_irqsave(&ide_lock, flags); | ||
4690 | if (test_bit(IDETAPE_BUSY, &tape->flags) || drive->usage || | ||
4691 | tape->first_stage != NULL || tape->merge_stage_size) { | ||
4692 | spin_unlock_irqrestore(&ide_lock, flags); | ||
4693 | return 1; | ||
4694 | } | ||
4695 | 4688 | ||
4696 | spin_unlock_irqrestore(&ide_lock, flags); | 4689 | ide_unregister_subdriver(drive, tape->driver); |
4697 | DRIVER(drive)->busy = 0; | ||
4698 | (void) ide_unregister_subdriver(drive); | ||
4699 | 4690 | ||
4700 | ide_unregister_region(tape->disk); | 4691 | ide_unregister_region(tape->disk); |
4701 | 4692 | ||
@@ -4710,6 +4701,8 @@ static void ide_tape_release(struct kref *kref) | |||
4710 | ide_drive_t *drive = tape->drive; | 4701 | ide_drive_t *drive = tape->drive; |
4711 | struct gendisk *g = tape->disk; | 4702 | struct gendisk *g = tape->disk; |
4712 | 4703 | ||
4704 | BUG_ON(tape->first_stage != NULL || tape->merge_stage_size); | ||
4705 | |||
4713 | drive->dsc_overlap = 0; | 4706 | drive->dsc_overlap = 0; |
4714 | drive->driver_data = NULL; | 4707 | drive->driver_data = NULL; |
4715 | devfs_remove("%s/mt", drive->devfs_name); | 4708 | devfs_remove("%s/mt", drive->devfs_name); |
@@ -4747,26 +4740,24 @@ static ide_proc_entry_t idetape_proc[] = { | |||
4747 | 4740 | ||
4748 | #endif | 4741 | #endif |
4749 | 4742 | ||
4750 | static int idetape_attach(ide_drive_t *drive); | 4743 | static int ide_tape_probe(struct device *); |
4751 | 4744 | ||
4752 | /* | ||
4753 | * IDE subdriver functions, registered with ide.c | ||
4754 | */ | ||
4755 | static ide_driver_t idetape_driver = { | 4745 | static ide_driver_t idetape_driver = { |
4756 | .owner = THIS_MODULE, | 4746 | .owner = THIS_MODULE, |
4757 | .name = "ide-tape", | 4747 | .gen_driver = { |
4748 | .name = "ide-tape", | ||
4749 | .bus = &ide_bus_type, | ||
4750 | .probe = ide_tape_probe, | ||
4751 | .remove = ide_tape_remove, | ||
4752 | }, | ||
4758 | .version = IDETAPE_VERSION, | 4753 | .version = IDETAPE_VERSION, |
4759 | .media = ide_tape, | 4754 | .media = ide_tape, |
4760 | .busy = 1, | ||
4761 | .supports_dsc_overlap = 1, | 4755 | .supports_dsc_overlap = 1, |
4762 | .cleanup = idetape_cleanup, | ||
4763 | .do_request = idetape_do_request, | 4756 | .do_request = idetape_do_request, |
4764 | .end_request = idetape_end_request, | 4757 | .end_request = idetape_end_request, |
4765 | .error = __ide_error, | 4758 | .error = __ide_error, |
4766 | .abort = __ide_abort, | 4759 | .abort = __ide_abort, |
4767 | .proc = idetape_proc, | 4760 | .proc = idetape_proc, |
4768 | .attach = idetape_attach, | ||
4769 | .drives = LIST_HEAD_INIT(idetape_driver.drives), | ||
4770 | }; | 4761 | }; |
4771 | 4762 | ||
4772 | /* | 4763 | /* |
@@ -4829,8 +4820,9 @@ static struct block_device_operations idetape_block_ops = { | |||
4829 | .ioctl = idetape_ioctl, | 4820 | .ioctl = idetape_ioctl, |
4830 | }; | 4821 | }; |
4831 | 4822 | ||
4832 | static int idetape_attach (ide_drive_t *drive) | 4823 | static int ide_tape_probe(struct device *dev) |
4833 | { | 4824 | { |
4825 | ide_drive_t *drive = to_ide_device(dev); | ||
4834 | idetape_tape_t *tape; | 4826 | idetape_tape_t *tape; |
4835 | struct gendisk *g; | 4827 | struct gendisk *g; |
4836 | int minor; | 4828 | int minor; |
@@ -4865,10 +4857,7 @@ static int idetape_attach (ide_drive_t *drive) | |||
4865 | 4857 | ||
4866 | ide_init_disk(g, drive); | 4858 | ide_init_disk(g, drive); |
4867 | 4859 | ||
4868 | if (ide_register_subdriver(drive, &idetape_driver)) { | 4860 | ide_register_subdriver(drive, &idetape_driver); |
4869 | printk(KERN_ERR "ide-tape: %s: Failed to register the driver with ide.c\n", drive->name); | ||
4870 | goto out_put_disk; | ||
4871 | } | ||
4872 | 4861 | ||
4873 | memset(tape, 0, sizeof(*tape)); | 4862 | memset(tape, 0, sizeof(*tape)); |
4874 | 4863 | ||
@@ -4902,12 +4891,11 @@ static int idetape_attach (ide_drive_t *drive) | |||
4902 | ide_register_region(g); | 4891 | ide_register_region(g); |
4903 | 4892 | ||
4904 | return 0; | 4893 | return 0; |
4905 | out_put_disk: | 4894 | |
4906 | put_disk(g); | ||
4907 | out_free_tape: | 4895 | out_free_tape: |
4908 | kfree(tape); | 4896 | kfree(tape); |
4909 | failed: | 4897 | failed: |
4910 | return 1; | 4898 | return -ENODEV; |
4911 | } | 4899 | } |
4912 | 4900 | ||
4913 | MODULE_DESCRIPTION("ATAPI Streaming TAPE Driver"); | 4901 | MODULE_DESCRIPTION("ATAPI Streaming TAPE Driver"); |
@@ -4915,7 +4903,7 @@ MODULE_LICENSE("GPL"); | |||
4915 | 4903 | ||
4916 | static void __exit idetape_exit (void) | 4904 | static void __exit idetape_exit (void) |
4917 | { | 4905 | { |
4918 | ide_unregister_driver(&idetape_driver); | 4906 | driver_unregister(&idetape_driver.gen_driver); |
4919 | unregister_chrdev(IDETAPE_MAJOR, "ht"); | 4907 | unregister_chrdev(IDETAPE_MAJOR, "ht"); |
4920 | } | 4908 | } |
4921 | 4909 | ||
@@ -4928,8 +4916,7 @@ static int idetape_init (void) | |||
4928 | printk(KERN_ERR "ide-tape: Failed to register character device interface\n"); | 4916 | printk(KERN_ERR "ide-tape: Failed to register character device interface\n"); |
4929 | return -EBUSY; | 4917 | return -EBUSY; |
4930 | } | 4918 | } |
4931 | ide_register_driver(&idetape_driver); | 4919 | return driver_register(&idetape_driver.gen_driver); |
4932 | return 0; | ||
4933 | } | 4920 | } |
4934 | 4921 | ||
4935 | module_init(idetape_init); | 4922 | module_init(idetape_init); |