diff mbox series

[1/4] ASoC: Intel: Skylake: Change the order of machine device and platform registration

Message ID 20200421202519.4008-2-mateusz.gorski@linux.intel.com (mailing list archive)
State New, archived
Headers show
Series Add support for different DMIC configurations | expand

Commit Message

Gorski, Mateusz April 21, 2020, 8:25 p.m. UTC
Swap the order of machine device and platform device registration.
This change ensures that even if the codec enumeration falls late - during
the driver module or topology reload - i2s_dev field is always ready to
be used.

Follow-up patch uses data from this field to create alternative topology
name based on used machine device.

Signed-off-by: Mateusz Gorski <mateusz.gorski@linux.intel.com>
---
 sound/soc/intel/skylake/skl.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

Comments

Pierre-Louis Bossart April 21, 2020, 8:49 p.m. UTC | #1
On 4/21/20 3:25 PM, Mateusz Gorski wrote:
> Swap the order of machine device and platform device registration.
> This change ensures that even if the codec enumeration falls late - during
> the driver module or topology reload - i2s_dev field is always ready to
> be used.

Are you sure?

The platform device will register the DAIs that are used by the machine 
driver, don't you have a risk of missing dependencies during the card 
registration with this change?

Put differently, why do this now when the existing code has been 
'working' for a number of years without needing such a change?


> Follow-up patch uses data from this field to create alternative topology
> name based on used machine device.
> 
> Signed-off-by: Mateusz Gorski <mateusz.gorski@linux.intel.com>
> ---
>   sound/soc/intel/skylake/skl.c | 10 +++++-----
>   1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/sound/soc/intel/skylake/skl.c b/sound/soc/intel/skylake/skl.c
> index 63182bfd7941..8473eb13ea65 100644
> --- a/sound/soc/intel/skylake/skl.c
> +++ b/sound/soc/intel/skylake/skl.c
> @@ -819,16 +819,16 @@ static void skl_probe_work(struct work_struct *work)
>   	/* create codec instances */
>   	skl_codec_create(bus);
>   
> -	/* register platform dai and controls */
> -	err = skl_platform_register(bus->dev);
> +	err = skl_machine_device_register(skl);
>   	if (err < 0) {
> -		dev_err(bus->dev, "platform register failed: %d\n", err);
> +		dev_err(bus->dev, "machine register failed: %d\n", err);
>   		goto out_err;
>   	}
>   
> -	err = skl_machine_device_register(skl);
> +	/* register platform dai and controls */
> +	err = skl_platform_register(bus->dev);
>   	if (err < 0) {
> -		dev_err(bus->dev, "machine register failed: %d\n", err);
> +		dev_err(bus->dev, "platform register failed: %d\n", err);
>   		goto out_err;
>   	}
>   
>
Gorski, Mateusz April 22, 2020, 12:03 p.m. UTC | #2
> Swap the order of machine device and platform device registration.
>> This change ensures that even if the codec enumeration falls late - 
>> during
>> the driver module or topology reload - i2s_dev field is always ready to
>> be used.
>
> Are you sure?
>
> The platform device will register the DAIs that are used by the 
> machine driver, don't you have a risk of missing dependencies during 
> the card registration with this change?
>
> Put differently, why do this now when the existing code has been 
> 'working' for a number of years without needing such a change?
>
This change was tested on multiple platforms (including production 
laptops) and did not show any issues.
Anyway, in patchset v2 the alt_tplg_name creation mechanism was slightly 
changed and this patch was removed.

Thanks for your input,
Mateusz
diff mbox series

Patch

diff --git a/sound/soc/intel/skylake/skl.c b/sound/soc/intel/skylake/skl.c
index 63182bfd7941..8473eb13ea65 100644
--- a/sound/soc/intel/skylake/skl.c
+++ b/sound/soc/intel/skylake/skl.c
@@ -819,16 +819,16 @@  static void skl_probe_work(struct work_struct *work)
 	/* create codec instances */
 	skl_codec_create(bus);
 
-	/* register platform dai and controls */
-	err = skl_platform_register(bus->dev);
+	err = skl_machine_device_register(skl);
 	if (err < 0) {
-		dev_err(bus->dev, "platform register failed: %d\n", err);
+		dev_err(bus->dev, "machine register failed: %d\n", err);
 		goto out_err;
 	}
 
-	err = skl_machine_device_register(skl);
+	/* register platform dai and controls */
+	err = skl_platform_register(bus->dev);
 	if (err < 0) {
-		dev_err(bus->dev, "machine register failed: %d\n", err);
+		dev_err(bus->dev, "platform register failed: %d\n", err);
 		goto out_err;
 	}