[PATCH] drivers/cdrom/cm206.c: cleanups

This patch contains the following cleanups:
- make needlessly global functions static
- remove the following unused global function:
- cm206_delay

Signed-off-by: Adrian Bunk <bunk@stusta.de>
Cc: Jens Axboe <axboe@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

authored by Adrian Bunk and committed by Linus Torvalds 8b3d4a2a 995c6ed2

+50 -63
+50 -63
drivers/cdrom/cm206.c
··· 307 307 /* First, we define some polling functions. These are actually 308 308 only being used in the initialization. */ 309 309 310 - void send_command_polled(int command) 310 + static void send_command_polled(int command) 311 311 { 312 312 int loop = POLLOOP; 313 313 while (!(inw(r_line_status) & ls_transmitter_buffer_empty) ··· 318 318 outw(command, r_uart_transmit); 319 319 } 320 320 321 - uch receive_echo_polled(void) 321 + static uch receive_echo_polled(void) 322 322 { 323 323 int loop = POLLOOP; 324 324 while (!(inw(r_line_status) & ls_receive_buffer_full) && loop > 0) { ··· 328 328 return ((uch) inw(r_uart_receive)); 329 329 } 330 330 331 - uch send_receive_polled(int command) 331 + static uch send_receive_polled(int command) 332 332 { 333 333 send_command_polled(command); 334 334 return receive_echo_polled(); 335 335 } 336 336 337 - inline void clear_ur(void) 337 + static inline void clear_ur(void) 338 338 { 339 339 if (cd->ur_r != cd->ur_w) { 340 340 debug(("Deleting bytes from fifo:")); ··· 439 439 } 440 440 441 441 /* we have put the address of the wait queue in who */ 442 - void cm206_timeout(unsigned long who) 442 + static void cm206_timeout(unsigned long who) 443 443 { 444 444 cd->timed_out = 1; 445 445 debug(("Timing out\n")); ··· 448 448 449 449 /* This function returns 1 if a timeout occurred, 0 if an interrupt 450 450 happened */ 451 - int sleep_or_timeout(wait_queue_head_t * wait, int timeout) 451 + static int sleep_or_timeout(wait_queue_head_t * wait, int timeout) 452 452 { 453 453 cd->timed_out = 0; 454 454 init_timer(&cd->timer); ··· 465 465 return 0; 466 466 } 467 467 468 - void cm206_delay(int nr_jiffies) 469 - { 470 - DECLARE_WAIT_QUEUE_HEAD(wait); 471 - sleep_or_timeout(&wait, nr_jiffies); 472 - } 473 - 474 - void send_command(int command) 468 + static void send_command(int command) 475 469 { 476 470 debug(("Sending 0x%x\n", command)); 477 471 if (!(inw(r_line_status) & ls_transmitter_buffer_empty)) { ··· 484 490 outw(command, r_uart_transmit); 485 491 } 486 492 487 - uch receive_byte(int timeout) 493 + static uch receive_byte(int timeout) 488 494 { 489 495 uch ret; 490 496 cli(); ··· 515 521 return ret; 516 522 } 517 523 518 - inline uch receive_echo(void) 524 + static inline uch receive_echo(void) 519 525 { 520 526 return receive_byte(UART_TIMEOUT); 521 527 } 522 528 523 - inline uch send_receive(int command) 529 + static inline uch send_receive(int command) 524 530 { 525 531 send_command(command); 526 532 return receive_echo(); 527 533 } 528 534 529 - inline uch wait_dsb(void) 535 + static inline uch wait_dsb(void) 530 536 { 531 537 return receive_byte(DSB_TIMEOUT); 532 538 } 533 539 534 - int type_0_command(int command, int expect_dsb) 540 + static int type_0_command(int command, int expect_dsb) 535 541 { 536 542 int e; 537 543 clear_ur(); ··· 546 552 return 0; 547 553 } 548 554 549 - int type_1_command(int command, int bytes, uch * status) 555 + static int type_1_command(int command, int bytes, uch * status) 550 556 { /* returns info */ 551 557 int i; 552 558 if (type_0_command(command, 0)) ··· 558 564 559 565 /* This function resets the adapter card. We'd better not do this too 560 566 * often, because it tends to generate `lost interrupts.' */ 561 - void reset_cm260(void) 567 + static void reset_cm260(void) 562 568 { 563 569 outw(dc_normal | dc_initialize | READ_AHEAD, r_data_control); 564 570 udelay(10); /* 3.3 mu sec minimum */ ··· 566 572 } 567 573 568 574 /* fsm: frame-sec-min from linear address; one of many */ 569 - void fsm(int lba, uch * fsm) 575 + static void fsm(int lba, uch * fsm) 570 576 { 571 577 fsm[0] = lba % 75; 572 578 lba /= 75; ··· 575 581 fsm[2] = lba / 60; 576 582 } 577 583 578 - inline int fsm2lba(uch * fsm) 584 + static inline int fsm2lba(uch * fsm) 579 585 { 580 586 return fsm[0] + 75 * (fsm[1] - 2 + 60 * fsm[2]); 581 587 } 582 588 583 - inline int f_s_m2lba(uch f, uch s, uch m) 589 + static inline int f_s_m2lba(uch f, uch s, uch m) 584 590 { 585 591 return f + 75 * (s - 2 + 60 * m); 586 592 } 587 593 588 - int start_read(int start) 594 + static int start_read(int start) 589 595 { 590 596 uch read_sector[4] = { c_read_data, }; 591 597 int i, e; ··· 607 613 return 0; 608 614 } 609 615 610 - int stop_read(void) 616 + static int stop_read(void) 611 617 { 612 618 int e; 613 619 type_0_command(c_stop, 0); ··· 624 630 routine takes care of this. Set a flag `background' in the cd 625 631 struct to indicate the process. */ 626 632 627 - int read_background(int start, int reading) 633 + static int read_background(int start, int reading) 628 634 { 629 635 if (cd->background) 630 636 return -1; /* can't do twice */ ··· 652 658 653 659 654 660 #define MAX_TRIES 100 655 - int read_sector(int start) 661 + static int read_sector(int start) 656 662 { 657 663 int tries = 0; 658 664 if (cd->background) { ··· 747 753 /* This command clears the dsb_possible_media_change flag, so we must 748 754 * retain it. 749 755 */ 750 - void get_drive_status(void) 756 + static void get_drive_status(void) 751 757 { 752 758 uch status[2]; 753 759 type_1_command(c_drive_status, 2, status); /* this might be done faster */ ··· 758 764 dsb_drive_not_ready | dsb_tray_not_closed)); 759 765 } 760 766 761 - void get_disc_status(void) 767 + static void get_disc_status(void) 762 768 { 763 769 if (type_1_command(c_disc_status, 7, cd->disc_status)) { 764 770 debug(("get_disc_status: error\n")); ··· 795 801 796 802 /* Empty buffer empties $sectors$ sectors of the adapter card buffer, 797 803 * and then reads a sector in kernel memory. */ 798 - void empty_buffer(int sectors) 804 + static void empty_buffer(int sectors) 799 805 { 800 806 while (sectors >= 0) { 801 807 transport_data(r_fifo_output_buffer, ··· 813 819 /* try_adapter. This function determines if the requested sector is 814 820 in adapter memory, or will appear there soon. Returns 0 upon 815 821 success */ 816 - int try_adapter(int sector) 822 + static int try_adapter(int sector) 817 823 { 818 824 if (cd->adapter_first <= sector && sector < cd->adapter_last) { 819 825 /* sector is in adapter memory */ ··· 904 910 */ 905 911 906 912 /* seek seeks to address lba. It does wait to arrive there. */ 907 - void seek(int lba) 913 + static void seek(int lba) 908 914 { 909 915 int i; 910 916 uch seek_command[4] = { c_seek, }; ··· 920 926 return (bcd >> 4) * 10 + (bcd & 0xf); 921 927 } 922 928 923 - inline uch normalize_track(uch track) 929 + static inline uch normalize_track(uch track) 924 930 { 925 931 if (track < 1) 926 932 return 1; ··· 933 939 * tracks seen in the process. Input $track$ must be between 1 and 934 940 * #-of-tracks+1. Note that the start of the disc must be in toc[1].fsm. 935 941 */ 936 - int get_toc_lba(uch track) 942 + static int get_toc_lba(uch track) 937 943 { 938 944 int max = 74 * 60 * 75 - 150, min = fsm2lba(cd->toc[1].fsm); 939 945 int i, lba, l, old_lba = 0; ··· 985 991 return lba; 986 992 } 987 993 988 - void update_toc_entry(uch track) 994 + static void update_toc_entry(uch track) 989 995 { 990 996 track = normalize_track(track); 991 997 if (!cd->toc[track].track) ··· 993 999 } 994 1000 995 1001 /* return 0 upon success */ 996 - int read_toc_header(struct cdrom_tochdr *hp) 1002 + static int read_toc_header(struct cdrom_tochdr *hp) 997 1003 { 998 1004 if (!FIRST_TRACK) 999 1005 get_disc_status(); ··· 1010 1016 return -1; 1011 1017 } 1012 1018 1013 - void play_from_to_msf(struct cdrom_msf *msfp) 1019 + static void play_from_to_msf(struct cdrom_msf *msfp) 1014 1020 { 1015 1021 uch play_command[] = { c_play, 1016 1022 msfp->cdmsf_frame0, msfp->cdmsf_sec0, msfp->cdmsf_min0, ··· 1026 1032 cd->dsb = wait_dsb(); 1027 1033 } 1028 1034 1029 - void play_from_to_track(int from, int to) 1035 + static void play_from_to_track(int from, int to) 1030 1036 { 1031 1037 uch play_command[8] = { c_play, }; 1032 1038 int i; ··· 1053 1059 cd->dsb = wait_dsb(); 1054 1060 } 1055 1061 1056 - int get_current_q(struct cdrom_subchnl *qp) 1062 + static int get_current_q(struct cdrom_subchnl *qp) 1057 1063 { 1058 1064 int i; 1059 1065 uch *q = cd->q; ··· 1087 1093 return 0; 1088 1094 } 1089 1095 1090 - void invalidate_toc(void) 1096 + static void invalidate_toc(void) 1091 1097 { 1092 1098 memset(cd->toc, 0, sizeof(cd->toc)); 1093 1099 memset(cd->disc_status, 0, sizeof(cd->disc_status)); 1094 1100 } 1095 1101 1096 1102 /* cdrom.c guarantees that cdte_format == CDROM_MSF */ 1097 - void get_toc_entry(struct cdrom_tocentry *ep) 1103 + static void get_toc_entry(struct cdrom_tocentry *ep) 1098 1104 { 1099 1105 uch track = normalize_track(ep->cdte_track); 1100 1106 update_toc_entry(track); ··· 1111 1117 * upon success. Memory checking has been done by cdrom_ioctl(), the 1112 1118 * calling function, as well as LBA/MSF sanitization. 1113 1119 */ 1114 - int cm206_audio_ioctl(struct cdrom_device_info *cdi, unsigned int cmd, 1115 - void *arg) 1120 + static int cm206_audio_ioctl(struct cdrom_device_info *cdi, unsigned int cmd, 1121 + void *arg) 1116 1122 { 1117 1123 switch (cmd) { 1118 1124 case CDROMREADTOCHDR: ··· 1183 1189 } 1184 1190 } 1185 1191 1186 - int cm206_media_changed(struct cdrom_device_info *cdi, int disc_nr) 1192 + static int cm206_media_changed(struct cdrom_device_info *cdi, int disc_nr) 1187 1193 { 1188 1194 if (cd != NULL) { 1189 1195 int r; ··· 1198 1204 /* The new generic cdrom support. Routines should be concise, most of 1199 1205 the logic should be in cdrom.c */ 1200 1206 1201 - /* returns number of times device is in use */ 1202 - int cm206_open_files(struct cdrom_device_info *cdi) 1203 - { 1204 - if (cd) 1205 - return cd->openfiles; 1206 - return -1; 1207 - } 1208 1207 1209 1208 /* controls tray movement */ 1210 - int cm206_tray_move(struct cdrom_device_info *cdi, int position) 1209 + static int cm206_tray_move(struct cdrom_device_info *cdi, int position) 1211 1210 { 1212 1211 if (position) { /* 1: eject */ 1213 1212 type_0_command(c_open_tray, 1); ··· 1211 1224 } 1212 1225 1213 1226 /* gives current state of the drive */ 1214 - int cm206_drive_status(struct cdrom_device_info *cdi, int slot_nr) 1227 + static int cm206_drive_status(struct cdrom_device_info *cdi, int slot_nr) 1215 1228 { 1216 1229 get_drive_status(); 1217 1230 if (cd->dsb & dsb_tray_not_closed) ··· 1224 1237 } 1225 1238 1226 1239 /* locks or unlocks door lock==1: lock; return 0 upon success */ 1227 - int cm206_lock_door(struct cdrom_device_info *cdi, int lock) 1240 + static int cm206_lock_door(struct cdrom_device_info *cdi, int lock) 1228 1241 { 1229 1242 uch command = (lock) ? c_lock_tray : c_unlock_tray; 1230 1243 type_0_command(command, 1); /* wait and get dsb */ ··· 1235 1248 /* Although a session start should be in LBA format, we return it in 1236 1249 MSF format because it is slightly easier, and the new generic ioctl 1237 1250 will take care of the necessary conversion. */ 1238 - int cm206_get_last_session(struct cdrom_device_info *cdi, 1239 - struct cdrom_multisession *mssp) 1251 + static int cm206_get_last_session(struct cdrom_device_info *cdi, 1252 + struct cdrom_multisession *mssp) 1240 1253 { 1241 1254 if (!FIRST_TRACK) 1242 1255 get_disc_status(); ··· 1255 1268 return 0; 1256 1269 } 1257 1270 1258 - int cm206_get_upc(struct cdrom_device_info *cdi, struct cdrom_mcn *mcn) 1271 + static int cm206_get_upc(struct cdrom_device_info *cdi, struct cdrom_mcn *mcn) 1259 1272 { 1260 1273 uch upc[10]; 1261 1274 char *ret = mcn->medium_catalog_number; ··· 1274 1287 return 0; 1275 1288 } 1276 1289 1277 - int cm206_reset(struct cdrom_device_info *cdi) 1290 + static int cm206_reset(struct cdrom_device_info *cdi) 1278 1291 { 1279 1292 stop_read(); 1280 1293 reset_cm260(); ··· 1287 1300 return 0; 1288 1301 } 1289 1302 1290 - int cm206_select_speed(struct cdrom_device_info *cdi, int speed) 1303 + static int cm206_select_speed(struct cdrom_device_info *cdi, int speed) 1291 1304 { 1292 1305 int r; 1293 1306 switch (speed) { ··· 1379 1392 request_region, 15 bits of one port and 6 of another make things 1380 1393 likely enough to accept the region on the first hit... 1381 1394 */ 1382 - int __init probe_base_port(int base) 1395 + static int __init probe_base_port(int base) 1383 1396 { 1384 1397 int b = 0x300, e = 0x370; /* this is the range of start addresses */ 1385 1398 volatile int fool, i; ··· 1403 1416 1404 1417 #if !defined(MODULE) || defined(AUTO_PROBE_MODULE) 1405 1418 /* Probe for irq# nr. If nr==0, probe for all possible irq's. */ 1406 - int __init probe_irq(int nr) 1419 + static int __init probe_irq(int nr) 1407 1420 { 1408 1421 int irqs, irq; 1409 1422 outw(dc_normal | READ_AHEAD, r_data_control); /* disable irq-generation */ ··· 1545 1558 } 1546 1559 } 1547 1560 1548 - int __cm206_init(void) 1561 + static int __cm206_init(void) 1549 1562 { 1550 1563 parse_options(); 1551 1564 #if !defined(AUTO_PROBE_MODULE) ··· 1554 1567 return cm206_init(); 1555 1568 } 1556 1569 1557 - void __exit cm206_exit(void) 1570 + static void __exit cm206_exit(void) 1558 1571 { 1559 1572 del_gendisk(cm206_gendisk); 1560 1573 put_disk(cm206_gendisk);