Received: by 10.192.165.156 with SMTP id m28csp159779imm; Tue, 10 Apr 2018 18:49:37 -0700 (PDT) X-Google-Smtp-Source: AIpwx49CKF0NfVqzr1YX62rjokW1sw1PNKY1w8RAYF9nzRNppjmCPe7L/wggsPPEhbgULAaXGtUa X-Received: by 2002:a17:902:86:: with SMTP id a6-v6mr2913670pla.298.1523411377138; Tue, 10 Apr 2018 18:49:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523411377; cv=none; d=google.com; s=arc-20160816; b=ZQx0VYz5bxhWG4ky3DRXu/9KnxkU2fvWqISsrlpZF5nq18OZbN7ecmInpT8J+sNZMS 4kO0cvwPgWOFDIcSaMIvgohZXPe04lrVOF8dAqCCY+Mqr4YCjaw/btDuExUDQzimXi1V DGfJYSu2pFn7hTAl0oYQ1zPSOh91cgt40siNaDUfCKuoH+a80NsvlW5tEN+GCCfpo0FJ B7jNIA2YXzu9Le6PIwyUOw3NKoUUPUMOYCm/s031v6GZM8nnBV6wzq64TUpHadKPZPnk uZ3HH23KA8A62vZuAXypfwaqx7teJsHxViZPUBAOmXh2zKxtQPwWrgsbvtIcNgTWjlHM 49FA== 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=ei+MJRdjKQEvjo+Y3v8gXYmNaZDlKcHZ7TqlwNIkjAk=; b=Zw2HbHuMC+Q159fBpNSsPYtRmHUEJ+gV/j2CvW0fcby15TIPg5gXQmev1DrvalfA13 yD35a857g9u3+z7y5RvqIRPLExrEQkv8HRMEz1CfqUySKQsEJPbBX/1SzMd1Yx7wFRPn 6t+4ikvTMQATYBx3SyU581maRbQbprLnCl0NxqB8b06eeCo/tFE/Emem3OjkzFf7vT1V cBmDermnfYQzw4v6ED+Q3KmsHL+HJEmubAIb4oSvnJA+bH5phd/OPsk6BvX4NoCusLbp stHzApAfPI21IP+91Y6UUOIppCtpLLUQHGGIonSUSPHlFOWA82v4i64WBzu7OxEo51F+ GKSw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=DhgJVMoq; 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 x8si7361pgr.301.2018.04.10.18.49.00; Tue, 10 Apr 2018 18:49:37 -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=DhgJVMoq; 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 S1752571AbeDKBnK (ORCPT + 99 others); Tue, 10 Apr 2018 21:43:10 -0400 Received: from mail-pl0-f65.google.com ([209.85.160.65]:39881 "EHLO mail-pl0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751960AbeDKBnI (ORCPT ); Tue, 10 Apr 2018 21:43:08 -0400 Received: by mail-pl0-f65.google.com with SMTP id e7-v6so181819plt.6; Tue, 10 Apr 2018 18:43:08 -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=ei+MJRdjKQEvjo+Y3v8gXYmNaZDlKcHZ7TqlwNIkjAk=; b=DhgJVMoqFhYfgtCWPM2ImP/2uv2S7N5mRKf3BuuRgeEEk5rNFobVIklBFvqkH2cgmY DJpMRxImPzWJcZU9mnmjF//gM6e8M4OzCDEJTrwQVy+jzYVQTjcix+mfYNklutRCY2iR LvjA3Q3BY/Hb5D5t3TlO0uSSUx5CEbU+2CTPSQis87ZxibDeJdqfJVPBpoNLgCGyehEn cmrfV3rB2JVVwtHZNfBIwXlB6nmxffDpk4pIwzSag5RSn/UZiH1n8BPhMlrfXT3fGYps +bnJk/e5C4nEeqWbNhMmIhkim+yfgpRz1pF4rYtAZp9ShCIJOYf/MqkS3ZIHhNN0PSg3 n5WA== 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=ei+MJRdjKQEvjo+Y3v8gXYmNaZDlKcHZ7TqlwNIkjAk=; b=K4Z5pcBuzE+/upeslIHMR+g0m/qOgotk8CwyDrCwQehXUXzpaMk5ALlN76JP8575tn LeGU1TncgDD++TFnb7FrwQ18jHxUkKdh/P4MvOeROe9gdLAFHcPOJiQ0NFlFynsTRG8a 7Zwy09qW0q0d5tRyXo5JBsGVu4kC2mnCfQUxUIQ2gcUbHptW7TzQOKysP2uKCZ/2vXmr tscE50JStF6LjdKXZ8OW8V3YfyFTXb79m+uU0dLWaLKkWvxVY4/Bjflc7lpEMTjXww0S aGwc1noMz21vI0aguSZhdC7Ws0svq7jCDWjm0EJ2zP22SScDm4hfAX5+1SFBLQZeyrUG /91Q== X-Gm-Message-State: ALQs6tBXT2JLFfjEGoCEAqJEGvJjHdbgrIEdrapztcnkjLhhGfUKszxu enTRSZ9ZMbixLeAbourpCeU= X-Received: by 2002:a17:902:900a:: with SMTP id a10-v6mr2923884plp.142.1523410988476; Tue, 10 Apr 2018 18:43:08 -0700 (PDT) Received: from oslab.tsinghua.edu.cn ([2402:f000:1:4413:edc8:c1dd:b0a8:461d]) by smtp.gmail.com with ESMTPSA id v186sm26240pfb.182.2018.04.10.18.43.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 10 Apr 2018 18:43:07 -0700 (PDT) From: Jia-Ju Bai To: wg@grandegger.com, mkl@pengutronix.de Cc: linux-can@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Jia-Ju Bai Subject: [PATCH 1/2] net: can: sja1000: Replace mdelay with usleep_range in peak_pci_probe Date: Wed, 11 Apr 2018 09:42:58 +0800 Message-Id: <1523410978-1834-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 peak_pci_probe() is never called in atomic context. peak_pci_probe() is set as ".probe" in struct pci_driver. Despite never getting called from atomic context, peak_pci_probe() 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/net/can/sja1000/peak_pci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/can/sja1000/peak_pci.c b/drivers/net/can/sja1000/peak_pci.c index 131026f..48cf821 100644 --- a/drivers/net/can/sja1000/peak_pci.c +++ b/drivers/net/can/sja1000/peak_pci.c @@ -608,7 +608,7 @@ static int peak_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) writeb(0x00, cfg_base + PITA_GPIOICR); /* Toggle reset */ writeb(0x05, cfg_base + PITA_MISC + 3); - mdelay(5); + usleep_range(5000, 6000); /* Leave parport mux mode */ writeb(0x04, cfg_base + PITA_MISC + 3); -- 1.9.1