Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3081213rwb; Mon, 15 Aug 2022 17:39:47 -0700 (PDT) X-Google-Smtp-Source: AA6agR68F5EwNerjTbQMh/EucSWgp7AJlrGHoZD//dMe8OJb+tKxBdNSQ4WIQfHHV4eWPyjQmqZ/ X-Received: by 2002:a17:907:a055:b0:730:a432:99d3 with SMTP id gz21-20020a170907a05500b00730a43299d3mr11315533ejc.690.1660610387032; Mon, 15 Aug 2022 17:39:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660610387; cv=none; d=google.com; s=arc-20160816; b=lfbjmcI7GCORdqWKGpTH2VgYiYioHYVS54yS4jLY5GoWaZBpS7alGUKHCXjQdfR5Fl eP7teC1dTdlpkv/+oNM+JAfDQVM5KY18votc1PJV/4/xBI9tfDbbv9wZFAAq6V+rmIqV p9uauKTu6GjQQgbRs22TE5X2Xqyd0M7FedvPkC3V+dfmNpfapa90f4yW7/NabCyC3h/I nmqeGV4Gy9cEOLXdTKhAOZo0OIfL8O+RHlU/YhmTQzVOzZgbexlrqkYkZde6WSc0iUXd HuxCzDKFNnFQFK0Mc1OQMmsNfEef76LSY6HK9saE6UgpGig6teCtXXN1VVAtjLGaOWwL q8vw== 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=oKRoqp7nn+ML1+Pof1dKPmv1wLwuZdD3UWm3DT/61QM=; b=gHuuTT/jgiE1ld9CvBpI203czdQBxe4cqc04NQreWjCBd09AwBbWpk3WHxbk7IhPvO 98Z62i2nVLEu+8jWdmA9xnLaaMa8FIhgzkIs/raW4pCTTtBZVuxRn0hgGb/1SY8ok38g mHeDEJcRjUhWCEbh0IU1kks+ooESiE3S9T0+EqRneqIeZpiFn2ohUHv7//4smGHf+OxV GdgjmIZLf5wlJf++DjfZFLm2Thu9JxQZWFBbO82QfNJnjV4NsdfwAjOu3aFSIoyFikD4 TjBxCtZNXo5cyQCkiTA0g2k++EWFEn5Gb5i1XTk/2SacQuH3CBUrqYO76HWd50XfVIZv 55Xw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=CHpgN3oN; 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 hb40-20020a170907162800b0072ab62adfe9si11214302ejc.237.2022.08.15.17.39.22; Mon, 15 Aug 2022 17:39:47 -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=CHpgN3oN; 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 S1344582AbiHOXO3 (ORCPT + 99 others); Mon, 15 Aug 2022 19:14:29 -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: 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 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 *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) @@ -327,8 +330,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