Re: [PATCH resend 3/6] cdrom: wait for tray to close

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

 



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.��.n��������+%������w��{.n�����{����*jg��������ݢj����G�������j:+v���w�m������w�������h�����٥




[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux