diff mbox series

[2/3] ASoC: topology: Allow TLV control to be either read or write

Message ID 20220111190528.445248-3-amadeuszx.slawinski@linux.intel.com (mailing list archive)
State Superseded
Headers show
Series ASoC: topology: Fixes | expand

Commit Message

Amadeusz Sławiński Jan. 11, 2022, 7:05 p.m. UTC
There is no reason to force readwrite access on TLV controls. It can be
either read, write or both. This is further evidenced in code where it
performs following checks:
                if ((k->access & SNDRV_CTL_ELEM_ACCESS_TLV_READ) && !sbe->get)
                        return -EINVAL;
                if ((k->access & SNDRV_CTL_ELEM_ACCESS_TLV_WRITE) && !sbe->put)
                        return -EINVAL;

Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com>
---
 sound/soc/soc-topology.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Pierre-Louis Bossart Jan. 11, 2022, 4:48 p.m. UTC | #1
On 1/11/22 1:05 PM, Amadeusz Sławiński wrote:
> There is no reason to force readwrite access on TLV controls. It can be
> either read, write or both. This is further evidenced in code where it
> performs following checks:
>                 if ((k->access & SNDRV_CTL_ELEM_ACCESS_TLV_READ) && !sbe->get)
>                         return -EINVAL;
>                 if ((k->access & SNDRV_CTL_ELEM_ACCESS_TLV_WRITE) && !sbe->put)
>                         return -EINVAL;
> 
> Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
> Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com>

Should there be a Fixes tag

Fixes: 1a3232d2f61d ("ASoC: topology: Add support for TLV bytes controls")

?

> ---
>  sound/soc/soc-topology.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/sound/soc/soc-topology.c b/sound/soc/soc-topology.c
> index e0f72ddd72c1..9d24184f85f9 100644
> --- a/sound/soc/soc-topology.c
> +++ b/sound/soc/soc-topology.c
> @@ -512,7 +512,8 @@ static int soc_tplg_kcontrol_bind_io(struct snd_soc_tplg_ctl_hdr *hdr,
>  
>  	if (le32_to_cpu(hdr->ops.info) == SND_SOC_TPLG_CTL_BYTES
>  		&& k->iface & SNDRV_CTL_ELEM_IFACE_MIXER
> -		&& k->access & SNDRV_CTL_ELEM_ACCESS_TLV_READWRITE
> +		&& (k->access & SNDRV_CTL_ELEM_ACCESS_TLV_READ
> +		    || k->access & SNDRV_CTL_ELEM_ACCESS_TLV_WRITE)
>  		&& k->access & SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK) {
>  		struct soc_bytes_ext *sbe;
>  		struct snd_soc_tplg_bytes_control *be;
>
Amadeusz Sławiński Jan. 12, 2022, 8:55 a.m. UTC | #2
On 1/11/2022 5:48 PM, Pierre-Louis Bossart wrote:
> 
> 
> On 1/11/22 1:05 PM, Amadeusz Sławiński wrote:
>> There is no reason to force readwrite access on TLV controls. It can be
>> either read, write or both. This is further evidenced in code where it
>> performs following checks:
>>                  if ((k->access & SNDRV_CTL_ELEM_ACCESS_TLV_READ) && !sbe->get)
>>                          return -EINVAL;
>>                  if ((k->access & SNDRV_CTL_ELEM_ACCESS_TLV_WRITE) && !sbe->put)
>>                          return -EINVAL;
>>
>> Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
>> Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com>
> 
> Should there be a Fixes tag
> 
> Fixes: 1a3232d2f61d ("ASoC: topology: Add support for TLV bytes controls")
> 
> ?

I guess it won't hurt, will add and send v2, thanks!
diff mbox series

Patch

diff --git a/sound/soc/soc-topology.c b/sound/soc/soc-topology.c
index e0f72ddd72c1..9d24184f85f9 100644
--- a/sound/soc/soc-topology.c
+++ b/sound/soc/soc-topology.c
@@ -512,7 +512,8 @@  static int soc_tplg_kcontrol_bind_io(struct snd_soc_tplg_ctl_hdr *hdr,
 
 	if (le32_to_cpu(hdr->ops.info) == SND_SOC_TPLG_CTL_BYTES
 		&& k->iface & SNDRV_CTL_ELEM_IFACE_MIXER
-		&& k->access & SNDRV_CTL_ELEM_ACCESS_TLV_READWRITE
+		&& (k->access & SNDRV_CTL_ELEM_ACCESS_TLV_READ
+		    || k->access & SNDRV_CTL_ELEM_ACCESS_TLV_WRITE)
 		&& k->access & SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK) {
 		struct soc_bytes_ext *sbe;
 		struct snd_soc_tplg_bytes_control *be;