Re: [PATCH] ASoC: Intel: Handle device properties with software node API

From: Heikki Krogerus
Date: Tue Mar 23 2021 - 05:29:07 EST


On Mon, Mar 22, 2021 at 10:02:40AM -0500, Pierre-Louis Bossart wrote:
>
>
> On 3/22/21 6:06 AM, Heikki Krogerus wrote:
> > The function device_add_properties() is going to be removed.
> > Replacing it with software node API equivalents.
> >
> > Signed-off-by: Heikki Krogerus <heikki.krogerus@xxxxxxxxxxxxxxx>
> > ---
> > Hi,
> >
> > This patch depends on a fix from mainline, available in v5.12-rc4:
> >
> > 2a92c90f2ecc ("software node: Fix device_add_software_node()")
> >
> > Cheers,
> > ---
> > sound/soc/intel/boards/bytcht_es8316.c | 2 +-
> > sound/soc/intel/boards/bytcr_rt5640.c | 2 +-
> > sound/soc/intel/boards/bytcr_rt5651.c | 2 +-
> > sound/soc/intel/boards/sof_sdw_rt711.c | 20 +++++++++++++++-----
> > sound/soc/intel/boards/sof_sdw_rt711_sdca.c | 20 +++++++++++++++-----
> > 5 files changed, 33 insertions(+), 13 deletions(-)
> >
> > diff --git a/sound/soc/intel/boards/bytcht_es8316.c b/sound/soc/intel/boards/bytcht_es8316.c
> > index 06df2d46d910b..4a9817a95928c 100644
> > --- a/sound/soc/intel/boards/bytcht_es8316.c
> > +++ b/sound/soc/intel/boards/bytcht_es8316.c
> > @@ -544,7 +544,7 @@ static int snd_byt_cht_es8316_mc_probe(struct platform_device *pdev)
> > props[cnt++] = PROPERTY_ENTRY_BOOL("everest,jack-detect-inverted");
> > if (cnt) {
> > - ret = device_add_properties(codec_dev, props);
> > + ret = device_create_managed_software_node(codec_dev, props, NULL);
>
> I don't think this is correct. This is using the codec_dev device, but this
> property is created in the machine driver - different device. I think the
> proper fix is to remove the property in the machine driver .remove()
> callback, as done below for the SoundWire case, and not to rely on devm_
> with the wrong device.
>
> there was a thread between July and October on this in
> https://github.com/thesofproject/linux/pull/2306/
>
> It seems that we need to restart this work.
>
> Heikki, do you mind if I take your patches (keeping you as the author) and
> rework+test them with the SOF tree + CI ?

OK by me (though, I'm not sure about the author part after that).


thanks,

--
heikki