diff options
author | Jia-Ju Bai <baijiaju1990@gmail.com> | 2018-07-27 05:01:43 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2018-07-27 05:49:16 -0400 |
commit | fad56c895f1f33f9063da558067307b00d44d40d (patch) | |
tree | 1201f89e6952680e0e6e59b751a13b3081c66bda | |
parent | 08fd8325d94eeddfe49ef8191337e5f54553f6b0 (diff) |
ALSA: ctxfi: cthw20k2: Replace mdelay() with msleep() and usleep_range()
hw_pll_init(), hw_dac_stop(), hw_dac_start() and hw_adc_init()
are never called in atomic context.
They call mdelay() to busily wait, which is not necessary.
mdelay() can be replaced with msleep().
This is found by a static analysis tool named DCNS written by myself.
Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r-- | sound/pci/ctxfi/cthw20k2.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/sound/pci/ctxfi/cthw20k2.c b/sound/pci/ctxfi/cthw20k2.c index b866d6b2c923..3c966fafc754 100644 --- a/sound/pci/ctxfi/cthw20k2.c +++ b/sound/pci/ctxfi/cthw20k2.c | |||
@@ -1316,12 +1316,12 @@ static int hw_pll_init(struct hw *hw, unsigned int rsr) | |||
1316 | set_field(&pllctl, PLLCTL_FD, 48000 == rsr ? 16 - 4 : 147 - 4); | 1316 | set_field(&pllctl, PLLCTL_FD, 48000 == rsr ? 16 - 4 : 147 - 4); |
1317 | set_field(&pllctl, PLLCTL_RD, 48000 == rsr ? 1 - 1 : 10 - 1); | 1317 | set_field(&pllctl, PLLCTL_RD, 48000 == rsr ? 1 - 1 : 10 - 1); |
1318 | hw_write_20kx(hw, PLL_CTL, pllctl); | 1318 | hw_write_20kx(hw, PLL_CTL, pllctl); |
1319 | mdelay(40); | 1319 | msleep(40); |
1320 | 1320 | ||
1321 | pllctl = hw_read_20kx(hw, PLL_CTL); | 1321 | pllctl = hw_read_20kx(hw, PLL_CTL); |
1322 | set_field(&pllctl, PLLCTL_FD, 48000 == rsr ? 16 - 2 : 147 - 2); | 1322 | set_field(&pllctl, PLLCTL_FD, 48000 == rsr ? 16 - 2 : 147 - 2); |
1323 | hw_write_20kx(hw, PLL_CTL, pllctl); | 1323 | hw_write_20kx(hw, PLL_CTL, pllctl); |
1324 | mdelay(40); | 1324 | msleep(40); |
1325 | 1325 | ||
1326 | for (i = 0; i < 1000; i++) { | 1326 | for (i = 0; i < 1000; i++) { |
1327 | pllstat = hw_read_20kx(hw, PLL_STAT); | 1327 | pllstat = hw_read_20kx(hw, PLL_STAT); |
@@ -1584,7 +1584,7 @@ static void hw_dac_stop(struct hw *hw) | |||
1584 | data = hw_read_20kx(hw, GPIO_DATA); | 1584 | data = hw_read_20kx(hw, GPIO_DATA); |
1585 | data &= 0xFFFFFFFD; | 1585 | data &= 0xFFFFFFFD; |
1586 | hw_write_20kx(hw, GPIO_DATA, data); | 1586 | hw_write_20kx(hw, GPIO_DATA, data); |
1587 | mdelay(10); | 1587 | usleep_range(10000, 11000); |
1588 | } | 1588 | } |
1589 | 1589 | ||
1590 | static void hw_dac_start(struct hw *hw) | 1590 | static void hw_dac_start(struct hw *hw) |
@@ -1593,7 +1593,7 @@ static void hw_dac_start(struct hw *hw) | |||
1593 | data = hw_read_20kx(hw, GPIO_DATA); | 1593 | data = hw_read_20kx(hw, GPIO_DATA); |
1594 | data |= 0x2; | 1594 | data |= 0x2; |
1595 | hw_write_20kx(hw, GPIO_DATA, data); | 1595 | hw_write_20kx(hw, GPIO_DATA, data); |
1596 | mdelay(50); | 1596 | msleep(50); |
1597 | } | 1597 | } |
1598 | 1598 | ||
1599 | static void hw_dac_reset(struct hw *hw) | 1599 | static void hw_dac_reset(struct hw *hw) |
@@ -1864,11 +1864,11 @@ static int hw_adc_init(struct hw *hw, const struct adc_conf *info) | |||
1864 | hw_write_20kx(hw, GPIO_DATA, data); | 1864 | hw_write_20kx(hw, GPIO_DATA, data); |
1865 | } | 1865 | } |
1866 | 1866 | ||
1867 | mdelay(10); | 1867 | usleep_range(10000, 11000); |
1868 | /* Return the ADC to normal operation. */ | 1868 | /* Return the ADC to normal operation. */ |
1869 | data |= (0x1 << 15); | 1869 | data |= (0x1 << 15); |
1870 | hw_write_20kx(hw, GPIO_DATA, data); | 1870 | hw_write_20kx(hw, GPIO_DATA, data); |
1871 | mdelay(50); | 1871 | msleep(50); |
1872 | 1872 | ||
1873 | /* I2C write to register offset 0x0B to set ADC LRCLK polarity */ | 1873 | /* I2C write to register offset 0x0B to set ADC LRCLK polarity */ |
1874 | /* invert bit, interface format to I2S, word length to 24-bit, */ | 1874 | /* invert bit, interface format to I2S, word length to 24-bit, */ |