Received: by 10.213.65.68 with SMTP id h4csp3878730imn; Tue, 10 Apr 2018 06:08:13 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+DzOCif1dVQqmwwZ/tGAmSzkUQjI8d8Z/chj1XEk84hJ6OlRmGsUA7pLSiHAjprdo7KGcf X-Received: by 2002:a17:902:24:: with SMTP id 33-v6mr336763pla.341.1523365693931; Tue, 10 Apr 2018 06:08:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523365693; cv=none; d=google.com; s=arc-20160816; b=Chz81u5o8P8PE+9AlKMb+sgzGAwPqtpa4r+fMrSwb6ADdlycqmJhzSRDLRtyiApuSg gt/k+susQoEn1vmBOJqWeSNc18zUgXr+NCTHYKwSKrH6LDih4d3r8PjcGyXlhsuv4YZ3 FLh2T0nf7HNbP6qT4DeefiDP34G2Slym8am7UXWyH/5R9PgRA3qHbmvVzIewoJ9smbi6 qQH2b7QFFvGs2KLB/lbZ0H6EullbhzIzCTLyHu26CHLARwwVB7VzRnZVrw2bsLY5zw+k QXK3W2/bIVAu/RK7N4NNB812w8kGu1rFLYE7B1IakCCGmPfj/RdCu7hjdluCP/dFIJ1K F6kw== 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=i4ge9SuuzIlhjB3wcfSVAWh4FT4K7IGzjrLj6mtRpXw=; b=CR9RbCAhTbLTW4F5vB4NDbtvX6IOw0EXO05l2Cs/5s4IOoHMAuBHJvY4E7MZZApKCF JkMfJTAEPjhkR0OZ4KPALSKyc65up0TSjCOblsyb8jx/IrgMdUSEqCzN1sUFj7mN3tun OddW/yaMTvyOAeuTZpJ5Kpx9jn8zasjZ3Ry5xAfdZbEdZu6BaEiIQLtQ+Mt6YbTJQTwh A7ZSjMfvT1wqbRosSFH7vNyYbZ3mC0XSNAQtVE5Av9Av9He61Qh8dpnDX95enNuJCLRd SDN3nfByiEaBYkQC/FWBLB5lSe40ow4m6j27AVttYK8WvMXlsv0/C6h9biZ3PdO6NusL lR6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=t3FSGz2V; 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 f9-v6si2678138pln.45.2018.04.10.06.07.35; Tue, 10 Apr 2018 06:08:13 -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=t3FSGz2V; 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 S1752947AbeDJNET (ORCPT + 99 others); Tue, 10 Apr 2018 09:04:19 -0400 Received: from mail-pf0-f193.google.com ([209.85.192.193]:33251 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752587AbeDJNER (ORCPT ); Tue, 10 Apr 2018 09:04:17 -0400 Received: by mail-pf0-f193.google.com with SMTP id f15so8252072pfn.0; Tue, 10 Apr 2018 06:04:16 -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=i4ge9SuuzIlhjB3wcfSVAWh4FT4K7IGzjrLj6mtRpXw=; b=t3FSGz2VlOY5KRqUmh+sMx0E+hvEtfBzI1jWuywHvpsj6Ec3gyOo2UH1VHyhJRZ4CZ GrMyQaT0a8YrkJS00AVOG7NtVthpvegEDBOnI31qJr7dQFWj3ENF82HUkk72lxAcN3RQ KsOKz0kUuXQUDvdSf5v6v3MAwXj4BQfT/kvVVIUTfK3sWy9VRwieGsz8tnh7Z0wFpTRA sw0LHhoTDpUz1KWSBkzfiOxFJi/r2ar+1Ru51TzeU4AGRTYio3s4jVUGEwhIS1Oj/fCB J9wxnBvqW3ZkC/QCWIywxY8PE1fkhcUI1PE6dDj1E1dX9n6ZEaN9KIYtwPirzcuC1Dk1 19Og== 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=i4ge9SuuzIlhjB3wcfSVAWh4FT4K7IGzjrLj6mtRpXw=; b=cVlC36bC3x1YIOow8H8G7nQh+oCHn+aB2BOIrQgbAlrW8SbTzMHwyAAzeMO0EL32Wv GUoYwxNxvwVITf56rf9iGZ/MuUshvomQdvMPDELZXcdJIBGa1xinTbEqVZUmR4yYomGw 4VaCGAJytGfqg723hVfbRnm0UgXBXMB4XsDnO53EJBxSnRN5A2Y2+aH/4Se6zd+8H3IF lFYiq6bM3TKBIk0wxN79pw/eG4XaTi3V1im5+g7UcVU+Y1C37KOSlFI6vB1qvj+qZt7E 2vBP2jX6snwBnjUMokQjagpj9/KetwEj0IFJZn6XzTS29ocm7aNX6FlrNFnraGjJgO1O j2ZQ== X-Gm-Message-State: ALQs6tD+lFhE6ZwiG0jZHojB2NunR8E4rlBeSr352zKfmuk6IMoRLw+v IAJf8I8nDXkjcDVXt+e+OK5TR55u X-Received: by 10.101.83.136 with SMTP id x8mr248033pgq.288.1523365456735; Tue, 10 Apr 2018 06:04:16 -0700 (PDT) Received: from oslab.tsinghua.edu.cn ([2402:f000:1:4413:8dc7:7954:4991:f324]) by smtp.gmail.com with ESMTPSA id d12sm4249571pgq.41.2018.04.10.06.04.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 10 Apr 2018 06:04:16 -0700 (PDT) From: Jia-Ju Bai To: kishon@ti.com, bhelgaas@google.com, nsekhar@ti.com, john@metanate.com, shawn.lin@rock-chips.com Cc: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, Jia-Ju Bai Subject: [PATCH] pci: endpoint: Replace mdelay with usleep_range in pci_epf_test_write Date: Tue, 10 Apr 2018 21:04:06 +0800 Message-Id: <1523365446-31563-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 pci_epf_test_write() is never called in atomic context. The call chain ending up at pci_epf_test_write() is: [1] pci_epf_test_write() <- pci_epf_test_cmd_handler() pci_epf_test_cmd_handler() is set as a parameter of INIT_DELAYED_WORK() in pci_epf_test_probe(). This function is not called in atomic context. Despite never getting called from atomic context, pci_epf_test_write() calls mdelay() to busily 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. And I also manually check it. Signed-off-by: Jia-Ju Bai --- drivers/pci/endpoint/functions/pci-epf-test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/pci/endpoint/functions/pci-epf-test.c b/drivers/pci/endpoint/functions/pci-epf-test.c index f9308c2..2f0642e 100644 --- a/drivers/pci/endpoint/functions/pci-epf-test.c +++ b/drivers/pci/endpoint/functions/pci-epf-test.c @@ -237,7 +237,7 @@ static int pci_epf_test_write(struct pci_epf_test *epf_test) * wait 1ms inorder for the write to complete. Without this delay L3 * error in observed in the host system. */ - mdelay(1); + usleep_range(1000, 2000); kfree(buf); -- 1.9.1