aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-02-01 17:09:22 -0500
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-02-01 17:09:22 -0500
commitcdf6000d7e332d0f7f14233e71dee489628f5aae (patch)
treedad8ddf4590138a9f024e060539bf30e4bb2acd8
parent3fc3cbf786b6e73cd5cfe2f3233410a260405c86 (diff)
ide-cd: remove STANDARD_ATAPI define
Remove STANDARD_ATAPI define + drive-by coding style fixes. Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
-rw-r--r--drivers/ide/ide-cd.c43
-rw-r--r--drivers/ide/ide-cd.h10
2 files changed, 10 insertions, 43 deletions
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index 1232086d2e1a..206d038c1a1f 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -1775,7 +1775,6 @@ ide_do_rw_cdrom (ide_drive_t *drive, struct request *rq, sector_t block)
1775 * can also be NULL, in which case no sense information is returned. 1775 * can also be NULL, in which case no sense information is returned.
1776 */ 1776 */
1777 1777
1778#if ! STANDARD_ATAPI
1779static inline 1778static inline
1780int bin2bcd (int x) 1779int bin2bcd (int x)
1781{ 1780{
@@ -1797,9 +1796,6 @@ void msf_from_bcd (struct atapi_msf *msf)
1797 msf->frame = bcd2bin (msf->frame); 1796 msf->frame = bcd2bin (msf->frame);
1798} 1797}
1799 1798
1800#endif /* not STANDARD_ATAPI */
1801
1802
1803static inline 1799static inline
1804void lba_to_msf (int lba, byte *m, byte *s, byte *f) 1800void lba_to_msf (int lba, byte *m, byte *s, byte *f)
1805{ 1801{
@@ -1830,12 +1826,11 @@ static int cdrom_check_status(ide_drive_t *drive, struct request_sense *sense)
1830 req.cmd[0] = GPCMD_TEST_UNIT_READY; 1826 req.cmd[0] = GPCMD_TEST_UNIT_READY;
1831 req.cmd_flags |= REQ_QUIET; 1827 req.cmd_flags |= REQ_QUIET;
1832 1828
1833#if ! STANDARD_ATAPI 1829 /*
1834 /* the Sanyo 3 CD changer uses byte 7 of TEST_UNIT_READY to 1830 * Sanyo 3 CD changer uses byte 7 of TEST_UNIT_READY to
1835 switch CDs instead of supporting the LOAD_UNLOAD opcode */ 1831 * switch CDs instead of supporting the LOAD_UNLOAD opcode.
1836 1832 */
1837 req.cmd[7] = cdi->sanyo_slot % 3; 1833 req.cmd[7] = cdi->sanyo_slot % 3;
1838#endif /* not STANDARD_ATAPI */
1839 1834
1840 return cdrom_queue_packet_command(drive, &req); 1835 return cdrom_queue_packet_command(drive, &req);
1841} 1836}
@@ -2024,12 +2019,10 @@ static int cdrom_read_toc(ide_drive_t *drive, struct request_sense *sense)
2024 if (stat) 2019 if (stat)
2025 return stat; 2020 return stat;
2026 2021
2027#if ! STANDARD_ATAPI
2028 if (info->cd_flags & IDE_CD_FLAG_TOCTRACKS_AS_BCD) { 2022 if (info->cd_flags & IDE_CD_FLAG_TOCTRACKS_AS_BCD) {
2029 toc->hdr.first_track = bcd2bin(toc->hdr.first_track); 2023 toc->hdr.first_track = bcd2bin(toc->hdr.first_track);
2030 toc->hdr.last_track = bcd2bin(toc->hdr.last_track); 2024 toc->hdr.last_track = bcd2bin(toc->hdr.last_track);
2031 } 2025 }
2032#endif /* not STANDARD_ATAPI */
2033 2026
2034 ntracks = toc->hdr.last_track - toc->hdr.first_track + 1; 2027 ntracks = toc->hdr.last_track - toc->hdr.first_track + 1;
2035 if (ntracks <= 0) 2028 if (ntracks <= 0)
@@ -2061,16 +2054,13 @@ static int cdrom_read_toc(ide_drive_t *drive, struct request_sense *sense)
2061 (ntracks + 1) * 2054 (ntracks + 1) *
2062 sizeof(struct atapi_toc_entry), 2055 sizeof(struct atapi_toc_entry),
2063 sense); 2056 sense);
2064 if (stat) { 2057 if (stat)
2065 return stat; 2058 return stat;
2066 } 2059
2067#if ! STANDARD_ATAPI
2068 if (info->cd_flags & IDE_CD_FLAG_TOCTRACKS_AS_BCD) { 2060 if (info->cd_flags & IDE_CD_FLAG_TOCTRACKS_AS_BCD) {
2069 toc->hdr.first_track = bin2bcd(CDROM_LEADOUT); 2061 toc->hdr.first_track = bin2bcd(CDROM_LEADOUT);
2070 toc->hdr.last_track = bin2bcd(CDROM_LEADOUT); 2062 toc->hdr.last_track = bin2bcd(CDROM_LEADOUT);
2071 } else 2063 } else {
2072#endif /* not STANDARD_ATAPI */
2073 {
2074 toc->hdr.first_track = CDROM_LEADOUT; 2064 toc->hdr.first_track = CDROM_LEADOUT;
2075 toc->hdr.last_track = CDROM_LEADOUT; 2065 toc->hdr.last_track = CDROM_LEADOUT;
2076 } 2066 }
@@ -2081,21 +2071,17 @@ static int cdrom_read_toc(ide_drive_t *drive, struct request_sense *sense)
2081 2071
2082 toc->hdr.toc_length = ntohs (toc->hdr.toc_length); 2072 toc->hdr.toc_length = ntohs (toc->hdr.toc_length);
2083 2073
2084#if ! STANDARD_ATAPI
2085 if (info->cd_flags & IDE_CD_FLAG_TOCTRACKS_AS_BCD) { 2074 if (info->cd_flags & IDE_CD_FLAG_TOCTRACKS_AS_BCD) {
2086 toc->hdr.first_track = bcd2bin(toc->hdr.first_track); 2075 toc->hdr.first_track = bcd2bin(toc->hdr.first_track);
2087 toc->hdr.last_track = bcd2bin(toc->hdr.last_track); 2076 toc->hdr.last_track = bcd2bin(toc->hdr.last_track);
2088 } 2077 }
2089#endif /* not STANDARD_ATAPI */
2090 2078
2091 for (i=0; i<=ntracks; i++) { 2079 for (i = 0; i <= ntracks; i++) {
2092#if ! STANDARD_ATAPI
2093 if (info->cd_flags & IDE_CD_FLAG_TOCADDR_AS_BCD) { 2080 if (info->cd_flags & IDE_CD_FLAG_TOCADDR_AS_BCD) {
2094 if (info->cd_flags & IDE_CD_FLAG_TOCTRACKS_AS_BCD) 2081 if (info->cd_flags & IDE_CD_FLAG_TOCTRACKS_AS_BCD)
2095 toc->ent[i].track = bcd2bin(toc->ent[i].track); 2082 toc->ent[i].track = bcd2bin(toc->ent[i].track);
2096 msf_from_bcd(&toc->ent[i].addr.msf); 2083 msf_from_bcd(&toc->ent[i].addr.msf);
2097 } 2084 }
2098#endif /* not STANDARD_ATAPI */
2099 toc->ent[i].addr.lba = msf_to_lba (toc->ent[i].addr.msf.minute, 2085 toc->ent[i].addr.lba = msf_to_lba (toc->ent[i].addr.msf.minute,
2100 toc->ent[i].addr.msf.second, 2086 toc->ent[i].addr.msf.second,
2101 toc->ent[i].addr.msf.frame); 2087 toc->ent[i].addr.msf.frame);
@@ -2115,7 +2101,6 @@ static int cdrom_read_toc(ide_drive_t *drive, struct request_sense *sense)
2115 toc->last_session_lba = msf_to_lba(0, 2, 0); /* 0m 2s 0f */ 2101 toc->last_session_lba = msf_to_lba(0, 2, 0); /* 0m 2s 0f */
2116 } 2102 }
2117 2103
2118#if ! STANDARD_ATAPI
2119 if (info->cd_flags & IDE_CD_FLAG_TOCADDR_AS_BCD) { 2104 if (info->cd_flags & IDE_CD_FLAG_TOCADDR_AS_BCD) {
2120 /* Re-read multisession information using MSF format */ 2105 /* Re-read multisession information using MSF format */
2121 stat = cdrom_read_tocentry(drive, 0, 1, 1, (char *)&ms_tmp, 2106 stat = cdrom_read_tocentry(drive, 0, 1, 1, (char *)&ms_tmp,
@@ -2128,7 +2113,6 @@ static int cdrom_read_toc(ide_drive_t *drive, struct request_sense *sense)
2128 ms_tmp.ent.addr.msf.second, 2113 ms_tmp.ent.addr.msf.second,
2129 ms_tmp.ent.addr.msf.frame); 2114 ms_tmp.ent.addr.msf.frame);
2130 } 2115 }
2131#endif /* not STANDARD_ATAPI */
2132 2116
2133 toc->xa_flag = (ms_tmp.hdr.first_track != ms_tmp.hdr.last_track); 2117 toc->xa_flag = (ms_tmp.hdr.first_track != ms_tmp.hdr.last_track);
2134 2118
@@ -2705,16 +2689,11 @@ int ide_cdrom_probe_capabilities (ide_drive_t *drive)
2705 strcmp(drive->id->model, "MATSHITADVD-ROM SR-8174") == 0) 2689 strcmp(drive->id->model, "MATSHITADVD-ROM SR-8174") == 0)
2706 cdi->mask &= ~CDC_PLAY_AUDIO; 2690 cdi->mask &= ~CDC_PLAY_AUDIO;
2707 2691
2708#if ! STANDARD_ATAPI
2709 if (cdi->sanyo_slot > 0) { 2692 if (cdi->sanyo_slot > 0) {
2710 cdi->mask &= ~CDC_SELECT_DISC; 2693 cdi->mask &= ~CDC_SELECT_DISC;
2711 nslots = 3; 2694 nslots = 3;
2712 } 2695 } else if (mechtype == mechtype_individual_changer ||
2713 2696 mechtype == mechtype_cartridge_changer) {
2714 else
2715#endif /* not STANDARD_ATAPI */
2716 if (mechtype == mechtype_individual_changer ||
2717 mechtype == mechtype_cartridge_changer) {
2718 nslots = cdrom_number_of_slots(cdi); 2697 nslots = cdrom_number_of_slots(cdi);
2719 if (nslots > 1) 2698 if (nslots > 1)
2720 cdi->mask &= ~CDC_SELECT_DISC; 2699 cdi->mask &= ~CDC_SELECT_DISC;
@@ -2868,7 +2847,6 @@ int ide_cdrom_setup (ide_drive_t *drive)
2868 else if (!strcmp(drive->id->model, "SAMSUNG CD-ROM SCR-3231")) 2847 else if (!strcmp(drive->id->model, "SAMSUNG CD-ROM SCR-3231"))
2869 cd->cd_flags |= IDE_CD_FLAG_NO_SPEED_SELECT; 2848 cd->cd_flags |= IDE_CD_FLAG_NO_SPEED_SELECT;
2870 2849
2871#if ! STANDARD_ATAPI
2872 if (strcmp (drive->id->model, "V003S0DS") == 0 && 2850 if (strcmp (drive->id->model, "V003S0DS") == 0 &&
2873 drive->id->fw_rev[4] == '1' && 2851 drive->id->fw_rev[4] == '1' &&
2874 drive->id->fw_rev[6] <= '2') { 2852 drive->id->fw_rev[6] <= '2') {
@@ -2901,7 +2879,6 @@ int ide_cdrom_setup (ide_drive_t *drive)
2901 /* uses CD in slot 0 when value is set to 3 */ 2879 /* uses CD in slot 0 when value is set to 3 */
2902 cdi->sanyo_slot = 3; 2880 cdi->sanyo_slot = 3;
2903 } 2881 }
2904#endif /* not STANDARD_ATAPI */
2905 2882
2906 nslots = ide_cdrom_probe_capabilities (drive); 2883 nslots = ide_cdrom_probe_capabilities (drive);
2907 2884
diff --git a/drivers/ide/ide-cd.h b/drivers/ide/ide-cd.h
index 59b43935630f..34e9291c0a8e 100644
--- a/drivers/ide/ide-cd.h
+++ b/drivers/ide/ide-cd.h
@@ -18,16 +18,6 @@
18#define VERBOSE_IDE_CD_ERRORS 1 18#define VERBOSE_IDE_CD_ERRORS 1
19#endif 19#endif
20 20
21
22/* Turning this on will remove code to work around various nonstandard
23 ATAPI implementations. If you know your drive follows the standard,
24 this will give you a slightly smaller kernel. */
25
26#ifndef STANDARD_ATAPI
27#define STANDARD_ATAPI 0
28#endif
29
30
31/* 21/*
32 * typical timeout for packet command 22 * typical timeout for packet command
33 */ 23 */