Re: [PATCH 1/6] spi: fsl-dspi: Use devm_spi_register_controller()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Sep 22, 2020 at 01:06:52PM +0200, Sascha Hauer wrote:
> On Tue, Sep 22, 2020 at 10:44:37AM +0100, Mark Brown wrote:
> > On Tue, Sep 22, 2020 at 11:32:23AM +0200, Sascha Hauer wrote:

> > > -	/* Disconnect from the SPI framework */
> > > -	spi_unregister_controller(dspi->ctlr);
> > > -
> > >  	/* Disable RX and TX */
> > >  	regmap_update_bits(dspi->regmap, SPI_MCR,
> > >  			   SPI_MCR_DIS_TXF | SPI_MCR_DIS_RXF,

> > Is this fix safe - what happens if we start another transaction between
> > disabling RX/TX and the unregistration taking effect?  Similar concerns
> > apply to some of the other patches.

> I asked myself the same question until I saw that a dozen of other drivers
> also do it like this.

Right, it's unfortunately common for people to just use devm without
thinking about it too hard and it doesn't always get spotted :(

> data. IMO this only works when all drivers are fully managed with devm_*
> functions and runtime pm so that the remove functions for all drivers
> become empty.  Until this happens spi_unregister_controller() has to be
> split up in a function actually unregistering the controller and another
> one freeing the resources.

It's probably easier to just not have this option for allocating driver
data as part of the controller TBH, it's probably mroe trouble to use
safely than it's worth.

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux