Commit 3dfcc8ac authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

Some more misc wait_ms() conversions to use msleep()

parent e1a929af
...@@ -146,13 +146,6 @@ static struct i2c_driver therm_pm72_driver = ...@@ -146,13 +146,6 @@ static struct i2c_driver therm_pm72_driver =
.detach_adapter = therm_pm72_detach, .detach_adapter = therm_pm72_detach,
}; };
static inline void wait_ms(unsigned int ms)
{
set_current_state(TASK_UNINTERRUPTIBLE);
schedule_timeout(1 + (ms * HZ + 999) / 1000);
}
/* /*
* Utility function to create an i2c_client structure and * Utility function to create an i2c_client structure and
* attach it to one of u3 adapters * attach it to one of u3 adapters
...@@ -251,7 +244,7 @@ static int read_smon_adc(struct cpu_pid_state *state, int chan) ...@@ -251,7 +244,7 @@ static int read_smon_adc(struct cpu_pid_state *state, int chan)
if (rc <= 0) if (rc <= 0)
goto error; goto error;
/* Wait for convertion */ /* Wait for convertion */
wait_ms(1); msleep(1);
/* Switch to data register */ /* Switch to data register */
buf[0] = 4; buf[0] = 4;
rc = i2c_master_send(state->monitor, buf, 1); rc = i2c_master_send(state->monitor, buf, 1);
...@@ -269,7 +262,7 @@ static int read_smon_adc(struct cpu_pid_state *state, int chan) ...@@ -269,7 +262,7 @@ static int read_smon_adc(struct cpu_pid_state *state, int chan)
printk(KERN_ERR "therm_pm72: Error reading ADC !\n"); printk(KERN_ERR "therm_pm72: Error reading ADC !\n");
return -1; return -1;
} }
wait_ms(10); msleep(10);
} }
} }
...@@ -283,7 +276,7 @@ static int fan_read_reg(int reg, unsigned char *buf, int nb) ...@@ -283,7 +276,7 @@ static int fan_read_reg(int reg, unsigned char *buf, int nb)
nw = i2c_master_send(fcu, buf, 1); nw = i2c_master_send(fcu, buf, 1);
if (nw > 0 || (nw < 0 && nw != -EIO) || tries >= 100) if (nw > 0 || (nw < 0 && nw != -EIO) || tries >= 100)
break; break;
wait_ms(10); msleep(10);
++tries; ++tries;
} }
if (nw <= 0) { if (nw <= 0) {
...@@ -295,7 +288,7 @@ static int fan_read_reg(int reg, unsigned char *buf, int nb) ...@@ -295,7 +288,7 @@ static int fan_read_reg(int reg, unsigned char *buf, int nb)
nr = i2c_master_recv(fcu, buf, nb); nr = i2c_master_recv(fcu, buf, nb);
if (nr > 0 || (nr < 0 && nr != ENODEV) || tries >= 100) if (nr > 0 || (nr < 0 && nr != ENODEV) || tries >= 100)
break; break;
wait_ms(10); msleep(10);
++tries; ++tries;
} }
if (nr <= 0) if (nr <= 0)
...@@ -316,7 +309,7 @@ static int fan_write_reg(int reg, const unsigned char *ptr, int nb) ...@@ -316,7 +309,7 @@ static int fan_write_reg(int reg, const unsigned char *ptr, int nb)
nw = i2c_master_send(fcu, buf, nb); nw = i2c_master_send(fcu, buf, nb);
if (nw > 0 || (nw < 0 && nw != EIO) || tries >= 100) if (nw > 0 || (nw < 0 && nw != EIO) || tries >= 100)
break; break;
wait_ms(10); msleep(10);
++tries; ++tries;
} }
if (nw < 0) if (nw < 0)
......
...@@ -48,6 +48,7 @@ ...@@ -48,6 +48,7 @@
#include <linux/netdevice.h> #include <linux/netdevice.h>
#include <linux/suspend.h> #include <linux/suspend.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/delay.h>
#include <linux/usb.h> #include <linux/usb.h>
#include <linux/crc32.h> #include <linux/crc32.h>
#include <net/irda/irda.h> #include <net/irda/irda.h>
...@@ -652,7 +653,7 @@ static int fifo_txwait(struct stir_cb *stir, int space) ...@@ -652,7 +653,7 @@ static int fifo_txwait(struct stir_cb *stir, int space)
return 0; return 0;
/* estimate transfer time for remaining chars */ /* estimate transfer time for remaining chars */
wait_ms((count * 8000) / stir->speed); msleep((count * 8000) / stir->speed);
} }
err = write_reg(stir, REG_FIFOCTL, FIFOCTL_CLR); err = write_reg(stir, REG_FIFOCTL, FIFOCTL_CLR);
...@@ -810,7 +811,7 @@ static int stir_transmit_thread(void *arg) ...@@ -810,7 +811,7 @@ static int stir_transmit_thread(void *arg)
info("%s: receive usb submit failed", info("%s: receive usb submit failed",
stir->netdev->name); stir->netdev->name);
stir->receiving = 0; stir->receiving = 0;
wait_ms(10); msleep(10);
continue; continue;
} }
} }
......
...@@ -1184,7 +1184,7 @@ static void radeon_write_pll_regs(struct radeonfb_info *rinfo, struct radeon_reg ...@@ -1184,7 +1184,7 @@ static void radeon_write_pll_regs(struct radeonfb_info *rinfo, struct radeon_reg
~(PPLL_RESET | PPLL_SLEEP | PPLL_ATOMIC_UPDATE_EN | PPLL_VGA_ATOMIC_UPDATE_EN)); ~(PPLL_RESET | PPLL_SLEEP | PPLL_ATOMIC_UPDATE_EN | PPLL_VGA_ATOMIC_UPDATE_EN));
/* We may want some locking ... oh well */ /* We may want some locking ... oh well */
wait_ms(5); msleep(5);
/* Switch back VCLK source to PPLL */ /* Switch back VCLK source to PPLL */
OUTPLLP(VCLK_ECP_CNTL, VCLK_SRC_SEL_PPLLCLK, ~VCLK_SRC_SEL_MASK); OUTPLLP(VCLK_ECP_CNTL, VCLK_SRC_SEL_PPLLCLK, ~VCLK_SRC_SEL_MASK);
......
...@@ -189,12 +189,12 @@ int radeon_probe_i2c_connector(struct radeonfb_info *rinfo, int conn, u8 **out_e ...@@ -189,12 +189,12 @@ int radeon_probe_i2c_connector(struct radeonfb_info *rinfo, int conn, u8 **out_e
*/ */
OUTREG(reg, INREG(reg) & ~(VGA_DDC_DATA_OUT_EN)); OUTREG(reg, INREG(reg) & ~(VGA_DDC_DATA_OUT_EN));
(void)INREG(reg); (void)INREG(reg);
wait_ms(13); msleep(13);
OUTREG(reg, INREG(reg) & ~(VGA_DDC_CLK_OUT_EN)); OUTREG(reg, INREG(reg) & ~(VGA_DDC_CLK_OUT_EN));
(void)INREG(reg); (void)INREG(reg);
for (j = 0; j < 5; j++) { for (j = 0; j < 5; j++) {
wait_ms(10); msleep(10);
if (INREG(reg) & VGA_DDC_CLK_INPUT) if (INREG(reg) & VGA_DDC_CLK_INPUT)
break; break;
} }
...@@ -203,13 +203,13 @@ int radeon_probe_i2c_connector(struct radeonfb_info *rinfo, int conn, u8 **out_e ...@@ -203,13 +203,13 @@ int radeon_probe_i2c_connector(struct radeonfb_info *rinfo, int conn, u8 **out_e
OUTREG(reg, INREG(reg) | VGA_DDC_DATA_OUT_EN); OUTREG(reg, INREG(reg) | VGA_DDC_DATA_OUT_EN);
(void)INREG(reg); (void)INREG(reg);
wait_ms(15); msleep(15);
OUTREG(reg, INREG(reg) | VGA_DDC_CLK_OUT_EN); OUTREG(reg, INREG(reg) | VGA_DDC_CLK_OUT_EN);
(void)INREG(reg); (void)INREG(reg);
wait_ms(15); msleep(15);
OUTREG(reg, INREG(reg) & ~(VGA_DDC_DATA_OUT_EN)); OUTREG(reg, INREG(reg) & ~(VGA_DDC_DATA_OUT_EN));
(void)INREG(reg); (void)INREG(reg);
wait_ms(15); msleep(15);
/* Do the real work */ /* Do the real work */
edid = radeon_do_probe_i2c_edid(&rinfo->i2c[conn-1]); edid = radeon_do_probe_i2c_edid(&rinfo->i2c[conn-1]);
...@@ -217,19 +217,19 @@ int radeon_probe_i2c_connector(struct radeonfb_info *rinfo, int conn, u8 **out_e ...@@ -217,19 +217,19 @@ int radeon_probe_i2c_connector(struct radeonfb_info *rinfo, int conn, u8 **out_e
OUTREG(reg, INREG(reg) | OUTREG(reg, INREG(reg) |
(VGA_DDC_DATA_OUT_EN | VGA_DDC_CLK_OUT_EN)); (VGA_DDC_DATA_OUT_EN | VGA_DDC_CLK_OUT_EN));
(void)INREG(reg); (void)INREG(reg);
wait_ms(15); msleep(15);
OUTREG(reg, INREG(reg) & ~(VGA_DDC_CLK_OUT_EN)); OUTREG(reg, INREG(reg) & ~(VGA_DDC_CLK_OUT_EN));
(void)INREG(reg); (void)INREG(reg);
for (j = 0; j < 10; j++) { for (j = 0; j < 10; j++) {
wait_ms(10); msleep(10);
if (INREG(reg) & VGA_DDC_CLK_INPUT) if (INREG(reg) & VGA_DDC_CLK_INPUT)
break; break;
} }
OUTREG(reg, INREG(reg) & ~(VGA_DDC_DATA_OUT_EN)); OUTREG(reg, INREG(reg) & ~(VGA_DDC_DATA_OUT_EN));
(void)INREG(reg); (void)INREG(reg);
wait_ms(15); msleep(15);
OUTREG(reg, INREG(reg) | OUTREG(reg, INREG(reg) |
(VGA_DDC_DATA_OUT_EN | VGA_DDC_CLK_OUT_EN)); (VGA_DDC_DATA_OUT_EN | VGA_DDC_CLK_OUT_EN));
(void)INREG(reg); (void)INREG(reg);
......
...@@ -438,15 +438,6 @@ static inline u32 _INPLL(struct radeonfb_info *rinfo, u32 addr) ...@@ -438,15 +438,6 @@ static inline u32 _INPLL(struct radeonfb_info *rinfo, u32 addr)
/* /*
* Inline utilities * Inline utilities
*/ */
static inline void wait_ms(unsigned long ms)
{
set_current_state(TASK_UNINTERRUPTIBLE);
schedule_timeout((ms * HZ + 999) / 1000);
}
static inline int round_div(int num, int den) static inline int round_div(int num, int den)
{ {
return (num + (den / 2)) / den; return (num + (den / 2)) / den;
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include <linux/module.h> #include <linux/module.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/delay.h>
#include <linux/proc_fs.h> #include <linux/proc_fs.h>
#include <linux/ioport.h> #include <linux/ioport.h>
#include <linux/sysctl.h> #include <linux/sysctl.h>
...@@ -97,14 +98,14 @@ int daca_leave_sleep(void) ...@@ -97,14 +98,14 @@ int daca_leave_sleep(void)
/* Do a short sleep, just to make sure I2C bus is awake and paying /* Do a short sleep, just to make sure I2C bus is awake and paying
* attention to us * attention to us
*/ */
wait_ms(20); msleep(20);
/* Write the sample rate reg the value it needs */ /* Write the sample rate reg the value it needs */
i2c_smbus_write_byte_data(daca_client, 1, 8); i2c_smbus_write_byte_data(daca_client, 1, 8);
daca_set_volume(cur_left_vol >> 5, cur_right_vol >> 5); daca_set_volume(cur_left_vol >> 5, cur_right_vol >> 5);
/* Another short delay, just to make sure the other I2C bus writes /* Another short delay, just to make sure the other I2C bus writes
* have taken... * have taken...
*/ */
wait_ms(20); msleep(20);
/* Write the global config reg - invert right power amp, /* Write the global config reg - invert right power amp,
* DAC on, use 5-volt mode */ * DAC on, use 5-volt mode */
i2c_smbus_write_byte_data(daca_client, 3, 0x45); i2c_smbus_write_byte_data(daca_client, 3, 0x45);
......
...@@ -267,12 +267,6 @@ extern int dmasound_catchRadius; ...@@ -267,12 +267,6 @@ extern int dmasound_catchRadius;
*/ */
#define BS_VAL 1 #define BS_VAL 1
static inline void wait_ms(unsigned int ms)
{
current->state = TASK_UNINTERRUPTIBLE;
schedule_timeout(1 + ms * HZ / 1000);
}
#define SW_INPUT_VOLUME_SCALE 4 #define SW_INPUT_VOLUME_SCALE 4
#define SW_INPUT_VOLUME_DEFAULT (128 / SW_INPUT_VOLUME_SCALE) #define SW_INPUT_VOLUME_DEFAULT (128 / SW_INPUT_VOLUME_SCALE)
......
...@@ -457,9 +457,9 @@ tas_dmasound_init(void) ...@@ -457,9 +457,9 @@ tas_dmasound_init(void)
&gpio_headphone_detect_pol); &gpio_headphone_detect_pol);
write_audio_gpio(gpio_audio_reset, gpio_audio_reset_pol); write_audio_gpio(gpio_audio_reset, gpio_audio_reset_pol);
wait_ms(100); msleep(100);
write_audio_gpio(gpio_audio_reset, !gpio_audio_reset_pol); write_audio_gpio(gpio_audio_reset, !gpio_audio_reset_pol);
wait_ms(100); msleep(100);
if (gpio_headphone_irq) { if (gpio_headphone_irq) {
if (request_irq(gpio_headphone_irq,headphone_intr,0,"Headphone detect",0) < 0) { if (request_irq(gpio_headphone_irq,headphone_intr,0,"Headphone detect",0) < 0) {
printk(KERN_ERR "tumbler: Can't request headphone interrupt\n"); printk(KERN_ERR "tumbler: Can't request headphone interrupt\n");
...@@ -653,7 +653,7 @@ static void PMacIrqCleanup(void) ...@@ -653,7 +653,7 @@ static void PMacIrqCleanup(void)
machine_is_compatible("PowerBook3,2")) && awacs) { machine_is_compatible("PowerBook3,2")) && awacs) {
awacs_reg[1] |= MASK_PAROUT0 | MASK_PAROUT1; awacs_reg[1] |= MASK_PAROUT0 | MASK_PAROUT1;
awacs_write(MASK_ADDR1 | awacs_reg[1]); awacs_write(MASK_ADDR1 | awacs_reg[1]);
wait_ms(200); msleep(200);
} }
if (awacs) if (awacs)
free_irq(awacs_irq, 0); free_irq(awacs_irq, 0);
...@@ -775,10 +775,10 @@ awacs_recalibrate(void) ...@@ -775,10 +775,10 @@ awacs_recalibrate(void)
/* Sorry for the horrible delays... I hope to get that improved /* Sorry for the horrible delays... I hope to get that improved
* by making the whole PM process asynchronous in a future version * by making the whole PM process asynchronous in a future version
*/ */
wait_ms(750); msleep(750);
awacs_reg[1] |= MASK_CMUTE | MASK_AMUTE; awacs_reg[1] |= MASK_CMUTE | MASK_AMUTE;
awacs_write(awacs_reg[1] | MASK_RECALIBRATE | MASK_ADDR1); awacs_write(awacs_reg[1] | MASK_RECALIBRATE | MASK_ADDR1);
wait_ms(1000); msleep(1000);
awacs_write(awacs_reg[1] | MASK_ADDR1); awacs_write(awacs_reg[1] | MASK_ADDR1);
} }
...@@ -1405,9 +1405,9 @@ load_awacs(void) ...@@ -1405,9 +1405,9 @@ load_awacs(void)
if (awacs_revision == AWACS_SCREAMER) { if (awacs_revision == AWACS_SCREAMER) {
awacs_write(awacs_reg[5] + MASK_ADDR5); awacs_write(awacs_reg[5] + MASK_ADDR5);
wait_ms(100); msleep(100);
awacs_write(awacs_reg[6] + MASK_ADDR6); awacs_write(awacs_reg[6] + MASK_ADDR6);
wait_ms(2); msleep(2);
awacs_write(awacs_reg[1] + MASK_ADDR1); awacs_write(awacs_reg[1] + MASK_ADDR1);
awacs_write(awacs_reg[7] + MASK_ADDR7); awacs_write(awacs_reg[7] + MASK_ADDR7);
} }
...@@ -1479,7 +1479,7 @@ static int awacs_sleep_notify(struct pmu_sleep_notifier *self, int when) ...@@ -1479,7 +1479,7 @@ static int awacs_sleep_notify(struct pmu_sleep_notifier *self, int when)
machine_is_compatible("PowerBook3,2")) && awacs) { machine_is_compatible("PowerBook3,2")) && awacs) {
awacs_reg[1] |= MASK_PAROUT0 | MASK_PAROUT1; awacs_reg[1] |= MASK_PAROUT0 | MASK_PAROUT1;
awacs_write(MASK_ADDR1 | awacs_reg[1]); awacs_write(MASK_ADDR1 | awacs_reg[1]);
wait_ms(200); msleep(200);
} }
break; break;
case PBOOK_WAKE: case PBOOK_WAKE:
...@@ -1487,12 +1487,12 @@ static int awacs_sleep_notify(struct pmu_sleep_notifier *self, int when) ...@@ -1487,12 +1487,12 @@ static int awacs_sleep_notify(struct pmu_sleep_notifier *self, int when)
pmac_call_feature(PMAC_FTR_SOUND_CHIP_ENABLE, awacs_node, 0, 1); pmac_call_feature(PMAC_FTR_SOUND_CHIP_ENABLE, awacs_node, 0, 1);
if ((machine_is_compatible("PowerBook3,1") || if ((machine_is_compatible("PowerBook3,1") ||
machine_is_compatible("PowerBook3,2")) && awacs) { machine_is_compatible("PowerBook3,2")) && awacs) {
wait_ms(100); msleep(100);
awacs_reg[1] &= ~(MASK_PAROUT0 | MASK_PAROUT1); awacs_reg[1] &= ~(MASK_PAROUT0 | MASK_PAROUT1);
awacs_write(MASK_ADDR1 | awacs_reg[1]); awacs_write(MASK_ADDR1 | awacs_reg[1]);
wait_ms(300); msleep(300);
} else } else
wait_ms(1000); msleep(1000);
/* restore settings */ /* restore settings */
switch (awacs_revision) { switch (awacs_revision) {
case AWACS_TUMBLER: case AWACS_TUMBLER:
...@@ -1500,14 +1500,14 @@ static int awacs_sleep_notify(struct pmu_sleep_notifier *self, int when) ...@@ -1500,14 +1500,14 @@ static int awacs_sleep_notify(struct pmu_sleep_notifier *self, int when)
write_audio_gpio(gpio_headphone_mute, gpio_headphone_mute_pol); write_audio_gpio(gpio_headphone_mute, gpio_headphone_mute_pol);
write_audio_gpio(gpio_amp_mute, gpio_amp_mute_pol); write_audio_gpio(gpio_amp_mute, gpio_amp_mute_pol);
write_audio_gpio(gpio_audio_reset, gpio_audio_reset_pol); write_audio_gpio(gpio_audio_reset, gpio_audio_reset_pol);
wait_ms(100); msleep(100);
write_audio_gpio(gpio_audio_reset, !gpio_audio_reset_pol); write_audio_gpio(gpio_audio_reset, !gpio_audio_reset_pol);
wait_ms(150); msleep(150);
tas_leave_sleep(); /* Stub for now */ tas_leave_sleep(); /* Stub for now */
headphone_intr(0,0,0); headphone_intr(0,0,0);
break; break;
case AWACS_DACA: case AWACS_DACA:
wait_ms(10); /* Check this !!! */ msleep(10); /* Check this !!! */
daca_leave_sleep(); daca_leave_sleep();
break ; /* dont know how yet */ break ; /* dont know how yet */
case AWACS_BURGUNDY: case AWACS_BURGUNDY:
...@@ -2432,7 +2432,7 @@ static void PMacAbortRead(void) ...@@ -2432,7 +2432,7 @@ static void PMacAbortRead(void)
* release the memory. * release the memory.
*/ */
wait_ms(100) ; /* give it a (small) chance to act */ msleep(100) ; /* give it a (small) chance to act */
/* apply the sledgehammer approach - just stop it now */ /* apply the sledgehammer approach - just stop it now */
......
...@@ -4294,7 +4294,7 @@ trident_game_open(struct gameport *gameport, int mode) ...@@ -4294,7 +4294,7 @@ trident_game_open(struct gameport *gameport, int mode)
switch (mode) { switch (mode) {
case GAMEPORT_MODE_COOKED: case GAMEPORT_MODE_COOKED:
outb(0x80, TRID_REG(card, T4D_GAME_CR)); outb(0x80, TRID_REG(card, T4D_GAME_CR));
wait_ms(20); msleep(20);
return 0; return 0;
case GAMEPORT_MODE_RAW: case GAMEPORT_MODE_RAW:
outb(0x00, TRID_REG(card, T4D_GAME_CR)); outb(0x00, TRID_REG(card, T4D_GAME_CR));
......
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#include <sound/driver.h> #include <sound/driver.h>
#include <linux/time.h> #include <linux/time.h>
#include <linux/delay.h>
#include <linux/init.h> #include <linux/init.h>
#include <sound/core.h> #include <sound/core.h>
#include "au88x0.h" #include "au88x0.h"
...@@ -81,7 +82,7 @@ static int vortex_game_open(struct gameport *gameport, int mode) ...@@ -81,7 +82,7 @@ static int vortex_game_open(struct gameport *gameport, int mode)
hwwrite(vortex->mmio, VORTEX_CTRL2, hwwrite(vortex->mmio, VORTEX_CTRL2,
hwread(vortex->mmio, hwread(vortex->mmio,
VORTEX_CTRL2) | CTRL2_GAME_ADCMODE); VORTEX_CTRL2) | CTRL2_GAME_ADCMODE);
wait_ms(VORTEX_GAME_DWAIT); msleep(VORTEX_GAME_DWAIT);
return 0; return 0;
case GAMEPORT_MODE_RAW: case GAMEPORT_MODE_RAW:
hwwrite(vortex->mmio, VORTEX_CTRL2, hwwrite(vortex->mmio, VORTEX_CTRL2,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment