aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/telephony/ixj.c
diff options
context:
space:
mode:
authorNishanth Aravamudan <nacc@us.ibm.com>2005-09-10 03:26:50 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2005-09-10 13:06:29 -0400
commitf4c9925ccc185da68c2d42230711d017f222e420 (patch)
treee9f77fbe4e100d3569f83fc386bf1eb5226d638a /drivers/telephony/ixj.c
parent3a11ec5e502cb61ee31095008318f9c107d9db60 (diff)
[PATCH] telephony/ixj: use msleep() instead of schedule_timeout()
Replace schedule_timeout() with msleep() to guarantee the task delays as expected. Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com> Signed-off-by: Domen Puncer <domen@coderock.org> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/telephony/ixj.c')
-rw-r--r--drivers/telephony/ixj.c62
1 files changed, 10 insertions, 52 deletions
diff --git a/drivers/telephony/ixj.c b/drivers/telephony/ixj.c
index f2c9fa423d40..9585d48dc4fc 100644
--- a/drivers/telephony/ixj.c
+++ b/drivers/telephony/ixj.c
@@ -774,10 +774,7 @@ static int ixj_wink(IXJ *j)
774 j->pots_winkstart = jiffies; 774 j->pots_winkstart = jiffies;
775 SLIC_SetState(PLD_SLIC_STATE_OC, j); 775 SLIC_SetState(PLD_SLIC_STATE_OC, j);
776 776
777 while (time_before(jiffies, j->pots_winkstart + j->winktime)) { 777 msleep(jiffies_to_msecs(j->winktime));
778 set_current_state(TASK_INTERRUPTIBLE);
779 schedule_timeout(1);
780 }
781 778
782 SLIC_SetState(slicnow, j); 779 SLIC_SetState(slicnow, j);
783 return 0; 780 return 0;
@@ -1912,7 +1909,6 @@ static int ixj_pcmcia_cable_check(IXJ *j)
1912 1909
1913static int ixj_hookstate(IXJ *j) 1910static int ixj_hookstate(IXJ *j)
1914{ 1911{
1915 unsigned long det;
1916 int fOffHook = 0; 1912 int fOffHook = 0;
1917 1913
1918 switch (j->cardtype) { 1914 switch (j->cardtype) {
@@ -1943,11 +1939,7 @@ static int ixj_hookstate(IXJ *j)
1943 j->pld_slicr.bits.state == PLD_SLIC_STATE_STANDBY) { 1939 j->pld_slicr.bits.state == PLD_SLIC_STATE_STANDBY) {
1944 if (j->flags.ringing || j->flags.cringing) { 1940 if (j->flags.ringing || j->flags.cringing) {
1945 if (!in_interrupt()) { 1941 if (!in_interrupt()) {
1946 det = jiffies + (hertz / 50); 1942 msleep(20);
1947 while (time_before(jiffies, det)) {
1948 set_current_state(TASK_INTERRUPTIBLE);
1949 schedule_timeout(1);
1950 }
1951 } 1943 }
1952 SLIC_GetState(j); 1944 SLIC_GetState(j);
1953 if (j->pld_slicr.bits.state == PLD_SLIC_STATE_RINGING) { 1945 if (j->pld_slicr.bits.state == PLD_SLIC_STATE_RINGING) {
@@ -2062,7 +2054,7 @@ static void ixj_ring_start(IXJ *j)
2062static int ixj_ring(IXJ *j) 2054static int ixj_ring(IXJ *j)
2063{ 2055{
2064 char cntr; 2056 char cntr;
2065 unsigned long jif, det; 2057 unsigned long jif;
2066 2058
2067 j->flags.ringing = 1; 2059 j->flags.ringing = 1;
2068 if (ixj_hookstate(j) & 1) { 2060 if (ixj_hookstate(j) & 1) {
@@ -2070,7 +2062,6 @@ static int ixj_ring(IXJ *j)
2070 j->flags.ringing = 0; 2062 j->flags.ringing = 0;
2071 return 1; 2063 return 1;
2072 } 2064 }
2073 det = 0;
2074 for (cntr = 0; cntr < j->maxrings; cntr++) { 2065 for (cntr = 0; cntr < j->maxrings; cntr++) {
2075 jif = jiffies + (1 * hertz); 2066 jif = jiffies + (1 * hertz);
2076 ixj_ring_on(j); 2067 ixj_ring_on(j);
@@ -2089,13 +2080,7 @@ static int ixj_ring(IXJ *j)
2089 ixj_ring_off(j); 2080 ixj_ring_off(j);
2090 while (time_before(jiffies, jif)) { 2081 while (time_before(jiffies, jif)) {
2091 if (ixj_hookstate(j) & 1) { 2082 if (ixj_hookstate(j) & 1) {
2092 det = jiffies + (hertz / 100); 2083 msleep(10);
2093 while (time_before(jiffies, det)) {
2094 set_current_state(TASK_INTERRUPTIBLE);
2095 schedule_timeout(1);
2096 if (signal_pending(current))
2097 break;
2098 }
2099 if (ixj_hookstate(j) & 1) { 2084 if (ixj_hookstate(j) & 1) {
2100 j->flags.ringing = 0; 2085 j->flags.ringing = 0;
2101 return 1; 2086 return 1;
@@ -6694,8 +6679,6 @@ static struct file_operations ixj_fops =
6694 6679
6695static int ixj_linetest(IXJ *j) 6680static int ixj_linetest(IXJ *j)
6696{ 6681{
6697 unsigned long jifwait;
6698
6699 j->flags.pstncheck = 1; /* Testing */ 6682 j->flags.pstncheck = 1; /* Testing */
6700 j->flags.pstn_present = 0; /* Assume the line is not there */ 6683 j->flags.pstn_present = 0; /* Assume the line is not there */
6701 6684
@@ -6726,11 +6709,7 @@ static int ixj_linetest(IXJ *j)
6726 6709
6727 outb_p(j->pld_scrw.byte, j->XILINXbase); 6710 outb_p(j->pld_scrw.byte, j->XILINXbase);
6728 daa_set_mode(j, SOP_PU_CONVERSATION); 6711 daa_set_mode(j, SOP_PU_CONVERSATION);
6729 jifwait = jiffies + hertz; 6712 msleep(1000);
6730 while (time_before(jiffies, jifwait)) {
6731 set_current_state(TASK_INTERRUPTIBLE);
6732 schedule_timeout(1);
6733 }
6734 daa_int_read(j); 6713 daa_int_read(j);
6735 daa_set_mode(j, SOP_PU_RESET); 6714 daa_set_mode(j, SOP_PU_RESET);
6736 if (j->m_DAAShadowRegs.XOP_REGS.XOP.xr0.bitreg.VDD_OK) { 6715 if (j->m_DAAShadowRegs.XOP_REGS.XOP.xr0.bitreg.VDD_OK) {
@@ -6750,11 +6729,7 @@ static int ixj_linetest(IXJ *j)
6750 j->pld_slicw.bits.rly3 = 0; 6729 j->pld_slicw.bits.rly3 = 0;
6751 outb_p(j->pld_slicw.byte, j->XILINXbase + 0x01); 6730 outb_p(j->pld_slicw.byte, j->XILINXbase + 0x01);
6752 daa_set_mode(j, SOP_PU_CONVERSATION); 6731 daa_set_mode(j, SOP_PU_CONVERSATION);
6753 jifwait = jiffies + hertz; 6732 msleep(1000);
6754 while (time_before(jiffies, jifwait)) {
6755 set_current_state(TASK_INTERRUPTIBLE);
6756 schedule_timeout(1);
6757 }
6758 daa_int_read(j); 6733 daa_int_read(j);
6759 daa_set_mode(j, SOP_PU_RESET); 6734 daa_set_mode(j, SOP_PU_RESET);
6760 if (j->m_DAAShadowRegs.XOP_REGS.XOP.xr0.bitreg.VDD_OK) { 6735 if (j->m_DAAShadowRegs.XOP_REGS.XOP.xr0.bitreg.VDD_OK) {
@@ -6783,7 +6758,6 @@ static int ixj_linetest(IXJ *j)
6783static int ixj_selfprobe(IXJ *j) 6758static int ixj_selfprobe(IXJ *j)
6784{ 6759{
6785 unsigned short cmd; 6760 unsigned short cmd;
6786 unsigned long jif;
6787 int cnt; 6761 int cnt;
6788 BYTES bytes; 6762 BYTES bytes;
6789 6763
@@ -6933,29 +6907,13 @@ static int ixj_selfprobe(IXJ *j)
6933 } else { 6907 } else {
6934 if (j->cardtype == QTI_LINEJACK) { 6908 if (j->cardtype == QTI_LINEJACK) {
6935 LED_SetState(0x1, j); 6909 LED_SetState(0x1, j);
6936 jif = jiffies + (hertz / 10); 6910 msleep(100);
6937 while (time_before(jiffies, jif)) {
6938 set_current_state(TASK_INTERRUPTIBLE);
6939 schedule_timeout(1);
6940 }
6941 LED_SetState(0x2, j); 6911 LED_SetState(0x2, j);
6942 jif = jiffies + (hertz / 10); 6912 msleep(100);
6943 while (time_before(jiffies, jif)) {
6944 set_current_state(TASK_INTERRUPTIBLE);
6945 schedule_timeout(1);
6946 }
6947 LED_SetState(0x4, j); 6913 LED_SetState(0x4, j);
6948 jif = jiffies + (hertz / 10); 6914 msleep(100);
6949 while (time_before(jiffies, jif)) {
6950 set_current_state(TASK_INTERRUPTIBLE);
6951 schedule_timeout(1);
6952 }
6953 LED_SetState(0x8, j); 6915 LED_SetState(0x8, j);
6954 jif = jiffies + (hertz / 10); 6916 msleep(100);
6955 while (time_before(jiffies, jif)) {
6956 set_current_state(TASK_INTERRUPTIBLE);
6957 schedule_timeout(1);
6958 }
6959 LED_SetState(0x0, j); 6917 LED_SetState(0x0, j);
6960 daa_get_version(j); 6918 daa_get_version(j);
6961 if (ixjdebug & 0x0002) 6919 if (ixjdebug & 0x0002)