aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/cdrom
diff options
context:
space:
mode:
authorJoe Perches <joe@perches.com>2014-05-04 20:05:11 -0400
committerJens Axboe <axboe@fb.com>2014-05-05 16:58:06 -0400
commita803393bf8b2b0dd69d9aa87471e7afee91fbdc0 (patch)
treede83786fc3df80e19a7a376e24138adce2f9b1e0 /drivers/cdrom
parentdac1c5cf448c2bfdb8f6e1fe10a0eec616c34138 (diff)
cdrom: Remove cdrom_count_tracks prototype
Move function to proper location instead. Fix whitespace and embedded if too. Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'drivers/cdrom')
-rw-r--r--drivers/cdrom/cdrom.c94
1 files changed, 47 insertions, 47 deletions
diff --git a/drivers/cdrom/cdrom.c b/drivers/cdrom/cdrom.c
index 8888ed3a8d4f..f614847aad8f 100644
--- a/drivers/cdrom/cdrom.c
+++ b/drivers/cdrom/cdrom.c
@@ -338,8 +338,6 @@ do { \
338 338
339/* Not-exported routines. */ 339/* Not-exported routines. */
340 340
341static void cdrom_count_tracks(struct cdrom_device_info *, tracktype*);
342
343static int cdrom_mrw_exit(struct cdrom_device_info *cdi); 341static int cdrom_mrw_exit(struct cdrom_device_info *cdi);
344 342
345static int cdrom_get_disc_info(struct cdrom_device_info *cdi, disc_information *di); 343static int cdrom_get_disc_info(struct cdrom_device_info *cdi, disc_information *di);
@@ -948,6 +946,53 @@ static int cdrom_close_write(struct cdrom_device_info *cdi)
948#endif 946#endif
949} 947}
950 948
949/* badly broken, I know. Is due for a fixup anytime. */
950static void cdrom_count_tracks(struct cdrom_device_info *cdi, tracktype *tracks)
951{
952 struct cdrom_tochdr header;
953 struct cdrom_tocentry entry;
954 int ret, i;
955 tracks->data = 0;
956 tracks->audio = 0;
957 tracks->cdi = 0;
958 tracks->xa = 0;
959 tracks->error = 0;
960 cd_dbg(CD_COUNT_TRACKS, "entering cdrom_count_tracks\n");
961 /* Grab the TOC header so we can see how many tracks there are */
962 ret = cdi->ops->audio_ioctl(cdi, CDROMREADTOCHDR, &header);
963 if (ret) {
964 if (ret == -ENOMEDIUM)
965 tracks->error = CDS_NO_DISC;
966 else
967 tracks->error = CDS_NO_INFO;
968 return;
969 }
970 /* check what type of tracks are on this disc */
971 entry.cdte_format = CDROM_MSF;
972 for (i = header.cdth_trk0; i <= header.cdth_trk1; i++) {
973 entry.cdte_track = i;
974 if (cdi->ops->audio_ioctl(cdi, CDROMREADTOCENTRY, &entry)) {
975 tracks->error = CDS_NO_INFO;
976 return;
977 }
978 if (entry.cdte_ctrl & CDROM_DATA_TRACK) {
979 if (entry.cdte_format == 0x10)
980 tracks->cdi++;
981 else if (entry.cdte_format == 0x20)
982 tracks->xa++;
983 else
984 tracks->data++;
985 } else {
986 tracks->audio++;
987 }
988 cd_dbg(CD_COUNT_TRACKS, "track %d: format=%d, ctrl=%d\n",
989 i, entry.cdte_format, entry.cdte_ctrl);
990 }
991 cd_dbg(CD_COUNT_TRACKS, "disc has %d tracks: %d=audio %d=data %d=Cd-I %d=XA\n",
992 header.cdth_trk1, tracks->audio, tracks->data,
993 tracks->cdi, tracks->xa);
994}
995
951static 996static
952int open_for_data(struct cdrom_device_info *cdi) 997int open_for_data(struct cdrom_device_info *cdi)
953{ 998{
@@ -1457,51 +1502,6 @@ int cdrom_media_changed(struct cdrom_device_info *cdi)
1457 return media_changed(cdi, 0); 1502 return media_changed(cdi, 0);
1458} 1503}
1459 1504
1460/* badly broken, I know. Is due for a fixup anytime. */
1461static void cdrom_count_tracks(struct cdrom_device_info *cdi, tracktype* tracks)
1462{
1463 struct cdrom_tochdr header;
1464 struct cdrom_tocentry entry;
1465 int ret, i;
1466 tracks->data=0;
1467 tracks->audio=0;
1468 tracks->cdi=0;
1469 tracks->xa=0;
1470 tracks->error=0;
1471 cd_dbg(CD_COUNT_TRACKS, "entering cdrom_count_tracks\n");
1472 /* Grab the TOC header so we can see how many tracks there are */
1473 if ((ret = cdi->ops->audio_ioctl(cdi, CDROMREADTOCHDR, &header))) {
1474 if (ret == -ENOMEDIUM)
1475 tracks->error = CDS_NO_DISC;
1476 else
1477 tracks->error = CDS_NO_INFO;
1478 return;
1479 }
1480 /* check what type of tracks are on this disc */
1481 entry.cdte_format = CDROM_MSF;
1482 for (i = header.cdth_trk0; i <= header.cdth_trk1; i++) {
1483 entry.cdte_track = i;
1484 if (cdi->ops->audio_ioctl(cdi, CDROMREADTOCENTRY, &entry)) {
1485 tracks->error=CDS_NO_INFO;
1486 return;
1487 }
1488 if (entry.cdte_ctrl & CDROM_DATA_TRACK) {
1489 if (entry.cdte_format == 0x10)
1490 tracks->cdi++;
1491 else if (entry.cdte_format == 0x20)
1492 tracks->xa++;
1493 else
1494 tracks->data++;
1495 } else
1496 tracks->audio++;
1497 cd_dbg(CD_COUNT_TRACKS, "track %d: format=%d, ctrl=%d\n",
1498 i, entry.cdte_format, entry.cdte_ctrl);
1499 }
1500 cd_dbg(CD_COUNT_TRACKS, "disc has %d tracks: %d=audio %d=data %d=Cd-I %d=XA\n",
1501 header.cdth_trk1, tracks->audio, tracks->data,
1502 tracks->cdi, tracks->xa);
1503}
1504
1505/* Requests to the low-level drivers will /always/ be done in the 1505/* Requests to the low-level drivers will /always/ be done in the
1506 following format convention: 1506 following format convention:
1507 1507