staging: most: Convert to the common vmalloc memalloc
Subsystems (2)
PATCH 1/1 staging: most: Convert to the common vmalloc memalloc
The recent change (*) in the ALSA memalloc core allows us to drop the special vmalloc-specific allocation and page handling. This patch coverts to the common code.
(*) 1fe7f397cfe2: ALSA: memalloc: Add vmalloc buffer allocation
support
7e8edae39fd1: ALSA: pcm: Handle special page mapping in the
default mmap handler
---
Since the prerequisite commits above are found only on for-next branch of sound git tree, please give ACK if the patch is OK; then I'll apply it on top of my branch. Thanks!
drivers/staging/most/sound/sound.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/staging/most/sound/sound.c +4 -4
@@ -344,8 +344,7 @@ static int pcm_hw_params(struct snd_pcm_substream *substream,pr_err ("Requested number of channels not supported.\n" );return -EINVAL ; } -return snd_pcm_lib_alloc_vmalloc_buffer (substream, -params_buffer_bytes (hw_params)); +return snd_pcm_lib_malloc_pages (substream,params_buffer_bytes (hw_params)); }/**
@@ -359,7 +358,7 @@ static int pcm_hw_params(struct snd_pcm_substream *substream,*/ static int pcm_hw_free (struct snd_pcm_substream *substream) { -return snd_pcm_lib_free_vmalloc_buffer (substream); +return snd_pcm_lib_free_pages (substream); }/**
@@ -469,7 +468,6 @@ static const struct snd_pcm_ops pcm_ops = { .prepare = pcm_prepare, .trigger = pcm_trigger, .pointer = pcm_pointer, - .page = snd_pcm_lib_get_vmalloc_page, };static int split_arg_list (char *buf,u16 *ch_num,char **sample_res)
@@ -663,6 +661,8 @@ static int audio_probe_channel(struct most_interface *iface, int channel_id, pcm->private_data = channel;strscpy (pcm->name, device_name,sizeof (pcm->name));snd_pcm_set_ops (pcm, direction, &pcm_ops); +snd_pcm_lib_preallocate_pages_for_all (pcm,SNDRV_DMA_TYPE_VMALLOC , +NULL ,0 ,0 );return 0 ;
Signature · 1 line
2.16.4
Quoted 8 lines · Takashi Iwai
The recent change (*) in the ALSA memalloc core allows us to drop the special vmalloc-specific allocation and page handling. This patch coverts to the common code.
(*)1fe7f397cfe2: ALSA: memalloc: Add vmalloc buffer allocation
support
7e8edae39fd1: ALSA: pcm: Handle special page mapping in the
default mmap handler
Quoted 9 lines
Signed-off-by Takashi Iwai <[email protected]>---
Since the prerequisite commits above are found only on for-next branch of sound git tree, please give ACK if the patch is OK; then I'll apply it on top of my branch. Thanks!
kbuild test robot
build botI love your patch! Yet something to improve:
Hi Takashi,
I love your patch! Yet something to improve:
[auto build test ERROR on staging/staging-testing]
[also build test ERROR on v5.4-rc7]
[cannot apply to next-20191112]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system. BTW, we also suggest to use '--base' option to specify the base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
url: https://github.com/0day-ci/linux/commits/Takashi-Iwai/staging-most-Convert-to-the-common-vmalloc-memalloc/20191110-060926 base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git b79967a27f347d39a6e0b85b49bd11963cacf5c1 config: i386-randconfig-h004-201945 (attached as .config) compiler: gcc-7 (Debian 7.4.0-14) 7.4.0 reproduce: # save the attached .config to linux build tree make ARCH=i386
If you fix the issue, kindly add following tag
All errors (new ones prefixed by >>):
drivers/staging//most/sound/sound.c: In function 'audio_probe_channel':
>> drivers/staging//most/sound/sound.c:664:45: error: 'SNDRV_DMA_TYPE_VMALLOC' undeclared (first use in this function); did you mean 'SNDRV_DMA_TYPE_DEV_UC'?
snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_VMALLOC,
^~~~~~~~~~~~~~~~~~~~~~
SNDRV_DMA_TYPE_DEV_UCdrivers/staging//most/sound/sound.c:664:45: note: each undeclared identifier is reported only once for each function it appears in
vim +664 drivers/staging//most/sound/sound.c
558
559 /**
560 * audio_probe_channel - probe function of the driver module
561 * @iface: pointer to interface instance
562 * @channel_id: channel index/ID
563 * @cfg: pointer to actual channel configuration
564 * @arg_list: string that provides the name of the device to be created in /dev
565 * plus the desired audio resolution
566 *
567 * Creates sound card, pcm device, sets pcm ops and registers sound card.
568 *
569 * Returns 0 on success or error code otherwise.
570 */
571 static int audio_probe_channel(struct most_interface *iface, int channel_id,
572 struct most_channel_config *cfg,
573 char *device_name, char *arg_list)
574 {
575 struct channel *channel;
576 struct sound_adapter *adpt;
577 struct snd_pcm *pcm;
578 int playback_count = 0;
579 int capture_count = 0;
580 int ret;
581 int direction;
582 u16 ch_num;
583 char *sample_res;
584 char arg_list_cpy[STRING_SIZE];
585
586 if (!iface)
587 return -EINVAL;
588
589 if (cfg->data_type != MOST_CH_SYNC) {
590 pr_err("Incompatible channel type\n");
591 return -EINVAL;
592 }
593 strlcpy(arg_list_cpy, arg_list, STRING_SIZE);
594 ret = split_arg_list(arg_list_cpy, &ch_num, &sample_res);
595 if (ret < 0)
596 return ret;
597
598 list_for_each_entry(adpt, &adpt_list, list) {
599 if (adpt->iface != iface)
600 continue;
601 if (adpt->registered)
602 return -ENOSPC;
603 adpt->pcm_dev_idx++;
604 goto skip_adpt_alloc;
605 }
606 adpt = kzalloc(sizeof(*adpt), GFP_KERNEL);
607 if (!adpt)
608 return -ENOMEM;
609
610 adpt->iface = iface;
611 INIT_LIST_HEAD(&adpt->dev_list);
612 iface->priv = adpt;
613 list_add_tail(&adpt->list, &adpt_list);
614 ret = snd_card_new(iface->driver_dev, -1, "INIC", THIS_MODULE,
615 sizeof(*channel), &adpt->card);
616 if (ret < 0)
617 goto err_free_adpt;
618 snprintf(adpt->card->driver, sizeof(adpt->card->driver),
619 "%s", DRIVER_NAME);
620 snprintf(adpt->card->shortname, sizeof(adpt->card->shortname),
621 "Microchip INIC");
622 snprintf(adpt->card->longname, sizeof(adpt->card->longname),
623 "%s at %s", adpt->card->shortname, iface->description);
624 skip_adpt_alloc:
625 if (get_channel(iface, channel_id)) {
626 pr_err("channel (%s:%d) is already linked\n",
627 iface->description, channel_id);
628 return -EINVAL;
629 }
630
631 if (cfg->direction == MOST_CH_TX) {
632 playback_count = 1;
633 direction = SNDRV_PCM_STREAM_PLAYBACK;
634 } else {
635 capture_count = 1;
636 direction = SNDRV_PCM_STREAM_CAPTURE;
637 }
638 channel = kzalloc(sizeof(*channel), GFP_KERNEL);
639 if (!channel) {
640 ret = -ENOMEM;
641 goto err_free_adpt;
642 }
643 channel->card = adpt->card;
644 channel->cfg = cfg;
645 channel->iface = iface;
646 channel->id = channel_id;
647 init_waitqueue_head(&channel->playback_waitq);
648 list_add_tail(&channel->list, &adpt->dev_list);
649
650 ret = audio_set_hw_params(&channel->pcm_hardware, ch_num, sample_res,
651 cfg);
652 if (ret)
653 goto err_free_adpt;
654
655 ret = snd_pcm_new(adpt->card, device_name, adpt->pcm_dev_idx,
656 playback_count, capture_count, &pcm);
657
658 if (ret < 0)
659 goto err_free_adpt;
660
661 pcm->private_data = channel;
662 strscpy(pcm->name, device_name, sizeof(pcm->name));
663 snd_pcm_set_ops(pcm, direction, &pcm_ops);
> 664 snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_VMALLOC,
665 NULL, 0, 0);
666
667 return 0;
668
669 err_free_adpt:
670 release_adapter(adpt);
671 return ret;
672 }
673
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org Intel Corporation