Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp3982315imm; Mon, 30 Jul 2018 06:49:55 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdAGl7STjlUi58TduDOYPenSzsUR5FQtpiMIDFEfGFcUl7quEEHF7JUuiL+m9rOyH7BcdeB X-Received: by 2002:a17:902:740a:: with SMTP id g10-v6mr16572492pll.204.1532958595033; Mon, 30 Jul 2018 06:49:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532958595; cv=none; d=google.com; s=arc-20160816; b=wZWVg0/P2Kv37QJqzQoBKg6ceAdJ1vezvR8MPMfG16h9CD4UKXovM62LYwWF/P775N 29UtO4mPdl4caxKA+VwcyqGVYM1bumaSSYm7/z7OVHLkrCgGqRILM2licZlX1MT+6DfC d/EZI7bmZZAnVK7X+BgUGgPajgtHC5vJnP0M7V7EtI0WAajRv3AjuaHpfDGiReBRNmoy 035qc2/gcBV02FoZsGnrWi82Ejjr2OCMOcNBr8ocLaW57Sqj3BeASoBFlc5QOMaotxqf l/yenoTnGC8oneHN8FxgyzeoPpFKNvtCu5HgPjRL4qJKY23fkpXQii1QFcdkHqvOayY7 x/cw== 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=kE7PjXU5llRJHB5rk8hyr4gVdBSe3+TpguvSPdwdSwE=; b=LATImlzkJpcZTo6bFFACP0lEZCZIQtMVO3XI72BJhV/cvQwkY/6CJLIyHGbkMWOQxW yWyM4EvWPD+4iv3uDxBJc4WFGN9RHX4D1oorIKBEuAxEDdB9otGVQRVHqO/gvisRt9FC 3dalYqMNSOGNfN48xQxcoI3vRoejzyudzANVmASRHMvVwIq9YfRkwZ9QaX3yvkxnZTgc FF0NRoyx3H+fLf5RpuHTGu7J7UwlQGKQTN2/+ODSg/nYyqX/WH69vrbQejHb6zgw132W maAboSBhHEom/b3LMKevnNnvVDqBMtX2G6pokl91q/eGvLzjPOuIXsG3cZFQhvplw3CJ 59aA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=WATxpgJ9; 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 z15-v6si10687761pgs.570.2018.07.30.06.49.40; Mon, 30 Jul 2018 06:49:55 -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=WATxpgJ9; 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 S1726810AbeG3PXv (ORCPT + 99 others); Mon, 30 Jul 2018 11:23:51 -0400 Received: from mail-pl0-f66.google.com ([209.85.160.66]:41033 "EHLO mail-pl0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726535AbeG3PXu (ORCPT ); Mon, 30 Jul 2018 11:23:50 -0400 Received: by mail-pl0-f66.google.com with SMTP id w8-v6so5583769ply.8; Mon, 30 Jul 2018 06:48:45 -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=kE7PjXU5llRJHB5rk8hyr4gVdBSe3+TpguvSPdwdSwE=; b=WATxpgJ9OhKwqV8ZqmY/VQQ17p64PgGVUfthS6EIPwMHcHgIxiwniYmw0w4yQ3dLL/ Ay5tr0+1MEHIB5+s1pHreVDJMwYFYbLj1cpoPZ4LMEZHdmD4n06hyZS44TOqNTQCyCaz UA9BcILbggE45RpE0LtkfCN3bf4Mm1t8MSGO1wZvu6CoujUsN0Nk19vP6q1AZTZSomVx ZYIwZQo3LDMOMfmeBNfnV6h6rdktti9qHw8iqvt8SHrVyVUuna3n5Velhz4MQ+k7NMGF VT1iNmOmycGheiHW1rL0xev1Wq/UOzRqKClEYqbqs9vtJGZ9kzZd4wC7zMCrCKv0AjeY tHYQ== 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=kE7PjXU5llRJHB5rk8hyr4gVdBSe3+TpguvSPdwdSwE=; b=rJy/kMNu/NWm3mvE6Qc6assDC5AuMQI7HvLG6GG6rxqx/1nRIWR0b1pWLD19Zu4+UJ zo5/lMH8HPAED2+1AutevFCKGZuoOWWocF2FTOvjSvuSpV85Wt3CKPNC2Ze/0D3Tvr04 nz+6VG0M+bE5j8t9ivFw78N3Kn0t+eRBPkbcoza3h95UcmZG/yZBe2Hvs77EADemsO1c 4c1XNzL3mT2/j+4ql6c1OrxIki5ECeSK4OO+oxTpBriCoL9Tbn/VHwmV+vSdIgoeclLP kEflz/yLpBM3MMcATLdlIeJitlPJlsgoKYAty/Tt10CRF2NWBgmciVFaSdY6/J+T4jBj 7J0Q== X-Gm-Message-State: AOUpUlGjPVn4xKCKf03b0fXVz2Zwb3VZ4fdGhouKXQgmrm1pwKUERHmc g0VdjOZDfD3PsDp6gc+/4uk= X-Received: by 2002:a17:902:28a6:: with SMTP id f35-v6mr5534573plb.240.1532958525668; Mon, 30 Jul 2018 06:48:45 -0700 (PDT) Received: from localhost.localdomain ([2402:f000:1:4414:4550:ab75:cee3:d6c1]) by smtp.gmail.com with ESMTPSA id 1-v6sm25345114pfk.134.2018.07.30.06.48.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 30 Jul 2018 06:48:45 -0700 (PDT) From: Jia-Ju Bai To: sre@kernel.org Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Jia-Ju Bai Subject: [PATCH] power: reset: piix4-poweroff: Replace mdelay() with msleep() and usleep_range() in piix4_poweroff() Date: Mon, 30 Jul 2018 21:48:38 +0800 Message-Id: <20180730134838.9124-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 piix4_poweroff() is never called in atomic context. It calls mdelay() to busily wait, which is not necessary. mdelay() can be replaced with msleep() and usleep_range(). This is found by a static analysis tool named DCNS written by myself. Signed-off-by: Jia-Ju Bai --- drivers/power/reset/piix4-poweroff.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/power/reset/piix4-poweroff.c b/drivers/power/reset/piix4-poweroff.c index 20ce3ff5e039..5d4c72992d2c 100644 --- a/drivers/power/reset/piix4-poweroff.c +++ b/drivers/power/reset/piix4-poweroff.c @@ -47,7 +47,7 @@ static void piix4_poweroff(void) io_offset + PIIX4_FUNC3IO_PMCNTRL); /* If the special cycle occurs too soon this doesn't work... */ - mdelay(10); + usleep_range(10000, 11000); /* * The PIIX4 will enter the suspend state only after seeing a special @@ -59,7 +59,7 @@ static void piix4_poweroff(void) PIIX4_SUSPEND_MAGIC); /* Give the system some time to power down, then error */ - mdelay(1000); + msleep(1000); pr_emerg("Unable to poweroff system\n"); } -- 2.17.0