From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 139C73E1CFF for ; Wed, 20 May 2026 13:11:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779282698; cv=none; b=He9KfsUw54uRHcSaAcOhkIuTmTHhf6w4zjnsCwWFLpZwn9j2TohuAPgppy3LM6IhP0QVU07EgRPFj1/F1VTEmyzlbEApjCtFMG0rRtqgBppDZzNEwspXTO7tnDtjlCtRrJ+o042IuqviaKdSoaFDfUd71mj953Twt7loCKtA5pg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779282698; c=relaxed/simple; bh=XCrL1C1+HKmP8OFnLWGIJlenjNQzUHpyAE+k5vnkosY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ROH24ShRSRPciLWpJTM/7R7sqRsSbBIjcgOxbKFnkL4tFv1ZDdBDz6zw5evIIUvod5aHwC3CBh2kP6MhZtNJF2gfTowOkKeUDljz9/pK+eAZLHwsxEnhmo35ipNDc651C6stJ65DfLrx4iSHQZNrdQp8nT4wU4goG6CtKgqZd2I= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=QjUU2/+0; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="QjUU2/+0" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B90DA1F00893; Wed, 20 May 2026 13:11:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1779282691; bh=ap9T3Dxi6F5RmdAiPBME85ij9yh4i/iyjNHy1SyzQuU=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=QjUU2/+0TTx+Sv+hpwMNLpWlDCfZM1NSZzt+rbt4ysOtx/y6oib/Phb0rHJ3wVYro jQ4PIJBpANqeWhQnbAa7w+hV61l68Jc6Lf0mItjYS9qLQIciv66g2wFXVMNyWnhFta wdF4rL2XQtBeKlHWKz0WsnIuxwdXHdWRG+Madr9GLhO702ud6Kp2JEJqi2hYDQ+Yqh WzmR7LhqwWPXD50gNL25QwETif5a+E7HRbLnvM0DL2IDlmgW31PSL0OgShYCltNclq +G/IhHbl8lYJopYsHDFv+BYHGdGYlH9qIqV3AIJIMd5g4YfZtbH9w5a5el2zpxKCTw f1LGae0TURd0g== From: Sasha Levin To: stable@vger.kernel.org Cc: Johan Hovold , Yash Shah , Mark Brown , Sasha Levin Subject: [PATCH 6.18.y 2/2] spi: sifive: fix controller deregistration Date: Wed, 20 May 2026 09:11:28 -0400 Message-ID: <20260520131128.3608456-2-sashal@kernel.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260520131128.3608456-1-sashal@kernel.org> References: <2026051546-bulldog-wildcat-3dd3@gregkh> <20260520131128.3608456-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Johan Hovold [ Upstream commit 0f25236694a2854627c1597465a071e6bb6fe572 ] Make sure to deregister the controller before disabling underlying resources like interrupts during driver unbind. Note that clocks were also disabled before the recent commit 140039c23aca ("spi: sifive: Simplify clock handling with devm_clk_get_enabled()"). Fixes: 484a9a68d669 ("spi: sifive: Add driver for the SiFive SPI controller") Cc: stable@vger.kernel.org # 5.1 Cc: Yash Shah Signed-off-by: Johan Hovold Link: https://patch.msgid.link/20260410081757.503099-15-johan@kernel.org Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- drivers/spi/spi-sifive.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/spi/spi-sifive.c b/drivers/spi/spi-sifive.c index 90be9fbab7071..d6e0f12e86b82 100644 --- a/drivers/spi/spi-sifive.c +++ b/drivers/spi/spi-sifive.c @@ -393,7 +393,7 @@ static int sifive_spi_probe(struct platform_device *pdev) dev_info(&pdev->dev, "mapped; irq=%d, cs=%d\n", irq, host->num_chipselect); - ret = devm_spi_register_controller(&pdev->dev, host); + ret = spi_register_controller(host); if (ret < 0) { dev_err(&pdev->dev, "spi_register_host failed\n"); goto put_host; @@ -412,8 +412,14 @@ static void sifive_spi_remove(struct platform_device *pdev) struct spi_controller *host = platform_get_drvdata(pdev); struct sifive_spi *spi = spi_controller_get_devdata(host); + spi_controller_get(host); + + spi_unregister_controller(host); + /* Disable all the interrupts just in case */ sifive_spi_write(spi, SIFIVE_SPI_REG_IE, 0); + + spi_controller_put(host); } static int sifive_spi_suspend(struct device *dev) -- 2.53.0