From patchwork Mon Apr 9 13:03:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jia-Ju Bai X-Patchwork-Id: 10331293 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 5B71D6037F for ; Mon, 9 Apr 2018 13:03:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4AD1928A09 for ; Mon, 9 Apr 2018 13:03:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3F70728A1B; Mon, 9 Apr 2018 13:03:36 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D210228A09 for ; Mon, 9 Apr 2018 13:03:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751704AbeDINDf (ORCPT ); Mon, 9 Apr 2018 09:03:35 -0400 Received: from mail-pl0-f68.google.com ([209.85.160.68]:39853 "EHLO mail-pl0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751697AbeDINDe (ORCPT ); Mon, 9 Apr 2018 09:03:34 -0400 Received: by mail-pl0-f68.google.com with SMTP id e7-v6so3089275plt.6; Mon, 09 Apr 2018 06:03:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=Fb4TNy6IHMG8cMQ7Q8YTEl5d8hLERD1pJrUnHp5x2Ns=; b=s0CAf+iyvglIRQ2QEmO8Pc5b2XGKOcLNvGndbc9T2kjF/m/Rw9P8AojIgdWzEVTRgR 0Q75YkPrvJ7KuJO1w+nS380dnEWikrwyC4Oc0X7kB2GXIrGaxys1iKQ6O8/NJSA6Q7sX 3Tzmbzmq5s3G5ifPi40G5WVsCBLQJh3x2f1LOPw0x9A5LgQr+lN5Hj4AsG45P8MQA5YF h1Fag1oSQk6agVy9OD0NZVmWyUSOS/nLmKVrSsKwj3/WsWd7rwDeSWV0jpt3TyHerj0U ET2ogIOO4wiwXG/yYcOMPIC93Vq0IW/r0FiUeALMQeb993+0YyvvxzdofA852Qfa5b3P Xhxg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=Fb4TNy6IHMG8cMQ7Q8YTEl5d8hLERD1pJrUnHp5x2Ns=; b=PyrBvl6g/G2HIOHQUEZ0SWGDVzgjCHUBSGN9X+habszfHPZQOHs/J8AjicjnNKtTIe UwzN64j5MJ/4Ddtv3GzNEz06G5XELDR+njDxwVofiC4206TQid+OiHVVvJkev8r6Fhic yk3ZPcjkX3tG9AiiRN3n31qk2hAetUymX7ZRJxSc5NXjVuSc39G2P447EWjjLWm6ZUuP JXssTMp3u3SN/if8g0fuotnBt44drIiQ74Za6A3RYxcDhgB54qxl7msfm0jJVUwbj+YY dnIKNIjyn8PcX7+o6Neg5kf+ZjBXhT+jtcsVqd0SWKqgH0v4qACTTd2fDLbIn6znpFeM RYvA== X-Gm-Message-State: ALQs6tDQYv7887MdTTtN06W1cUeO6HCww8Hs2jGqaBtefMhl7N2yJvCE NI/OlZV49ooVKkm/sKqgfTw= X-Google-Smtp-Source: AIpwx4/NX1BWBfZbVAgLp84WqOUU4JCJ1Gi3IJx9scvztcENf1E20WAI5ku/laQcJU7P7AaZPmN/6Q== X-Received: by 2002:a17:902:590e:: with SMTP id o14-v6mr14656650pli.229.1523279013760; Mon, 09 Apr 2018 06:03:33 -0700 (PDT) Received: from oslab.tsinghua.edu.cn ([2402:f000:1:4413:39e9:70fb:21a6:f4d2]) by smtp.gmail.com with ESMTPSA id s63sm1426078pfe.6.2018.04.09.06.03.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 09 Apr 2018 06:03:33 -0700 (PDT) From: Jia-Ju Bai To: T-Bone@parisc-linux.org, perex@perex.cz, tiwai@suse.com Cc: linux-parisc@vger.kernel.org, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, Jia-Ju Bai Subject: [PATCH 1/2] sound: ad1889: Replace mdelay with usleep_range in snd_ad1889_init Date: Mon, 9 Apr 2018 21:03:20 +0800 Message-Id: <1523279000-23973-1-git-send-email-baijiaju1990@gmail.com> X-Mailer: git-send-email 1.9.1 Sender: linux-parisc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-parisc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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(10000, 11000); /* enable Master and Target abort interrupts */ ad1889_writel(chip, AD_DMA_DISR, AD_DMA_DISR_PMAE | AD_DMA_DISR_PTAE);