From: Mark Brown <broonie@kernel.org>
To: Lino Sanfilippo <LinoSanfilippo@gmx.de>
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
Date: Mon, 4 Oct 2021 13:49:21 +0100 [thread overview]
Message-ID: <YVr4USeiIoQJ0Pqh@sirena.org.uk> (raw)
In-Reply-To: <2c4d7115-7a02-f79e-c91b-3c2dd54051b2@gmx.de>
[-- Attachment #1.1: Type: text/plain, Size: 1393 bytes --]
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 = platform_get_drvdata(pdev);
> struct bcm2835_spi *bs = spi_controller_get_devdata(ctlr);
>
> if (ctlr->dma_tx)
> dmaengine_terminate_sync(ctlr->dma_tx);
>
> if (ctlr->dma_rx)
> dmaengine_terminate_sync(ctlr->dma_rx);
>
> /* Clear FIFOs, and disable the HW block */
> bcm2835_wr(bs, BCM2835_SPI_CS,
> BCM2835_SPI_CS_CLEAR_RX | BCM2835_SPI_CS_CLEAR_TX);
>
> 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?
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
[-- Attachment #2: Type: text/plain, Size: 176 bytes --]
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2021-10-04 12:51 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-28 19:56 [PATCH] spi: bcm2835: do not unregister controller in shutdown handler Lino Sanfilippo
2021-09-28 20:08 ` Mark Brown
2021-09-29 8:38 ` Aw: " Lino Sanfilippo
2021-10-01 17:54 ` Mark Brown
2021-10-03 15:25 ` Lino Sanfilippo
2021-10-04 12:49 ` Mark Brown [this message]
2021-10-04 13:17 ` Jason Gunthorpe
2021-10-04 14:12 ` Mark Brown
2021-10-04 15:44 ` Jason Gunthorpe
2021-10-04 16:31 ` Mark Brown
2021-10-04 16:36 ` Florian Fainelli
2021-10-04 16:51 ` Jason Gunthorpe
2021-10-04 16:55 ` Florian Fainelli
2021-10-04 17:13 ` Jason Gunthorpe
2021-10-04 17:27 ` Mark Brown
2021-10-04 17:35 ` Jason Gunthorpe
2021-10-04 17:44 ` Florian Fainelli
2021-10-04 17:56 ` Mark Brown
2021-10-04 17:05 ` Mark Brown
2021-10-04 16:52 ` Mark Brown
2021-10-04 16:57 ` Florian Fainelli
2021-10-04 18:30 ` Lino Sanfilippo
2021-10-04 18:37 ` Jason Gunthorpe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YVr4USeiIoQJ0Pqh@sirena.org.uk \
--to=broonie@kernel.org \
--cc=LinoSanfilippo@gmx.de \
--cc=bcm-kernel-feedback-list@broadcom.com \
--cc=f.fainelli@gmail.com \
--cc=jgg@ziepe.ca \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-integrity@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rpi-kernel@lists.infradead.org \
--cc=linux-spi@vger.kernel.org \
--cc=nsaenz@kernel.org \
--cc=p.rosenberger@kunbus.com \
--cc=rjui@broadcom.com \
--cc=sbranden@broadcom.com \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox