Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp576181imm; Fri, 27 Jul 2018 02:14:28 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeUg08P1Q1lWhZJjuQrTFFOwF2gc8EM+rFioRuvRcVg9NUe4Y8sE2vwQfpWqxJKBQBDx+oA X-Received: by 2002:a17:902:381:: with SMTP id d1-v6mr5275454pld.309.1532682868257; Fri, 27 Jul 2018 02:14:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532682868; cv=none; d=google.com; s=arc-20160816; b=hanzE36xzN9hYQW/a30EZSfCnkVZAy9OIYX4N4Q7aBxkq4us1cTwJLdaoP1nx4JGhJ ldlazCBl6I3PN+EK6lUT9m4tEZb3ttFSmkk6zS2RS84sNicIhGMYX4Lh0PHEt+fz3S/x Avb/eTdwx0gu0d2QbzlbtiuLn/UCTlXBvFUtdFEeO0FZx9SaXnomxuyX/EBqrObvuGeR 7Lh63h3EFxryHlJEChlN355+Y7XpsAmDAOLudpsW4LHgIwC4RZ8HBd/sSBL1+XoWDVX+ EeeqrRjoeNI+ojDO9I4kmX/U9cG2RoIOtqDd+itP4CRDSvuv7/W5icJk/zN5jF5iqeHI NqQQ== 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=uvTHbGutzAZckRt+6qi7Iz8OaqAPur9V4Cn4afpXUVY=; b=zCg1eO5+HPaNO6LTjHEW4c8Y99SxuhyZfGKWIFNhkO2R+rlIdZ3qmAHO5vEOVP6t36 lfxD1/m8jeYefnCD6aPxzkqmaNA5FKP8WSbZ62/L1DphdRp9A09LkSr5Bk0Ap8RjKDEZ FzZmE1Yj8jYEpkOrbLiqjaYsfkaRxgKg3TgnzZHqT8HaCvskkbznmdAtF7Yg0WEn3uEc e2B0bjSBdsU+JkYucRBvmy9EHHCZyUcTO6r/X2uE938kbVNI0mrSiQztxjdbbTRbblJu LqKWh1LXyGNhv6+NkBFxrpO5cgLD0M8DX2Rjkl60H9qjS9O7j85u1FZhZyp6B4gQvSgU ssyA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=AkssfN9d; 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 z3-v6si3516697pgh.557.2018.07.27.02.14.13; Fri, 27 Jul 2018 02:14:28 -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=AkssfN9d; 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 S1730406AbeG0KeV (ORCPT + 99 others); Fri, 27 Jul 2018 06:34:21 -0400 Received: from mail-pg1-f193.google.com ([209.85.215.193]:41471 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729955AbeG0KeV (ORCPT ); Fri, 27 Jul 2018 06:34:21 -0400 Received: by mail-pg1-f193.google.com with SMTP id z8-v6so2880222pgu.8; Fri, 27 Jul 2018 02:13:23 -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=uvTHbGutzAZckRt+6qi7Iz8OaqAPur9V4Cn4afpXUVY=; b=AkssfN9dyA3um/2+9+ODrauLL0F5lFgNcm3n1jT0nGUv+MRU8jJDK87xHRCuwvezAf RvRzznBpnU8OHAuPqn9DwMHKfPYDtfDRoTptgRWMYJgBDHoGWp2zF4X0d14ctyetAwMr rYvq9GDEYG1H8/cmTzT1lT+UTIc5ZYUcCqB16dSCjXQlLBqBRoJlLdb4tbuvzj0IIBpX qVJkzlLKYarxLKXW3SgKO4T/KNZM56JwKF8VuoF9pkD6eav65dtkyJgtEUUfGbKCBZ9I 1vFUvStHE17XCDs6ciw/MkhUxq11x5zVDU4fsfiA1Tu4xsWnwXvsf9ECwTyttCFg60j7 Z8eQ== 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=uvTHbGutzAZckRt+6qi7Iz8OaqAPur9V4Cn4afpXUVY=; b=rGfzH5rXIICvar+KF3RMIxpCB3sBlgaN6qrpS8ugBCMD1gCOGDvledieWuZCWnBzW2 SPZf1cYs5xr/POHceMJe77+42jZhCkET58Xdc0boa9pygG6T5TY33sjonNkWmIknz6w/ /L0rRhqFT4911T1S/Nsna2DyONzr2YN81mEbC4kSszVOWxPN7jprN77gZ4eRt/g9vQR6 NsRJ8O21O/iNsqLmIenbk9mHdnBgkpYu8sv+q1mJ9ibGGW8BgQHv4oF32VmFBpTLAGQ/ nnwXIf4b4OjthE7FEhpUg1LqzPtd/eFJiSoio56V2vX1aJSVM/c4XzmXuCPMdKhogGsb Xapw== X-Gm-Message-State: AOUpUlFNYZYLN2C1S/nUAkLUkYxTcSFrx/1vqq0s1O6WTohR7XEqc9+7 Zd3+955koO6nepDhV1V2yuU= X-Received: by 2002:a63:4a61:: with SMTP id j33-v6mr5305289pgl.436.1532682802910; Fri, 27 Jul 2018 02:13:22 -0700 (PDT) Received: from localhost.localdomain ([2402:f000:1:4414:8ca7:1cde:b1e6:2647]) by smtp.gmail.com with ESMTPSA id 64-v6sm6474685pfi.89.2018.07.27.02.13.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 27 Jul 2018 02:13:22 -0700 (PDT) From: Jia-Ju Bai To: jejb@linux.vnet.ibm.com, martin.petersen@oracle.com Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, Jia-Ju Bai Subject: [PATCH] scsi: atp870u: Replace mdelay() with msleep() Date: Fri, 27 Jul 2018 17:13:17 +0800 Message-Id: <20180727091317.6976-1-baijiaju1990@gmail.com> X-Mailer: git-send-email 2.17.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org tscam(), atp870_init(), atp880_init() and atp885_init() are never called in atomic context. They call mdelay() to busily wait, which is not necessary. mdelay() can be replaced with msleep(). This is found by a static analysis tool named DCNS written by myself. Signed-off-by: Jia-Ju Bai --- drivers/scsi/atp870u.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/scsi/atp870u.c b/drivers/scsi/atp870u.c index b46997cf77e2..8996d2329e11 100644 --- a/drivers/scsi/atp870u.c +++ b/drivers/scsi/atp870u.c @@ -1055,7 +1055,7 @@ static void tscam(struct Scsi_Host *host, bool wide_chip, u8 scam_on) udelay(2); /* 2 deskew delay(45ns*2=90ns) */ val &= 0x007f; /* no bsy */ atp_writew_io(dev, 0, 0x1c, val); - mdelay(128); + msleep(128); val &= 0x00fb; /* after 1ms no msg */ atp_writew_io(dev, 0, 0x1c, val); while ((atp_readb_io(dev, 0, 0x1c) & 0x04) != 0) @@ -1286,9 +1286,9 @@ static void atp870_init(struct Scsi_Host *shpnt) k = (atp_readb_base(atpdev, 0x3a) & 0xf3) | 0x10; atp_writeb_base(atpdev, 0x3a, k); atp_writeb_base(atpdev, 0x3a, k & 0xdf); - mdelay(32); + msleep(32); atp_writeb_base(atpdev, 0x3a, k); - mdelay(32); + msleep(32); atp_set_host_id(atpdev, 0, host_id); tscam(shpnt, wide_chip, scam_on); @@ -1370,9 +1370,9 @@ static void atp880_init(struct Scsi_Host *shpnt) k = atp_readb_base(atpdev, 0x38) & 0x80; atp_writeb_base(atpdev, 0x38, k); atp_writeb_base(atpdev, 0x3b, 0x20); - mdelay(32); + msleep(32); atp_writeb_base(atpdev, 0x3b, 0); - mdelay(32); + msleep(32); atp_readb_io(atpdev, 0, 0x1b); atp_readb_io(atpdev, 0, 0x17); @@ -1454,10 +1454,10 @@ static void atp885_init(struct Scsi_Host *shpnt) atp_writeb_base(atpdev, 0x28, k); atp_writeb_pci(atpdev, 0, 1, 0x80); atp_writeb_pci(atpdev, 1, 1, 0x80); - mdelay(100); + msleep(100); atp_writeb_pci(atpdev, 0, 1, 0); atp_writeb_pci(atpdev, 1, 1, 0); - mdelay(1000); + msleep(1000); atp_readb_io(atpdev, 0, 0x1b); atp_readb_io(atpdev, 0, 0x17); atp_readb_io(atpdev, 1, 0x1b); @@ -1473,7 +1473,7 @@ static void atp885_init(struct Scsi_Host *shpnt) k = (k & 0x07) | 0x40; atp_set_host_id(atpdev, 1, k); - mdelay(600); /* this delay used to be called tscam_885() */ + msleep(600); /* this delay used to be called tscam_885() */ dev_info(&pdev->dev, "Scanning Channel A SCSI Device ...\n"); atp_is(atpdev, 0, true, atp_readb_io(atpdev, 0, 0x1b) >> 7); atp_writeb_io(atpdev, 0, 0x16, 0x80); -- 2.17.0