Re: [PATCH v1 1/5] ASoC: Intel: bytcht_cx2072x: Replace open coded acpi_dev_put()
From: Pierre-Louis Bossart
Date: Tue Jan 03 2023 - 11:07:48 EST
On 1/2/23 14:30, Andy Shevchenko wrote:
> Instead of calling put_device(&adev->dev) where adev is a pointer
> to an ACPI device, use specific call, i.e. acpi_dev_put().
>
> Also move it out of the conditional to make it more visible in case
> some other code will be added which may use that pointer. We need
> to keep a reference as long as we use the pointer.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
Answering for the series: we should make the change across all Intel
machine drivers. I see at least four cases that were missed
bytcr_rt5640.c: put_device(&adev->dev);
bytcr_rt5651.c: put_device(&adev->dev);
bytcr_wm5102.c: put_device(&adev->dev);
sof_es8336.c: put_device(&adev->dev);
> ---
> sound/soc/intel/boards/bytcht_cx2072x.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/sound/soc/intel/boards/bytcht_cx2072x.c b/sound/soc/intel/boards/bytcht_cx2072x.c
> index 41cec67157b6..9942a2de6f7a 100644
> --- a/sound/soc/intel/boards/bytcht_cx2072x.c
> +++ b/sound/soc/intel/boards/bytcht_cx2072x.c
> @@ -253,9 +253,9 @@ static int snd_byt_cht_cx2072x_probe(struct platform_device *pdev)
> if (adev) {
> snprintf(codec_name, sizeof(codec_name), "i2c-%s",
> acpi_dev_name(adev));
> - put_device(&adev->dev);
> byt_cht_cx2072x_dais[dai_index].codecs->name = codec_name;
> }
> + acpi_dev_put(adev);
>
> /* override platform name, if required */
> ret = snd_soc_fixup_dai_links_platform_name(&byt_cht_cx2072x_card,