Skip to contentSkip to conversation

scsi: sr: Return correct event when media event code is 3

PATCH New Li Manyi 1 participant 1 message Jul 26, 2021 SCSI

lore
Share & tools
lore

Li Manyi

author
#0 lore raw

PATCH 1/1 scsi: sr: Return correct event when media event code is 3

the description for media event code 0: NoChg
Media status is unchanged.

the description for media event code 1: EjectRequest
The Drive has received a request from the user (usually through a mechanical switch on the Drive) to eject the specified slot or media.

the description for media event code 2: NewMedia
The specified slot (or the Drive) has received new media, and is ready to access it.

the description for media event code 3: MediaRemoval The media has been removed from the specified slot, and the Drive is unable to access the media without user intervention. This applies to media changers only.

fix bug: https://bugzilla.kernel.org/show_bug.cgi?id=213759

---
 drivers/scsi/sr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/sr.c +1 -1
index 94c254e9012e..a6d3ac0a6cbc 100644
@@ -221,7 +221,7 @@ static unsigned int sr_get_events(struct scsi_device *sdev)
 	else if (med->media_event_code == 2)
 		return DISK_EVENT_MEDIA_CHANGE;
 	else if (med->media_event_code == 3)
-		return DISK_EVENT_EJECT_REQUEST;
+		return DISK_EVENT_MEDIA_CHANGE;
 	return 0;
 }
 
Signature · 1 line
2.20.1