Received: by 10.223.176.46 with SMTP id f43csp834719wra; Fri, 26 Jan 2018 07:38:32 -0800 (PST) X-Google-Smtp-Source: AH8x226O77ii1cGnuG7laYucFkgy4C0Gb0kZGb2aLoQsmprpwpkTxCW0GDPS9OwrNo8Wc7PYMLA2 X-Received: by 10.98.247.25 with SMTP id h25mr14413497pfi.162.1516981111973; Fri, 26 Jan 2018 07:38:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516981111; cv=none; d=google.com; s=arc-20160816; b=ZktXj1RnPCNDgrWdf2dSV/UmcFutgmobFbD8E6MYZV2aiArI2aAMJf5gDSBe4GwLKT lnlmlMjkTHQgg69rCzK7gti5WpfgYAXlNJ+I8y2Nh2qzqa5rXcQTqKKKtdaBpGj/tUbR 7/uOjnP70Eq4t6kLvy4RBW14Koj3/twfOEiM68XvvWFtSkioYN2UapBNl0ks2rmccf6c h9pyyj9sgDHJnWZFWpDqpWGe1lYYUo2VLpTo0X4hOX+/0blueHSSeIJt2oVXtkGpVyc0 Wp2mCGnWAnMDe9NnuORK5t0iPfza4f9PRSeyCjxHQDoeurlX3Gnbm4C2O818Ih7m/7jO f25Q== 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=VVLShnKEQsmi3Uh5mWteVvYTiag3ImE2agLgKB9Z4TU=; b=iJwH2HswqghtVZNCqS87oGBQqoKFrC78rd+PehI4CQvNv48Fa6Mpf1ajpG9WBqFQbj 18HyZxzIl5W3IH4FzaHX0vV/SEec10vv8piGdIxYqxJukrB3zyJKxlUCE/XC2w4lF57T PYiLrNlXRXmRqwtx5Ndj1YzXWj647uUlw779qLIDvGgUtTPyQXBw5gPqmdAFm/wa3Uvi s98bgLmM03X9ZXbyYxcnOf2wRUinlItUGbtJ+IfnJsyEVvjkziXheQyvM92aHBQE4Aex YDm9Y2KvwJoTHtCwYr55b3M81btU6S5xqmun600wn3chBtK5vRAyWfAtewlfH4UHKVyQ 2OvA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=UQQfVAyr; 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=NONE 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 a72si6511376pfk.398.2018.01.26.07.38.17; Fri, 26 Jan 2018 07:38:31 -0800 (PST) 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=UQQfVAyr; 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=NONE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752018AbeAZPhv (ORCPT + 99 others); Fri, 26 Jan 2018 10:37:51 -0500 Received: from mail-pg0-f67.google.com ([74.125.83.67]:42244 "EHLO mail-pg0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751431AbeAZPht (ORCPT ); Fri, 26 Jan 2018 10:37:49 -0500 Received: by mail-pg0-f67.google.com with SMTP id q67so474782pga.9 for ; Fri, 26 Jan 2018 07:37:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=VVLShnKEQsmi3Uh5mWteVvYTiag3ImE2agLgKB9Z4TU=; b=UQQfVAyrCe2x1MYwRpi+CWJZloH1S1BIoRRpfmc1Wq4ALsrjHAqSmeNcdZlZpFogOr qOZ5hefrVcGVMSlrVtd6wRoQwD/piOm8T4v9GsL9WsaBOuX+gw3dPOJ2XluffIcgYp1s dIUa1Ao+ZONavx1GwGaY2PlcClrhXcwtlurlZEgSfIzlKiYLNUujsVJo3h8lUSzbw2Np VRS3hiLtDIlPiG0Z16L1Ek4otYP+hgtTeLLQAKHUMKXmKwNjG8xC1fkVlo2XZfJhZZh1 tvwZKT5GYtqgJL5tMp6hcVT1kTIiK9CKdoTQb0QFkBvdpdKEKeeW2r+KUhRZGmXAtnZj K3Fg== 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=VVLShnKEQsmi3Uh5mWteVvYTiag3ImE2agLgKB9Z4TU=; b=WnfqaZv0rA9h46GzgxukEFvhsQK7arbZfu/FksyJwP97X8xoFsFJgJJB6/QP3ay2rG 01gvMQ8gt9GZnlF+FLBlrgwEL7u7HIDmva/e8kqzaSLNBUUYuWpSI/J6lJKUeGun5sTJ TJV/EQ4voOdYCuOH28lepvv4hctVRgXpxC2F8GqF+x2PQvnwWx1Kl+P+tL7tvd4pKE4T pCfnyb5ONvXV3V1/dY9J6/8zVatzIg04s0VSgIwOULGYFXK8tYdBS8uZ308IamhT9icl gD5JTGvy94MV8NeKPQjdVLlW/kRdjIwZsuXmdGZdM8eyU9xCqSWjki3+2K7ohgoCZAs3 kkoQ== X-Gm-Message-State: AKwxytd1ce/V6Lk+VnSYczSNaZSW8TqwR/vhAc+mA+Rz3oh4p7IawVDd Qfh7m7ErRjHS2snh47bsWYD6EA== X-Received: by 2002:a17:902:8b88:: with SMTP id ay8-v6mr1391564plb.197.1516981069461; Fri, 26 Jan 2018 07:37:49 -0800 (PST) Received: from bai-oslab.tsinghua.edu.cn ([2402:f000:1:4413:3967:a579:e81d:66fa]) by smtp.gmail.com with ESMTPSA id q16sm21333912pfg.124.2018.01.26.07.37.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 26 Jan 2018 07:37:48 -0800 (PST) From: Jia-Ju Bai To: tim@cyberelk.net Cc: linux-kernel@vger.kernel.org, Jia-Ju Bai Subject: [PATCH] block: paride: on26: Replace mdelay with msleep in on26_test_port Date: Fri, 26 Jan 2018 23:42:25 +0800 Message-Id: <1516981345-8202-1-git-send-email-baijiaju1990@gmail.com> X-Mailer: git-send-email 1.7.9.5 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org After checking all possible call chains to on26_test_port() here, my tool finds that this function is never called in atomic context, namely never in an interrupt handler or holding a spinlock. And on26_test_port() is only called by pi_probe_unit() that calls wait_event() through pi_claim(), so it indicates that on26_test_port() can call functions that can sleep. Thus mdelay can be replaced with msleep to avoid busy wait. This is found by a static analysis tool named DCNS written by myself. Signed-off-by: Jia-Ju Bai --- drivers/block/paride/on26.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/block/paride/on26.c b/drivers/block/paride/on26.c index 95ba256..3240d6f 100644 --- a/drivers/block/paride/on26.c +++ b/drivers/block/paride/on26.c @@ -163,7 +163,7 @@ static int on26_test_port( PIA *pi) /* hard reset */ on26_write_regr(pi,0,6,0xb0); y = on26_read_regr(pi,0,7); if (!((x&0x80)||(y&0x80))) break; - mdelay(100); + msleep(100); } if (i == RESET_WAIT) -- 1.7.9.5