Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp120001imm; Wed, 29 Aug 2018 15:46:46 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZBYj2jlu2/d3KLx2dVFNMtczIeozQk/W2OJ0BtAHDulBJqO/zPDiu5js9nYt2mStJ4C00p X-Received: by 2002:a63:1e63:: with SMTP id p35-v6mr7410914pgm.376.1535582806561; Wed, 29 Aug 2018 15:46:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535582806; cv=none; d=google.com; s=arc-20160816; b=hrP3uqm3zvX9v+NeMBqdKUzjbSnRHiEXCJY8R4jIJ/i77HwGY7Laa34ROa2ztpeP7d tQXEjdwRsVj/0ci4dBqEmlTjBgf1Uir2cltl9bcsGzLA3NPTTl5TBONPQT051ZckW+G5 7ES86b9u5E8uSU5aXyVaeJ0r9FBCO8d/vbGTlE9628bs52vxWefsHF3r3/0M1PPxj9HM vXFZ+rSFFHypF5pXeOJe09xwqCJrDAqtl9BBBcuMCp2xxSTknPMy/luPcEPuKk6TUAEX GesIaFi6RCszIPnxLJ2Ie0Lh2mgtQVo2CbiZ6qzTFftp3Gho1U4DpdCf7NzKLhMdYM/i Vgog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=BAljCSM05B5YTcPvSIroRZ6BtJ6j3YfjRFNzJIwOSAg=; b=TWWVrbcSmjSw8nRe+foDoRBEZdCNsDPlFwlRoLFm9Qmfa9ZcitRRWU4iImRLgCN2Ds b3pEIRjaZPybv9SnUeTpg1uj2NcTtp4mrxupAsq3pu0z9Mt01+DgEPLn8ev73lMKcJ+Q 4k2e4VDL0IZ0UOV+yjes9NgxuuFSmbuN7qy5ybUVOJAEmL1upQQoDggwYXtNcoY+oAVf FyQ2SEOBAMNcYMMP8qSylI1XxPHlaEhVV9uwHlEEyxysMUhQnGTusjsmS8/co7n/C3tE mNgBg0lF8TdpAZWJ9Br4+2EnVq0AstqG8yEXr/PkrkdyiFaSQ0TaRWzZzp17GyPwd4bQ zVvA== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n3-v6si4957597pgh.359.2018.08.29.15.46.32; Wed, 29 Aug 2018 15:46:46 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727573AbeH3CoL (ORCPT + 99 others); Wed, 29 Aug 2018 22:44:11 -0400 Received: from bhuna.collabora.co.uk ([46.235.227.227]:60248 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727233AbeH3CoL (ORCPT ); Wed, 29 Aug 2018 22:44:11 -0400 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: sre) with ESMTPSA id B05C42723A7 Date: Thu, 30 Aug 2018 00:44:56 +0200 From: Sebastian Reichel To: Jia-Ju Bai Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] power: reset: piix4-poweroff: Replace mdelay() with msleep() and usleep_range() in piix4_poweroff() Message-ID: <20180829224456.3iadf2hnv5pxlms4@earth.universe> References: <20180730134838.9124-1-baijiaju1990@gmail.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="e6z24ml27j33bwcs" Content-Disposition: inline In-Reply-To: <20180730134838.9124-1-baijiaju1990@gmail.com> User-Agent: NeoMutt/20180716 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --e6z24ml27j33bwcs Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi, On Mon, Jul 30, 2018 at 09:48:38PM +0800, Jia-Ju Bai wrote: > 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(). >=20 > This is found by a static analysis tool named DCNS written by myself. >=20 > Signed-off-by: Jia-Ju Bai > --- This is a shutdown driver, so busy waiting is ok. -- Sebastian > drivers/power/reset/piix4-poweroff.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) >=20 > diff --git a/drivers/power/reset/piix4-poweroff.c b/drivers/power/reset/p= iix4-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); > =20 > /* If the special cycle occurs too soon this doesn't work... */ > - mdelay(10); > + usleep_range(10000, 11000); > =20 > /* > * The PIIX4 will enter the suspend state only after seeing a special > @@ -59,7 +59,7 @@ static void piix4_poweroff(void) > PIIX4_SUSPEND_MAGIC); > =20 > /* Give the system some time to power down, then error */ > - mdelay(1000); > + msleep(1000); > pr_emerg("Unable to poweroff system\n"); > } > =20 > --=20 > 2.17.0 >=20 --e6z24ml27j33bwcs Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEE72YNB0Y/i3JqeVQT2O7X88g7+poFAluHIegACgkQ2O7X88g7 +prmXg/7B8AukUKPN9HKBpe0p6+SVWU8sgcHbz/vQEl9PbMI1ZFx5r75LljtlnVH rOZLa3T4sko945gfrC07aG8a3BJS/V7ozVGWnfde5/Xsn2AtTiVO8UZPEIktnYgi ELvJVwUkCziMd8O64K2Y3eiyUJEJVrdbCitPvIKbYINuH8XpCdnWT9GkAfsjAYkn 9Gxq7zlIf/DXjX8wUor/xlXILyW08KvKe4UxjHY8q5CWTdUo/CAUBfwJ6v1Jx8Bk VrqHwZPCGPUIaY769BTy3tpUyltO8tsAjx0DOfLz0rlME6qZ76fSDtv9gMOqmXZf CJ8KaD8KfD6mzW973/Sq3Pxy1UynZ0OXaml9gEEPiY/srQnCD9+SbyY5aRiRVFOy sIO7RPsLrQaaqlqhfyqrZL7RTiaaykpX7pR40JxOKvuzCkw2/IzZK+EdsAhA5v0g KdBxnu+ltUioSt7tVcCSVK53b2eCb4Hhu9A9Id/bVvCnH8IsKv5qjMaGqpjLhMzE KzlwRRGxwEV7O7pYDwfBlYpTyIIIKtysdg+OT5ob+bo04vkMzmsCl6GOHJ8+Uf4V JK13LnRBn34kFeqN1bq+LKJPVgrFBZGt/C3HDGxwR9Xu8X6naBkecTUl9jTt7hkq H7ZFc10wxqUjTNbriFIOowyy1NCtPVCfrOmayVydZyl1x0P5zNg= =VUEm -----END PGP SIGNATURE----- --e6z24ml27j33bwcs--