Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp895533yba; Thu, 18 Apr 2019 11:22:17 -0700 (PDT) X-Google-Smtp-Source: APXvYqzPW9aYJJRik9GZh51l+vT/3RCZPVMgVWNRgyC6QHFylRx8ST12avtF4u75RJMVbgeL2ZxF X-Received: by 2002:a62:1690:: with SMTP id 138mr98610058pfw.28.1555611737041; Thu, 18 Apr 2019 11:22:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555611737; cv=none; d=google.com; s=arc-20160816; b=PSnURJASSq+0XKLVChGZro5ydk/OLSRCceOqqrc2e33FbDGuJsaOATk1r2/froF3Jg JpfJtmIGBMYgoNlmJSMFGA2G+Yx6n3vHW0hEIlDAN8wdWUuxy2mcPhDAgoo3kplhRIn7 W5e4D4gsb0o5PA+RtEzTjef15a8atLFjjUTPyI3FlNSWhBlNvYxmb9ckBy5uCjvasnxv 8LWw3O51CX5qy81lPdyOxs7d0mFYmmUrV4E8ckVxT0gBTJPq6KZtqYk+hifpRZEp22qY lC+60cWcvofoXD75isMLuwSO7sPvyjer2kufzblHOqFqdyJh0fjp7QZxbvBTaX+P/Y08 +DTA== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=rhJq2HvVGabPgB/dBHrz1gZY6hY1rdlYdJ0Relo1Q1c=; b=jhMwgHBoc7UV0CTGGx72zfLX3lDoQoVVjPIIAv5lKiDhsRry44MH2PO2cUPTl7gaSv Lux5nq5h9zpzFXfGGkZ198Ra7EGL8eot5EPKLTGQzJNZnIXtSk3v6g5tawx+V35lvs1V /OW3rAPX2er83V5jka6gP0j+khFzhgVspj5MNZt+rqxMRCOsZS2tanof9DJZLkkQFt+b AX/duOVe4rxzIMQstofidDmgoqVxh+bvW+I4Q5wHua2wGxRtQkafK5Txo+QR/StQEKkq XNYAyx2jTPaGGDsjlqFjJZlYR2/jb80CXwH+PHoO2rHUn21JN8CLphkCNBnKWnu5sAXx uZtg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=zgk5vvmK; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a73si2532604pge.358.2019.04.18.11.22.02; Thu, 18 Apr 2019 11:22:17 -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=zgk5vvmK; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391734AbfDRSIp (ORCPT + 99 others); Thu, 18 Apr 2019 14:08:45 -0400 Received: from mail.kernel.org ([198.145.29.99]:40048 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391291AbfDRSIo (ORCPT ); Thu, 18 Apr 2019 14:08:44 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id DD6632186A; Thu, 18 Apr 2019 18:08:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1555610923; bh=BmB3KNquAvh4sksIMssg9XDMV2iYEgjkCPYvtCQi/jU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zgk5vvmKbq17DxCMwZPenV1DfRlLXWY1KQQicsR9AzJs/k7hmyjqkon0YUH9aT4Ra 3pkJyjgNzjKfUf9Kiy1J1guYNIjclUtLjGt9Vg6AouSsOEZnxDarcflF3b0rNPD+Lo +W8PfP0FNWNB/LhN17inOKeHrbzdUjdNaN3kGDuc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dmitry Osipenko , Jon Hunter , Thierry Reding , Sasha Levin Subject: [PATCH 4.9 42/50] soc/tegra: pmc: Drop locking from tegra_powergate_is_powered() Date: Thu, 18 Apr 2019 19:57:53 +0200 Message-Id: <20190418160427.560303045@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190418160422.455656724@linuxfoundation.org> References: <20190418160422.455656724@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ 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 9685f9b8be07..a12710c917a1 100644 --- a/drivers/soc/tegra/pmc.c +++ b/drivers/soc/tegra/pmc.c @@ -512,16 +512,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