On Thu, 2024-02-01 at 12:08 +0200, Kalle Valo wrote: > Alexis Lothoré <alexis.lothore@xxxxxxxxxxx> writes: > > > On 1/27/24 01:43, David Mosberger-Tang wrote: > > > Previously, the driver created a net device (typically wlan0) as soon > > > as the module was loaded. This commit changes the driver to follow > > > normal Linux convention of creating the net device only when bus > > > probing detects a supported chip. > > > > As already mentioned multiple times, I am skeptical about the validity of > > keeping netdev registration before chip presence check, but I am not the > > maintainer, so I let Ajay and Kalle decide for this. > > I haven't checked the code but as a general comment I agree with Alexis, > registering netdev before the hardware is ready sounds odd to me. I agree, but it's orthogonal to what my patch does. I did a quick scan and it looks like the cleanest thing to do would be to change all the code below "Spi Internal Read/Write Function" and "Spi interfaces" to take a spi_device pointer instead of the wilc pointer. The probe code could then safely call these lower-level functions without having to worry that they might inadvertently access a part of the wilc structure that hasn't been initialized yet. >From the looks of it, that would probably also shorten the code, since many calls to to_spi_device(wilc->dev) would go away. However, it'd be a major rewrite of spi.c so it better had the buy in of the maintainer(s). --david