Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp3979840imm; Mon, 30 Jul 2018 06:47:31 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdmlNA85mPg6mFu1O+pGdYCGnnsaAQgthekrGRyfk2cGGwyiHYT7FAlK2ZME8vs7UH/wZ6u X-Received: by 2002:a17:902:7884:: with SMTP id q4-v6mr16388741pll.174.1532958451883; Mon, 30 Jul 2018 06:47:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532958451; cv=none; d=google.com; s=arc-20160816; b=ODHTb1PfrfyKJmm5H4K5p7dTKTlmibTUJJVIp79g/sQt8+5nMSz/2WP0AV5h8RfeDX C+N3hXKs34UPGZHv6M/pknBbCNEcb+M5h9oEBfAA8xSGZycgdnQHIdXY/EAYiYbP3fuk 32LAONelsDK5XYStMFlmfQTf6Rt/OAEd0l02rgytesjkLBYE/RPp6M4aSYh2eEHzdUFP 36YOSROCvrF/uDa3lL7yIt5z/tR2CU2inwUAkWcsDwmYL7XRk5gA/BVtxw3iFclbUYaL VJjkMM4lFHqvL5E9jVMZBxYwFcNJ8oHAs408F1AtGaYrDKGE4qtNCD4oHov278tmB/Sf f8hA== 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=cpeRy15Wk6bv+h52Ji00CmuhkRmAG9Bs8LCMfFc87Pk=; b=Zw0M/tane+BO/prCCK/Hq7i1uSvghW6bN/nIC5KwSdEy6J0Nfk5jPHKNbLPxjDTAqI /O+hlNGu5do6yLreI+lt49ao1Qfb5iE723tNo/nhajHHOhJqW4rDB58zhhVPx+DBgr1S WDvPXk5SwBPpFslhGD13jq676QJyLjetg3+vduF2XO7A8RHwVJN1X6XcGq40rA6zdK4N vCSFBzY1QVUxgfqk7wTq1qzlJkvtdUi7S1UKvPLrlfXeYERJefwuzcrdauid4tpMlVXM Wh/y2hq1gaisj3sXEN+ZdtYwVwwfEbqU+wcUm+64jkt+RljJojYaCpAUiBUxiEqUIt/7 8g6Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Aq3BcCEL; 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 f15-v6si10738998pli.194.2018.07.30.06.47.17; Mon, 30 Jul 2018 06:47:31 -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=Aq3BcCEL; 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 S1726876AbeG3PV1 (ORCPT + 99 others); Mon, 30 Jul 2018 11:21:27 -0400 Received: from mail-pg1-f196.google.com ([209.85.215.196]:39536 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726562AbeG3PV1 (ORCPT ); Mon, 30 Jul 2018 11:21:27 -0400 Received: by mail-pg1-f196.google.com with SMTP id a11-v6so7299332pgw.6; Mon, 30 Jul 2018 06:46:22 -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=cpeRy15Wk6bv+h52Ji00CmuhkRmAG9Bs8LCMfFc87Pk=; b=Aq3BcCELBFVHB10lws86HcTMWBdMFwUx2uvsnNa8A2apAaWWtQR7BdEsh7TwAOtlfD i84SSIm1Qc/KIUGZ9b8XhRaCVcEbZIukQxVxW7XSri5hon2jR9oTLRsql+i4ntXMStb2 AyEh0+lSo9OonBAltFe1yvS4S92STA+U7ci9mWowKbVTc9cpL8L0FS43OVnNJs6HbtnJ ZAWvMdDZiwcsrPzxBY3JlPXRuCUGMZV6OmY0a0obSJ4vgiUKPDRaXx0UZpyduRBZxXYE rF+4fNZcDwNyKduNmwAetkhFh8/5XUkmleJI7iNbiip1ozMnF3g59E/UGbHs3Ejq39XZ fDig== 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=cpeRy15Wk6bv+h52Ji00CmuhkRmAG9Bs8LCMfFc87Pk=; b=blK3j0/vRgU5trNdJIk7h4IGqrTtQmOyevKSOF4Tf6Sa5oZOwYEOOXfwbBefA5+qg5 HDr46/bLkM4TrO0WZ4rsJcaYPuhHu36ryLEe90AW0hxCti0y323HrFdt3hDE2yr20PBs DJ5iMQ3nAD10t7oPsYBnGhr4e8ZI5xCzyCSaI4Ae79or2xhj+TFtZWvYi9ohkNHSpo0V 9zXRhGZNWAYyNuIyNSQKthqXmY0An5nNNGLYVALVdBgMOSk9qXNk72dmEVErMgeR8nkg 3JuIBxg967jIr19jB4RfiedWVr7O3qk0I/zBPRn4mHKDzFz1DA87CB2KvtWsuFwGkSdQ ouOQ== X-Gm-Message-State: AOUpUlEXGTFORJv3dB5OVewUsV51B4ai6kYwSZ5FwUpWtdjn1xUEAaz+ ueW1FhwyI0gjwiy61YBWNvU= X-Received: by 2002:a63:2404:: with SMTP id k4-v6mr16282632pgk.191.1532958382697; Mon, 30 Jul 2018 06:46:22 -0700 (PDT) Received: from localhost.localdomain ([2402:f000:1:4414:4550:ab75:cee3:d6c1]) by smtp.gmail.com with ESMTPSA id k123-v6sm25456998pga.21.2018.07.30.06.46.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 30 Jul 2018 06:46:22 -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: gpio-poweroff: Replace mdelay() with msleep() in gpio_poweroff_do_poweroff() Date: Mon, 30 Jul 2018 21:46:14 +0800 Message-Id: <20180730134614.9016-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 gpio_poweroff_do_poweroff() is never called in atomic context. It calls 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/power/reset/gpio-poweroff.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/power/reset/gpio-poweroff.c b/drivers/power/reset/gpio-poweroff.c index 6273ad3b411d..bbe55cfa87d0 100644 --- a/drivers/power/reset/gpio-poweroff.c +++ b/drivers/power/reset/gpio-poweroff.c @@ -33,16 +33,16 @@ static void gpio_poweroff_do_poweroff(void) /* drive it active, also inactive->active edge */ gpiod_direction_output(reset_gpio, 1); - mdelay(100); + msleep(100); /* drive inactive, also active->inactive edge */ gpiod_set_value(reset_gpio, 0); - mdelay(100); + msleep(100); /* drive it active, also inactive->active edge */ gpiod_set_value(reset_gpio, 1); /* give it some time */ - mdelay(timeout); + msleep(timeout); WARN_ON(1); } -- 2.17.0