Received: by 10.223.176.46 with SMTP id f43csp410468wra; Fri, 26 Jan 2018 00:35:49 -0800 (PST) X-Google-Smtp-Source: AH8x226Xhff4xlKQ/17UvYbQf/SMJS6dl7pGKgucK2DUc7Tv/5WtF+st7huOpoeZ5ewnxNWUQhHC X-Received: by 10.98.171.7 with SMTP id p7mr18761352pff.138.1516955749291; Fri, 26 Jan 2018 00:35:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516955749; cv=none; d=google.com; s=arc-20160816; b=F9apmwTc7Ei5x5VkAohtqgyRBAGLFF0jGSR+v+V4AhWcvM4rcG7pWVnk9lHPXIkae8 sTCqeHpkWA3ysJKW/R8M+sGhAdBNsWjv770P4N3A/ajj6uk9TzssYDjpl97UFBV4e8Zc 6kcmmU8H45pF6gDOALDHteEi5OeaUcCSBQN8xOC9eCw28si4vwaoiCDIPD9riO7SgfIN reEgVlgDZSW/VR/5xLEKdquV0RfSB2cdHOWKGFzDW3oDLVU80rmBXV1ECHvUTTrs4pPD nYrSZ7QzZyCfbHuPcNPZq/TFOJBMRfihhMy1XEKf9KIQzUbXjjN+x1VJKgfFXYKS53eq s9jw== 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=TDLIdkgFvJa3NlDPhJALTk7wD7IrDcL6feNo7sXr5l4=; b=rqzaoxtmEKmjtzfr/LA+1hQASJbsTtmgqC6fLQzsTXfItbVh9b2WNPhEwr5cAWjZJ5 YeAFAhTiDZT0ymoLt3UhKZysGVQolXFmqx6isRYA9lmXd+jKUjYZSFV/KPVz/ZEzKo8E gmPauATl9+anlKC9aCVB2+H3HBpXFa60BqaeMiX8LrW8yAPhnIBmwYZSDPgBs4qaICin 0bpk0noeIp28S8QH7bozxVNcm2XYVOIT0jNCVcxgpJqc+54c5LcO1KoUSFHIjx4Q8TWv fP0yhvNUrJj5UNYEUAJOM2lZeNLFZiyfhHVCnOaRfk1ezqeHdnbF88jl/rQkronp8tMT S0jg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=PmoyJvMR; 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 i1si2685923pgn.373.2018.01.26.00.35.34; Fri, 26 Jan 2018 00:35:49 -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=PmoyJvMR; 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 S1752548AbeAZIdr (ORCPT + 99 others); Fri, 26 Jan 2018 03:33:47 -0500 Received: from mail-pg0-f68.google.com ([74.125.83.68]:41417 "EHLO mail-pg0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752429AbeAZIdq (ORCPT ); Fri, 26 Jan 2018 03:33:46 -0500 Received: by mail-pg0-f68.google.com with SMTP id 136so6841694pgd.8; Fri, 26 Jan 2018 00:33:45 -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=TDLIdkgFvJa3NlDPhJALTk7wD7IrDcL6feNo7sXr5l4=; b=PmoyJvMRYR1uV67KYhYTpaNVubzEKg4IymFwoAoPDl8RAQ+wS+pK3v0nfXUV7gOMVw h9tfo2ItHvyH3gfo/jzSqoAuIs/vpng2/OEVSACPS3wetHV/labp4dDc1GFSbAWWnNVz bVwlDNJMh7iipLOfFRnZz51VA6tu5l5Ct8UdbxgATTmWJUTcS2PbnwnpqWHK/5p2DwOP LqYlU8jQkA6Z7tBbgaOECVt8CfM4tMYZIjzZXUJAAnSU1FPQXn3X8MuzN1VIG1i4enB8 ianSJeGeLqwu6FZIewQ0dNsID1SJBgxMXXhZ0QcsVb01xA32ZfxLsnKAGjn9A0jMbT8k aQdQ== 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=TDLIdkgFvJa3NlDPhJALTk7wD7IrDcL6feNo7sXr5l4=; b=eRJE48R79LFTmb4h11JoKHI4occr1SdV4p5rHkmE41EcVu22brATU81gbZuMb6j2h0 qd2duMXHtuIg5PXlFZG/7KSXphtCwXu66OtgHDoaf0HGwxmTQI2p3QxktCxbx6foHV/L 2+6YkahyzSAInA3vjCTj0lNNgVSEwA60T+rwKJKOeU6C7Esd70O5pQCAqHlyMfBz3RDg K/yaXuHlFc9RhfHgJvqAaMretQh6QzaIb04HUwDjawyj5qq5g8AkFhJ/32D0M+lxtFkK e3Vtgg9EtCZwryWmHjACcuJfAFxniRwwJlZRVWPUT4Gr4RezackmFUkvLIXXf79ByGz6 dtCw== X-Gm-Message-State: AKwxytcRwM6620SoUE5cQfON+0yQP4tV1sGyzL6jpGa5vj556e9vWD0r JO1tjEIY3yKgP/vqNMx1CuM= X-Received: by 2002:a17:902:bc47:: with SMTP id t7-v6mr13615636plz.344.1516955625603; Fri, 26 Jan 2018 00:33:45 -0800 (PST) Received: from bai-oslab.tsinghua.edu.cn ([2402:f000:1:4413:3967:a579:e81d:66fa]) by smtp.gmail.com with ESMTPSA id h2sm6440164pgp.65.2018.01.26.00.33.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 26 Jan 2018 00:33:45 -0800 (PST) From: Jia-Ju Bai To: rjw@rjwysocki.net, khilman@kernel.org, ulf.hansson@linaro.org, len.brown@intel.com, pavel@ucw.cz, gregkh@linuxfoundation.org Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Jia-Ju Bai Subject: [PATCH] base: power: domain: Replace mdelay with msleep Date: Fri, 26 Jan 2018 16:38:19 +0800 Message-Id: <1516955899-31810-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 After checking all possible call chains to genpd_dev_pm_detach() and genpd_dev_pm_attach() here, my tool finds that these functions are never called in atomic context, namely never in an interrupt handler or holding a spinlock. Thus mdelay 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 --- drivers/base/power/domain.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c index 0c80bea..f84ac72 100644 --- a/drivers/base/power/domain.c +++ b/drivers/base/power/domain.c @@ -2144,7 +2144,7 @@ static void genpd_dev_pm_detach(struct device *dev, bool power_off) if (ret != -EAGAIN) break; - mdelay(i); + msleep(i); cond_resched(); } @@ -2231,7 +2231,7 @@ int genpd_dev_pm_attach(struct device *dev) if (ret != -EAGAIN) break; - mdelay(i); + msleep(i); cond_resched(); } mutex_unlock(&gpd_list_lock); -- 1.7.9.5