Received: by 2002:a25:5b86:0:0:0:0:0 with SMTP id p128csp2081097ybb; Fri, 29 Mar 2019 18:33:00 -0700 (PDT) X-Google-Smtp-Source: APXvYqwyoOz0Y3JCmMZAdXXZOf8tRhaIFp5T/Cv0H+sBVq8rX5ZKJEOg4KgwCxrl7XN/MQuqrthH X-Received: by 2002:a17:902:bd92:: with SMTP id q18mr2469533pls.136.1553909580841; Fri, 29 Mar 2019 18:33:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553909580; cv=none; d=google.com; s=arc-20160816; b=grWszkwMRI6mP8DmmaBqWZypOkTPzk8q6XV5BG6n4lDve75OzE7DBnOBxvS4NGQI1a GUK+RBD4vYrFDULCLYE57NfnQE6OAoIdUPsbn9LYF/gkXb/kmYTptM3J8HBPARYPjJJ7 +SSqE5ncEGnm9VEOkAAnl9f2oarjwrxvNW0oYhM2SpAbfK5gY2AeTT0cL42Ru7rQAmHN apYjv1YamEe0FHO2GoZVKiAJm3v2aclHZQ5nRcR8Iy2wil50eNgdmoZtToMrMgjPKC2m Drkp8O3RlsT+ou+75CqDvTBtm9mmZ67SjnpH60k18z3eOX1PCGfrTu2UR37z1H+sPelU AkBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=6qcgHdgIHi6VMLxkdfVx+eVpONlgD0x5rLjKnxWNbfc=; b=oE85rnV71BxymrLBn8o0hD801e/TUcqkAtFZbN7D/mlz4cpbZLM+oBTJ1EBWCxlt74 g3h5B6cJ6fwWlKnQwshjr5WNhAPiL/nrSOylf69bQfhqR81zg9MBtLe1qwikSxhm6pqV zhP9AIJNI8ZSFwWVyL9elEP1Kb3Ay/mcAs3SiQ/b9wcyDtEgZg7LE75zLpXsQkZmeSA0 BPQ1pUpBbnb5IZmYH5wpnK05ZZswORvuh/akAWmp1A+vER02j+dT/jJe3vz3XkEAMbSK q06pVQ5SfQQtqjMQY2XQ27sxZ3REaBW8Z91CZk53v0K2RDN53QvV93+BrcYohlxF7nKe kHLA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=czatT2g3; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i1si3222575pgb.322.2019.03.29.18.32.45; Fri, 29 Mar 2019 18:33:00 -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=@kernel.org header.s=default header.b=czatT2g3; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731910AbfC3BbO (ORCPT + 99 others); Fri, 29 Mar 2019 21:31:14 -0400 Received: from mail.kernel.org ([198.145.29.99]:38554 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730995AbfC3BbI (ORCPT ); Fri, 29 Mar 2019 21:31:08 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 5547721773; Sat, 30 Mar 2019 01:31:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1553909468; bh=yvZvvvl3jzqFAQWk0koBGI6lJnJryL41y0l+MTcLHQg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=czatT2g3SkpBFCkpOi63l7prmt0rGmef5LjbR5cBFWK3ce2TL2vNwb4ngKYKnvMGI LdHma6fDzgCItew6gdmaqQ9ZL0ah0qdhT7B8kOT97GqKbXjoay9Mx/iJ1++qR1JOyH 2XHlmKG59e8L6vChPaPPLdwWqE3GUC+qYOSBJWEg= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Dmitry Osipenko , Thierry Reding , Sasha Levin , linux-tegra@vger.kernel.org Subject: [PATCH AUTOSEL 4.14 24/37] soc/tegra: pmc: Drop locking from tegra_powergate_is_powered() Date: Fri, 29 Mar 2019 21:30:07 -0400 Message-Id: <20190330013020.379-24-sashal@kernel.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190330013020.379-1-sashal@kernel.org> References: <20190330013020.379-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Dmitry Osipenko [ Upstream commit b6e1fd17a38bd1d97c11d69fd3207b3ef9bfa4b3 ] This fixes splats like the one below if CONFIG_DEBUG_ATOMIC_SLEEP=y and machine (Tegra30) booted with SMP=n or all secondary CPU's are put offline. Locking isn't needed because it protects atomic operation. BUG: sleeping function called from invalid context at kernel/locking/mutex.c:254 in_atomic(): 1, irqs_disabled(): 128, pid: 0, name: swapper/0 CPU: 0 PID: 0 Comm: swapper/0 Tainted: G C 4.18.0-next-20180821-00180-gc3ebb6544e44-dirty #823 Hardware name: NVIDIA Tegra SoC (Flattened Device Tree) [] (unwind_backtrace) from [] (show_stack+0x20/0x24) [] (show_stack) from [] (dump_stack+0x94/0xa8) [] (dump_stack) from [] (___might_sleep+0x13c/0x174) [] (___might_sleep) from [] (__might_sleep+0x70/0xa8) [] (__might_sleep) from [] (mutex_lock+0x2c/0x70) [] (mutex_lock) from [] (tegra_powergate_is_powered+0x44/0xa8) [] (tegra_powergate_is_powered) from [] (tegra30_cpu_rail_off_ready+0x30/0x74) [] (tegra30_cpu_rail_off_ready) from [] (tegra30_idle_lp2+0xa0/0x108) [] (tegra30_idle_lp2) from [] (cpuidle_enter_state+0x140/0x540) [] (cpuidle_enter_state) from [] (cpuidle_enter+0x40/0x4c) [] (cpuidle_enter) from [] (call_cpuidle+0x30/0x48) [] (call_cpuidle) from [] (do_idle+0x238/0x28c) [] (do_idle) from [] (cpu_startup_entry+0x28/0x2c) [] (cpu_startup_entry) from [] (rest_init+0xd8/0xdc) [] (rest_init) from [] (start_kernel+0x41c/0x430) Signed-off-by: Dmitry Osipenko Acked-by: Jon Hunter Signed-off-by: Thierry Reding Signed-off-by: Sasha Levin --- drivers/soc/tegra/pmc.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/drivers/soc/tegra/pmc.c b/drivers/soc/tegra/pmc.c index 7e9ef3431bea..2422ed56895a 100644 --- a/drivers/soc/tegra/pmc.c +++ b/drivers/soc/tegra/pmc.c @@ -521,16 +521,10 @@ EXPORT_SYMBOL(tegra_powergate_power_off); */ int tegra_powergate_is_powered(unsigned int id) { - int status; - if (!tegra_powergate_is_valid(id)) return -EINVAL; - mutex_lock(&pmc->powergates_lock); - status = tegra_powergate_state(id); - mutex_unlock(&pmc->powergates_lock); - - return status; + return tegra_powergate_state(id); } /** -- 2.19.1