On Wed, Sep 25, 2024 at 12:31:34PM +0000, Usyskin, Alexander wrote: > > It's locking/refcounting stuff that looks nothing like any other SPI > > controller driver. Even if it works it's obviously fragile since the > > driver does surprising things which break assumptions that will be made > > by people not looking at this specific driver, and causes people to have > > to spend more effort figuring out what you're doing. If there is any > > benefit to doing this then open coding it in one specific driver is > > clearly not the right place to do it. > The reason for all this refcounting that the device itself is discrete card and > the SPI memory backend can disappear at any moment leaving open connections dangling. > Refcount ensures that object behind the MTD device will be freed only > when the last user-space is disconnected. > Is there any other model that can keep the object alive in this situation? If devices connected to the SPI controller can be hotplugged then those devices should be registered and unregistered like any other spi_device would be, the driver core and relevant subsystems will deal with the lifetime issues. This is all invisible to the SPI controllers, the fact that things are being open coded in the driver should be a big warning sign.
Attachment:
signature.asc
Description: PGP signature