Re: [PATCH v3 06/13] ASoC: simple-card-utils: Expose new members for asoc_simple_priv

From: Sameer Pujar
Date: Fri Oct 02 2020 - 04:59:26 EST



diff --git a/include/sound/simple_card_utils.h b/include/sound/simple_card_utils.h
index 86a1e95..9825308 100644
--- a/include/sound/simple_card_utils.h
+++ b/include/sound/simple_card_utils.h
@@ -56,6 +56,10 @@ struct asoc_simple_priv {
struct asoc_simple_dai *dais;
struct snd_soc_codec_conf *codec_conf;
struct gpio_desc *pa_gpio;
+ const struct snd_soc_ops *ops;
+ unsigned int force_dpcm:1;
+ uintptr_t dpcm_selectable;
+ void *data;
};
I have opinions about these.


About dpcm_selectable, indeed current audio-graph is using it as "uintptr_t",
but as you know, it checks whether it was non-NULL or not only.
This means we can use it as bit-field.

Yes that is true. Something like this would work?

graph_probe(...)
{
    ...

    if (of_device_get_match_data(dev))
        priv->dpcm_selectable = 1;

    ...
}



BTW, do we need to have dpcm_selectable at priv ?

Tegra audio graph driver does not require this because already it is populating 'force_dpcm' flag and having 'selectable' does not make much sense for it.


One note is that, -scu- user is only me (locally),
and it will be removed when audio-graph2 was created.
(My plan is keep code for you, but remove compatible)

Right now I am just keeping it to allow current code work. Later you can remove this during graph2.


About *data, I think we can avoid *data
if driver side priv includes asoc_simple_priv ?

struct my_priv {
struct asoc_simple_priv *simple;
...
};

#define simple_to_priv(_simple) container_of((_simple), struct my_priv, simple)


This seems like a better plan, will do this.