[PATCH 08/13] libata-hp: move device enable/disable out of ata_bus_probe()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



For drivers support hot/warm plugging, the controller should stay
enabled whether devices are attached to it or not.  Move
ata_port_probe() and disable calls out of ata_bus_probe() and disable
only if the driver doesn't implement new style ->error_handler, which
is responsible for hotplug.

While at it, kill the FIXME about controllers with no device attached.
Hotplug is coming and all drivers should support it in not so distant
future.

Signed-off-by: Tejun Heo <htejun@xxxxxxxxx>

---

 drivers/scsi/libata-core.c |   19 ++++++-------------
 1 files changed, 6 insertions(+), 13 deletions(-)

84a5e767247a9a0047e4b485fbd9de7582d9b283
diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c
index 45ef1e2..e68a64d 100644
--- a/drivers/scsi/libata-core.c
+++ b/drivers/scsi/libata-core.c
@@ -1478,8 +1478,6 @@ static int ata_bus_probe(struct ata_port
 	int i, rc, down_xfermask;
 	struct ata_device *dev;
 
-	ata_port_probe(ap);
-
 	for (i = 0; i < ATA_MAX_DEVICES; i++) {
 		tries[i] = ATA_PROBE_MAX_TRIES;
 		ata_dev_init(ap, &ap->device[i]);
@@ -1556,10 +1554,6 @@ static int ata_bus_probe(struct ata_port
 	for (i = 0; i < ATA_MAX_DEVICES; i++)
 		if (ata_dev_enabled(&ap->device[i]))
 			return 0;
-
-	/* no device present, disable port */
-	ata_port_disable(ap);
-	ap->ops->port_disable(ap);
 	return -ENODEV;
 
  fail:
@@ -5033,6 +5027,8 @@ int ata_device_add(const struct ata_prob
 
 		ap = host_set->ports[i];
 
+		ata_port_probe(ap);
+
 		/* init ap->orig_sata_spd_limit to boot value */
 		if ((ap->flags & ATA_FLAG_SATA) && ap->ops->scr_read) {
 			u32 spd;
@@ -5045,13 +5041,10 @@ int ata_device_add(const struct ata_prob
 		rc = ata_bus_probe(ap);
 		DPRINTK("ata%u: bus probe end\n", ap->id);
 
-		if (rc) {
-			/* FIXME: do something useful here?
-			 * Current libata behavior will
-			 * tear down everything when
-			 * the module is removed
-			 * or the h/w is unplugged.
-			 */
+		if (rc && !ap->ops->error_handler) {
+			/* no device attached and no hotplug support */
+			ata_port_disable(ap);
+			ap->ops->port_disable(ap);
 		}
 
 		rc = scsi_add_host(ap->host, dev);
-- 
1.2.4


-
: send the line "unsubscribe linux-ide" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Filesystems]     [Linux SCSI]     [Linux RAID]     [Git]     [Kernel Newbies]     [Linux Newbie]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Samba]     [Device Mapper]

  Powered by Linux