[PATCH 07/15] libata-hp: implement transportt->user_scan

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

 



Implement ata_scsi_user_scan() which is used for
ata_scsi_transport_template->user_scan.  This function schedules ATA
hotplug probe on user request.

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

---

 drivers/scsi/libata-scsi.c |   37 +++++++++++++++++++++++++++++++++++++
 1 files changed, 37 insertions(+), 0 deletions(-)

18519ac3e6800187945e6d81bd1574c091eb0eaf
diff --git a/drivers/scsi/libata-scsi.c b/drivers/scsi/libata-scsi.c
index 5e68305..b05cd8a 100644
--- a/drivers/scsi/libata-scsi.c
+++ b/drivers/scsi/libata-scsi.c
@@ -55,6 +55,8 @@ typedef unsigned int (*ata_xlat_func_t)(
 
 static struct ata_device *__ata_scsi_find_dev(struct ata_port *ap,
 					      const struct scsi_device *scsidev);
+static int ata_scsi_user_scan(struct Scsi_Host *shost, unsigned int channel,
+			      unsigned int id, unsigned int lun);
 
 #define RW_RECOVERY_MPAGE 0x1
 #define RW_RECOVERY_MPAGE_LEN 12
@@ -101,6 +103,7 @@ static const u8 def_control_mpage[CONTRO
  */
 struct scsi_transport_template ata_scsi_transport_template = {
 	.eh_timed_out		= ata_scsi_timed_out,
+	.user_scan		= ata_scsi_user_scan,
 };
 
 
@@ -2852,3 +2855,37 @@ void ata_scsi_remove_dev(struct ata_port
 
 	scsi_remove_device(sdev);
 }
+
+/**
+ *	ata_scsi_user_scan - indication for user-initiated bus scan
+ *	@shost: SCSI host to scan
+ *	@channel: Channel to scan
+ *	@id: ID to scan
+ *	@lun: LUN to scan
+ *
+ *	This function is called when user explicitly requests bus
+ *	scan.  Set probe pending flag and invoke EH.  libata scans the
+ *	whole bus regardless of channel, id and lun arguments.
+ *
+ *	LOCKING:
+ *	SCSI layer (we don't care)
+ *
+ *	RETURNS:
+ *	Zero.
+ */
+static int ata_scsi_user_scan(struct Scsi_Host *shost, unsigned int channel,
+			      unsigned int id, unsigned int lun)
+{
+	struct ata_port *ap = (struct ata_port *)&shost->hostdata[0];
+	unsigned long flags;
+
+	if (!ap->ops->error_handler)
+		return -EOPNOTSUPP;
+
+	spin_lock_irqsave(&ap->host_set->lock, flags);
+	ata_set_hotplug_flags(ap, ATA_HOTPLUG_PROBE);
+	ata_eh_schedule_port(ap, ATA_EH_FREEZE);
+	spin_unlock_irqrestore(&ap->host_set->lock, flags);
+
+	return 0;
+}
-- 
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