Received: by 2002:a25:5b86:0:0:0:0:0 with SMTP id p128csp2084300ybb; Fri, 29 Mar 2019 18:39:05 -0700 (PDT) X-Google-Smtp-Source: APXvYqxEpcGOxxGGihRia7E+cNvEFYb7/pPimeBQpouhKI9hA4sldJIWYUrLfgquwESDRG+T7O9V X-Received: by 2002:aa7:9286:: with SMTP id j6mr49207575pfa.47.1553909945292; Fri, 29 Mar 2019 18:39:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553909945; cv=none; d=google.com; s=arc-20160816; b=QqVJpdklE3FF3seZ9eaXljxEp+eTX9h7mbG6oFMI8hDuReQGlry+VIl+c5Qunr5hBm NH9Swv3QiV4BXgobprb4k1yLU8Nc34JukY9iENr04MMMl+EjTeZyQZf4wFUBwi7qnm/u oK2PCKP2MVM96mCXjLtCoP413vFDoFHyPT1YtUVO8eAx96MKlZ2qsTppgjSIa1H+/E77 fDPVUxvd4cHjlxLSJeBz/P9a66Z82ABI9BhHBFYWKSP++nUW5ygSEwxi7gkDYlQqEyX4 vvr9YPI2uAjat7JKJE7/TZ+WSlIZchftBBfoHFBTQJsFi17Xih7InXSRrhJLea4HRFmS 1RSQ== 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=HU9H8A8dUzTftTMVQxm7qr62xHZGFNmpDY6N1A2pWLo=; b=fTG1eSZUfFWvoawSL0s/6pPz5qgoP2YvW3+42RYaWtrq9aAnbpGto8e8LuPIAAzT1r eU51qN8R1/AfJmvDDe9LPMMVVYbALePOzRjI9sOSGdvI0FnsuIG5wforMLrFEsAjNwFx EKoXYx5U36QS/Jb8JgGx017pzKx/T43O/skLkiwuzvG1CvD/QSPlDAvp30MsoMKPwkZS LJn4R8i55X8sGYY4wlNwcyaUbnErWXn3CuWp3Wtldn2zHLOo3hfwr9dTcVuZO+FbcXSK gBuWLyWb/sOai6r9bb5icwiucf47zr+UXEU93pYQ+RMuLKpZwbgyZhJvVCyc5++ZwvEa KTWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=WLWgfVqD; 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 o1si3178389pfe.194.2019.03.29.18.38.49; Fri, 29 Mar 2019 18:39:05 -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=WLWgfVqD; 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 S1730671AbfC3BaW (ORCPT + 99 others); Fri, 29 Mar 2019 21:30:22 -0400 Received: from mail.kernel.org ([198.145.29.99]:37404 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731419AbfC3BaQ (ORCPT ); Fri, 29 Mar 2019 21:30:16 -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 3A62421773; Sat, 30 Mar 2019 01:30:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1553909415; bh=07/xPOzy7kWoEh2fNQSj0v+wnCt9I2iqJiHt6d0Em4Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WLWgfVqDJTfW0sU8PwHCamWndZGdRy/2v6eSfuwdCto6lhN5dX3GRZP9th/2GBcEM 5huvopKMgHZ5MGF8IxPP6B+AOovj2BU2ddtz+cdvO8ARwucih4sJ5HQy3Kmu5hqpLT 9L7p9ikwi8JEb6N+tsuDMCO2xN6u5yQNT3Es/gMM= 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.19 41/57] soc/tegra: pmc: Drop locking from tegra_powergate_is_powered() Date: Fri, 29 Mar 2019 21:28:34 -0400 Message-Id: <20190330012854.32212-41-sashal@kernel.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190330012854.32212-1-sashal@kernel.org> References: <20190330012854.32212-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 ed71a4c9c8b2..4b452f36f054 100644 --- a/drivers/soc/tegra/pmc.c +++ b/drivers/soc/tegra/pmc.c @@ -524,16 +524,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