Re: [alsa-devel] [PATCH v5 09/17] soundwire: intel: remove platform devices and use 'Master Devices' instead

From: Pierre-Louis Bossart
Date: Tue Jan 14 2020 - 12:48:24 EST



I am quoting the code in patch, which i pointed in my first reply!

On 17-12-19, 15:03, Pierre-Louis Bossart wrote:

diff --git a/drivers/soundwire/intel_init.c b/drivers/soundwire/intel_init.c
index 4b769409f6f8..42f7ae034bea 100644
--- a/drivers/soundwire/intel_init.c

This is intel specific file...

+++ b/drivers/soundwire/intel_init.c

snip ...

+static struct sdw_intel_ctx
+*sdw_intel_probe_controller(struct sdw_intel_res *res)

this is intel driver, intel function!

-
- link->pdev = pdev;
- link++;
+ /* let the SoundWire master driver to its probe */
+ md->driver->probe(md, link);
^^^^^^
which does this... calls a probe()!

And my first reply was:

+ /* let the SoundWire master driver to its probe */
+ md->driver->probe(md, link);

So you are invoking driver probe here.. That is typically role of driver
core to do that.. If we need that, make driver core do that for you!

I rest my case!

I think you are too focused on the probe case and not realizing the extensions suggested by this patchset. A "driver" is not limited to 'probe' and 'remove' cases.

As mentioned since mid-September, there is a need for an initialization of software/kernel structures (which I called probe but should have been called init really), and a second step where the hardware is actually configured - after all power rail dependencies are under control.

Can you please look at the .startup callback and let me know how a 'driver core' would handle this?

To the best of my knowledge, there is no .startup in any device model functionality, so the only thing I could do to avoid a direct call is add a wrapper to avoid a direct call, e.g.

static inline sdw_master_device_startup(struct sdw_master_device *md)
{
if (md && md->driver && md->driver->startup)
md->driver->startup(md);
}