Received: by 10.213.65.68 with SMTP id h4csp2593193imn; Mon, 9 Apr 2018 06:07:26 -0700 (PDT) X-Google-Smtp-Source: AIpwx49CMnl2sD1RcBN9w7zWzEjuUCxHqZKI44V9U5L/Yc+DHPhlcwn1dMMbT9TxCF0TA56esDF/ X-Received: by 2002:a17:902:820d:: with SMTP id x13-v6mr1577513pln.225.1523279246141; Mon, 09 Apr 2018 06:07:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523279246; cv=none; d=google.com; s=arc-20160816; b=mSpyk+z1UR1B6Km+iNiQhewUAJyTiTJJXNdVr+bmuznMXvm7utI4odfLgKDZ6A2qG7 F+mmls6q7bC/raAje4PUhNJPKXPnB7AAmpk3vXnT8l6dRqW4R6qdkPb87xXAg939teEo ADEsFdugJeuHPUf+EMQiEd0hAusWGiktt9k1ZwDUOJoTLSFreAbC9OBH4dr/VKof0sAH IvLeJazUsr1H9eJVMI5FeQYmDNB/BkEm40gep5xsl7ABjnH24ZwLgs9LbJrjxYmgai6w k5UxaNfgO90HahtH4SE0J6OzzbeAcEfAWmCnanLP4Ia0HVA1iJ2/Yl64vN9yClKXsKxK 0Quw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=Fb4TNy6IHMG8cMQ7Q8YTEl5d8hLERD1pJrUnHp5x2Ns=; b=ssBmNISEBVA2Enzl1Wc4O3AyStlDwIT5MDlOHItPzb7uNh+bFVaCjCDWaj/uTKppK9 hvX0mJjpqWMGZLmuWLgUGdkB8R065/JG4meQBpGdkOwLryAF/4BOmQzrbu5fC6Kbg1Uz Uf/DbcAN1NeOVl9EERoq/Zj9OJy3GWFQNF0C5x5THiy9vzXpiIeWc3ZXnaQ9hHBe8gk+ 6O2wrkvcqE+INjPi3YRqHZmHjNg5/4jtPF1vYNgUgOZyOYOmfJ6K+Bu/VCN3aKVdOCsf CA1MjVxSjQ5QKbcg+WvNLXgZQuZwoWjBlE9AUtlCpRTaQwZge6XipJm6sMKWY/Exa7vE 6JIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=s0CAf+iy; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 6si217896pgf.33.2018.04.09.06.06.47; Mon, 09 Apr 2018 06:07:26 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=s0CAf+iy; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751862AbeDINDf (ORCPT + 99 others); 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-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-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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); -- 1.9.1