public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Bart Van Assche <Bart.VanAssche@wdc.com>
To: "corbet@lwn.net" <corbet@lwn.net>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-ide@vger.kernel.org" <linux-ide@vger.kernel.org>,
	"keescook@chromium.org" <keescook@chromium.org>,
	"msuchanek@suse.de" <msuchanek@suse.de>,
	"tglx@linutronix.de" <tglx@linutronix.de>,
	"martin.petersen@oracle.com" <martin.petersen@oracle.com>,
	"axboe@kernel.dk" <axboe@kernel.dk>,
	"linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>,
	"kstewart@linuxfoundation.org" <kstewart@linuxfoundation.org>,
	"pombredanne@nexb.com" <pombredanne@nexb.com>,
	"bp@alien8.de" <bp@alien8.de>,
	"gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
	"jejb@linux.vnet.ibm.com" <jejb@linux.vnet.ibm.com>,
	"christophe.jaillet@wanadoo.fr" <christophe.jaillet@wanadoo.fr>,
	davem@davemlof
Subject: Re: [PATCH resend 3/6] cdrom: wait for tray to close
Date: Mon, 29 Jan 2018 17:05:47 +0000	[thread overview]
Message-ID: <1517245546.2687.17.camel@wdc.com> (raw)
In-Reply-To: <03915a2e64f50ec04ea6d8e6f80e36ecf16e4f0f.1516985620.git.msuchanek@suse.de>

On Fri, 2018-01-26 at 17:58 +0100, Michal Suchanek wrote:
> +static int cdrom_tray_close(struct cdrom_device_info *cdi)
> +{
> +	int ret;
> +
> +	ret = cdi->ops->tray_move(cdi, 0);
> +	if (ret || !cdi->ops->drive_status)
> +		return ret;
> +
> +	return poll_event_interruptible(CDS_TRAY_OPEN !=
> +			cdi->ops->drive_status(cdi, CDSL_CURRENT), 500);
> +}
> +
>  static
>  int open_for_common(struct cdrom_device_info *cdi, tracktype *tracks)
>  {
> @@ -1048,7 +1062,9 @@ int open_for_common(struct cdrom_device_info *cdi, tracktype *tracks)
>  			if (CDROM_CAN(CDC_CLOSE_TRAY) &&
>  			    cdi->options & CDO_AUTO_CLOSE) {
>  				cd_dbg(CD_OPEN, "trying to close the tray\n");
> -				ret = cdo->tray_move(cdi, 0);
> +				ret = cdrom_tray_close(cdi);
> +				if (ret == -ERESTARTSYS)
> +					return ret;
>  				if (ret) {
>  					cd_dbg(CD_OPEN, "bummer. tried to close the tray but failed.\n");
>  					/* Ignore the error from the low
> @@ -2312,7 +2328,8 @@ static int cdrom_ioctl_closetray(struct cdrom_device_info *cdi)
>  
>  	if (!CDROM_CAN(CDC_CLOSE_TRAY))
>  		return -ENOSYS;
> -	return cdi->ops->tray_move(cdi, 0);
> +
> +	return cdrom_tray_close(cdi);
>  }

So this patch changes code that does not wait into code that potentially waits
forever? Sorry but I don't think that's ideal. Please make sure that after a
certain time (a few seconds?) the loop finishes.

Thanks,

Bart.

  reply	other threads:[~2018-01-29 17:05 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-14 15:13 [PATCH 0/6] Fix cdrom autoclose Michal Suchanek
2017-12-14 15:13 ` [PATCH 5/6] Documentetion: cdrom: introduce CDS_DRIVE_ERROR Michal Suchanek
2018-01-26 16:58 ` [PATCH resend 0/6] Fix cdrom autoclose Michal Suchanek
2018-01-26 16:58   ` [PATCH resend 1/6] delay: add poll_event_interruptible Michal Suchanek
2018-01-29 17:00     ` Bart Van Assche
2018-01-26 16:58   ` [PATCH resend 2/6] cdrom: factor out common open_for_* code Michal Suchanek
2018-01-29 17:02     ` Bart Van Assche
2018-01-26 16:58   ` [PATCH resend 3/6] cdrom: wait for tray to close Michal Suchanek
2018-01-29 17:05     ` Bart Van Assche [this message]
2018-01-31 18:20       ` Michal Suchánek
2019-10-23 12:19       ` Michal Suchánek
2018-01-26 16:58   ` [PATCH resend 4/6] cdrom: introduce CDS_DRIVE_ERROR Michal Suchanek
2018-01-26 16:58   ` [PATCH resend 5/6] Documentetion: " Michal Suchanek
2018-01-26 16:58   ` [PATCH resend 6/6] cdrom: wait for drive to become ready Michal Suchanek
2018-01-29 17:11     ` Bart Van Assche
2018-01-26 20:04   ` [PATCH resend 0/6] Fix cdrom autoclose James Bottomley
2018-01-27 22:53     ` Michal Suchánek

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=1517245546.2687.17.camel@wdc.com \
    --to=bart.vanassche@wdc.com \
    --cc=axboe@kernel.dk \
    --cc=bp@alien8.de \
    --cc=christophe.jaillet@wanadoo.fr \
    --cc=corbet@lwn.net \
    --cc=davem@davemlof \
    --cc=gregkh@linuxfoundation.org \
    --cc=jejb@linux.vnet.ibm.com \
    --cc=keescook@chromium.org \
    --cc=kstewart@linuxfoundation.org \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=msuchanek@suse.de \
    --cc=pombredanne@nexb.com \
    --cc=tglx@linutronix.de \
    /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