public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@suse.de>
To: Pat LaVarre <p.lavarre@ieee.org>
Cc: linux-scsi@vger.kernel.org
Subject: Re: [PATCH] fix cdrom mt rainier probe
Date: Fri, 16 Jul 2004 18:02:24 +0200	[thread overview]
Message-ID: <20040716160224.GA2402@suse.de> (raw)
In-Reply-To: <1089993519.7028.26.camel@patibmrh9>

On Fri, Jul 16 2004, Pat LaVarre wrote:
> diff -urp linux-2.6.8-rc1/drivers/cdrom/cdrom.c linux-2.6.8-rc1-pel/drivers/cdrom/cdrom.c
> --- linux-2.6.8-rc1/drivers/cdrom/cdrom.c	2004-07-13 08:26:02.000000000 -0600
> +++ linux-2.6.8-rc1-pel/drivers/cdrom/cdrom.c	2004-07-16 09:40:22.765020896 -0600
> @@ -897,10 +897,10 @@ int cdrom_open(struct cdrom_device_info 
>  			goto err;
>  		if (fp->f_mode & FMODE_WRITE) {
>  			ret = -EROFS;
> -			if (!CDROM_CAN(CDC_RAM))
> -				goto err;
>  			if (cdrom_open_write(cdi))
>  				goto err;
> +			if (!CDROM_CAN(CDC_RAM))
> +				goto err;
>  			ret = 0;
>  		}
>  	}
> diff -urp linux-2.6.8-rc1/drivers/ide/ide-cd.c linux-2.6.8-rc1-pel/drivers/ide/ide-cd.c
> --- linux-2.6.8-rc1/drivers/ide/ide-cd.c	2004-07-13 08:26:05.000000000 -0600
> +++ linux-2.6.8-rc1-pel/drivers/ide/ide-cd.c	2004-07-16 09:37:07.613688408 -0600
> @@ -785,14 +785,6 @@ static int cdrom_decode_status(ide_drive
>  				do_end_request = 1;
>  		} else if (sense_key == ILLEGAL_REQUEST ||
>  			   sense_key == DATA_PROTECT) {
> -			/*
> -			 * check if this was a write protected media
> -			 */
> -			if (rq_data_dir(rq) == WRITE) {
> -				printk("ide-cd: media marked write protected\n");
> -				set_disk_ro(drive->disk, 1);
> -			}
> -
>  			/* No point in retrying after an illegal
>  			   request or data protect error.*/
>  			ide_dump_status (drive, "command error", stat);
> @@ -3248,9 +3240,8 @@ int ide_cdrom_setup (ide_drive_t *drive)
>  	nslots = ide_cdrom_probe_capabilities (drive);
>  
>  	/*
> -	 * set correct block size and read-only for non-ram media
> +	 * set correct block size
>  	 */
> -	set_disk_ro(drive->disk, !CDROM_CONFIG_FLAGS(drive)->ram);
>  	blk_queue_hardsect_size(drive->queue, CD_FRAMESIZE);
>  
>  #if 0
> diff -urp linux-2.6.8-rc1/drivers/scsi/sr.c linux-2.6.8-rc1-pel/drivers/scsi/sr.c
> --- linux-2.6.8-rc1/drivers/scsi/sr.c	2004-07-13 08:26:16.000000000 -0600
> +++ linux-2.6.8-rc1-pel/drivers/scsi/sr.c	2004-07-15 14:29:34.000000000 -0600
> @@ -775,9 +775,6 @@ static void get_capabilities(struct scsi
>  		""
>  	};
>  
> -	/* Set read only initially */
> -	set_disk_ro(cd->disk, 1);
> -
>  	/* allocate a request for the TEST_UNIT_READY */
>  	SRpnt = scsi_allocate_request(cd->device, GFP_KERNEL);
>  	if (!SRpnt) {
> @@ -885,7 +882,6 @@ static void get_capabilities(struct scsi
>  	if ((cd->cdi.mask & (CDC_DVD_RAM | CDC_MRW_W | CDC_RAM)) !=
>  			(CDC_DVD_RAM | CDC_MRW_W | CDC_RAM)) {
>  		cd->device->writeable = 1;
> -		set_disk_ro(cd->disk, 0);
>  	}
>  
>  	scsi_release_request(SRpnt);
> 
> 
> 

This looks perfect! Have you tested it works as expected as well, with
rw and ro media?

-- 
Jens Axboe


  reply	other threads:[~2004-07-16 16:02 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1089741428.3806.3.camel@patibmrh9>
2004-07-13 20:55 ` [PATCH] fix cdrom mt rainier probe Pat LaVarre
2004-07-14  5:41   ` Jens Axboe
2004-07-14 23:34     ` Pat LaVarre
2004-07-16  0:39       ` Pat LaVarre
2004-07-16 12:25         ` Jens Axboe
2004-07-16 12:28           ` Jens Axboe
2004-07-16 15:58             ` Pat LaVarre
2004-07-16 16:02               ` Jens Axboe [this message]
2004-07-16 16:19                 ` Pat LaVarre
2004-07-16 17:51                   ` Jens Axboe
2004-07-18  0:43                     ` Pat LaVarre

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=20040716160224.GA2402@suse.de \
    --to=axboe@suse.de \
    --cc=linux-scsi@vger.kernel.org \
    --cc=p.lavarre@ieee.org \
    /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