From patchwork Thu Jan 2 22:06:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 234639 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 53469C3276C for ; Thu, 2 Jan 2020 22:43:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 19A8120866 for ; Thu, 2 Jan 2020 22:43:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578005023; bh=i3r2YVtZHaXxjrHcpKUexnyVw10KSTmfADbaLgjH4Po=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=qMvKfxvdVwaBT6plaD9oQmRdDj9zQQBpDEIj7uAttxSxZ41i4sFYefwt6a7BL976f hKWdWjvVx4h5SZwW+K/QzF2hNGdfbXrMIrLuw95BtCIljqyW1I4eu2fXvS6LKBBXKK /HBGBSy5VZYxqncGO6KkzsKZgMIepJ/DfGAcaRig= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730397AbgABWeZ (ORCPT ); Thu, 2 Jan 2020 17:34:25 -0500 Received: from mail.kernel.org ([198.145.29.99]:42848 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730704AbgABWeV (ORCPT ); Thu, 2 Jan 2020 17:34:21 -0500 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 B069522314; Thu, 2 Jan 2020 22:34:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578004461; bh=i3r2YVtZHaXxjrHcpKUexnyVw10KSTmfADbaLgjH4Po=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ig9i91/RjuCxORy2kzwFEVcrvr10spgbyqTnHb4ZXbLhLABvM7C3deZ6L4HVwreT7 hhUnsBDjxaAm280obL96p76moD/xPmE5zJqe4Bnw4Sz0UIalnPDCR8cDXWpeWtcev8 NK6oTk1YS8XYx/exHDUQfKWMUDHlkJ/eqF3hz+WU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Aaro Koskinen , Adam Ford , =?utf-8?q?Pali_Roh=C3=A1r?= , Sebastian Reichel , Tero Kristo , Tony Lindgren , Herbert Xu , Sasha Levin Subject: [PATCH 4.4 017/137] hwrng: omap3-rom - Call clk_disable_unprepare() on exit only if not idled Date: Thu, 2 Jan 2020 23:06:30 +0100 Message-Id: <20200102220548.982890368@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200102220546.618583146@linuxfoundation.org> References: <20200102220546.618583146@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Tony Lindgren [ Upstream commit eaecce12f5f0d2c35d278e41e1bc4522393861ab ] When unloading omap3-rom-rng, we'll get the following: WARNING: CPU: 0 PID: 100 at drivers/clk/clk.c:948 clk_core_disable This is because the clock may be already disabled by omap3_rom_rng_idle(). Let's fix the issue by checking for rng_idle on exit. Cc: Aaro Koskinen Cc: Adam Ford Cc: Pali Rohár Cc: Sebastian Reichel Cc: Tero Kristo Fixes: 1c6b7c2108bd ("hwrng: OMAP3 ROM Random Number Generator support") Signed-off-by: Tony Lindgren Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin --- drivers/char/hw_random/omap3-rom-rng.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/char/hw_random/omap3-rom-rng.c b/drivers/char/hw_random/omap3-rom-rng.c index a405cdcd8dd2..4813f9406a8f 100644 --- a/drivers/char/hw_random/omap3-rom-rng.c +++ b/drivers/char/hw_random/omap3-rom-rng.c @@ -119,7 +119,8 @@ static int omap3_rom_rng_probe(struct platform_device *pdev) static int omap3_rom_rng_remove(struct platform_device *pdev) { hwrng_unregister(&omap3_rom_rng_ops); - clk_disable_unprepare(rng_clk); + if (!rng_idle) + clk_disable_unprepare(rng_clk); return 0; }