Skip to contentSkip to conversation

some scsi_scan.c restructuring for ieee1394 hotplugging

PATCH New Christoph Hellwig 1 participant 1 message Feb 21, 2003 SCSI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 some scsi_scan.c restructuring for ieee1394 hotplugging

I had some discussion with Ben Collins on ow to properly allow hotplugging of ieee1394 storage device (sbp2). While the scsi_add_host/ scsi_remove_host interface allows hotpluging of ieee1394 adapters we need a way to register the actual devices with the scsi layer when they're plugged in. I've restructured the code to handle the /proc/scsi/scsi code to add/remove devices a bit to have an interface the ieee1394 driver can use, and created the following new interface:

struct scsi_device *scsi_add_device(struct Scsi_Host *shost,
uint channel, uint id, uint lun)
int scsi_remove_device(struct scsi_device *sdev)

in addition scsi_probe_and_add_lun() got some overhaul to become readable and can now return the struct scsi_device it probed as an optional argument.

drivers/scsi/hosts.c +0 -15
@@ -270,21 +270,6 @@
 		if (scsi_check_device_busy(sdev))
 			return 1;
 
-	/*
-	 * Next we detach the high level drivers from the Scsi_Device
-	 * structures
-	 */
-	list_for_each_entry(sdev, &shost->my_devices, siblings) {
-		scsi_detach_device(sdev);
-
-		/* If something still attached, punt */
-		if (sdev->attached) {
-			printk(KERN_ERR "Attached usage count = %d\n",
-			       sdev->attached);
-			return 1;
-		}
-	}
-
 	scsi_forget_host(shost);
 	return 0;
 }
drivers/scsi/scsi.h +3 -2
@@ -502,8 +502,9 @@
 /*
  * Prototypes for functions in scsi_scan.c
  */
-extern int scsi_add_single_device(uint, uint, uint, uint);
-extern int scsi_remove_single_device(uint, uint, uint, uint);
+extern struct scsi_device *scsi_add_device(struct Scsi_Host *,
+		uint, uint, uint);
+extern int scsi_remove_device(struct scsi_device *);
 extern u64 scsi_calculate_bounce_limit(struct Scsi_Host *);
 
 /*
drivers/scsi/scsi_proc.c +44 -0

50 lines not on this page · raw message

drivers/scsi/scsi_scan.c +80 -120

272 lines not on this page · raw message

drivers/scsi/scsi_syms.c +2 -0
@@ -80,6 +80,8 @@
 EXPORT_SYMBOL(scsi_slave_detach);
 EXPORT_SYMBOL(scsi_device_get);
 EXPORT_SYMBOL(scsi_device_put);
+EXPORT_SYMBOL(scsi_add_device);
+EXPORT_SYMBOL(scsi_remove_device);
 
 /*
  * This symbol is for the highlevel drivers (e.g. sg) only.