From nobody Mon Sep 29 22:49:03 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9B506C00140 for ; Mon, 15 Aug 2022 23:14:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241627AbiHOXOa (ORCPT ); Mon, 15 Aug 2022 19:14:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42514 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241267AbiHOXNO (ORCPT ); Mon, 15 Aug 2022 19:13:14 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E349F74DEE; Mon, 15 Aug 2022 13:00:53 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 1A2E2B80EAD; Mon, 15 Aug 2022 20:00:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6C505C433D6; Mon, 15 Aug 2022 20:00:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593650; bh=HlBebKpEE0JFe5Tqbf+1zibKNm60Ko2VD1mV+7WZAyg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CHpgN3oNLmRKSVef+BFsxnu/zdK/i8KUaXiN4OJiaug74CPzfL0eGgRibJJ87sQsH ggE9tbN2pfySs06SIIhWDuTQzvqF7V6FMIWOjeu34eJeH/Ec+yQKELRpol5nU/mER3 eHLfMywSGg7KUNm0FISbRgVtLwMNbG8OXsXNx1So= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= , Emil Renner Berthing , Thierry Reding , Sasha Levin Subject: [PATCH 5.19 0302/1157] pwm: sifive: Shut down hardware only after pwmchip_remove() completed Date: Mon, 15 Aug 2022 19:54:18 +0200 Message-Id: <20220815180451.730208685@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180439.416659447@linuxfoundation.org> References: <20220815180439.416659447@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Uwe Kleine-K=C3=B6nig [ Upstream commit 2375e964d541bb09158cd2dff67b5d74e8de61cd ] The PWMs are expected to be functional until pwmchip_remove() is called. So disable the clks only afterwards. Fixes: 9e37a53eb051 ("pwm: sifive: Add a driver for SiFive SoC PWM") Signed-off-by: Uwe Kleine-K=C3=B6nig Tested-by: Emil Renner Berthing Signed-off-by: Thierry Reding Signed-off-by: Sasha Levin --- drivers/pwm/pwm-sifive.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/pwm/pwm-sifive.c b/drivers/pwm/pwm-sifive.c index 3fbc1d96fcb6..1b61344c7cd1 100644 --- a/drivers/pwm/pwm-sifive.c +++ b/drivers/pwm/pwm-sifive.c @@ -320,6 +320,9 @@ static int pwm_sifive_remove(struct platform_device *de= v) struct pwm_device *pwm; int ch; =20 + pwmchip_remove(&ddata->chip); + clk_notifier_unregister(ddata->clk, &ddata->notifier); + for (ch =3D 0; ch < ddata->chip.npwm; ch++) { pwm =3D &ddata->chip.pwms[ch]; if (pwm->state.enabled) @@ -327,8 +330,6 @@ static int pwm_sifive_remove(struct platform_device *de= v) } =20 clk_unprepare(ddata->clk); - pwmchip_remove(&ddata->chip); - clk_notifier_unregister(ddata->clk, &ddata->notifier); =20 return 0; } --=20 2.35.1