From: James Bottomley <James.Bottomley@steeleye.com>
To: Matthew Dharm <mdharm-usb@one-eyed-alien.net>
Cc: torvalds@transmeta.com,
Linux SCSI list <linux-scsi@vger.kernel.org>,
Greg KH <greg@kroah.com>,
USB Developers <linux-usb-devel@lists.sourceforge.net>
Subject: Re: PATCH; make sr.c respect use_10_for_ms
Date: 21 Jun 2003 19:25:49 -0500 [thread overview]
Message-ID: <1056241551.1775.14.camel@mulgrave> (raw)
In-Reply-To: <20030621165920.F2811@one-eyed-alien.net>
In general, you would have been a bit better off just doing a
if(cd->device->use_10_for_ms) {
cgc.cmd[0] = MODE_SENSE_10;
cgc.cmd[8] = 128;
} else {
cdc.cmd[0] = MODE_SENSE;
cgc.cmd[4] = 128;
}
Rather than duplicating so much code.
This:
> + if (cd->device->use_10_for_ms) {
> + memset(&cgc, 0, sizeof(struct cdrom_generic_command));
> + cgc.cmd[0] = MODE_SENSE_10;
> + cgc.cmd[2] = 0x2a; /* page code */
> + cgc.cmd[8] = 128; /* allocation length */
> + cgc.buffer = buffer;
> + cgc.buflen = 128;
> + cgc.quiet = 1;
> + cgc.data_direction = SCSI_DATA_READ;
> + cgc.timeout = SR_TIMEOUT;
> + rc = sr_do_ioctl(cd, &cgc);
> + }
> +
> + /* if we got an error, return to old behavior */
> + if (rc)
> + cd->device->use_10_for_ms = 0;
Is slightly incorrect. Mode sense commands can return errors for many
reasons, you need to check for ILLEGAL_REQUEST sense before assuming it
was a problem with the command.
What probably should happen is that the resetting of the flag should be
in scsi_io_completion (like it is for the use_10_for_rw flag), then the
retry and the flag reset would come for free.
James
next prev parent reply other threads:[~2003-06-22 0:11 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-06-21 23:59 PATCH; make sr.c respect use_10_for_ms Matthew Dharm
2003-06-22 0:07 ` Linus Torvalds
2003-06-22 0:12 ` Matthew Dharm
2003-06-22 0:21 ` Linus Torvalds
2003-06-22 0:30 ` Matthew Dharm
2003-06-22 0:38 ` Linus Torvalds
2003-06-22 0:46 ` Matthew Dharm
2003-06-22 0:25 ` James Bottomley [this message]
2003-06-22 0:46 ` Matthew Dharm
2003-06-22 2:54 ` James Bottomley
2003-06-22 4:24 ` Matthew Dharm
2003-06-22 5:05 ` Douglas Gilbert
2003-06-22 13:58 ` James Bottomley
2003-06-22 19:49 ` Matthew Dharm
2003-06-22 19:56 ` Matthew Dharm
2003-06-22 20:37 ` James Bottomley
2003-06-22 21:06 ` Matthew Dharm
2003-06-23 14:33 ` James Bottomley
2003-06-23 17:30 ` Matthew Dharm
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=1056241551.1775.14.camel@mulgrave \
--to=james.bottomley@steeleye.com \
--cc=greg@kroah.com \
--cc=linux-scsi@vger.kernel.org \
--cc=linux-usb-devel@lists.sourceforge.net \
--cc=mdharm-usb@one-eyed-alien.net \
--cc=torvalds@transmeta.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