Re: [PATCH 1/2] sound: ad1889: Replace mdelay with usleep_range in snd_ad1889_init

2018-04-09 Thread Takashi Iwai
On Mon, 09 Apr 2018 15:03:20 +0200,
Jia-Ju Bai wrote:
> 
> snd_ad1889_init() is never called in atomic context.
> 
> The call chain ending up at snd_ad1889_init() is:
> [1] snd_ad1889_init() <- snd_ad1889_create() <- snd_ad1889_probe()
> 
> snd_ad1889_probe() is only set as ".probe" in struct pci_driver.
> This function is not called in atomic context.
> 
> Despite never getting called from atomic context, snd_ad1889_init()
> calls mdelay for busy wait.
> This is not necessary and can be replaced with usleep_range to
> avoid busy waiting.
> 
> This is found by a static analysis tool named DCNS written by myself.
> 
> Signed-off-by: Jia-Ju Bai 

Since it's no urgent fix, I'll postpone to 4.18.


thanks,

Takashi


Re: [PATCH 1/2] sound: ad1889: Replace mdelay with usleep_range in snd_ad1889_init

2018-04-09 Thread Takashi Iwai
On Mon, 09 Apr 2018 15:03:20 +0200,
Jia-Ju Bai wrote:
> 
> snd_ad1889_init() is never called in atomic context.
> 
> The call chain ending up at snd_ad1889_init() is:
> [1] snd_ad1889_init() <- snd_ad1889_create() <- snd_ad1889_probe()
> 
> snd_ad1889_probe() is only set as ".probe" in struct pci_driver.
> This function is not called in atomic context.
> 
> Despite never getting called from atomic context, snd_ad1889_init()
> calls mdelay for busy wait.
> This is not necessary and can be replaced with usleep_range to
> avoid busy waiting.
> 
> This is found by a static analysis tool named DCNS written by myself.
> 
> Signed-off-by: Jia-Ju Bai 

Since it's no urgent fix, I'll postpone to 4.18.


thanks,

Takashi


[PATCH 1/2] sound: ad1889: Replace mdelay with usleep_range in snd_ad1889_init

2018-04-09 Thread Jia-Ju Bai
snd_ad1889_init() is never called in atomic context.

The call chain ending up at snd_ad1889_init() is:
[1] snd_ad1889_init() <- snd_ad1889_create() <- snd_ad1889_probe()

snd_ad1889_probe() is only set as ".probe" in struct pci_driver.
This function is not called in atomic context.

Despite never getting called from atomic context, snd_ad1889_init()
calls mdelay for busy wait.
This is not necessary and can be replaced with usleep_range to
avoid busy waiting.

This is found by a static analysis tool named DCNS written by myself.

Signed-off-by: Jia-Ju Bai 
---
 sound/pci/ad1889.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/pci/ad1889.c b/sound/pci/ad1889.c
index 0bf2c04..d4965eb 100644
--- a/sound/pci/ad1889.c
+++ b/sound/pci/ad1889.c
@@ -872,7 +872,7 @@ struct snd_ad1889 {
ad1889_writew(chip, AD_DS_CCS, AD_DS_CCS_CLKEN); /* turn on clock */
ad1889_readw(chip, AD_DS_CCS);  /* flush posted write */
 
-   mdelay(10);
+   usleep_range(1, 11000);
 
/* enable Master and Target abort interrupts */
ad1889_writel(chip, AD_DMA_DISR, AD_DMA_DISR_PMAE | AD_DMA_DISR_PTAE);
-- 
1.9.1



[PATCH 1/2] sound: ad1889: Replace mdelay with usleep_range in snd_ad1889_init

2018-04-09 Thread Jia-Ju Bai
snd_ad1889_init() is never called in atomic context.

The call chain ending up at snd_ad1889_init() is:
[1] snd_ad1889_init() <- snd_ad1889_create() <- snd_ad1889_probe()

snd_ad1889_probe() is only set as ".probe" in struct pci_driver.
This function is not called in atomic context.

Despite never getting called from atomic context, snd_ad1889_init()
calls mdelay for busy wait.
This is not necessary and can be replaced with usleep_range to
avoid busy waiting.

This is found by a static analysis tool named DCNS written by myself.

Signed-off-by: Jia-Ju Bai 
---
 sound/pci/ad1889.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/pci/ad1889.c b/sound/pci/ad1889.c
index 0bf2c04..d4965eb 100644
--- a/sound/pci/ad1889.c
+++ b/sound/pci/ad1889.c
@@ -872,7 +872,7 @@ struct snd_ad1889 {
ad1889_writew(chip, AD_DS_CCS, AD_DS_CCS_CLKEN); /* turn on clock */
ad1889_readw(chip, AD_DS_CCS);  /* flush posted write */
 
-   mdelay(10);
+   usleep_range(1, 11000);
 
/* enable Master and Target abort interrupts */
ad1889_writel(chip, AD_DMA_DISR, AD_DMA_DISR_PMAE | AD_DMA_DISR_PTAE);
-- 
1.9.1