Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp2930342rwb; Mon, 15 Aug 2022 14:16:11 -0700 (PDT) X-Google-Smtp-Source: AA6agR5QtCSl/hPf8KpvNxOA/f39kfGyzf9pFI/51lWh6pfi4E9SbsqsESI+wwi7HlVg+hjXmKnT X-Received: by 2002:a17:90b:3ec2:b0:1f7:3f49:17bf with SMTP id rm2-20020a17090b3ec200b001f73f4917bfmr20545025pjb.4.1660598049883; Mon, 15 Aug 2022 14:14:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660598049; cv=none; d=google.com; s=arc-20160816; b=kXsMwu4+2QisQjoqSq7ia5TN+YqgLIIe5DD3t0WxNZscIOHJWMShLile0JiHWW8RJm lh6g4Vh5TIzfw8INFztMCwWpUFEvrB/N2uWnb18eLaRlJHQWJEmH+UaKz2OVVtXe8iSW hkfojsNHVUDWDgQACj34ZdpPLCOMnS+szWEnVj7L/Z2tVmeVAJc9KJhYUm4C7ducX8/K pTp/WJuC9Y1FewXU8Vp2N/7lKScjwn8L05Wpl750WpFxRBIqMCfNHDzqtmHCczo/13uf wIYcCeyi7JZoW6cFe2rMi6tr9s+HOSNRAlqOLtp4Ub2XHSQSjJFvMy7puUFJtVlOD1o+ BBOw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Om9Hr6xqdPvbwYSlvbALAtSX9Zh1LQQYZeTnXj3OlvY=; b=W4s2jGI+tWsrfSzZEDVkgi8oLFynz5N6VmVivSkLUOjJCrw/ge9cBrpgx3D5e2zuyU zjl8Z3gad4iG0Gy75FnCvNyZN1J6kTGkXwxbATNQpN45YzxWukUfQ2XzWuxCXj8xGUM0 gzP6DOIKxwQh2LnVzHIlEqeKtmZqUK7KPRNzGpzV+qhEesA7nSYmKcUfkCq0ZFPL6fSj pqhTkXXEMFjle2q26AKy2F+Lk4HL0NfvOqZr+o6TjyZ74SoC2nfDuNUsF7kyR8Gxl2/c tK2h4HsM0vQpjpDLT0Bbjx1gNGL6/QxjZkqMspYXhilUccyyPQ2fAcOiHj6vNN0gtuO/ pAZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=qnQAPmum; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s6-20020a170902a50600b0016dcacb565csi10376690plq.596.2022.08.15.14.13.58; Mon, 15 Aug 2022 14:14:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=qnQAPmum; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346411AbiHOUzY (ORCPT + 99 others); Mon, 15 Aug 2022 16:55:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54544 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346668AbiHOUyP (ORCPT ); Mon, 15 Aug 2022 16:54:15 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0ABF82B194; Mon, 15 Aug 2022 12:11:04 -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 dfw.source.kernel.org (Postfix) with ESMTPS id 493AC6069E; Mon, 15 Aug 2022 19:11:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4F7CFC433C1; Mon, 15 Aug 2022 19:11:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590663; bh=phN+qSxQHO3xHdsp0Cmw0hMbLrUCSsjAQLXTncAvUFU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qnQAPmum1MN7kLtjOPgzsN5NYJwPtu+1nO5uS850+Ghtgfp372YCd0wqg3tPZgFs4 UPUVpZmCPEHPDanDHTeDURtHlJL7Ac13jIau/bzbgfZaCiEyFJ1AecHdrnAIK7aRaL 03RrVzlATk6rhFq54fvpFgjCyRSJeDoWDZowxq4A= 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.18 0300/1095] pwm: sifive: Shut down hardware only after pwmchip_remove() completed Date: Mon, 15 Aug 2022 19:54:59 +0200 Message-Id: <20220815180442.192147527@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Uwe Kleine-König [ 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önig 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 3936fda53366..58347fcd4812 100644 --- a/drivers/pwm/pwm-sifive.c +++ b/drivers/pwm/pwm-sifive.c @@ -321,6 +321,9 @@ static int pwm_sifive_remove(struct platform_device *dev) struct pwm_device *pwm; int ch; + pwmchip_remove(&ddata->chip); + clk_notifier_unregister(ddata->clk, &ddata->notifier); + for (ch = 0; ch < ddata->chip.npwm; ch++) { pwm = &ddata->chip.pwms[ch]; if (pwm->state.enabled) @@ -328,8 +331,6 @@ static int pwm_sifive_remove(struct platform_device *dev) } clk_unprepare(ddata->clk); - pwmchip_remove(&ddata->chip); - clk_notifier_unregister(ddata->clk, &ddata->notifier); return 0; } -- 2.35.1