From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
To: linux-ide@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH 40/63] ide-cd: merge cdrom_select_speed() into ide_cdrom_select_speed()
Date: Thu, 20 Dec 2007 02:23:31 +0100 [thread overview]
Message-ID: <200712200223.31134.bzolnier@gmail.com> (raw)
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
-13 bytes
drivers/ide/ide-cd.c | 66 ++++++++++++++++++++++-----------------------------
1 file changed, 29 insertions(+), 37 deletions(-)
Index: b/drivers/ide/ide-cd.c
===================================================================
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -1996,38 +1996,6 @@ static int ide_cd_read_tochdr(ide_drive_
return 0;
}
-/* ATAPI cdrom drives are free to select the speed you request or any slower
- rate :-( Requesting too fast a speed will _not_ produce an error. */
-static int cdrom_select_speed(ide_drive_t *drive, int speed,
- struct request_sense *sense)
-{
- struct cdrom_info *cd = drive->driver_data;
- struct cdrom_device_info *cdi = &cd->devinfo;
- struct request req;
- cdrom_prepare_request(drive, &req);
-
- req.sense = sense;
- if (speed == 0)
- speed = 0xffff; /* set to max */
- else
- speed *= 177; /* Nx to kbytes/s */
-
- req.cmd[0] = GPCMD_SET_SPEED;
- /* Read Drive speed in kbytes/second MSB */
- req.cmd[2] = (speed >> 8) & 0xff;
- /* Read Drive speed in kbytes/second LSB */
- req.cmd[3] = speed & 0xff;
- if ((cdi->mask & (CDC_CD_R | CDC_CD_RW | CDC_DVD_R)) !=
- (CDC_CD_R | CDC_CD_RW | CDC_DVD_R)) {
- /* Write Drive speed in kbytes/second MSB */
- req.cmd[4] = (speed >> 8) & 0xff;
- /* Write Drive speed in kbytes/second LSB */
- req.cmd[5] = speed & 0xff;
- }
-
- return cdrom_queue_packet_command(drive, &req);
-}
-
static int cdrom_get_toc_entry(ide_drive_t *drive, int track,
struct atapi_toc_entry **ent)
{
@@ -2251,23 +2219,47 @@ static void ide_cdrom_update_speed(ide_d
cd->max_speed = (maxspeed + (176/2)) / 176;
}
-static
-int ide_cdrom_select_speed (struct cdrom_device_info *cdi, int speed)
+/*
+ * ATAPI devices are free to select the speed you request or any slower
+ * rate. :-( Requesting too fast a speed will _not_ produce an error.
+ */
+static int ide_cdrom_select_speed(struct cdrom_device_info *cdi, int speed)
{
ide_drive_t *drive = cdi->handle;
struct cdrom_info *cd = drive->driver_data;
+ struct request rq;
struct request_sense sense;
u8 buf[ATAPI_CAPABILITIES_PAGE_SIZE];
int stat;
- if ((stat = cdrom_select_speed(drive, speed, &sense)) < 0)
- return stat;
+ cdrom_prepare_request(drive, &rq);
+
+ rq.sense = &sense;
+
+ if (speed == 0)
+ speed = 0xffff; /* set to max */
+ else
+ speed *= 177; /* Nx to kbytes/s */
+
+ rq.cmd[0] = GPCMD_SET_SPEED;
+ /* Read Drive speed in kbytes/second MSB/LSB */
+ rq.cmd[2] = (speed >> 8) & 0xff;
+ rq.cmd[3] = speed & 0xff;
+ if ((cdi->mask & (CDC_CD_R | CDC_CD_RW | CDC_DVD_R)) !=
+ (CDC_CD_R | CDC_CD_RW | CDC_DVD_R)) {
+ /* Write Drive speed in kbytes/second MSB/LSB */
+ rq.cmd[4] = (speed >> 8) & 0xff;
+ rq.cmd[5] = speed & 0xff;
+ }
+
+ stat = cdrom_queue_packet_command(drive, &rq);
if (!ide_cdrom_get_capabilities(drive, buf)) {
ide_cdrom_update_speed(drive, buf);
cdi->speed = cd->current_speed;
}
- return 0;
+
+ return 0;
}
/*
reply other threads:[~2007-12-20 1:34 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=200712200223.31134.bzolnier@gmail.com \
--to=bzolnier@gmail.com \
--cc=linux-ide@vger.kernel.org \
--cc=linux-kernel@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).