linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Li Manyi <limanyi@uniontech.com>
To: axboe@kernel.dk, jejb@linux.ibm.com, martin.petersen@oracle.com
Cc: linux-kernel@vger.kernel.org, linux-scsi@vger.kernel.org,
	Li Manyi <limanyi@uniontech.com>
Subject: [PATCH] scsi: sr: Return correct event when media event code is 3
Date: Mon, 26 Jul 2021 19:49:13 +0800	[thread overview]
Message-ID: <20210726114913.6760-1-limanyi@uniontech.com> (raw)

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

Signed-off-by: Li Manyi <limanyi@uniontech.com>
---
 drivers/scsi/sr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/sr.c b/drivers/scsi/sr.c
index 94c254e9012e..a6d3ac0a6cbc 100644
--- a/drivers/scsi/sr.c
+++ b/drivers/scsi/sr.c
@@ -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;
 }
 
-- 
2.20.1




             reply	other threads:[~2021-07-26 11:49 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-26 11:49 Li Manyi [this message]
2021-07-29  3:37 ` [PATCH] scsi: sr: Return correct event when media event code is 3 Martin K. Petersen
  -- strict thread matches above, loose matches on Subject: below --
2021-07-26 11:42 Li Manyi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210726114913.6760-1-limanyi@uniontech.com \
    --to=limanyi@uniontech.com \
    --cc=axboe@kernel.dk \
    --cc=jejb@linux.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).