From mboxrd@z Thu Jan 1 00:00:00 1970 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B83FAC433EF for ; Mon, 4 Oct 2021 12:51:18 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 816A56136F for ; Mon, 4 Oct 2021 12:51:18 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 816A56136F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Content-Type: List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: In-Reply-To:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date: Reply-To:Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date :Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=HT6j82gN/Sg0HFUGmn585tZ+PojVuyE66gE+LwozxbM=; b=E/An/pxbZXduY44xh3x60Akjrv CBYSLnuEqU7ZaDy5VPibpuemVMdyyGWBxGa4xA5LsMNy27hLwogBP2Yks00th0FmrvtaJ7AKLCCSM rciLKVlaF1eHk3mCU57sA2HhwYQ+R4S8qJoMjWXu/KCKvKG1Bg2OGZHb5Rv7pQ1gLGoWZpS5nskL8 gS4//FNLpBxWUz4rEs6g9J1Iq/rkSbwCkFCbQJOAM1uqe0pDyt/3maspG9m0x7I0h5lF43qnuq+zX uPSB/ZE7DmxF2AL++JdfhRBWk97c6ZvTDLjC18ZbCCuyqaIOPYe/rz/tyNcRA7J2dQ4QnCH72VYtr I/t3asPQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mXNPM-006V2a-49; Mon, 04 Oct 2021 12:49:28 +0000 Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mXNPI-006V1l-NC; Mon, 04 Oct 2021 12:49:26 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id B20396124C; Mon, 4 Oct 2021 12:49:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1633351764; bh=+HwUhsuP6MVKRpgbKf+vXOZOCYCgZp8OBkYFKe3NbyE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=k2rzhQnyHr6jnh5xTvXNa+gPYf7uCWtdQFWsNzYolRM5TM7kOLAMEB7LcZbNLATU+ bKxpbxah0ol0M/TGU7dAGCKTyYZTtbqfEpP95HRHVv8bZvL+s8/Ad1XN1AJoYpbCek 8nGPkVECzAcDKAd/tUXPTEP9fLZ6hzNoD1G89zUmpaWqrMP3Ex23OPNLtHrMfwVzeQ 9oPxekGskiNYLVX3ehkEU70vmYdJB6dWnB2b7P0HKAKrMILX6c6B+eab2zbvbrGkth hltyOBaIc+VW5NUL8yyfBZuNBCplwNEf9Tzv/YS4eWVoZaSp84W1HbteTRSK5Ryibq sSCYFvbMBLtbA== Date: Mon, 4 Oct 2021 13:49:21 +0100 From: Mark Brown To: Lino Sanfilippo Cc: f.fainelli@gmail.com, rjui@broadcom.com, sbranden@broadcom.com, bcm-kernel-feedback-list@broadcom.com, nsaenz@kernel.org, linux-spi@vger.kernel.org, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, jgg@ziepe.ca, p.rosenberger@kunbus.com, linux-integrity@vger.kernel.org, stable@vger.kernel.org Subject: Re: [PATCH] spi: bcm2835: do not unregister controller in shutdown handler Message-ID: References: <20210928195657.5573-1-LinoSanfilippo@gmx.de> <20211001175422.GA53652@sirena.org.uk> <2c4d7115-7a02-f79e-c91b-3c2dd54051b2@gmx.de> MIME-Version: 1.0 In-Reply-To: <2c4d7115-7a02-f79e-c91b-3c2dd54051b2@gmx.de> X-Cookie: If it heals good, say it. X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211004_054924_797787_49CA12D0 X-CRM114-Status: GOOD ( 14.78 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: multipart/mixed; boundary="===============8960304479579908489==" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org --===============8960304479579908489== Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="RcF28Bs204Ejhms1" Content-Disposition: inline --RcF28Bs204Ejhms1 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Oct 03, 2021 at 05:25:47PM +0200, Lino Sanfilippo wrote: > I see your point here. So what about narrowing down the shutdown handler > to only disable the hardware: > static void bcm2835_spi_shutdown(struct platform_device *pdev) > { > struct spi_controller *ctlr =3D platform_get_drvdata(pdev); > struct bcm2835_spi *bs =3D spi_controller_get_devdata(ctlr); >=20 > if (ctlr->dma_tx) > dmaengine_terminate_sync(ctlr->dma_tx); >=20 > if (ctlr->dma_rx) > dmaengine_terminate_sync(ctlr->dma_rx); >=20 > /* Clear FIFOs, and disable the HW block */ > bcm2835_wr(bs, BCM2835_SPI_CS, > BCM2835_SPI_CS_CLEAR_RX | BCM2835_SPI_CS_CLEAR_TX); >=20 > clk_disable_unprepare(bs->clk); > } This still leaves a potential race where something (eg, an interrupt handler) could come in and try to schedule more SPI transfers on the shut down hardware. I'm really not sure we can do something that's totally robust here without also ensuring that all the client drivers also have effective shutdown implementations (which seems ambitious) or doing what we have now and unregistering the clients. I am, however, wondering if we really need the shutdown callback at all - the commit adding it just describes what it's doing, it doesn't explain why it's particularly needed. I guess there might be an issue on reboot with reset not completely resetting the hardware? --RcF28Bs204Ejhms1 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAmFa+FEACgkQJNaLcl1U h9Aw9wf/Q1ESD1wDdZcEiaAk3DV1WXkmfSTqsKkW5cXYRyNVoUNqBH6qZIDJWV9t l5qRi5zzy+yxR4mj1JKYTxidOe8N0SxRxqnGus6CQ9ZBjuGWOV9GK6gT+15eoLR4 +g2ew8Kg6j1VBn5tvZyZYvqmKYwd5FxxF5hBE7NeIU8J8nbe5MHWl4jPkJ8SDvJb KofgwdfezKmkR6eioIJtYKKaxUxgK1JWb33TYGQvKXu5MeMoroR0BjoWJ6k/cOim +srK5/1OMyVMBXoHXj8rEHJ+uNEtvXcriwM5UkreCeMiLSpf1ayUehz1wxB0aAXq h5uj2fyE1BzNy1id1yqSDsutP49RkA== =yMkL -----END PGP SIGNATURE----- --RcF28Bs204Ejhms1-- --===============8960304479579908489== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel --===============8960304479579908489==--