Received: by 10.192.165.156 with SMTP id m28csp159383imm; Tue, 10 Apr 2018 18:48:56 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/ZOQYU2FXH6739Hu95xd/3wLG5opoJEqw30Y1vAhAO94YESagqxQN7Wh7oUUyuCMz0z55v X-Received: by 2002:a17:902:9a9:: with SMTP id 38-v6mr2848335pln.40.1523411336191; Tue, 10 Apr 2018 18:48:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523411336; cv=none; d=google.com; s=arc-20160816; b=Spbsf0e3u6ro3j3PTAZGUUJp5BPIm8E6fA7vfZ0M5LeetTCmBCx1b02oZNx+0U/Xhw 0fRkQq6LCa46+5wJQZNV5ZwxGaoksMgCtQXVE8PhrG4Nl1u+y8VS3McR7DWbMi5ifvAM v+Gvm+nDZBcLHzSBKNdXLtn0fZTKCoby6T61gfeeoGu875vQAeATO6lMpj+D2SPbCUh6 2QRz+ND6NUy43tB3/w6CQK5ZrcdKo52Cqv3LvnIShOegpZqhpC4HW0xarsEyPDIIkCBt HjvRRe5TtB6P7CcWeCfZmOoI5/B/qSM/RdYkmYXvknneqdZrytAsQ8KjDWLeIz/sy09k xXvA== 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=s5v+Avm3EudLHDQhH5NMaIptVIbmoZ3eoVPQp5piF9Q=; b=IRbqVwg8SqBqWxdoiG1y+SMChIjVIkLhCaTJYbFgh6/L8AVvkD/9zBYgRGT0qfKVIy CvmIkBYYwr9WCFRl9x+Q4B2WfbipR5TVdvo+lcMdo/+wnT2xTNnQSm3jGLniV6vIFay2 PE8qVkqboAcEicvnx04YTx6q/sV31B+7yWHAckMixqYblt4II3kIdTefcJba4amf54/E GZKwXJ3fabHtOM8P1Ii1J5NiVuX90rqzr40D1P385q/PohbqKvPkLRiIdycZsvyRau2m elGA1hDY137b0ntZsnixSyr2OZQZuLAkEckTEz+Q13N4VbTe7fq6lNJ6pAn8zf7cNgC1 XwHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Hvx06piy; 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 c23-v6si19351plo.80.2018.04.10.18.48.17; Tue, 10 Apr 2018 18:48:56 -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=Hvx06piy; 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 S1752785AbeDKBoQ (ORCPT + 99 others); Tue, 10 Apr 2018 21:44:16 -0400 Received: from mail-pg0-f66.google.com ([74.125.83.66]:41266 "EHLO mail-pg0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752366AbeDKBoO (ORCPT ); Tue, 10 Apr 2018 21:44:14 -0400 Received: by mail-pg0-f66.google.com with SMTP id e2so50802pgv.8; Tue, 10 Apr 2018 18:44:14 -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=s5v+Avm3EudLHDQhH5NMaIptVIbmoZ3eoVPQp5piF9Q=; b=Hvx06piyOTCHyzTaE4a22xUcg0MNqfCsmrjp4BfKAnh1ozR6j7yUp+OpcfwzSy1qi/ S+kdtj7jK8exQE3LdoqPEK2+0k9tF60kStha1dNUw7KnWNrtwSxxuda18duvCntlrIcm xWn1HemN0PnF8D1IUU2LChpwhZSitRpzJ8oIl2tXidrzNkufh84rcf5XN+/O7hYqGJHD XbQhgnYRP9s8VWzCopKiN2KhE2CU3PQuL6XfTjhiVryK1/qwHltxHm5dyYgKkDs1b+zA XOsUDZmaVkBAOTIwN9HREoSZZeGUDwZBY9IC6zsBGm4/rM2mAKrmwK7NVIYafb4j2MkI flrA== 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=s5v+Avm3EudLHDQhH5NMaIptVIbmoZ3eoVPQp5piF9Q=; b=CzeRDr7aYTL04pxO3djs1OXWkHJIhdDa3nL4xwcMQjdtlmeAlCtUCPXuDJdGDq0I6D iC5fU9vcg5t/A/+wa/JwGQGLtPL9qrayQ7St8DJ0fXd5rJFBMHk3QjqL7zUARaksHPso KZSiK8Dmyaol/kvxxUDtD1Lw9hShLK+ByKbVq80ShxSo/XL7NpnaDuiodnNQ2XAN0lYo Xbv5TczYSQZgICXdJUZX/EcHyvmir6UHVBeVmwAbGBfjnJrf0mUCN9dUBoLxbLAPUo/r /7lcNmaUKoz6zUJtdGh9sfZdXCoobXbG5AAxqO2VJPzi8i2/5ePQjNT/8DjOWOZOalTo r5HQ== X-Gm-Message-State: ALQs6tBRw3QLNi7HTo0vJZ/k1i3ht3kkeTEP6RZyKcHFkzDA2epOa7T6 spjNyCibnGFU6gyr0TKwsi8= X-Received: by 10.99.164.82 with SMTP id c18mr1954386pgp.101.1523411053962; Tue, 10 Apr 2018 18:44:13 -0700 (PDT) Received: from oslab.tsinghua.edu.cn ([2402:f000:1:4413:edc8:c1dd:b0a8:461d]) by smtp.gmail.com with ESMTPSA id r20sm35159pff.165.2018.04.10.18.44.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 10 Apr 2018 18:44:13 -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 2/2] net: can: sja1000: Replace mdelay with usleep_range in pcan_add_channels Date: Wed, 11 Apr 2018 09:43:26 +0800 Message-Id: <1523411006-1905-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 pcan_add_channels() is never called in atomic context. pcan_add_channels() is only called by pcan_probe(), which is only set as ".probe" in struct pcmcia_driver. Despite never getting called from atomic context, pcan_add_channels() 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_pcmcia.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/can/sja1000/peak_pcmcia.c b/drivers/net/can/sja1000/peak_pcmcia.c index dd56133..1a1fbf3 100644 --- a/drivers/net/can/sja1000/peak_pcmcia.c +++ b/drivers/net/can/sja1000/peak_pcmcia.c @@ -530,7 +530,7 @@ static int pcan_add_channels(struct pcan_pccard *card) pcan_write_reg(card, PCC_CCR, ccr); /* wait 2ms before unresetting channels */ - mdelay(2); + usleep_range(2000, 3000); ccr &= ~PCC_CCR_RST_ALL; pcan_write_reg(card, PCC_CCR, ccr); -- 1.9.1