From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
To: linux-ide@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH 39/63] ide-cd: merge cdrom_read_subchannel() into ide_cdrom_get_mcn()
Date: Thu, 20 Dec 2007 02:22:51 +0100 [thread overview]
Message-ID: <200712200222.51336.bzolnier@gmail.com> (raw)
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
-19 bytes
drivers/ide/ide-cd.c | 53 ++++++++++++++++++++-------------------------------
1 file changed, 21 insertions(+), 32 deletions(-)
Index: b/drivers/ide/ide-cd.c
===================================================================
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -1996,25 +1996,6 @@ static int ide_cd_read_tochdr(ide_drive_
return 0;
}
-static int cdrom_read_subchannel(ide_drive_t *drive, int format, char *buf,
- int buflen, struct request_sense *sense)
-{
- struct request req;
-
- cdrom_prepare_request(drive, &req);
-
- req.sense = sense;
- req.data = buf;
- req.data_len = buflen;
- req.cmd[0] = GPCMD_READ_SUBCHANNEL;
- req.cmd[1] = 2; /* MSF addressing */
- req.cmd[2] = 0x40; /* request subQ data */
- req.cmd[3] = format;
- req.cmd[7] = (buflen >> 8);
- req.cmd[8] = (buflen & 0xff);
- return cdrom_queue_packet_command(drive, &req);
-}
-
/* 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,
@@ -2356,28 +2337,36 @@ int ide_cdrom_get_last_session (struct c
return 0;
}
-static
-int ide_cdrom_get_mcn (struct cdrom_device_info *cdi,
- struct cdrom_mcn *mcn_info)
+static int ide_cdrom_get_mcn(struct cdrom_device_info *cdi,
+ struct cdrom_mcn *mcn_info)
{
- int stat;
- char mcnbuf[24];
ide_drive_t *drive = cdi->handle;
+ int stat, mcnlen;
+ struct request rq;
+ char buf[24];
+
+ cdrom_prepare_request(drive, &rq);
+
+ rq.data = buf;
+ rq.data_len = sizeof(buf);
-/* get MCN */
- if ((stat = cdrom_read_subchannel(drive, 2, mcnbuf, sizeof (mcnbuf), NULL)))
+ rq.cmd[0] = GPCMD_READ_SUBCHANNEL;
+ rq.cmd[1] = 2; /* MSF addressing */
+ rq.cmd[2] = 0x40; /* request subQ data */
+ rq.cmd[3] = 2; /* format */
+ rq.cmd[8] = sizeof(buf);
+
+ stat = cdrom_queue_packet_command(drive, &rq);
+ if (stat)
return stat;
- memcpy (mcn_info->medium_catalog_number, mcnbuf+9,
- sizeof (mcn_info->medium_catalog_number)-1);
- mcn_info->medium_catalog_number[sizeof (mcn_info->medium_catalog_number)-1]
- = '\0';
+ mcnlen = sizeof(mcn_info->medium_catalog_number) - 1;
+ memcpy(mcn_info->medium_catalog_number, buf + 9, mcnlen);
+ mcn_info->medium_catalog_number[mcnlen] = '\0';
return 0;
}
-
-
/****************************************************************************
* Other driver requests (open, close, check media change).
*/
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=200712200222.51336.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.