aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/ide-scsi.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/ide-scsi.c')
-rw-r--r--drivers/scsi/ide-scsi.c58
1 files changed, 26 insertions, 32 deletions
diff --git a/drivers/scsi/ide-scsi.c b/drivers/scsi/ide-scsi.c
index 2e2486b035dd..d80c4c9d5a63 100644
--- a/drivers/scsi/ide-scsi.c
+++ b/drivers/scsi/ide-scsi.c
@@ -713,7 +713,6 @@ static void idescsi_add_settings(ide_drive_t *drive)
713 */ 713 */
714static void idescsi_setup (ide_drive_t *drive, idescsi_scsi_t *scsi) 714static void idescsi_setup (ide_drive_t *drive, idescsi_scsi_t *scsi)
715{ 715{
716 DRIVER(drive)->busy++;
717 if (drive->id && (drive->id->config & 0x0060) == 0x20) 716 if (drive->id && (drive->id->config & 0x0060) == 0x20)
718 set_bit (IDESCSI_DRQ_INTERRUPT, &scsi->flags); 717 set_bit (IDESCSI_DRQ_INTERRUPT, &scsi->flags);
719 set_bit(IDESCSI_TRANSFORM, &scsi->transform); 718 set_bit(IDESCSI_TRANSFORM, &scsi->transform);
@@ -722,17 +721,16 @@ static void idescsi_setup (ide_drive_t *drive, idescsi_scsi_t *scsi)
722 set_bit(IDESCSI_LOG_CMD, &scsi->log); 721 set_bit(IDESCSI_LOG_CMD, &scsi->log);
723#endif /* IDESCSI_DEBUG_LOG */ 722#endif /* IDESCSI_DEBUG_LOG */
724 idescsi_add_settings(drive); 723 idescsi_add_settings(drive);
725 DRIVER(drive)->busy--;
726} 724}
727 725
728static int idescsi_cleanup (ide_drive_t *drive) 726static int ide_scsi_remove(struct device *dev)
729{ 727{
728 ide_drive_t *drive = to_ide_device(dev);
730 struct Scsi_Host *scsihost = drive->driver_data; 729 struct Scsi_Host *scsihost = drive->driver_data;
731 struct ide_scsi_obj *scsi = scsihost_to_idescsi(scsihost); 730 struct ide_scsi_obj *scsi = scsihost_to_idescsi(scsihost);
732 struct gendisk *g = scsi->disk; 731 struct gendisk *g = scsi->disk;
733 732
734 if (ide_unregister_subdriver(drive)) 733 ide_unregister_subdriver(drive, scsi->driver);
735 return 1;
736 734
737 ide_unregister_region(g); 735 ide_unregister_region(g);
738 736
@@ -746,7 +744,7 @@ static int idescsi_cleanup (ide_drive_t *drive)
746 return 0; 744 return 0;
747} 745}
748 746
749static int idescsi_attach(ide_drive_t *drive); 747static int ide_scsi_probe(struct device *);
750 748
751#ifdef CONFIG_PROC_FS 749#ifdef CONFIG_PROC_FS
752static ide_proc_entry_t idescsi_proc[] = { 750static ide_proc_entry_t idescsi_proc[] = {
@@ -757,24 +755,22 @@ static ide_proc_entry_t idescsi_proc[] = {
757# define idescsi_proc NULL 755# define idescsi_proc NULL
758#endif 756#endif
759 757
760/*
761 * IDE subdriver functions, registered with ide.c
762 */
763static ide_driver_t idescsi_driver = { 758static ide_driver_t idescsi_driver = {
764 .owner = THIS_MODULE, 759 .owner = THIS_MODULE,
765 .name = "ide-scsi", 760 .gen_driver = {
761 .name = "ide-scsi",
762 .bus = &ide_bus_type,
763 .probe = ide_scsi_probe,
764 .remove = ide_scsi_remove,
765 },
766 .version = IDESCSI_VERSION, 766 .version = IDESCSI_VERSION,
767 .media = ide_scsi, 767 .media = ide_scsi,
768 .busy = 0,
769 .supports_dsc_overlap = 0, 768 .supports_dsc_overlap = 0,
770 .proc = idescsi_proc, 769 .proc = idescsi_proc,
771 .attach = idescsi_attach,
772 .cleanup = idescsi_cleanup,
773 .do_request = idescsi_do_request, 770 .do_request = idescsi_do_request,
774 .end_request = idescsi_end_request, 771 .end_request = idescsi_end_request,
775 .error = idescsi_atapi_error, 772 .error = idescsi_atapi_error,
776 .abort = idescsi_atapi_abort, 773 .abort = idescsi_atapi_abort,
777 .drives = LIST_HEAD_INIT(idescsi_driver.drives),
778}; 774};
779 775
780static int idescsi_ide_open(struct inode *inode, struct file *filp) 776static int idescsi_ide_open(struct inode *inode, struct file *filp)
@@ -821,8 +817,6 @@ static struct block_device_operations idescsi_ops = {
821 .ioctl = idescsi_ide_ioctl, 817 .ioctl = idescsi_ide_ioctl,
822}; 818};
823 819
824static int idescsi_attach(ide_drive_t *drive);
825
826static int idescsi_slave_configure(struct scsi_device * sdp) 820static int idescsi_slave_configure(struct scsi_device * sdp)
827{ 821{
828 /* Configure detected device */ 822 /* Configure detected device */
@@ -1095,8 +1089,9 @@ static struct scsi_host_template idescsi_template = {
1095 .proc_name = "ide-scsi", 1089 .proc_name = "ide-scsi",
1096}; 1090};
1097 1091
1098static int idescsi_attach(ide_drive_t *drive) 1092static int ide_scsi_probe(struct device *dev)
1099{ 1093{
1094 ide_drive_t *drive = to_ide_device(dev);
1100 idescsi_scsi_t *idescsi; 1095 idescsi_scsi_t *idescsi;
1101 struct Scsi_Host *host; 1096 struct Scsi_Host *host;
1102 struct gendisk *g; 1097 struct gendisk *g;
@@ -1112,7 +1107,7 @@ static int idescsi_attach(ide_drive_t *drive)
1112 !drive->present || 1107 !drive->present ||
1113 drive->media == ide_disk || 1108 drive->media == ide_disk ||
1114 !(host = scsi_host_alloc(&idescsi_template,sizeof(idescsi_scsi_t)))) 1109 !(host = scsi_host_alloc(&idescsi_template,sizeof(idescsi_scsi_t))))
1115 return 1; 1110 return -ENODEV;
1116 1111
1117 g = alloc_disk(1 << PARTN_BITS); 1112 g = alloc_disk(1 << PARTN_BITS);
1118 if (!g) 1113 if (!g)
@@ -1138,20 +1133,19 @@ static int idescsi_attach(ide_drive_t *drive)
1138 idescsi->host = host; 1133 idescsi->host = host;
1139 idescsi->disk = g; 1134 idescsi->disk = g;
1140 g->private_data = &idescsi->driver; 1135 g->private_data = &idescsi->driver;
1141 err = ide_register_subdriver(drive, &idescsi_driver); 1136 ide_register_subdriver(drive, &idescsi_driver);
1137 err = 0;
1138 idescsi_setup(drive, idescsi);
1139 g->fops = &idescsi_ops;
1140 ide_register_region(g);
1141 err = scsi_add_host(host, &drive->gendev);
1142 if (!err) { 1142 if (!err) {
1143 idescsi_setup (drive, idescsi); 1143 scsi_scan_host(host);
1144 g->fops = &idescsi_ops; 1144 return 0;
1145 ide_register_region(g);
1146 err = scsi_add_host(host, &drive->gendev);
1147 if (!err) {
1148 scsi_scan_host(host);
1149 return 0;
1150 }
1151 /* fall through on error */
1152 ide_unregister_region(g);
1153 ide_unregister_subdriver(drive);
1154 } 1145 }
1146 /* fall through on error */
1147 ide_unregister_region(g);
1148 ide_unregister_subdriver(drive, &idescsi_driver);
1155 1149
1156 put_disk(g); 1150 put_disk(g);
1157out_host_put: 1151out_host_put:
@@ -1161,12 +1155,12 @@ out_host_put:
1161 1155
1162static int __init init_idescsi_module(void) 1156static int __init init_idescsi_module(void)
1163{ 1157{
1164 return ide_register_driver(&idescsi_driver); 1158 return driver_register(&idescsi_driver.gen_driver);
1165} 1159}
1166 1160
1167static void __exit exit_idescsi_module(void) 1161static void __exit exit_idescsi_module(void)
1168{ 1162{
1169 ide_unregister_driver(&idescsi_driver); 1163 driver_unregister(&idescsi_driver.gen_driver);
1170} 1164}
1171 1165
1172module_init(init_idescsi_module); 1166module_init(init_idescsi_module);