linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH V1 0/1]ASoC: compress: propagate the error code from the compress framework
@ 2022-02-23 12:52 Raghu Bankapur
  2022-02-23 12:52 ` [PATCH V1 1/1] ASoC: " Raghu Bankapur
  0 siblings, 1 reply; 7+ messages in thread
From: Raghu Bankapur @ 2022-02-23 12:52 UTC (permalink / raw)
  To: Jaroslav Kysela, linux-kernel, Takashi Iwai, alsa-devel
  Cc: Krishna Jha, Raghu Bankapur

Propagate the error code from the compress framework for the timestamp
query. This error code will be used by the client to handle the
error case scenarios gracefully.

This propgated error is used by direct client like Audio HAL through
IOCTL -SNDRV_COMPRESS_TSTAMP response, further this response is sent
to upper layer, based on this error audio related usecases related 
to render position and presentation are handled.

Raghu Bankapur (1):
  ASoC: compress: propagate the error code from the compress framework

 sound/core/compress_offload.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

-- 
2.17.1


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

* [PATCH V1 1/1] ASoC: compress: propagate the error code from the compress framework
  2022-02-23 12:52 [PATCH V1 0/1]ASoC: compress: propagate the error code from the compress framework Raghu Bankapur
@ 2022-02-23 12:52 ` Raghu Bankapur
  2022-02-23 19:46   ` kernel test robot
  2022-02-23 19:56   ` kernel test robot
  0 siblings, 2 replies; 7+ messages in thread
From: Raghu Bankapur @ 2022-02-23 12:52 UTC (permalink / raw)
  To: Jaroslav Kysela, linux-kernel, Takashi Iwai, alsa-devel
  Cc: Krishna Jha, Raghu Bankapur

Propagate the error code from the compress framework for the timestamp
query. This error code will be used by the client to handle the
error case scenarios gracefully.

Signed-off-by: Raghu Bankapur <quic_rbankapu@quicinc.com>
---
 sound/core/compress_offload.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/sound/core/compress_offload.c b/sound/core/compress_offload.c
index de514ec8c83d..48aa87d08bdc 100644
--- a/sound/core/compress_offload.c
+++ b/sound/core/compress_offload.c
@@ -31,7 +31,11 @@
 #include <sound/info.h>
 #include <sound/compress_params.h>
 #include <sound/compress_offload.h>
-#include <sound/compress_driver.h>
+#include <sound/compress_driver.h>ASoC: compress: propagate the error code from the compress framework
+
+Propagate the error code from the compress framework for the timestamp
+query. This error code will be used by the client to handle the
+error case scenarios gracefully.
 
 /* struct snd_compr_codec_caps overflows the ioctl bit size for some
  * architectures, so we need to disable the relevant ioctls.
@@ -166,9 +170,12 @@ static int snd_compr_free(struct inode *inode, struct file *f)
 static int snd_compr_update_tstamp(struct snd_compr_stream *stream,
 		struct snd_compr_tstamp *tstamp)
 {
+	int ret = 0;
 	if (!stream->ops->pointer)
 		return -ENOTSUPP;
-	stream->ops->pointer(stream, tstamp);
+	ret = stream->ops->pointer(stream, tstamp);
+	if (ret)
+		return ret;
 	pr_debug("dsp consumed till %d total %d bytes\n",
 		tstamp->byte_offset, tstamp->copied_total);
 	if (stream->direction == SND_COMPRESS_PLAYBACK)
-- 
2.17.1


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

* Re: [PATCH V1 1/1] ASoC: compress: propagate the error code from the compress framework
  2022-02-23 12:52 ` [PATCH V1 1/1] ASoC: " Raghu Bankapur
@ 2022-02-23 19:46   ` kernel test robot
  2022-02-23 19:56   ` kernel test robot
  1 sibling, 0 replies; 7+ messages in thread
From: kernel test robot @ 2022-02-23 19:46 UTC (permalink / raw)
  To: Raghu Bankapur, Jaroslav Kysela, linux-kernel, Takashi Iwai, alsa-devel
  Cc: llvm, kbuild-all, Krishna Jha, Raghu Bankapur

Hi Raghu,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on tiwai-sound/for-next]
[also build test ERROR on linux/master broonie-sound/for-next linus/master v5.17-rc5 next-20220222]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Raghu-Bankapur/ASoC-compress-propagate-the-error-code-from-the-compress-framework/20220223-215509
base:   https://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git for-next
config: hexagon-buildonly-randconfig-r001-20220223 (https://download.01.org/0day-ci/archive/20220224/202202240324.GFUDFcms-lkp@intel.com/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project d271fc04d5b97b12e6b797c6067d3c96a8d7470e)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/0day-ci/linux/commit/6154c602c715dac9253695c89bebd921f43cc81d
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Raghu-Bankapur/ASoC-compress-propagate-the-error-code-from-the-compress-framework/20220223-215509
        git checkout 6154c602c715dac9253695c89bebd921f43cc81d
        # save the config file to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=hexagon SHELL=/bin/bash sound/core/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All error/warnings (new ones prefixed by >>):

>> sound/core/compress_offload.c:34:35: warning: extra tokens at end of #include directive [-Wextra-tokens]
   #include <sound/compress_driver.h>ASoC: compress: propagate the error code from the compress framework
                                     ^
                                     //
>> sound/core/compress_offload.c:36:1: error: unknown type name 'Propagate'
   Propagate the error code from the compress framework for the timestamp
   ^
>> sound/core/compress_offload.c:36:14: error: expected ';' after top level declarator
   Propagate the error code from the compress framework for the timestamp
                ^
                ;
>> sound/core/compress_offload.c:112:23: error: invalid application of 'sizeof' to an incomplete type 'struct snd_compr_file'
           data = kzalloc(sizeof(*data), GFP_KERNEL);
                                ^~~~~~~
   sound/core/compress_offload.c:82:9: note: forward declaration of 'struct snd_compr_file'
           struct snd_compr_file *data;
                  ^
>> sound/core/compress_offload.c:118:25: error: incomplete definition of type 'struct snd_compr_file'
           INIT_DELAYED_WORK(&data->stream.error_work, error_delayed_work);
                              ~~~~^
   include/linux/workqueue.h:267:22: note: expanded from macro 'INIT_DELAYED_WORK'
           __INIT_DELAYED_WORK(_work, _func, 0)
                               ^~~~~
   include/linux/workqueue.h:252:15: note: expanded from macro '__INIT_DELAYED_WORK'
                   INIT_WORK(&(_work)->work, (_func));                     \
                               ^~~~~
   include/linux/workqueue.h:245:15: note: expanded from macro 'INIT_WORK'
           __INIT_WORK((_work), (_func), 0)
                        ^~~~~
   include/linux/workqueue.h:228:16: note: expanded from macro '__INIT_WORK'
                   __init_work((_work), _onstack);                         \
                                ^~~~~
   sound/core/compress_offload.c:82:9: note: forward declaration of 'struct snd_compr_file'
           struct snd_compr_file *data;
                  ^
>> sound/core/compress_offload.c:118:25: error: incomplete definition of type 'struct snd_compr_file'
           INIT_DELAYED_WORK(&data->stream.error_work, error_delayed_work);
                              ~~~~^
   include/linux/workqueue.h:267:22: note: expanded from macro 'INIT_DELAYED_WORK'
           __INIT_DELAYED_WORK(_work, _func, 0)
                               ^~~~~
   include/linux/workqueue.h:252:15: note: expanded from macro '__INIT_DELAYED_WORK'
                   INIT_WORK(&(_work)->work, (_func));                     \
                               ^~~~~
   include/linux/workqueue.h:245:15: note: expanded from macro 'INIT_WORK'
           __INIT_WORK((_work), (_func), 0)
                        ^~~~~
   include/linux/workqueue.h:229:4: note: expanded from macro '__INIT_WORK'
                   (_work)->data = (atomic_long_t) WORK_DATA_INIT();       \
                    ^~~~~
   sound/core/compress_offload.c:82:9: note: forward declaration of 'struct snd_compr_file'
           struct snd_compr_file *data;
                  ^
>> sound/core/compress_offload.c:118:25: error: incomplete definition of type 'struct snd_compr_file'
           INIT_DELAYED_WORK(&data->stream.error_work, error_delayed_work);
                              ~~~~^
   include/linux/workqueue.h:267:22: note: expanded from macro 'INIT_DELAYED_WORK'
           __INIT_DELAYED_WORK(_work, _func, 0)
                               ^~~~~
   include/linux/workqueue.h:252:15: note: expanded from macro '__INIT_DELAYED_WORK'
                   INIT_WORK(&(_work)->work, (_func));                     \
                               ^~~~~
   include/linux/workqueue.h:245:15: note: expanded from macro 'INIT_WORK'
           __INIT_WORK((_work), (_func), 0)
                        ^~~~~
   include/linux/workqueue.h:230:22: note: expanded from macro '__INIT_WORK'
                   lockdep_init_map(&(_work)->lockdep_map, "(work_completion)"#_work, &__key, 0); \
                                      ^~~~~
   sound/core/compress_offload.c:82:9: note: forward declaration of 'struct snd_compr_file'
           struct snd_compr_file *data;
                  ^
>> sound/core/compress_offload.c:118:25: error: incomplete definition of type 'struct snd_compr_file'
           INIT_DELAYED_WORK(&data->stream.error_work, error_delayed_work);
                              ~~~~^
   include/linux/workqueue.h:267:22: note: expanded from macro 'INIT_DELAYED_WORK'
           __INIT_DELAYED_WORK(_work, _func, 0)
                               ^~~~~
   include/linux/workqueue.h:252:15: note: expanded from macro '__INIT_DELAYED_WORK'
                   INIT_WORK(&(_work)->work, (_func));                     \
                               ^~~~~
   include/linux/workqueue.h:245:15: note: expanded from macro 'INIT_WORK'
           __INIT_WORK((_work), (_func), 0)
                        ^~~~~
   include/linux/workqueue.h:231:20: note: expanded from macro '__INIT_WORK'
                   INIT_LIST_HEAD(&(_work)->entry);                        \
                                    ^~~~~
   sound/core/compress_offload.c:82:9: note: forward declaration of 'struct snd_compr_file'
           struct snd_compr_file *data;
                  ^
>> sound/core/compress_offload.c:118:25: error: incomplete definition of type 'struct snd_compr_file'
           INIT_DELAYED_WORK(&data->stream.error_work, error_delayed_work);
                              ~~~~^
   include/linux/workqueue.h:267:22: note: expanded from macro 'INIT_DELAYED_WORK'
           __INIT_DELAYED_WORK(_work, _func, 0)
                               ^~~~~
   include/linux/workqueue.h:252:15: note: expanded from macro '__INIT_DELAYED_WORK'
                   INIT_WORK(&(_work)->work, (_func));                     \
                               ^~~~~
   include/linux/workqueue.h:245:15: note: expanded from macro 'INIT_WORK'
           __INIT_WORK((_work), (_func), 0)
                        ^~~~~
   include/linux/workqueue.h:232:4: note: expanded from macro '__INIT_WORK'
                   (_work)->func = (_func);                                \
                    ^~~~~
   sound/core/compress_offload.c:82:9: note: forward declaration of 'struct snd_compr_file'
           struct snd_compr_file *data;
                  ^
>> sound/core/compress_offload.c:118:25: error: incomplete definition of type 'struct snd_compr_file'
           INIT_DELAYED_WORK(&data->stream.error_work, error_delayed_work);
                              ~~~~^
   include/linux/workqueue.h:267:22: note: expanded from macro 'INIT_DELAYED_WORK'
           __INIT_DELAYED_WORK(_work, _func, 0)
                               ^~~~~
   include/linux/workqueue.h:253:18: note: expanded from macro '__INIT_DELAYED_WORK'
                   __init_timer(&(_work)->timer,                           \
                                  ^~~~~
   include/linux/timer.h:115:19: note: expanded from macro '__init_timer'
                   init_timer_key((_timer), (_fn), (_flags), #_timer, &__key);\
                                   ^~~~~~
   sound/core/compress_offload.c:82:9: note: forward declaration of 'struct snd_compr_file'
           struct snd_compr_file *data;
                  ^
   sound/core/compress_offload.c:120:6: error: incomplete definition of type 'struct snd_compr_file'
           data->stream.ops = compr->ops;
           ~~~~^
   sound/core/compress_offload.c:82:9: note: forward declaration of 'struct snd_compr_file'
           struct snd_compr_file *data;
                  ^
   sound/core/compress_offload.c:121:6: error: incomplete definition of type 'struct snd_compr_file'
           data->stream.direction = dirn;
           ~~~~^
   sound/core/compress_offload.c:82:9: note: forward declaration of 'struct snd_compr_file'
           struct snd_compr_file *data;
                  ^
   sound/core/compress_offload.c:122:6: error: incomplete definition of type 'struct snd_compr_file'
           data->stream.private_data = compr->private_data;
           ~~~~^
   sound/core/compress_offload.c:82:9: note: forward declaration of 'struct snd_compr_file'
           struct snd_compr_file *data;
                  ^
   sound/core/compress_offload.c:123:6: error: incomplete definition of type 'struct snd_compr_file'
           data->stream.device = compr;
           ~~~~^
   sound/core/compress_offload.c:82:9: note: forward declaration of 'struct snd_compr_file'
           struct snd_compr_file *data;
                  ^
   sound/core/compress_offload.c:132:6: error: incomplete definition of type 'struct snd_compr_file'
           data->stream.runtime = runtime;
           ~~~~^
   sound/core/compress_offload.c:82:9: note: forward declaration of 'struct snd_compr_file'
           struct snd_compr_file *data;
                  ^
   sound/core/compress_offload.c:135:30: error: incomplete definition of type 'struct snd_compr_file'
           ret = compr->ops->open(&data->stream);
                                   ~~~~^
   sound/core/compress_offload.c:82:9: note: forward declaration of 'struct snd_compr_file'
           struct snd_compr_file *data;
                  ^
   sound/core/compress_offload.c:148:42: error: incomplete definition of type 'struct snd_compr_file'
           struct snd_compr_runtime *runtime = data->stream.runtime;
                                               ~~~~^
   sound/core/compress_offload.c:147:9: note: forward declaration of 'struct snd_compr_file'
           struct snd_compr_file *data = f->private_data;
                  ^
   sound/core/compress_offload.c:150:32: error: incomplete definition of type 'struct snd_compr_file'
           cancel_delayed_work_sync(&data->stream.error_work);
                                     ~~~~^
   sound/core/compress_offload.c:147:9: note: forward declaration of 'struct snd_compr_file'
           struct snd_compr_file *data = f->private_data;
                  ^
   sound/core/compress_offload.c:156:7: error: incomplete definition of type 'struct snd_compr_file'
                   data->stream.ops->trigger(&data->stream, SNDRV_PCM_TRIGGER_STOP);
                   ~~~~^
   sound/core/compress_offload.c:147:9: note: forward declaration of 'struct snd_compr_file'
           struct snd_compr_file *data = f->private_data;
                  ^
   sound/core/compress_offload.c:156:34: error: incomplete definition of type 'struct snd_compr_file'
                   data->stream.ops->trigger(&data->stream, SNDRV_PCM_TRIGGER_STOP);
                                              ~~~~^
   sound/core/compress_offload.c:147:9: note: forward declaration of 'struct snd_compr_file'
           struct snd_compr_file *data = f->private_data;
                  ^
   fatal error: too many errors emitted, stopping now [-ferror-limit=]
   1 warning and 20 errors generated.


vim +/Propagate +36 sound/core/compress_offload.c

    14	
    15	#include <linux/file.h>
    16	#include <linux/fs.h>
    17	#include <linux/list.h>
    18	#include <linux/math64.h>
    19	#include <linux/mm.h>
    20	#include <linux/mutex.h>
    21	#include <linux/poll.h>
    22	#include <linux/slab.h>
    23	#include <linux/sched.h>
    24	#include <linux/types.h>
    25	#include <linux/uio.h>
    26	#include <linux/uaccess.h>
    27	#include <linux/module.h>
    28	#include <linux/compat.h>
    29	#include <sound/core.h>
    30	#include <sound/initval.h>
    31	#include <sound/info.h>
    32	#include <sound/compress_params.h>
    33	#include <sound/compress_offload.h>
  > 34	#include <sound/compress_driver.h>ASoC: compress: propagate the error code from the compress framework
    35	
  > 36	Propagate the error code from the compress framework for the timestamp
    37	query. This error code will be used by the client to handle the
    38	error case scenarios gracefully.
    39	
    40	/* struct snd_compr_codec_caps overflows the ioctl bit size for some
    41	 * architectures, so we need to disable the relevant ioctls.
    42	 */
    43	#if _IOC_SIZEBITS < 14
    44	#define COMPR_CODEC_CAPS_OVERFLOW
    45	#endif
    46	
    47	/* TODO:
    48	 * - add substream support for multiple devices in case of
    49	 *	SND_DYNAMIC_MINORS is not used
    50	 * - Multiple node representation
    51	 *	driver should be able to register multiple nodes
    52	 */
    53	
    54	struct snd_compr_file {
    55		unsigned long caps;
    56		struct snd_compr_stream stream;
    57	};
    58	
    59	static void error_delayed_work(struct work_struct *work);
    60	
    61	/*
    62	 * a note on stream states used:
    63	 * we use following states in the compressed core
    64	 * SNDRV_PCM_STATE_OPEN: When stream has been opened.
    65	 * SNDRV_PCM_STATE_SETUP: When stream has been initialized. This is done by
    66	 *	calling SNDRV_COMPRESS_SET_PARAMS. Running streams will come to this
    67	 *	state at stop by calling SNDRV_COMPRESS_STOP, or at end of drain.
    68	 * SNDRV_PCM_STATE_PREPARED: When a stream has been written to (for
    69	 *	playback only). User after setting up stream writes the data buffer
    70	 *	before starting the stream.
    71	 * SNDRV_PCM_STATE_RUNNING: When stream has been started and is
    72	 *	decoding/encoding and rendering/capturing data.
    73	 * SNDRV_PCM_STATE_DRAINING: When stream is draining current data. This is done
    74	 *	by calling SNDRV_COMPRESS_DRAIN.
    75	 * SNDRV_PCM_STATE_PAUSED: When stream is paused. This is done by calling
    76	 *	SNDRV_COMPRESS_PAUSE. It can be stopped or resumed by calling
    77	 *	SNDRV_COMPRESS_STOP or SNDRV_COMPRESS_RESUME respectively.
    78	 */
    79	static int snd_compr_open(struct inode *inode, struct file *f)
    80	{
    81		struct snd_compr *compr;
    82		struct snd_compr_file *data;
    83		struct snd_compr_runtime *runtime;
    84		enum snd_compr_direction dirn;
    85		int maj = imajor(inode);
    86		int ret;
    87	
    88		if ((f->f_flags & O_ACCMODE) == O_WRONLY)
    89			dirn = SND_COMPRESS_PLAYBACK;
    90		else if ((f->f_flags & O_ACCMODE) == O_RDONLY)
    91			dirn = SND_COMPRESS_CAPTURE;
    92		else
    93			return -EINVAL;
    94	
    95		if (maj == snd_major)
    96			compr = snd_lookup_minor_data(iminor(inode),
    97						SNDRV_DEVICE_TYPE_COMPRESS);
    98		else
    99			return -EBADFD;
   100	
   101		if (compr == NULL) {
   102			pr_err("no device data!!!\n");
   103			return -ENODEV;
   104		}
   105	
   106		if (dirn != compr->direction) {
   107			pr_err("this device doesn't support this direction\n");
   108			snd_card_unref(compr->card);
   109			return -EINVAL;
   110		}
   111	
 > 112		data = kzalloc(sizeof(*data), GFP_KERNEL);
   113		if (!data) {
   114			snd_card_unref(compr->card);
   115			return -ENOMEM;
   116		}
   117	
 > 118		INIT_DELAYED_WORK(&data->stream.error_work, error_delayed_work);
   119	
   120		data->stream.ops = compr->ops;
   121		data->stream.direction = dirn;
   122		data->stream.private_data = compr->private_data;
   123		data->stream.device = compr;
   124		runtime = kzalloc(sizeof(*runtime), GFP_KERNEL);
   125		if (!runtime) {
   126			kfree(data);
   127			snd_card_unref(compr->card);
   128			return -ENOMEM;
   129		}
   130		runtime->state = SNDRV_PCM_STATE_OPEN;
   131		init_waitqueue_head(&runtime->sleep);
   132		data->stream.runtime = runtime;
   133		f->private_data = (void *)data;
   134		mutex_lock(&compr->lock);
   135		ret = compr->ops->open(&data->stream);
   136		mutex_unlock(&compr->lock);
   137		if (ret) {
   138			kfree(runtime);
   139			kfree(data);
   140		}
   141		snd_card_unref(compr->card);
   142		return ret;
   143	}
   144	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

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

* Re: [PATCH V1 1/1] ASoC: compress: propagate the error code from the compress framework
  2022-02-23 12:52 ` [PATCH V1 1/1] ASoC: " Raghu Bankapur
  2022-02-23 19:46   ` kernel test robot
@ 2022-02-23 19:56   ` kernel test robot
  1 sibling, 0 replies; 7+ messages in thread
From: kernel test robot @ 2022-02-23 19:56 UTC (permalink / raw)
  To: Raghu Bankapur, Jaroslav Kysela, linux-kernel, Takashi Iwai, alsa-devel
  Cc: llvm, kbuild-all, Krishna Jha, Raghu Bankapur

Hi Raghu,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on tiwai-sound/for-next]
[also build test ERROR on linux/master broonie-sound/for-next linus/master v5.17-rc5 next-20220222]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Raghu-Bankapur/ASoC-compress-propagate-the-error-code-from-the-compress-framework/20220223-215509
base:   https://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git for-next
config: i386-randconfig-a011 (https://download.01.org/0day-ci/archive/20220224/202202240311.3VkBiyO2-lkp@intel.com/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project d271fc04d5b97b12e6b797c6067d3c96a8d7470e)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/0day-ci/linux/commit/6154c602c715dac9253695c89bebd921f43cc81d
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Raghu-Bankapur/ASoC-compress-propagate-the-error-code-from-the-compress-framework/20220223-215509
        git checkout 6154c602c715dac9253695c89bebd921f43cc81d
        # save the config file to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 SHELL=/bin/bash sound/core/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   sound/core/compress_offload.c:34:35: warning: extra tokens at end of #include directive [-Wextra-tokens]
   #include <sound/compress_driver.h>ASoC: compress: propagate the error code from the compress framework
                                     ^
                                     //
   sound/core/compress_offload.c:36:1: error: unknown type name 'Propagate'
   Propagate the error code from the compress framework for the timestamp
   ^
>> sound/core/compress_offload.c:36:14: error: expected ';' after top level declarator
   Propagate the error code from the compress framework for the timestamp
                ^
                ;
>> sound/core/compress_offload.c:112:23: error: invalid application of 'sizeof' to an incomplete type 'struct snd_compr_file'
           data = kzalloc(sizeof(*data), GFP_KERNEL);
                                ^~~~~~~
   sound/core/compress_offload.c:82:9: note: forward declaration of 'struct snd_compr_file'
           struct snd_compr_file *data;
                  ^
>> sound/core/compress_offload.c:118:25: error: incomplete definition of type 'struct snd_compr_file'
           INIT_DELAYED_WORK(&data->stream.error_work, error_delayed_work);
                              ~~~~^
   include/linux/workqueue.h:267:22: note: expanded from macro 'INIT_DELAYED_WORK'
           __INIT_DELAYED_WORK(_work, _func, 0)
                               ^~~~~
   include/linux/workqueue.h:252:15: note: expanded from macro '__INIT_DELAYED_WORK'
                   INIT_WORK(&(_work)->work, (_func));                     \
                               ^~~~~
   include/linux/workqueue.h:245:15: note: expanded from macro 'INIT_WORK'
           __INIT_WORK((_work), (_func), 0)
                        ^~~~~
   include/linux/workqueue.h:228:16: note: expanded from macro '__INIT_WORK'
                   __init_work((_work), _onstack);                         \
                                ^~~~~
   sound/core/compress_offload.c:82:9: note: forward declaration of 'struct snd_compr_file'
           struct snd_compr_file *data;
                  ^
>> sound/core/compress_offload.c:118:25: error: incomplete definition of type 'struct snd_compr_file'
           INIT_DELAYED_WORK(&data->stream.error_work, error_delayed_work);
                              ~~~~^
   include/linux/workqueue.h:267:22: note: expanded from macro 'INIT_DELAYED_WORK'
           __INIT_DELAYED_WORK(_work, _func, 0)
                               ^~~~~
   include/linux/workqueue.h:252:15: note: expanded from macro '__INIT_DELAYED_WORK'
                   INIT_WORK(&(_work)->work, (_func));                     \
                               ^~~~~
   include/linux/workqueue.h:245:15: note: expanded from macro 'INIT_WORK'
           __INIT_WORK((_work), (_func), 0)
                        ^~~~~
   include/linux/workqueue.h:229:4: note: expanded from macro '__INIT_WORK'
                   (_work)->data = (atomic_long_t) WORK_DATA_INIT();       \
                    ^~~~~
   sound/core/compress_offload.c:82:9: note: forward declaration of 'struct snd_compr_file'
           struct snd_compr_file *data;
                  ^
>> sound/core/compress_offload.c:118:25: error: incomplete definition of type 'struct snd_compr_file'
           INIT_DELAYED_WORK(&data->stream.error_work, error_delayed_work);
                              ~~~~^
   include/linux/workqueue.h:267:22: note: expanded from macro 'INIT_DELAYED_WORK'
           __INIT_DELAYED_WORK(_work, _func, 0)
                               ^~~~~
   include/linux/workqueue.h:252:15: note: expanded from macro '__INIT_DELAYED_WORK'
                   INIT_WORK(&(_work)->work, (_func));                     \
                               ^~~~~
   include/linux/workqueue.h:245:15: note: expanded from macro 'INIT_WORK'
           __INIT_WORK((_work), (_func), 0)
                        ^~~~~
   include/linux/workqueue.h:230:22: note: expanded from macro '__INIT_WORK'
                   lockdep_init_map(&(_work)->lockdep_map, "(work_completion)"#_work, &__key, 0); \
                                      ^~~~~
   sound/core/compress_offload.c:82:9: note: forward declaration of 'struct snd_compr_file'
           struct snd_compr_file *data;
                  ^
>> sound/core/compress_offload.c:118:25: error: incomplete definition of type 'struct snd_compr_file'
           INIT_DELAYED_WORK(&data->stream.error_work, error_delayed_work);
                              ~~~~^
   include/linux/workqueue.h:267:22: note: expanded from macro 'INIT_DELAYED_WORK'
           __INIT_DELAYED_WORK(_work, _func, 0)
                               ^~~~~
   include/linux/workqueue.h:252:15: note: expanded from macro '__INIT_DELAYED_WORK'
                   INIT_WORK(&(_work)->work, (_func));                     \
                               ^~~~~
   include/linux/workqueue.h:245:15: note: expanded from macro 'INIT_WORK'
           __INIT_WORK((_work), (_func), 0)
                        ^~~~~
   include/linux/workqueue.h:231:20: note: expanded from macro '__INIT_WORK'
                   INIT_LIST_HEAD(&(_work)->entry);                        \
                                    ^~~~~
   sound/core/compress_offload.c:82:9: note: forward declaration of 'struct snd_compr_file'
           struct snd_compr_file *data;
                  ^
>> sound/core/compress_offload.c:118:25: error: incomplete definition of type 'struct snd_compr_file'
           INIT_DELAYED_WORK(&data->stream.error_work, error_delayed_work);
                              ~~~~^
   include/linux/workqueue.h:267:22: note: expanded from macro 'INIT_DELAYED_WORK'
           __INIT_DELAYED_WORK(_work, _func, 0)
                               ^~~~~
   include/linux/workqueue.h:252:15: note: expanded from macro '__INIT_DELAYED_WORK'
                   INIT_WORK(&(_work)->work, (_func));                     \
                               ^~~~~
   include/linux/workqueue.h:245:15: note: expanded from macro 'INIT_WORK'
           __INIT_WORK((_work), (_func), 0)
                        ^~~~~
   include/linux/workqueue.h:232:4: note: expanded from macro '__INIT_WORK'
                   (_work)->func = (_func);                                \
                    ^~~~~
   sound/core/compress_offload.c:82:9: note: forward declaration of 'struct snd_compr_file'
           struct snd_compr_file *data;
                  ^
>> sound/core/compress_offload.c:118:25: error: incomplete definition of type 'struct snd_compr_file'
           INIT_DELAYED_WORK(&data->stream.error_work, error_delayed_work);
                              ~~~~^
   include/linux/workqueue.h:267:22: note: expanded from macro 'INIT_DELAYED_WORK'
           __INIT_DELAYED_WORK(_work, _func, 0)
                               ^~~~~
   include/linux/workqueue.h:253:18: note: expanded from macro '__INIT_DELAYED_WORK'
                   __init_timer(&(_work)->timer,                           \
                                  ^~~~~
   include/linux/timer.h:115:19: note: expanded from macro '__init_timer'
                   init_timer_key((_timer), (_fn), (_flags), #_timer, &__key);\
                                   ^~~~~~
   sound/core/compress_offload.c:82:9: note: forward declaration of 'struct snd_compr_file'
           struct snd_compr_file *data;
                  ^
   sound/core/compress_offload.c:120:6: error: incomplete definition of type 'struct snd_compr_file'
           data->stream.ops = compr->ops;
           ~~~~^
   sound/core/compress_offload.c:82:9: note: forward declaration of 'struct snd_compr_file'
           struct snd_compr_file *data;
                  ^
   sound/core/compress_offload.c:121:6: error: incomplete definition of type 'struct snd_compr_file'
           data->stream.direction = dirn;
           ~~~~^
   sound/core/compress_offload.c:82:9: note: forward declaration of 'struct snd_compr_file'
           struct snd_compr_file *data;
                  ^
   sound/core/compress_offload.c:122:6: error: incomplete definition of type 'struct snd_compr_file'
           data->stream.private_data = compr->private_data;
           ~~~~^
   sound/core/compress_offload.c:82:9: note: forward declaration of 'struct snd_compr_file'
           struct snd_compr_file *data;
                  ^
   sound/core/compress_offload.c:123:6: error: incomplete definition of type 'struct snd_compr_file'
           data->stream.device = compr;
           ~~~~^
   sound/core/compress_offload.c:82:9: note: forward declaration of 'struct snd_compr_file'
           struct snd_compr_file *data;
                  ^
   sound/core/compress_offload.c:132:6: error: incomplete definition of type 'struct snd_compr_file'
           data->stream.runtime = runtime;
           ~~~~^
   sound/core/compress_offload.c:82:9: note: forward declaration of 'struct snd_compr_file'
           struct snd_compr_file *data;
                  ^
   sound/core/compress_offload.c:135:30: error: incomplete definition of type 'struct snd_compr_file'
           ret = compr->ops->open(&data->stream);
                                   ~~~~^
   sound/core/compress_offload.c:82:9: note: forward declaration of 'struct snd_compr_file'
           struct snd_compr_file *data;
                  ^
   sound/core/compress_offload.c:148:42: error: incomplete definition of type 'struct snd_compr_file'
           struct snd_compr_runtime *runtime = data->stream.runtime;
                                               ~~~~^
   sound/core/compress_offload.c:147:9: note: forward declaration of 'struct snd_compr_file'
           struct snd_compr_file *data = f->private_data;
                  ^
   sound/core/compress_offload.c:150:32: error: incomplete definition of type 'struct snd_compr_file'
           cancel_delayed_work_sync(&data->stream.error_work);
                                     ~~~~^
   sound/core/compress_offload.c:147:9: note: forward declaration of 'struct snd_compr_file'
           struct snd_compr_file *data = f->private_data;
                  ^
   sound/core/compress_offload.c:156:7: error: incomplete definition of type 'struct snd_compr_file'
                   data->stream.ops->trigger(&data->stream, SNDRV_PCM_TRIGGER_STOP);
                   ~~~~^
   sound/core/compress_offload.c:147:9: note: forward declaration of 'struct snd_compr_file'
           struct snd_compr_file *data = f->private_data;
                  ^
   sound/core/compress_offload.c:156:34: error: incomplete definition of type 'struct snd_compr_file'
                   data->stream.ops->trigger(&data->stream, SNDRV_PCM_TRIGGER_STOP);
                                              ~~~~^
   sound/core/compress_offload.c:147:9: note: forward declaration of 'struct snd_compr_file'
           struct snd_compr_file *data = f->private_data;
                  ^
   fatal error: too many errors emitted, stopping now [-ferror-limit=]
   1 warning and 20 errors generated.


vim +36 sound/core/compress_offload.c

    35	
  > 36	Propagate the error code from the compress framework for the timestamp
    37	query. This error code will be used by the client to handle the
    38	error case scenarios gracefully.
    39	
    40	/* struct snd_compr_codec_caps overflows the ioctl bit size for some
    41	 * architectures, so we need to disable the relevant ioctls.
    42	 */
    43	#if _IOC_SIZEBITS < 14
    44	#define COMPR_CODEC_CAPS_OVERFLOW
    45	#endif
    46	
    47	/* TODO:
    48	 * - add substream support for multiple devices in case of
    49	 *	SND_DYNAMIC_MINORS is not used
    50	 * - Multiple node representation
    51	 *	driver should be able to register multiple nodes
    52	 */
    53	
    54	struct snd_compr_file {
    55		unsigned long caps;
    56		struct snd_compr_stream stream;
    57	};
    58	
    59	static void error_delayed_work(struct work_struct *work);
    60	
    61	/*
    62	 * a note on stream states used:
    63	 * we use following states in the compressed core
    64	 * SNDRV_PCM_STATE_OPEN: When stream has been opened.
    65	 * SNDRV_PCM_STATE_SETUP: When stream has been initialized. This is done by
    66	 *	calling SNDRV_COMPRESS_SET_PARAMS. Running streams will come to this
    67	 *	state at stop by calling SNDRV_COMPRESS_STOP, or at end of drain.
    68	 * SNDRV_PCM_STATE_PREPARED: When a stream has been written to (for
    69	 *	playback only). User after setting up stream writes the data buffer
    70	 *	before starting the stream.
    71	 * SNDRV_PCM_STATE_RUNNING: When stream has been started and is
    72	 *	decoding/encoding and rendering/capturing data.
    73	 * SNDRV_PCM_STATE_DRAINING: When stream is draining current data. This is done
    74	 *	by calling SNDRV_COMPRESS_DRAIN.
    75	 * SNDRV_PCM_STATE_PAUSED: When stream is paused. This is done by calling
    76	 *	SNDRV_COMPRESS_PAUSE. It can be stopped or resumed by calling
    77	 *	SNDRV_COMPRESS_STOP or SNDRV_COMPRESS_RESUME respectively.
    78	 */
    79	static int snd_compr_open(struct inode *inode, struct file *f)
    80	{
    81		struct snd_compr *compr;
    82		struct snd_compr_file *data;
    83		struct snd_compr_runtime *runtime;
    84		enum snd_compr_direction dirn;
    85		int maj = imajor(inode);
    86		int ret;
    87	
    88		if ((f->f_flags & O_ACCMODE) == O_WRONLY)
    89			dirn = SND_COMPRESS_PLAYBACK;
    90		else if ((f->f_flags & O_ACCMODE) == O_RDONLY)
    91			dirn = SND_COMPRESS_CAPTURE;
    92		else
    93			return -EINVAL;
    94	
    95		if (maj == snd_major)
    96			compr = snd_lookup_minor_data(iminor(inode),
    97						SNDRV_DEVICE_TYPE_COMPRESS);
    98		else
    99			return -EBADFD;
   100	
   101		if (compr == NULL) {
   102			pr_err("no device data!!!\n");
   103			return -ENODEV;
   104		}
   105	
   106		if (dirn != compr->direction) {
   107			pr_err("this device doesn't support this direction\n");
   108			snd_card_unref(compr->card);
   109			return -EINVAL;
   110		}
   111	
 > 112		data = kzalloc(sizeof(*data), GFP_KERNEL);
   113		if (!data) {
   114			snd_card_unref(compr->card);
   115			return -ENOMEM;
   116		}
   117	
 > 118		INIT_DELAYED_WORK(&data->stream.error_work, error_delayed_work);
   119	
   120		data->stream.ops = compr->ops;
   121		data->stream.direction = dirn;
   122		data->stream.private_data = compr->private_data;
   123		data->stream.device = compr;
   124		runtime = kzalloc(sizeof(*runtime), GFP_KERNEL);
   125		if (!runtime) {
   126			kfree(data);
   127			snd_card_unref(compr->card);
   128			return -ENOMEM;
   129		}
   130		runtime->state = SNDRV_PCM_STATE_OPEN;
   131		init_waitqueue_head(&runtime->sleep);
   132		data->stream.runtime = runtime;
   133		f->private_data = (void *)data;
   134		mutex_lock(&compr->lock);
   135		ret = compr->ops->open(&data->stream);
   136		mutex_unlock(&compr->lock);
   137		if (ret) {
   138			kfree(runtime);
   139			kfree(data);
   140		}
   141		snd_card_unref(compr->card);
   142		return ret;
   143	}
   144	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

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

* Re: [PATCH V1 1/1] ASoC: compress: propagate the error code from the compress framework
  2022-02-24  8:06 ` [PATCH V1 1/1] ASoC: compress: propagate the error code from the compress framework Raghu Bankapur
  2022-02-24  8:26   ` Raghu Bankapur
@ 2022-02-24  9:55   ` Vinod Koul
  1 sibling, 0 replies; 7+ messages in thread
From: Vinod Koul @ 2022-02-24  9:55 UTC (permalink / raw)
  To: Raghu Bankapur
  Cc: Jaroslav Kysela, Takashi Iwai, alsa-devel, linux-kernel, Krishna Jha

On 24-02-22, 13:56, Raghu Bankapur wrote:
> Propagate the error code from the compress framework for the timestamp
> query. This error code will be used by the client to handle the
> error case scenarios gracefully.
> 
> Signed-off-by: Raghu Bankapur <quic_rbankapu@quicinc.com>
> ---
>  sound/core/compress_offload.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/sound/core/compress_offload.c b/sound/core/compress_offload.c
> index de514ec8c83d..b89adbf666b1 100644
> --- a/sound/core/compress_offload.c
> +++ b/sound/core/compress_offload.c
> @@ -166,9 +166,12 @@ static int snd_compr_free(struct inode *inode, struct file *f)
>  static int snd_compr_update_tstamp(struct snd_compr_stream *stream,
>  		struct snd_compr_tstamp *tstamp)
>  {
> +	int ret = 0;

why initialize here, also pls leave an empty line here

>  	if (!stream->ops->pointer)
>  		return -ENOTSUPP;
> -	stream->ops->pointer(stream, tstamp);
> +	ret = stream->ops->pointer(stream, tstamp);
> +	if (ret)
> +		return ret;
>  	pr_debug("dsp consumed till %d total %d bytes\n",
>  		tstamp->byte_offset, tstamp->copied_total);
>  	if (stream->direction == SND_COMPRESS_PLAYBACK)
> -- 
> 2.17.1

-- 
~Vinod

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

* [PATCH V1 1/1] ASoC: compress: propagate the error code from the compress framework
  2022-02-24  8:06 ` [PATCH V1 1/1] ASoC: compress: propagate the error code from the compress framework Raghu Bankapur
@ 2022-02-24  8:26   ` Raghu Bankapur
  2022-02-24  9:55   ` Vinod Koul
  1 sibling, 0 replies; 7+ messages in thread
From: Raghu Bankapur @ 2022-02-24  8:26 UTC (permalink / raw)
  To: Vinod Koul, Jaroslav Kysela, Takashi Iwai, alsa-devel, linux-kernel
  Cc: Krishna Jha, Raghu Bankapur

Propagate the error code from the compress framework for the timestamp
query. This error code will be used by the client to handle the
error case scenarios gracefully.

Signed-off-by: Raghu Bankapur <quic_rbankapu@quicinc.com>
---
 sound/core/compress_offload.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/sound/core/compress_offload.c b/sound/core/compress_offload.c
index de514ec8c83d..b89adbf666b1 100644
--- a/sound/core/compress_offload.c
+++ b/sound/core/compress_offload.c
@@ -166,9 +166,12 @@ static int snd_compr_free(struct inode *inode, struct file *f)
 static int snd_compr_update_tstamp(struct snd_compr_stream *stream,
 		struct snd_compr_tstamp *tstamp)
 {
+	int ret = 0;
 	if (!stream->ops->pointer)
 		return -ENOTSUPP;
-	stream->ops->pointer(stream, tstamp);
+	ret = stream->ops->pointer(stream, tstamp);
+	if (ret)
+		return ret;
 	pr_debug("dsp consumed till %d total %d bytes\n",
 		tstamp->byte_offset, tstamp->copied_total);
 	if (stream->direction == SND_COMPRESS_PLAYBACK)
-- 
2.17.1


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

* [PATCH V1 1/1] ASoC: compress: propagate the error code from the compress framework
  2022-02-24  8:06 [PATCH V1 0/1] ASoC: compress: propagate the error code from the Raghu Bankapur
@ 2022-02-24  8:06 ` Raghu Bankapur
  2022-02-24  8:26   ` Raghu Bankapur
  2022-02-24  9:55   ` Vinod Koul
  0 siblings, 2 replies; 7+ messages in thread
From: Raghu Bankapur @ 2022-02-24  8:06 UTC (permalink / raw)
  To: Jaroslav Kysela, linux-kernel, Takashi Iwai, alsa-devel
  Cc: Krishna Jha, Raghu Bankapur

Propagate the error code from the compress framework for the timestamp
query. This error code will be used by the client to handle the
error case scenarios gracefully.

Signed-off-by: Raghu Bankapur <quic_rbankapu@quicinc.com>
---
 sound/core/compress_offload.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/sound/core/compress_offload.c b/sound/core/compress_offload.c
index de514ec8c83d..b89adbf666b1 100644
--- a/sound/core/compress_offload.c
+++ b/sound/core/compress_offload.c
@@ -166,9 +166,12 @@ static int snd_compr_free(struct inode *inode, struct file *f)
 static int snd_compr_update_tstamp(struct snd_compr_stream *stream,
 		struct snd_compr_tstamp *tstamp)
 {
+	int ret = 0;
 	if (!stream->ops->pointer)
 		return -ENOTSUPP;
-	stream->ops->pointer(stream, tstamp);
+	ret = stream->ops->pointer(stream, tstamp);
+	if (ret)
+		return ret;
 	pr_debug("dsp consumed till %d total %d bytes\n",
 		tstamp->byte_offset, tstamp->copied_total);
 	if (stream->direction == SND_COMPRESS_PLAYBACK)
-- 
2.17.1


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

end of thread, other threads:[~2022-02-24  9:55 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-23 12:52 [PATCH V1 0/1]ASoC: compress: propagate the error code from the compress framework Raghu Bankapur
2022-02-23 12:52 ` [PATCH V1 1/1] ASoC: " Raghu Bankapur
2022-02-23 19:46   ` kernel test robot
2022-02-23 19:56   ` kernel test robot
2022-02-24  8:06 [PATCH V1 0/1] ASoC: compress: propagate the error code from the Raghu Bankapur
2022-02-24  8:06 ` [PATCH V1 1/1] ASoC: compress: propagate the error code from the compress framework Raghu Bankapur
2022-02-24  8:26   ` Raghu Bankapur
2022-02-24  9:55   ` Vinod Koul

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).