Received: by 10.223.176.5 with SMTP id f5csp322285wra; Sat, 27 Jan 2018 00:22:03 -0800 (PST) X-Google-Smtp-Source: AH8x226gdj+3hlZ5/3LlEdGHxK2uMvLAYV8/f2s8ljTHpVjzXSLlOJtH165PN38T6nqaIc4ptVJK X-Received: by 10.99.53.203 with SMTP id c194mr10255173pga.12.1517041322904; Sat, 27 Jan 2018 00:22:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517041322; cv=none; d=google.com; s=arc-20160816; b=b4iIsc0m68aJdWYmz6G9BYqtNZQUtqyNEL+aw7oOUALGfnb1M79CnVpOl3P/GxDIZ4 buDMJP4HMZCwiFuBMkpvIV+lR9qCnrkQBi4QTi0a3jmvRh6pSIEixjl2lmaGJN4v9gcY DO3tVyteHc25vEjT89qd5A1jBEkc/x+ujrDX5TnW0F8X9u7vi3dJVmH0Eqyb5bKJcqnv g5xPH1a1jN7kx00dQUGWWXDeNO/GLPb5Eghs/oeMmiGVpv9dSFppT19n0nouUhK9rtQy j4ws/GN8ti5PxaIN9NBJ/kuCD5R00vlOuYWw1L/jkRg8xu0VVJMrDWF3TLz9MH8Uqk8y myJw== 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=8PzIj+qwrPoIdF47OPHuMD58ZY7BxaFwMPoDOp1NmQE=; b=lN7R0JF0ofjptf5XxrYqZhxQmiAVUAASVthOYk+qeQHjOecKaZMPugdk+5alZPd0wb uDSvLwPznrZYm3Apfi+Zbd7RaNUN7MP2I766YgVGTwiUl/QU+f/ywoOLknXCz7vtHYZS Pqs+Dd60WSkEAuQ5pEpA1v9QBP5thaW9PSExOOMOt3ltYdk5/aZSFiTRcyJQe2YjsO8C Oh2Np0JJWIr1N/8hQhaRrwzCPTgsiWNl1C5/MNFM9J9VIpbU8Q3ttNikcIRQSySyMhPe MxM4N6RD4B4c4BorgWBLY4G3ndr3jllflBT9C908vE9o7v+fwujS9brYHpmOiDpKHELK hFhA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=SxO+nL/4; 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 33-v6si4951909ply.512.2018.01.27.00.21.48; Sat, 27 Jan 2018 00:22:02 -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=SxO+nL/4; 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 S1752078AbeA0IVX (ORCPT + 99 others); Sat, 27 Jan 2018 03:21:23 -0500 Received: from mail-pl0-f66.google.com ([209.85.160.66]:44682 "EHLO mail-pl0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751506AbeA0IVW (ORCPT ); Sat, 27 Jan 2018 03:21:22 -0500 Received: by mail-pl0-f66.google.com with SMTP id f8so425627plk.11 for ; Sat, 27 Jan 2018 00:21:22 -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=8PzIj+qwrPoIdF47OPHuMD58ZY7BxaFwMPoDOp1NmQE=; b=SxO+nL/4+NpK7DSsna/XxaM4zrmZaCxxSmwkY44vyrXMv34faZ2qb5M2cqyWwBidew WDXy4rALhqSv8S3ywWn78N/OjF40Z/XtI60aBLGaP8/lRJjf/Ta1GY66P0WdxXR+5SHS Wf+C/nYu/j0s0qluniDOA8XFwig1Bi86KIayklDhB1Z0tW9zp6Jh1KQa+pjg5Hdj4T69 gTeMVlSSELeei1xOjAybnSUCz5ftMZdD7bl/X95sDzCywaap8rKQa9EyNx5aD20bSUUZ kQ8tCwH3T0TuBaNxqv2DP30wINzFluZeI/J74yDs20RgI1OkEmsCUPYx3pFMr7ZSYpKs abiQ== 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=8PzIj+qwrPoIdF47OPHuMD58ZY7BxaFwMPoDOp1NmQE=; b=smgcjXUFiUa+i7ulfbw+kl16cJ1HL470h9Bzk/8JZanJo3JRF5A/H6lw2XK2IeuRXz 5bqhog0bYEP4tb2kEFXI20AEFJEo7VaSLmGwprtBbWJY52OWg+SqblJwgLBuHmrOdll9 GMLEvVH4vrvdA+LwcCBllvcX0tY3F9YtL9PcRTJDkiGLq55I2KxDIAlCsUIIzQpqzIH8 ZKALfJuBwSpUHC7IjSy+8pDLl9SJcE3CnlO1mu2HteW9fP0CL3dBgskKOxYKrj7wqUAi 8oK7p/tP3hXWqSe/juiaaqm79kVOPNvmzRlCaKX2qDewH4Up+VAHh5AIAuIK6OhL15B0 aC6A== X-Gm-Message-State: AKwxytcFPrILlIIocyqOrCVedv58NU2e5cjsNJ9Z7Nz1431v1A/BSXG0 Hwv16JmFXNJLO/rj2W5kc+Q= X-Received: by 2002:a17:902:15c5:: with SMTP id a5-v6mr16510916plh.277.1517041281862; Sat, 27 Jan 2018 00:21:21 -0800 (PST) Received: from bai-oslab.tsinghua.edu.cn ([2402:f000:1:4413:c943:4098:9a43:1e52]) by smtp.gmail.com with ESMTPSA id 77sm22060691pfz.167.2018.01.27.00.21.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 27 Jan 2018 00:21:21 -0800 (PST) From: Jia-Ju Bai To: tim@cyberelk.net, viro@ZenIV.linux.org.uk Cc: linux-kernel@vger.kernel.org, Jia-Ju Bai Subject: [PATCH v2] block: paride: on26: Replace mdelay with msleep in on26_test_port Date: Sat, 27 Jan 2018 16:25:57 +0800 Message-Id: <1517041557-21667-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 on26_test_port() is never called from atomic context. It has no direct callers and it is called only via function pointer "->test_port" that is only used in pi_probe_unit(): drivers/block/paride/paride.c:322: max = pi->proto->test_port(pi); That gets called only from pi_init(), called from p{d,cd,f,t,g}_detect(), called from module_init stuff, all of the above without entering atomic context along the way. Despite never getting called from atomic context, on26_test_port() calls mdelay(100), i.e. busy wait for 100ms. That is not necessary and 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 --- v2: * Revise the description. Thanks Al for helpful advice. --- 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