Skip to contentSkip to conversation

libata: expose AN to user space

PATCH Applied [email protected] 2 participants 2 messages Oct 16, 2007 – Oct 25, 2007 libata

lore
Share & tools
lore
#0 lore raw

PATCH 4/4 libata: expose AN to user space

From: Kristen Carlson Accardi <[email protected]>

If Asynchronous Notification of media change events is supported, pass that information up to the SCSI layer.

---

 drivers/ata/libata-scsi.c |    3 +++
 1 file changed, 3 insertions(+)
drivers/ata/libata-scsi.c renamed from drivers/ata/libata-scsi.c~libata-expose-an-to-user-space +3 -0
diff -puN drivers/ata/libata-scsi.c~libata-expose-an-to-user-space drivers/ata/libata-scsi.c
@@ -773,6 +773,9 @@ static void ata_scsi_dev_config(struct s
 		blk_queue_max_hw_segments(q, q->max_hw_segments - 1);
 	}
 
+	if (dev->flags & ATA_DFLAG_AN)
+		sdev->media_change_notify = 1;
+
 	if (dev->flags & ATA_DFLAG_NCQ) {
 		int depth;
 

_

#1 lore raw
Quoted 19 lines · [email protected] wrote:

From: Kristen Carlson Accardi <[email protected]>

If Asynchronous Notification of media change events is supported, pass that information up to the SCSI layer.

---

 drivers/ata/libata-scsi.c |    3 +++
 1 file changed, 3 insertions(+)

diff -puN drivers/ata/libata-scsi.c~libata-expose-an-to-user-space drivers/ata/libata-scsi.c

drivers/ata/libata-scsi.c static void ata_scsi_dev_config(struct s · line 778

Quoted 6 lines
drivers/ata/libata-scsi.c renamed from drivers/ata/libata-scsi.c~libata-expose-an-to-user-space +3 -0
@@ -773,6 +773,9 @@ static void ata_scsi_dev_config(struct s
 		blk_queue_max_hw_segments(q, q->max_hw_segments - 1);
 	}
 
+	if (dev->flags & ATA_DFLAG_AN)
+		sdev->media_change_notify = 1;
+

Methinks this wasn't tested, as you missed removal of the crucial OTHER_AN_PATCHES_HAVE_BEEN_APPLIED ifdef-ery... :)

Anyway, I updated the patch for the media_event thingy in the last email, and applied the attached patch

commit 6ba2326c804e2d449c2f40a63ba0a9ea650bef47

Author: Jeff Garzik <[email protected]>
Date:   Thu Oct 25 03:20:05 2007 -0400

[libata] Utilize new SCSI media event infrastructure

 drivers/ata/libata-scsi.c |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

6ba2326c804e2d449c2f40a63ba0a9ea650bef47

drivers/ata/libata-scsi.c +4 -3
index f5d5420..65b6153 100644
@@ -773,6 +773,9 @@ static void ata_scsi_dev_config(struct scsi_device *sdev,
 		blk_queue_max_hw_segments(q, q->max_hw_segments - 1);
 	}
 
+	if (dev->flags & ATA_DFLAG_AN)
+		sdev->media_events = 1;
+
 	if (dev->flags & ATA_DFLAG_NCQ) {
 		int depth;
 
@@ -3248,10 +3251,8 @@ static void ata_scsi_handle_link_detach(struct ata_link *link)
  */
 void ata_scsi_media_change_notify(struct ata_device *dev)
 {
-#ifdef OTHER_AN_PATCHES_HAVE_BEEN_APPLIED
 	if (dev->sdev)
-		scsi_device_event_notify(dev->sdev, SDEV_MEDIA_CHANGE);
-#endif
+		scsi_device_event_notify(dev->sdev, 1UL << SDEV_MEDIA_CHANGE);
 }
 
 /**