Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp2882180rwb; Mon, 15 Aug 2022 13:14:09 -0700 (PDT) X-Google-Smtp-Source: AA6agR66eIN8IGTMrK5dDLpHDG8ZCZttKaN0/TUzkhNyYTUP/W1B0BLpiOvXCA6LJJdRsZQDRQho X-Received: by 2002:a17:907:8317:b0:731:2189:7f4d with SMTP id mq23-20020a170907831700b0073121897f4dmr11106596ejc.468.1660594449186; Mon, 15 Aug 2022 13:14:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660594449; cv=none; d=google.com; s=arc-20160816; b=by7UR7qyFIWR+RMbBYSnGGpdCQX3h9mBmxGMO8/2CMSxb8TJBpLhoi5hlkIZTQ3LIS drXg4AzrUQF/2jOR94fkktJQxOKd0WFXpZ8UFKOhm+qPxrFE2qsAXHogWAilQf+ckaoR k6NNI/SqRjalLKpzrnnoIMyIDcuV7unzonmbNGI8qWIq6Cj5fBbKfUgJwtRA/sadSgYr NSkbOLr27zKDhMA2VlZtp+/x0Y0jAquyDAh97g8I6pjWxWvoykwRfM1PFxeEoemxKyfa TdTHfVAdm7RGmN70B/ycUAhz605Vj04U/OVfB4gk6o3RUY26Z42TvDi+QIwsMbr2/yNF GWnw== 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=qxEycOj+Vx+JAK9mzRfuKd8rx2srEUXAVSHzniDpVKrlojP6K3yaEfDmBHseMwEEgu 83NUjnvz82TumUvV0lugNWgqXDqQt3RuINZQDo0sIZtX6NTwdYL10Rz4xioHbhXyJV5W gBST7Dzn/zIiMryVmpiNfW5MRyhhiPDhvQyS0nbYkES1P1NkFZYHgx+2Fpq/6C92r9v+ OA9OgAuwP1LIrUHyEgbLLNMfwhGrZA/yYQVTC8lHh+xtp3MhkjMfSenjNMPc7ZIPhqpO 2VSchMaHaG+0S//YfrvoD3Ta/a/mW2ddZjdcEmfqHePrKHmauRKTXxWLqkcNAkfYQTQg TmfQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=TFmr9amS; 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 m9-20020a170906720900b0072a7a1bd505si7414586ejk.207.2022.08.15.13.13.43; Mon, 15 Aug 2022 13: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=TFmr9amS; 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 S243939AbiHOSsB (ORCPT + 99 others); Mon, 15 Aug 2022 14:48:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38092 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232907AbiHOSm5 (ORCPT ); Mon, 15 Aug 2022 14:42:57 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4F36B2A43A; Mon, 15 Aug 2022 11:26:34 -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 E386060FC4; Mon, 15 Aug 2022 18:26:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E68ECC433C1; Mon, 15 Aug 2022 18:26:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587993; bh=phN+qSxQHO3xHdsp0Cmw0hMbLrUCSsjAQLXTncAvUFU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TFmr9amSxPdxyYlGXxCq/6XJ7CLHwVUOtJyUXOf6Eh4kY/e2k98OpMDmhnS8C7ceo u+k4HupshKDw8HxzldgFUXpC1tDW9tTAtguylIfafghBmd2w3MRU4HGbCRNYvwQrN7 eOggriTU1w4FS+WTDyOoH+toP1cN3mEHYMudTi6U= 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.15 230/779] pwm: sifive: Shut down hardware only after pwmchip_remove() completed Date: Mon, 15 Aug 2022 19:57:54 +0200 Message-Id: <20220815180347.131601780@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@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