Received: by 10.213.65.68 with SMTP id h4csp2597199imn; Mon, 9 Apr 2018 06:10:48 -0700 (PDT) X-Google-Smtp-Source: AIpwx49GKrWG5neo1PXghUgvkowZsxVeV8jF7osz7+6am3eQBsuN+CKsjWFKyrqH/4FaDgVlr8Uo X-Received: by 2002:a17:902:590e:: with SMTP id o14-v6mr14687384pli.229.1523279448799; Mon, 09 Apr 2018 06:10:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523279448; cv=none; d=google.com; s=arc-20160816; b=pLGgokpm+pmanrHj+QAtsX26H41zUMxkhzV2yaIeSQimbiSLJ/fjUYSD7Y6hUK2yCP 7kMXyJy4T5lvLRtp6wJeHQCLoAp98TOeoap/V+bSFhC8oo+wDY599B+xy4uefC8f96rD h9MTf4HVqS7r6Bl24FYitWuWx8TO5ul1dcWSgMM6pgf8v8I9Zp+twfdBJSfRUc7meObH YZXaBx7smnG2r2L1cELMsGAOFLx8P9oiQOnx1zn3ll4RIFuJpA5WjD5tbPr8SkHbnHlr K9ADkSDrEJpJA9YZMcoy52kFwBSDo2vVw5X/IiEg0vtu8YAbMlYyT18oE191+qCSezQC QW7Q== 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=VtFvdV4UzYTvg1ZEfvH1DA86rokF+JiO5hrUQyxMaSQ=; b=lZaMpLZznwREVFYI8C5Of530D6xZe+qsjc2FHHMMhaGqHT6EzhRz1QO1gehSOR+q+N +6DdKLWLtOOaR+4ROyVIKz67P+lXalJg9Oo8hcloLVlxZhHmvXsTO7/SacW3JuqWK595 l2HiWcnKgL+5wUlvdo/iZaDHEcmlGTg/rc2kK6NZZytWfUxcOMjWboUedrNt9ttuXMXN Vz7QhqYLygD3pieep1f4OScO/yHvHMCK9uVpxqyO5XsNRPGAXbopBsmg1Pyh/Gj3jLvU 3LYgItAimXqG4oyl2Ux1l7Tz3xswcv7AZv9pWqMx0wSnXjERp9Lc3fWJksNuWCAbiBim qk8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=fPPHif6F; 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 m32-v6si287371pld.174.2018.04.09.06.10.11; Mon, 09 Apr 2018 06:10:48 -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=fPPHif6F; 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 S1752052AbeDINDs (ORCPT + 99 others); Mon, 9 Apr 2018 09:03:48 -0400 Received: from mail-pf0-f196.google.com ([209.85.192.196]:35067 "EHLO mail-pf0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751820AbeDINDp (ORCPT ); Mon, 9 Apr 2018 09:03:45 -0400 Received: by mail-pf0-f196.google.com with SMTP id u86so5748933pfd.2; Mon, 09 Apr 2018 06:03:45 -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=VtFvdV4UzYTvg1ZEfvH1DA86rokF+JiO5hrUQyxMaSQ=; b=fPPHif6FD7H3v9JT/7nCPKUBiA64/FP0gZPNGHzTc5UiPfPnjRBb2I8+XvOJTxh0Qe I73VN8t9X+eMe2Rgni26YjNkBMfdi4o31MmSqHa6dg/YLFg3KQJgDYMHHGfydDmhDdND 7hL7+rd9g9/STTOiWob3pNG4qn3xuFipMQufpiA9JAS0314Il4Wsv3SSVFTitQFvoEL4 gMEZqhmdXTxViBI1+GBnvq7x5GwExu3lfGGZF7jHELyj9GHMfX4ogwqR/8DJbZvUBEaH AQHfvLihdpsUvilR+Rmc/fVUzsCaqofe8LbA/KBANrQ74Pznw3mo9ac4K2TgPbX11nV1 IgeQ== 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=VtFvdV4UzYTvg1ZEfvH1DA86rokF+JiO5hrUQyxMaSQ=; b=uD59grS1jwbCzA3kngDxHorvKSIfvYykjKjY5TJX7FLmaEqLVYPHbsw3DyAjM5oJNj X3dyxF8D28E5iRPe+O42fWWvcfeTzSo0Ty5nDrHc1L5zwIkpCWu4BDV320hEk00D8OZt 0RC0mhMF8/zx3uAoLM0tiEI9c+FpEiQlEEIOkR0LtDRhZZRnBn9vXPMRURTMqXbom8ya +78ndvWPiJzWF65vFP+hOgWPcEmSt/jLrKPh9nvKlN8ueNuw2m+Dt4YSz4TwfNAIABIq ra6jrUy8tr5DbZO5BOaXRZp6t8d5lWw3uJd6MMP3Wcp27+82wq/fZIc+F2yIx5Lz2qBh GJLg== X-Gm-Message-State: AElRT7FjUSrQcZjqs+Cr+ru/eRL4Wkck9m+510E/XqRZzYJ8fEIqRW+X s6myDXXBzyHAUsyvTmzeePi72A== X-Received: by 10.99.169.1 with SMTP id u1mr25751806pge.251.1523279025159; Mon, 09 Apr 2018 06:03:45 -0700 (PDT) Received: from oslab.tsinghua.edu.cn ([2402:f000:1:4413:39e9:70fb:21a6:f4d2]) by smtp.gmail.com with ESMTPSA id r20sm1382623pff.165.2018.04.09.06.03.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 09 Apr 2018 06:03:44 -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 2/2] sound: ad1889: Replace mdelay with usleep_range in snd_ad1889_ac97_ready Date: Mon, 9 Apr 2018 21:03:38 +0800 Message-Id: <1523279018-24017-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_ac97_ready() is never called in atomic context. The call chain ending up at snd_ad1889_ac97_ready() is: [1] snd_ad1889_ac97_ready() <- snd_ad1889_ac97_xinit() <- snd_ad1889_ac97_init() <- 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_ac97_ready() 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..a2a8e1d 100644 --- a/sound/pci/ad1889.c +++ b/sound/pci/ad1889.c @@ -258,7 +258,7 @@ struct snd_ad1889 { while (!(ad1889_readw(chip, AD_AC97_ACIC) & AD_AC97_ACIC_ACRDY) && --retry) - mdelay(1); + usleep_range(1000, 2000); if (!retry) { dev_err(chip->card->dev, "[%s] Link is not ready.\n", __func__); -- 1.9.1