aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/ide-cd.c
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-02-01 17:09:24 -0500
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-02-01 17:09:24 -0500
commit53126b91274b1f2186b17c1f587c662ab74b631f (patch)
tree9924777a2e76991f02d56f351735ec4caab26d23 /drivers/ide/ide-cd.c
parenta891b1446b02509e5c7e5888a9f2a02edf8651a3 (diff)
ide-cd: merge cdrom_read_subchannel() into ide_cdrom_get_mcn()
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/ide-cd.c')
-rw-r--r--drivers/ide/ide-cd.c53
1 files changed, 21 insertions, 32 deletions
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index 6f1d6f22beb..d9128a9ae3f 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -2017,25 +2017,6 @@ static int ide_cd_read_tochdr(ide_drive_t *drive, void *arg)
2017 return 0; 2017 return 0;
2018} 2018}
2019 2019
2020static int cdrom_read_subchannel(ide_drive_t *drive, int format, char *buf,
2021 int buflen, struct request_sense *sense)
2022{
2023 struct request req;
2024
2025 cdrom_prepare_request(drive, &req);
2026
2027 req.sense = sense;
2028 req.data = buf;
2029 req.data_len = buflen;
2030 req.cmd[0] = GPCMD_READ_SUBCHANNEL;
2031 req.cmd[1] = 2; /* MSF addressing */
2032 req.cmd[2] = 0x40; /* request subQ data */
2033 req.cmd[3] = format;
2034 req.cmd[7] = (buflen >> 8);
2035 req.cmd[8] = (buflen & 0xff);
2036 return cdrom_queue_packet_command(drive, &req);
2037}
2038
2039/* ATAPI cdrom drives are free to select the speed you request or any slower 2020/* ATAPI cdrom drives are free to select the speed you request or any slower
2040 rate :-( Requesting too fast a speed will _not_ produce an error. */ 2021 rate :-( Requesting too fast a speed will _not_ produce an error. */
2041static int cdrom_select_speed(ide_drive_t *drive, int speed, 2022static int cdrom_select_speed(ide_drive_t *drive, int speed,
@@ -2377,28 +2358,36 @@ int ide_cdrom_get_last_session (struct cdrom_device_info *cdi,
2377 return 0; 2358 return 0;
2378} 2359}
2379 2360
2380static 2361static int ide_cdrom_get_mcn(struct cdrom_device_info *cdi,
2381int ide_cdrom_get_mcn (struct cdrom_device_info *cdi, 2362 struct cdrom_mcn *mcn_info)
2382 struct cdrom_mcn *mcn_info)
2383{ 2363{
2384 int stat;
2385 char mcnbuf[24];
2386 ide_drive_t *drive = cdi->handle; 2364 ide_drive_t *drive = cdi->handle;
2365 int stat, mcnlen;
2366 struct request rq;
2367 char buf[24];
2368
2369 cdrom_prepare_request(drive, &rq);
2387 2370
2388/* get MCN */ 2371 rq.data = buf;
2389 if ((stat = cdrom_read_subchannel(drive, 2, mcnbuf, sizeof (mcnbuf), NULL))) 2372 rq.data_len = sizeof(buf);
2373
2374 rq.cmd[0] = GPCMD_READ_SUBCHANNEL;
2375 rq.cmd[1] = 2; /* MSF addressing */
2376 rq.cmd[2] = 0x40; /* request subQ data */
2377 rq.cmd[3] = 2; /* format */
2378 rq.cmd[8] = sizeof(buf);
2379
2380 stat = cdrom_queue_packet_command(drive, &rq);
2381 if (stat)
2390 return stat; 2382 return stat;
2391 2383
2392 memcpy (mcn_info->medium_catalog_number, mcnbuf+9, 2384 mcnlen = sizeof(mcn_info->medium_catalog_number) - 1;
2393 sizeof (mcn_info->medium_catalog_number)-1); 2385 memcpy(mcn_info->medium_catalog_number, buf + 9, mcnlen);
2394 mcn_info->medium_catalog_number[sizeof (mcn_info->medium_catalog_number)-1] 2386 mcn_info->medium_catalog_number[mcnlen] = '\0';
2395 = '\0';
2396 2387
2397 return 0; 2388 return 0;
2398} 2389}
2399 2390
2400
2401
2402/**************************************************************************** 2391/****************************************************************************
2403 * Other driver requests (open, close, check media change). 2392 * Other driver requests (open, close, check media change).
2404 */ 2393 */