alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Revert "ASoC: core: mark SND_SOC_BYTES_EXT as deprecated"
@ 2016-09-15 13:45 Takashi Sakamoto
  2016-09-15 14:21 ` Charles Keepax
  0 siblings, 1 reply; 10+ messages in thread
From: Takashi Sakamoto @ 2016-09-15 13:45 UTC (permalink / raw)
  To: clemens, tiwai; +Cc: vinod.koul, alsa-devel, ckeepax, broonie

SND_SOC_BYTES_TLV brings confusions to user land because it doesn't follow
to a protocol of ctl and tlv operation. At least, this macro and related
kernel APIs include two misunderstandings:
 - 'struct snd_ctl_elem_info.count' can also represent the length of TLV
   packet paylaod, snd_soc_bytes_info_ext() performs in this way.
 - 'struct snd_ctl_tlv.tlv' can include arbitrary data regardless of TLV
   packet structure, snd_soc_bytes_tlv_callback() performs in this way.

In a policy of kernel land development, it's quite worse to break protocols
for applications. Therefore, developers are discouraged to use these kernel
APIs.

In the first place, SND_SOC_BYTES_TLV was added to satisfy a request of
developers who need to add control elements which transfer data larger than
the size which 'struct snd_ctl_elem_value' can represent; e.g. over 512
bytes. However, as long as the size is less than the size; e.g. 512 bytes,
SND_SOC_BYTES_EXT is still available. Although there is actually the
limitation of maximum data size, it's better to use this API for stable
application interface till better alternative ways are implemented in
future.

For these reasons, this commit reverts the previous commit which lead
developers to the worse behaviour.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
---
 include/sound/soc.h | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/include/sound/soc.h b/include/sound/soc.h
index 6144882..18f7d21 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -311,9 +311,6 @@
 		{.base = xbase, .num_regs = xregs,	      \
 		 .mask = xmask }) }
 
-/*
- * SND_SOC_BYTES_EXT is deprecated, please USE SND_SOC_BYTES_TLV instead
- */
 #define SND_SOC_BYTES_EXT(xname, xcount, xhandler_get, xhandler_put) \
 {	.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
 	.info = snd_soc_bytes_info_ext, \
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 10+ messages in thread
* [PATCH] Revert "ASoC: core: mark SND_SOC_BYTES_EXT as deprecated"
@ 2016-09-15 23:06 Takashi Sakamoto
  2016-09-16 10:52 ` Mark Brown
  0 siblings, 1 reply; 10+ messages in thread
From: Takashi Sakamoto @ 2016-09-15 23:06 UTC (permalink / raw)
  To: clemens, tiwai, broonie; +Cc: vinod.koul, alsa-devel, ckeepax

SND_SOC_BYTES_EXT was added by commit d98812082c87 ("ASoC: add
SND_SOC_BYTES_EXT") to allow drivers to transfer arbitrary byte-aligned
data to/from devices via ALSA control interface. Later, SND_SOC_BYTES_TLV
was added by commit 7523a271682f ("ASoC: core: add a helper for extended
byte controls using TLV") was added for the same purpose and developers
expected this to obsolete the former.

However, SND_SOC_BYTES_TLV brought confusions to user land because it
doesn't follow to a protocol of ALSA control interface. At least, this
macro and related kernel APIs include two misunderstandings:
 - 'struct snd_ctl_elem_info.count' can also represent the length of TLV
   packet paylaod, snd_soc_bytes_info_ext() performs in this way.
 - 'struct snd_ctl_tlv.tlv' can include arbitrary data regardless of TLV
   packet structure, snd_soc_bytes_tlv_callback() performs in this way.

In a policy of kernel land development, it's quite worse to break protocols
for applications. Therefore, developers are discouraged to use these kernel
APIs.

In the first place, SND_SOC_BYTES_TLV was added to satisfy a request of
developers who need to add control elements which transfer data larger than
the size which 'struct snd_ctl_elem_value' can represent; e.g. over 512
bytes. As long as the size is less than the size, SND_SOC_BYTES_EXT is
still available. Although there is the limitation of maximum data size,
it's better to use this API for stable application interface till better
alternative ways are implemented in future.

For these reasons, this commit reverts the previous commit which lead
developers to the worse behaviour. Unfortunately, SND_SOC_BYTES_TLV was
already merged in development cycle for kernel 3.17 and published, so
this commit doesn't touch it for any compatibilities.

Reference: http://mailman.alsa-project.org/pipermail/alsa-devel/2013-November/069483.html
Reference: commit d98812082c87 ("ASoC: add SND_SOC_BYTES_EXT")
Reference: commit 7523a271682f ("ASoC: core: add a helper for extended byte controls using TLV")
Cc: Vinod Koul <vinod.koul@intel.com>
Acked-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
---
 include/sound/soc.h | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/include/sound/soc.h b/include/sound/soc.h
index 6144882..18f7d21 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -311,9 +311,6 @@
 		{.base = xbase, .num_regs = xregs,	      \
 		 .mask = xmask }) }
 
-/*
- * SND_SOC_BYTES_EXT is deprecated, please USE SND_SOC_BYTES_TLV instead
- */
 #define SND_SOC_BYTES_EXT(xname, xcount, xhandler_get, xhandler_put) \
 {	.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
 	.info = snd_soc_bytes_info_ext, \
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2016-09-16 14:11 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-09-15 13:45 [PATCH] Revert "ASoC: core: mark SND_SOC_BYTES_EXT as deprecated" Takashi Sakamoto
2016-09-15 14:21 ` Charles Keepax
2016-09-15 14:41   ` Takashi Sakamoto
2016-09-15 14:54     ` Mark Brown
2016-09-15 22:29       ` Takashi Sakamoto
2016-09-15 23:26         ` Takashi Sakamoto
  -- strict thread matches above, loose matches on Subject: below --
2016-09-15 23:06 Takashi Sakamoto
2016-09-16 10:52 ` Mark Brown
2016-09-16 13:21   ` Takashi Sakamoto
2016-09-16 14:11     ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).