ALSA: Use managed buffer allocation
Subsystems (14)
cover ALSA: Use managed buffer allocation
Hi,
we already got a PCM core extension in 5.5-rc1 for allocating / releasing the PCM buffers implicitly, so called managed buffer allocation mode. This patch set is to apply this new mode for the actual (non-ASoC) drivers. The patches for ASoC and the other subsystems will follow in later patch sets. Also, other PCM API changes will follow later, too.
This won't change anything from the functional POV, but merely cleanups.
Takashi
===
Takashi Iwai (71):
ALSA: aoa: Use managed buffer allocation
ALSA: aaci: Use managed buffer allocation
ALSA: atmel: Use managed buffer allocation
ALSA: aloop: Use managed buffer allocation
ALSA: dummy: Use managed buffer allocation
ALSA: ml403: Use managed buffer allocation
ALSA: pcsp: Use managed buffer allocation
ALSA: vx: Use managed buffer allocation
ALSA: firewire: Use managed buffer allocation
ALSA: ad1816a: Use managed buffer allocation
ALSA: cmi8330: Use managed buffer allocation
ALSA: es1688: Use managed buffer allocation
ALSA: es18xx: Use managed buffer allocation
ALSA: sb: Use managed buffer allocation
ALSA: gus: Use managed buffer allocation
ALSA: wss: Use managed buffer allocation
ALSA: mips: Use managed buffer allocation
ALSA: parisc: Use managed buffer allocation
ALSA: ad1889: Use managed buffer allocation
ALSA: ali5451: Use managed buffer allocation
ALSA: als300: Use managed buffer allocation
ALSA: als4000: Use managed buffer allocation
ALSA: asihpi: Use managed buffer allocation
ALSA: atiixp: Use managed buffer allocation
ALSA: au88x0: Use managed buffer allocation
ALSA: aw2: Use managed buffer allocation
ALSA: azt3328: Use managed buffer allocation
ALSA: bt87x: Use managed buffer allocation
ALSA: ca0106: Use managed buffer allocation
ALSA: cmipci: Use managed buffer allocation
ALSA: cs4281: Use managed buffer allocation
ALSA: cs5535: Use managed buffer allocation
ALSA: ctxfi: Use managed buffer allocation
ALSA: echoaudio: Use managed buffer allocation
ALSA: emu10k1x: Use managed buffer allocation
ALSA: emu10k1: Use managed buffer allocation
ALSA: ens137x: Use managed buffer allocation
ALSA: es1938: Use managed buffer allocation
ALSA: fm801: Use managed buffer allocation
ALSA: hda: Use managed buffer allocation
ALSA: ice1712: Use managed buffer allocation
ALSA: ice1724: Use managed buffer allocation
ALSA: intel8x0: Use managed buffer allocation
ALSA: lola: Use managed buffer allocation
ALSA: lx6464es: Use managed buffer allocation
ALSA: maestro3: Use managed buffer allocation
ALSA: mixart: Use managed buffer allocation
ALSA: oxygen: Use managed buffer allocation
ALSA: pcxhr: Use managed buffer allocation
ALSA: riptide: Use managed buffer allocation
ALSA: rme32: Use managed buffer allocation
ALSA: sis7019: Use managed buffer allocation
ALSA: sonicvibes: Use managed buffer allocation
ALSA: trident: Use managed buffer allocation
ALSA: via82xx: Use managed buffer allocation
ALSA: ymfpci: Use managed buffer allocation
ALSA: pdaudiocf: Use managed buffer allocation
ALSA: pmac: Use managed buffer allocation
ALSA: ps3: Use managed buffer allocation
ALSA: aica: Use managed buffer allocation
ALSA: sh: Use managed buffer allocation
ALSA: sparc: Use managed buffer allocation
ALSA: spi: Use managed buffer allocation
ALSA: 6fire: Use managed buffer allocation
ALSA: caiaq: Use managed buffer allocation
ALSA: hiface: Use managed buffer allocation
ALSA: line6: Use managed buffer allocation
ALSA: ua101: Use managed buffer allocation
ALSA: usx2y: Use managed buffer allocation
ALSA: usb-audio: Use managed buffer allocation
ALSA: hdml-lpe-audio: Use managed buffer allocation
sound/aoa/soundbus/i2sbus/pcm.c | 11 +------ sound/arm/aaci.c | 40 +++++++++-------------- sound/atmel/ac97c.c | 20 ++---------- sound/drivers/aloop.c | 12 ++----- sound/drivers/dummy.c | 14 ++------ sound/drivers/ml403-ac97cr.c | 29 +++-------------- sound/drivers/pcsp/pcsp_lib.c | 17 ++++------ sound/drivers/vx/vx_pcm.c | 27 ++------------- sound/firewire/bebob/bebob_pcm.c | 11 ++----- sound/firewire/dice/dice-pcm.c | 13 +++----- sound/firewire/digi00x/digi00x-pcm.c | 11 ++----- sound/firewire/fireface/ff-pcm.c | 9 ++--- sound/firewire/fireworks/fireworks_pcm.c | 11 ++----- sound/firewire/isight.c | 10 ++---- sound/firewire/motu/motu-pcm.c | 11 ++----- sound/firewire/oxfw/oxfw-pcm.c | 17 +++------- sound/firewire/tascam/tascam-pcm.c | 11 ++----- sound/isa/ad1816a/ad1816a_lib.c | 20 ++---------- sound/isa/cmi8330.c | 5 ++- sound/isa/es1688/es1688_lib.c | 20 ++---------- sound/isa/es18xx.c | 24 +++----------- sound/isa/gus/gus_pcm.c | 28 +++++----------- sound/isa/sb/sb16_main.c | 21 ++---------- sound/isa/sb/sb8_main.c | 21 ++---------- sound/isa/wss/wss_lib.c | 23 ++----------- sound/mips/hal2.c | 25 ++------------ sound/mips/sgio2audio.c | 20 ++---------- sound/parisc/harmony.c | 18 +++------- sound/pci/ad1889.c | 24 ++------------ sound/pci/ali5451/ali5451.c | 30 ++--------------- sound/pci/als300.c | 23 ++----------- sound/pci/als4000.c | 23 ++----------- sound/pci/asihpi/asihpi.c | 10 ++---- sound/pci/atiixp.c | 14 +++----- sound/pci/atiixp_modem.c | 9 ++--- sound/pci/au88x0/au88x0_pcm.c | 15 ++------- sound/pci/aw2/aw2-alsa.c | 45 +++++++------------------ sound/pci/azt3328.c | 30 +++-------------- sound/pci/bt87x.c | 14 +++----- sound/pci/ca0106/ca0106_main.c | 56 ++++---------------------------- sound/pci/cmipci.c | 36 ++++++-------------- sound/pci/cs4281.c | 20 ++---------- sound/pci/cs5535audio/cs5535audio_pcm.c | 12 +++---- sound/pci/ctxfi/ctpcm.c | 15 +++------ sound/pci/echoaudio/echoaudio.c | 19 +++-------- sound/pci/emu10k1/emu10k1x.c | 15 ++++----- sound/pci/emu10k1/emupcm.c | 41 ++++------------------- sound/pci/emu10k1/p16v.c | 48 ++++----------------------- sound/pci/ens1370.c | 27 +++------------ sound/pci/es1938.c | 28 ++-------------- sound/pci/fm801.c | 20 ++---------- sound/pci/hda/hda_controller.c | 13 +++----- sound/pci/ice1712/ice1712.c | 42 +++++------------------- sound/pci/ice1712/ice1724.c | 25 +++++--------- sound/pci/intel8x0.c | 11 +++---- sound/pci/intel8x0m.c | 23 +++---------- sound/pci/lola/lola_pcm.c | 11 +++---- sound/pci/lx6464es/lx6464es.c | 14 ++------ sound/pci/maestro3.c | 9 ++--- sound/pci/mixart/mixart.c | 14 +++----- sound/pci/oxygen/oxygen_pcm.c | 52 +++++++++++++---------------- sound/pci/pcxhr/pcxhr.c | 31 ++++-------------- sound/pci/riptide/riptide.c | 10 +++--- sound/pci/rme32.c | 35 ++++---------------- sound/pci/sis7019.c | 25 ++------------ sound/pci/sonicvibes.c | 20 ++---------- sound/pci/trident/trident_main.c | 49 +++++++++++----------------- sound/pci/via82xx.c | 45 ++++++++++--------------- sound/pci/via82xx_modem.c | 9 ++--- sound/pci/ymfpci/ymfpci_main.c | 33 +++++-------------- sound/pcmcia/pdaudiocf/pdaudiocf_pcm.c | 25 ++------------ sound/ppc/pmac.c | 28 ++-------------- sound/ppc/snd_ps3.c | 28 +++------------- sound/sh/aica.c | 29 +++-------------- sound/sh/sh_dac_audio.c | 20 ++---------- sound/sparc/amd7930.c | 20 ++---------- sound/sparc/cs4231.c | 17 ++-------- sound/sparc/dbri.c | 13 ++------ sound/spi/at73c213.c | 11 ++----- sound/usb/6fire/pcm.c | 17 +--------- sound/usb/caiaq/audio.c | 13 ++------ sound/usb/hiface/pcm.c | 18 ++-------- sound/usb/line6/pcm.c | 13 ++------ sound/usb/misc/ua101.c | 23 +++---------- sound/usb/pcm.c | 15 +++------ sound/usb/usx2y/usbusx2yaudio.c | 26 +++++---------- sound/usb/usx2y/usx2yhwdeppcm.c | 18 +++++----- sound/x86/intel_hdmi_audio.c | 16 ++++----- 88 files changed, 402 insertions(+), 1492 deletions(-)
Signature · 6 lines
2.16.4 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
PATCH 1/71 ALSA: aoa: Use managed buffer allocation
Clean up the driver with the new managed buffer allocation API. The hw_params callbacks became superfluous and got dropped.
--- sound/aoa/soundbus/i2sbus/pcm.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-)
sound/aoa/soundbus/i2sbus/pcm.c +1 -10
@@ -294,12 +294,6 @@ void i2sbus_wait_for_stop_both(struct i2sbus_dev *i2sdev) }#endif -static int i2sbus_hw_params (struct snd_pcm_substream *substream, -struct snd_pcm_hw_params *params) -{ -return snd_pcm_lib_malloc_pages (substream,params_buffer_bytes (params)); -} -static inline int i2sbus_hw_free (struct snd_pcm_substream *substream,int in) {struct i2sbus_dev *i2sdev =snd_pcm_substream_chip (substream);
@@ -308,7 +302,6 @@ static inline int i2sbus_hw_free(struct snd_pcm_substream *substream, int in)get_pcm_info (i2sdev, in, &pi,NULL );if (pi->dbdma_ring.stopping)i2sbus_wait_for_stop (i2sdev, pi); -snd_pcm_lib_free_pages (substream);return 0 ; }
@@ -781,7 +774,6 @@ static const struct snd_pcm_ops i2sbus_playback_ops = { .open = i2sbus_playback_open, .close = i2sbus_playback_close, .ioctl = snd_pcm_lib_ioctl, - .hw_params = i2sbus_hw_params, .hw_free = i2sbus_playback_hw_free, .prepare = i2sbus_playback_prepare, .trigger = i2sbus_playback_trigger,
@@ -851,7 +843,6 @@ static const struct snd_pcm_ops i2sbus_record_ops = { .open = i2sbus_record_open, .close = i2sbus_record_close, .ioctl = snd_pcm_lib_ioctl, - .hw_params = i2sbus_hw_params, .hw_free = i2sbus_record_hw_free, .prepare = i2sbus_record_prepare, .trigger = i2sbus_record_trigger,
@@ -1026,7 +1017,7 @@ i2sbus_attach_codec(struct soundbus_dev *dev, struct snd_card *card, dev->pcm->private_free = i2sbus_private_free;/* well, we really should support scatter/gather DMA */ -snd_pcm_lib_preallocate_pages_for_all ( +snd_pcm_set_managed_buffer_all ( dev->pcm,SNDRV_DMA_TYPE_DEV , &macio_get_pci_dev (i2sdev->macio)->dev,64 *1024 ,64 *1024 );
Signature · 6 lines
2.16.4 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
PATCH 2/71 ALSA: aaci: Use managed buffer allocation
In reply to Takashi IwaiClean up the driver with the new managed buffer allocation API. The superfluous snd_pcm_lib_malloc_pages() and snd_pcm_lib_free_pages() calls are dropped, and the if block is flattened accordingly.
--- sound/arm/aaci.c | 40 +++++++++++++++------------------------- 1 file changed, 15 insertions(+), 25 deletions(-)
sound/arm/aaci.c +15 -25
@@ -483,11 +483,6 @@ static int aaci_pcm_hw_free(struct snd_pcm_substream *substream)snd_ac97_pcm_close (aacirun->pcm); aacirun->pcm_open =0 ; -/* -* Clear out the DMA and any allocated buffers. -*/ -snd_pcm_lib_free_pages (substream); -return 0 ; }
@@ -502,6 +497,7 @@ static int aaci_pcm_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params) {struct aaci_runtime *aacirun = substream->runtime->private_data; +struct aaci *aaci = substream->private_data;unsigned int channels =params_channels (params);unsigned int rate =params_rate (params);int dbl = rate >48000 ;
@@ -517,25 +513,19 @@ static int aaci_pcm_hw_params(struct snd_pcm_substream *substream,if (dbl && channels !=2 )return -EINVAL ; - err =snd_pcm_lib_malloc_pages (substream, -params_buffer_bytes (params)); -if (err >=0 ) { -struct aaci *aaci = substream->private_data; + err =snd_ac97_pcm_open (aacirun->pcm, rate, channels, + aacirun->pcm->r[dbl].slots); - err =snd_ac97_pcm_open (aacirun->pcm, rate, channels, - aacirun->pcm->r[dbl].slots); + aacirun->pcm_open = err ==0 ; + aacirun->cr =CR_FEN |CR_COMPACT |CR_SZ16 ; + aacirun->cr |= channels_to_slotmask[channels + dbl *2 ]; - aacirun->pcm_open = err ==0 ; - aacirun->cr =CR_FEN |CR_COMPACT |CR_SZ16 ; - aacirun->cr |= channels_to_slotmask[channels + dbl *2 ]; - -/* -* fifo_bytes is the number of bytes we transfer to/from -* the FIFO, including padding. So that's x4. As we're -* in compact mode, the FIFO is half the size. -*/ - aacirun->fifo_bytes = aaci->fifo_depth *4 /2 ; - } +/* +* fifo_bytes is the number of bytes we transfer to/from +* the FIFO, including padding. So that's x4. As we're +* in compact mode, the FIFO is half the size. +*/ + aacirun->fifo_bytes = aaci->fifo_depth *4 /2 ;return err; }
@@ -937,9 +927,9 @@ static int aaci_init_pcm(struct aaci *aaci)snd_pcm_set_ops (pcm,SNDRV_PCM_STREAM_PLAYBACK , &aaci_playback_ops);snd_pcm_set_ops (pcm,SNDRV_PCM_STREAM_CAPTURE , &aaci_capture_ops); -snd_pcm_lib_preallocate_pages_for_all (pcm,SNDRV_DMA_TYPE_DEV , - aaci->card->dev, -0 ,64 *1024 ); +snd_pcm_set_managed_buffer_all (pcm,SNDRV_DMA_TYPE_DEV , + aaci->card->dev, +0 ,64 *1024 ); }return ret;
Signature · 6 lines
2.16.4 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
PATCH 3/71 ALSA: atmel: Use managed buffer allocation
In reply to Takashi IwaiClean up the driver with the new managed buffer allocation API. The hw_free_free callbacks became superfluous and got dropped.
--- sound/atmel/ac97c.c | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-)
sound/atmel/ac97c.c +3 -17
@@ -159,12 +159,6 @@ static int atmel_ac97c_playback_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *hw_params) {struct atmel_ac97c *chip =snd_pcm_substream_chip (substream); -int retval; - - retval =snd_pcm_lib_malloc_pages (substream, -params_buffer_bytes (hw_params)); -if (retval <0 ) -return retval;/* Set restrictions to params. */ mutex_lock (&opened_mutex);
@@ -172,19 +166,13 @@ static int atmel_ac97c_playback_hw_params(struct snd_pcm_substream *substream, chip->cur_format =params_format (hw_params);mutex_unlock (&opened_mutex); -return retval; +return 0 ; }static int atmel_ac97c_capture_hw_params (struct snd_pcm_substream *substream,struct snd_pcm_hw_params *hw_params) {struct atmel_ac97c *chip =snd_pcm_substream_chip (substream); -int retval; - - retval =snd_pcm_lib_malloc_pages (substream, -params_buffer_bytes (hw_params)); -if (retval <0 ) -return retval;/* Set restrictions to params. */ mutex_lock (&opened_mutex);
@@ -192,7 +180,7 @@ static int atmel_ac97c_capture_hw_params(struct snd_pcm_substream *substream, chip->cur_format =params_format (hw_params);mutex_unlock (&opened_mutex); -return retval; +return 0 ; }static int atmel_ac97c_playback_prepare (struct snd_pcm_substream *substream)
@@ -461,7 +449,6 @@ static const struct snd_pcm_ops atmel_ac97_playback_ops = { .close = atmel_ac97c_playback_close, .ioctl = snd_pcm_lib_ioctl, .hw_params = atmel_ac97c_playback_hw_params, - .hw_free = snd_pcm_lib_free_pages, .prepare = atmel_ac97c_playback_prepare, .trigger = atmel_ac97c_playback_trigger, .pointer = atmel_ac97c_playback_pointer,
@@ -472,7 +459,6 @@ static const struct snd_pcm_ops atmel_ac97_capture_ops = { .close = atmel_ac97c_capture_close, .ioctl = snd_pcm_lib_ioctl, .hw_params = atmel_ac97c_capture_hw_params, - .hw_free = snd_pcm_lib_free_pages, .prepare = atmel_ac97c_capture_prepare, .trigger = atmel_ac97c_capture_trigger, .pointer = atmel_ac97c_capture_pointer,
@@ -600,7 +586,7 @@ static int atmel_ac97c_pcm_new(struct atmel_ac97c *chip)snd_pcm_set_ops (pcm,SNDRV_PCM_STREAM_CAPTURE , &atmel_ac97_capture_ops);snd_pcm_set_ops (pcm,SNDRV_PCM_STREAM_PLAYBACK , &atmel_ac97_playback_ops); -snd_pcm_lib_preallocate_pages_for_all (pcm,SNDRV_DMA_TYPE_DEV , +snd_pcm_set_managed_buffer_all (pcm,SNDRV_DMA_TYPE_DEV , &chip->pdev->dev, hw.periods_min * hw.period_bytes_min, hw.buffer_bytes_max);
Signature · 6 lines
2.16.4 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
PATCH 4/71 ALSA: aloop: Use managed buffer allocation
In reply to Takashi IwaiClean up the driver with the new managed buffer allocation API. The hw_params callback became superfluous and got dropped.
--- sound/drivers/aloop.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-)
sound/drivers/aloop.c +2 -10
@@ -905,12 +905,6 @@ static void loopback_runtime_free(struct snd_pcm_runtime *runtime)kfree (dpcm); } -static int loopback_hw_params (struct snd_pcm_substream *substream, -struct snd_pcm_hw_params *params) -{ -return snd_pcm_lib_malloc_pages (substream,params_buffer_bytes (params)); -} -static int loopback_hw_free (struct snd_pcm_substream *substream) {struct snd_pcm_runtime *runtime = substream->runtime;
@@ -920,7 +914,7 @@ static int loopback_hw_free(struct snd_pcm_substream *substream)mutex_lock (&dpcm->loopback->cable_lock); cable->valid &= ~(1 << substream->stream);mutex_unlock (&dpcm->loopback->cable_lock); -return snd_pcm_lib_free_pages (substream); +return 0 ; }static unsigned int get_cable_index (struct snd_pcm_substream *substream)
@@ -1306,7 +1300,6 @@ static const struct snd_pcm_ops loopback_pcm_ops = { .open = loopback_open, .close = loopback_close, .ioctl = snd_pcm_lib_ioctl, - .hw_params = loopback_hw_params, .hw_free = loopback_hw_free, .prepare = loopback_prepare, .trigger = loopback_trigger,
@@ -1325,8 +1318,7 @@ static int loopback_pcm_new(struct loopback *loopback,return err;snd_pcm_set_ops (pcm,SNDRV_PCM_STREAM_PLAYBACK , &loopback_pcm_ops);snd_pcm_set_ops (pcm,SNDRV_PCM_STREAM_CAPTURE , &loopback_pcm_ops); -snd_pcm_lib_preallocate_pages_for_all (pcm,SNDRV_DMA_TYPE_VMALLOC , -NULL ,0 ,0 ); +snd_pcm_set_managed_buffer_all (pcm,SNDRV_DMA_TYPE_VMALLOC ,NULL ,0 ,0 ); pcm->private_data = loopback; pcm->info_flags =0 ;
Signature · 6 lines
2.16.4 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
PATCH 5/71 ALSA: dummy: Use managed buffer allocation
In reply to Takashi IwaiClean up the driver with the new managed buffer allocation API. The hw_free callback became superfluous and got dropped.
--- sound/drivers/dummy.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-)
sound/drivers/dummy.c +2 -12
@@ -529,15 +529,7 @@ static int dummy_pcm_hw_params(struct snd_pcm_substream *substream, substream->runtime->dma_bytes =params_buffer_bytes (hw_params);return 0 ; } -return snd_pcm_lib_malloc_pages (substream, -params_buffer_bytes (hw_params)); -} - -static int dummy_pcm_hw_free (struct snd_pcm_substream *substream) -{ -if (fake_buffer) -return 0 ; -return snd_pcm_lib_free_pages (substream); +return 0 ; }static int dummy_pcm_open (struct snd_pcm_substream *substream)
@@ -657,7 +649,6 @@ static struct snd_pcm_ops dummy_pcm_ops = { .close = dummy_pcm_close, .ioctl = snd_pcm_lib_ioctl, .hw_params = dummy_pcm_hw_params, - .hw_free = dummy_pcm_hw_free, .prepare = dummy_pcm_prepare, .trigger = dummy_pcm_trigger, .pointer = dummy_pcm_pointer,
@@ -668,7 +659,6 @@ static struct snd_pcm_ops dummy_pcm_ops_no_buf = { .close = dummy_pcm_close, .ioctl = snd_pcm_lib_ioctl, .hw_params = dummy_pcm_hw_params, - .hw_free = dummy_pcm_hw_free, .prepare = dummy_pcm_prepare, .trigger = dummy_pcm_trigger, .pointer = dummy_pcm_pointer,
@@ -700,7 +690,7 @@ static int snd_card_dummy_pcm(struct snd_dummy *dummy, int device, pcm->info_flags =0 ;strcpy (pcm->name,"Dummy PCM" );if (!fake_buffer) { -snd_pcm_lib_preallocate_pages_for_all (pcm, +snd_pcm_set_managed_buffer_all (pcm,SNDRV_DMA_TYPE_CONTINUOUS ,NULL ,0 ,64 *1024 );
Signature · 6 lines
2.16.4 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
PATCH 6/71 ALSA: ml403: Use managed buffer allocation
In reply to Takashi IwaiClean up the driver with the new managed buffer allocation API. The hw_params and hw_free callbacks became superfluous (they were only useless debug prints) and got dropped.
--- sound/drivers/ml403-ac97cr.c | 29 ++++------------------------- 1 file changed, 4 insertions(+), 25 deletions(-)
sound/drivers/ml403-ac97cr.c +4 -25
@@ -670,23 +670,6 @@ snd_ml403_ac97cr_pcm_capture_prepare(struct snd_pcm_substream *substream)return 0 ; } -static int snd_ml403_ac97cr_hw_free (struct snd_pcm_substream *substream) -{ -PDEBUG (WORK_INFO ,"hw_free()\n" ); -return snd_pcm_lib_free_pages (substream); -} - -static int -snd_ml403_ac97cr_hw_params (struct snd_pcm_substream *substream, -struct snd_pcm_hw_params *hw_params) -{ -PDEBUG (WORK_INFO ,"hw_params(): desired buffer bytes=%d, desired " -"period bytes=%d\n" , -params_buffer_bytes (hw_params),params_period_bytes (hw_params)); -return snd_pcm_lib_malloc_pages (substream, -params_buffer_bytes (hw_params)); -} -static int snd_ml403_ac97cr_playback_open (struct snd_pcm_substream *substream) {struct snd_ml403_ac97cr *ml403_ac97cr;
@@ -749,8 +732,6 @@ static const struct snd_pcm_ops snd_ml403_ac97cr_playback_ops = { .open = snd_ml403_ac97cr_playback_open, .close = snd_ml403_ac97cr_playback_close, .ioctl = snd_pcm_lib_ioctl, - .hw_params = snd_ml403_ac97cr_hw_params, - .hw_free = snd_ml403_ac97cr_hw_free, .prepare = snd_ml403_ac97cr_pcm_playback_prepare, .trigger = snd_ml403_ac97cr_pcm_playback_trigger, .pointer = snd_ml403_ac97cr_pcm_pointer,
@@ -760,8 +741,6 @@ static const struct snd_pcm_ops snd_ml403_ac97cr_capture_ops = { .open = snd_ml403_ac97cr_capture_open, .close = snd_ml403_ac97cr_capture_close, .ioctl = snd_pcm_lib_ioctl, - .hw_params = snd_ml403_ac97cr_hw_params, - .hw_free = snd_ml403_ac97cr_hw_free, .prepare = snd_ml403_ac97cr_pcm_capture_prepare, .trigger = snd_ml403_ac97cr_pcm_capture_trigger, .pointer = snd_ml403_ac97cr_pcm_pointer,
@@ -1241,10 +1220,10 @@ snd_ml403_ac97cr_pcm(struct snd_ml403_ac97cr *ml403_ac97cr, int device)strcpy (pcm->name,"ML403AC97CR DAC/ADC" ); ml403_ac97cr->pcm = pcm; -snd_pcm_lib_preallocate_pages_for_all (pcm,SNDRV_DMA_TYPE_CONTINUOUS , -NULL , -64 *1024 , -128 *1024 ); +snd_pcm_set_managed_buffer_all (pcm,SNDRV_DMA_TYPE_CONTINUOUS , +NULL , +64 *1024 , +128 *1024 );return 0 ; }
Signature · 6 lines
2.16.4 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
PATCH 7/71 ALSA: pcsp: Use managed buffer allocation
In reply to Takashi IwaiClean up the driver with the new managed buffer allocation API. The superfluous snd_pcm_lib_malloc_pages() and snd_pcm_lib_free_pages() are dropped.
--- sound/drivers/pcsp/pcsp_lib.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-)
sound/drivers/pcsp/pcsp_lib.c +6 -11
@@ -214,12 +214,7 @@ static int snd_pcsp_playback_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *hw_params) {struct snd_pcsp *chip =snd_pcm_substream_chip (substream); -int err;pcsp_sync_stop (chip); - err =snd_pcm_lib_malloc_pages (substream, -params_buffer_bytes (hw_params)); -if (err <0 ) -return err;return 0 ; }
@@ -230,7 +225,7 @@ static int snd_pcsp_playback_hw_free(struct snd_pcm_substream *substream)printk (KERN_INFO "PCSP: hw_free called\n" );#endif pcsp_sync_stop (chip); -return snd_pcm_lib_free_pages (substream); +return 0 ; }static int snd_pcsp_playback_prepare (struct snd_pcm_substream *substream)
@@ -350,11 +345,11 @@ int snd_pcsp_new_pcm(struct snd_pcsp *chip) chip->pcm->info_flags =SNDRV_PCM_INFO_HALF_DUPLEX ;strcpy (chip->pcm->name,"pcsp" ); -snd_pcm_lib_preallocate_pages_for_all (chip->pcm, -SNDRV_DMA_TYPE_CONTINUOUS , -NULL , -PCSP_BUFFER_SIZE , -PCSP_BUFFER_SIZE ); +snd_pcm_set_managed_buffer_all (chip->pcm, +SNDRV_DMA_TYPE_CONTINUOUS , +NULL , +PCSP_BUFFER_SIZE , +PCSP_BUFFER_SIZE );return 0 ; }
Signature · 6 lines
2.16.4 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
PATCH 8/71 ALSA: vx: Use managed buffer allocation
In reply to Takashi IwaiClean up the driver with the new managed buffer allocation API. The hw_params and hw_free callbacks became superfluous and got dropped.
--- sound/drivers/vx/vx_pcm.c | 27 +++------------------------ 1 file changed, 3 insertions(+), 24 deletions(-)
sound/drivers/vx/vx_pcm.c +3 -24
@@ -772,23 +772,6 @@ static snd_pcm_uframes_t vx_pcm_playback_pointer(struct snd_pcm_substream *subs)return pipe->position; } -/* -* vx_pcm_hw_params - hw_params callback for playback and capture -*/ -static int vx_pcm_hw_params (struct snd_pcm_substream *subs, -struct snd_pcm_hw_params *hw_params) -{ -return snd_pcm_lib_malloc_pages (subs,params_buffer_bytes (hw_params)); -} - -/* -* vx_pcm_hw_free - hw_free callback for playback and capture -*/ -static int vx_pcm_hw_free (struct snd_pcm_substream *subs) -{ -return snd_pcm_lib_free_pages (subs); -} -/* * vx_pcm_prepare - prepare callback for playback and capture */
@@ -861,8 +844,6 @@ static const struct snd_pcm_ops vx_pcm_playback_ops = { .open = vx_pcm_playback_open, .close = vx_pcm_playback_close, .ioctl = snd_pcm_lib_ioctl, - .hw_params = vx_pcm_hw_params, - .hw_free = vx_pcm_hw_free, .prepare = vx_pcm_prepare, .trigger = vx_pcm_trigger, .pointer = vx_pcm_playback_pointer,
@@ -1081,8 +1062,6 @@ static const struct snd_pcm_ops vx_pcm_capture_ops = { .open = vx_pcm_capture_open, .close = vx_pcm_capture_close, .ioctl = snd_pcm_lib_ioctl, - .hw_params = vx_pcm_hw_params, - .hw_free = vx_pcm_hw_free, .prepare = vx_pcm_prepare, .trigger = vx_pcm_trigger, .pointer = vx_pcm_capture_pointer,
@@ -1230,9 +1209,9 @@ int snd_vx_pcm_new(struct vx_core *chip)snd_pcm_set_ops (pcm,SNDRV_PCM_STREAM_PLAYBACK , &vx_pcm_playback_ops);if (ins)snd_pcm_set_ops (pcm,SNDRV_PCM_STREAM_CAPTURE , &vx_pcm_capture_ops); -snd_pcm_lib_preallocate_pages_for_all (pcm,SNDRV_DMA_TYPE_VMALLOC , -snd_dma_continuous_data (GFP_KERNEL |GFP_DMA32 ), -0 ,0 ); +snd_pcm_set_managed_buffer_all (pcm,SNDRV_DMA_TYPE_VMALLOC , +snd_dma_continuous_data (GFP_KERNEL |GFP_DMA32 ), +0 ,0 ); pcm->private_data = chip; pcm->private_free = snd_vx_pcm_free;
Signature · 6 lines
2.16.4 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
PATCH 9/71 ALSA: firewire: Use managed buffer allocation
In reply to Takashi IwaiClean up the drivers with the new managed buffer allocation API. The superfluous snd_pcm_lib_malloc_pages() and snd_pcm_lib_free_pages() calls are dropped.
--- sound/firewire/bebob/bebob_pcm.c | 11 +++-------- sound/firewire/dice/dice-pcm.c | 13 ++++--------- sound/firewire/digi00x/digi00x-pcm.c | 11 +++-------- sound/firewire/fireface/ff-pcm.c | 9 ++------- sound/firewire/fireworks/fireworks_pcm.c | 11 +++-------- sound/firewire/isight.c | 10 ++-------- sound/firewire/motu/motu-pcm.c | 11 +++-------- sound/firewire/oxfw/oxfw-pcm.c | 17 ++++------------- sound/firewire/tascam/tascam-pcm.c | 11 +++-------- 9 files changed, 27 insertions(+), 77 deletions(-)
sound/firewire/bebob/bebob_pcm.c +3 -8
@@ -214,10 +214,6 @@ static int pcm_hw_params(struct snd_pcm_substream *substream,struct snd_bebob *bebob = substream->private_data;int err; - err =snd_pcm_lib_malloc_pages (substream,params_buffer_bytes (hw_params)); -if (err <0 ) -return err; -if (substream->runtime->status->state ==SNDRV_PCM_STATE_OPEN ) {unsigned int rate =params_rate (hw_params);unsigned int frames_per_period =params_period_size (hw_params);
@@ -231,7 +227,7 @@ static int pcm_hw_params(struct snd_pcm_substream *substream,mutex_unlock (&bebob->mutex); } -return err; +return 0 ; }static int pcm_hw_free (struct snd_pcm_substream *substream)
@@ -247,7 +243,7 @@ static int pcm_hw_free(struct snd_pcm_substream *substream)mutex_unlock (&bebob->mutex); -return snd_pcm_lib_free_pages (substream); +return 0 ; } static int
@@ -377,8 +373,7 @@ int snd_bebob_create_pcm_devices(struct snd_bebob *bebob) "%s PCM", bebob->card->shortname);snd_pcm_set_ops (pcm,SNDRV_PCM_STREAM_PLAYBACK , &playback_ops);snd_pcm_set_ops (pcm,SNDRV_PCM_STREAM_CAPTURE , &capture_ops); -snd_pcm_lib_preallocate_pages_for_all (pcm,SNDRV_DMA_TYPE_VMALLOC , -NULL ,0 ,0 ); +snd_pcm_set_managed_buffer_all (pcm,SNDRV_DMA_TYPE_VMALLOC ,NULL ,0 ,0 ); end:return err; }
sound/firewire/dice/dice-pcm.c +4 -9
@@ -266,10 +266,6 @@ static int pcm_hw_params(struct snd_pcm_substream *substream,struct snd_dice *dice = substream->private_data;int err; - err =snd_pcm_lib_malloc_pages (substream,params_buffer_bytes (hw_params)); -if (err <0 ) -return err; -if (substream->runtime->status->state ==SNDRV_PCM_STATE_OPEN ) {unsigned int rate =params_rate (hw_params);unsigned int events_per_period =params_period_size (hw_params);
@@ -288,7 +284,7 @@ static int pcm_hw_params(struct snd_pcm_substream *substream,mutex_unlock (&dice->mutex); } -return err; +return 0 ; }static int pcm_hw_free (struct snd_pcm_substream *substream)
@@ -304,7 +300,7 @@ static int pcm_hw_free(struct snd_pcm_substream *substream)mutex_unlock (&dice->mutex); -return snd_pcm_lib_free_pages (substream); +return 0 ; }static int capture_prepare (struct snd_pcm_substream *substream)
@@ -457,9 +453,8 @@ int snd_dice_create_pcm(struct snd_dice *dice)snd_pcm_set_ops (pcm,SNDRV_PCM_STREAM_PLAYBACK , &playback_ops); -snd_pcm_lib_preallocate_pages_for_all (pcm, -SNDRV_DMA_TYPE_VMALLOC , -NULL ,0 ,0 ); +snd_pcm_set_managed_buffer_all (pcm,SNDRV_DMA_TYPE_VMALLOC , +NULL ,0 ,0 ); }return 0 ;
sound/firewire/digi00x/digi00x-pcm.c +3 -8
@@ -190,10 +190,6 @@ static int pcm_hw_params(struct snd_pcm_substream *substream,struct snd_dg00x *dg00x = substream->private_data;int err; - err =snd_pcm_lib_malloc_pages (substream,params_buffer_bytes (hw_params)); -if (err <0 ) -return err; -if (substream->runtime->status->state ==SNDRV_PCM_STATE_OPEN ) {unsigned int rate =params_rate (hw_params);unsigned int frames_per_period =params_period_size (hw_params);
@@ -207,7 +203,7 @@ static int pcm_hw_params(struct snd_pcm_substream *substream,mutex_unlock (&dg00x->mutex); } -return err; +return 0 ; }static int pcm_hw_free (struct snd_pcm_substream *substream)
@@ -223,7 +219,7 @@ static int pcm_hw_free(struct snd_pcm_substream *substream)mutex_unlock (&dg00x->mutex); -return snd_pcm_lib_free_pages (substream); +return 0 ; }static int pcm_capture_prepare (struct snd_pcm_substream *substream)
@@ -360,8 +356,7 @@ int snd_dg00x_create_pcm_devices(struct snd_dg00x *dg00x) "%s PCM", dg00x->card->shortname);snd_pcm_set_ops (pcm,SNDRV_PCM_STREAM_PLAYBACK , &playback_ops);snd_pcm_set_ops (pcm,SNDRV_PCM_STREAM_CAPTURE , &capture_ops); -snd_pcm_lib_preallocate_pages_for_all (pcm,SNDRV_DMA_TYPE_VMALLOC , -NULL ,0 ,0 ); +snd_pcm_set_managed_buffer_all (pcm,SNDRV_DMA_TYPE_VMALLOC ,NULL ,0 ,0 );return 0 ; }
sound/firewire/fireface/ff-pcm.c +2 -7
@@ -230,10 +230,6 @@ static int pcm_hw_params(struct snd_pcm_substream *substream,struct snd_ff *ff = substream->private_data;int err; - err =snd_pcm_lib_malloc_pages (substream,params_buffer_bytes (hw_params)); -if (err <0 ) -return err; -if (substream->runtime->status->state ==SNDRV_PCM_STATE_OPEN ) {unsigned int rate =params_rate (hw_params);unsigned int frames_per_period =params_period_size (hw_params);
@@ -263,7 +259,7 @@ static int pcm_hw_free(struct snd_pcm_substream *substream)mutex_unlock (&ff->mutex); -return snd_pcm_lib_free_pages (substream); +return 0 ; }static int pcm_capture_prepare (struct snd_pcm_substream *substream)
@@ -400,8 +396,7 @@ int snd_ff_create_pcm_devices(struct snd_ff *ff) "%s PCM", ff->card->shortname);snd_pcm_set_ops (pcm,SNDRV_PCM_STREAM_PLAYBACK , &pcm_playback_ops);snd_pcm_set_ops (pcm,SNDRV_PCM_STREAM_CAPTURE , &pcm_capture_ops); -snd_pcm_lib_preallocate_pages_for_all (pcm,SNDRV_DMA_TYPE_VMALLOC , -NULL ,0 ,0 ); +snd_pcm_set_managed_buffer_all (pcm,SNDRV_DMA_TYPE_VMALLOC ,NULL ,0 ,0 );return 0 ; }
sound/firewire/fireworks/fireworks_pcm.c +3 -8
@@ -250,10 +250,6 @@ static int pcm_hw_params(struct snd_pcm_substream *substream,struct snd_efw *efw = substream->private_data;int err; - err =snd_pcm_lib_malloc_pages (substream,params_buffer_bytes (hw_params)); -if (err <0 ) -return err; -if (substream->runtime->status->state ==SNDRV_PCM_STATE_OPEN ) {unsigned int rate =params_rate (hw_params);unsigned int frames_per_period =params_period_size (hw_params);
@@ -267,7 +263,7 @@ static int pcm_hw_params(struct snd_pcm_substream *substream,mutex_unlock (&efw->mutex); } -return err; +return 0 ; }static int pcm_hw_free (struct snd_pcm_substream *substream)
@@ -283,7 +279,7 @@ static int pcm_hw_free(struct snd_pcm_substream *substream)mutex_unlock (&efw->mutex); -return snd_pcm_lib_free_pages (substream); +return 0 ; }static int pcm_capture_prepare (struct snd_pcm_substream *substream)
@@ -406,8 +402,7 @@ int snd_efw_create_pcm_devices(struct snd_efw *efw)snprintf (pcm->name,sizeof (pcm->name),"%s PCM" , efw->card->shortname);snd_pcm_set_ops (pcm,SNDRV_PCM_STREAM_PLAYBACK , &playback_ops);snd_pcm_set_ops (pcm,SNDRV_PCM_STREAM_CAPTURE , &capture_ops); -snd_pcm_lib_preallocate_pages_for_all (pcm,SNDRV_DMA_TYPE_VMALLOC , -NULL ,0 ,0 ); +snd_pcm_set_managed_buffer_all (pcm,SNDRV_DMA_TYPE_VMALLOC ,NULL ,0 ,0 ); end:return err; }
sound/firewire/isight.c +2 -8
@@ -286,11 +286,6 @@ static int isight_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *hw_params) {struct isight *isight = substream->private_data; -int err; - - err =snd_pcm_lib_malloc_pages (substream,params_buffer_bytes (hw_params)); -if (err <0 ) -return err;WRITE_ONCE (isight->pcm_active, true);
@@ -336,7 +331,7 @@ static int isight_hw_free(struct snd_pcm_substream *substream)isight_stop_streaming (isight);mutex_unlock (&isight->mutex); -return snd_pcm_lib_free_pages (substream); +return 0 ; }static int isight_start_streaming (struct isight *isight)
@@ -463,8 +458,7 @@ static int isight_create_pcm(struct isight *isight)strcpy (pcm->name,"iSight" ); isight->pcm = pcm->streams[SNDRV_PCM_STREAM_CAPTURE ].substream; isight->pcm->ops = &ops; -snd_pcm_lib_preallocate_pages_for_all (pcm,SNDRV_DMA_TYPE_VMALLOC , -NULL ,0 ,0 ); +snd_pcm_set_managed_buffer_all (pcm,SNDRV_DMA_TYPE_VMALLOC ,NULL ,0 ,0 );return 0 ; }
sound/firewire/motu/motu-pcm.c +3 -8
@@ -218,10 +218,6 @@ static int pcm_hw_params(struct snd_pcm_substream *substream,struct snd_motu *motu = substream->private_data;int err; - err =snd_pcm_lib_malloc_pages (substream,params_buffer_bytes (hw_params)); -if (err <0 ) -return err; -if (substream->runtime->status->state ==SNDRV_PCM_STATE_OPEN ) {unsigned int rate =params_rate (hw_params);unsigned int frames_per_period =params_period_size (hw_params);
@@ -235,7 +231,7 @@ static int pcm_hw_params(struct snd_pcm_substream *substream,mutex_unlock (&motu->mutex); } -return err; +return 0 ; }static int pcm_hw_free (struct snd_pcm_substream *substream)
@@ -251,7 +247,7 @@ static int pcm_hw_free(struct snd_pcm_substream *substream)mutex_unlock (&motu->mutex); -return snd_pcm_lib_free_pages (substream); +return 0 ; }static int capture_prepare (struct snd_pcm_substream *substream)
@@ -378,8 +374,7 @@ int snd_motu_create_pcm_devices(struct snd_motu *motu)snd_pcm_set_ops (pcm,SNDRV_PCM_STREAM_CAPTURE , &capture_ops);snd_pcm_set_ops (pcm,SNDRV_PCM_STREAM_PLAYBACK , &playback_ops); -snd_pcm_lib_preallocate_pages_for_all (pcm,SNDRV_DMA_TYPE_VMALLOC , -NULL ,0 ,0 ); +snd_pcm_set_managed_buffer_all (pcm,SNDRV_DMA_TYPE_VMALLOC ,NULL ,0 ,0 );return 0 ; }
sound/firewire/oxfw/oxfw-pcm.c +4 -13
@@ -239,10 +239,6 @@ static int pcm_capture_hw_params(struct snd_pcm_substream *substream,struct snd_oxfw *oxfw = substream->private_data;int err; - err =snd_pcm_lib_malloc_pages (substream,params_buffer_bytes (hw_params)); -if (err <0 ) -return err; -if (substream->runtime->status->state ==SNDRV_PCM_STATE_OPEN ) {unsigned int rate =params_rate (hw_params);unsigned int channels =params_channels (hw_params);
@@ -258,7 +254,7 @@ static int pcm_capture_hw_params(struct snd_pcm_substream *substream,mutex_unlock (&oxfw->mutex); } -return err; +return 0 ; }static int pcm_playback_hw_params (struct snd_pcm_substream *substream,struct snd_pcm_hw_params *hw_params)
@@ -266,10 +262,6 @@ static int pcm_playback_hw_params(struct snd_pcm_substream *substream,struct snd_oxfw *oxfw = substream->private_data;int err; - err =snd_pcm_lib_malloc_pages (substream,params_buffer_bytes (hw_params)); -if (err <0 ) -return err; -if (substream->runtime->status->state ==SNDRV_PCM_STATE_OPEN ) {unsigned int rate =params_rate (hw_params);unsigned int channels =params_channels (hw_params);
@@ -301,7 +293,7 @@ static int pcm_capture_hw_free(struct snd_pcm_substream *substream)mutex_unlock (&oxfw->mutex); -return snd_pcm_lib_free_pages (substream); +return 0 ; }static int pcm_playback_hw_free (struct snd_pcm_substream *substream) {
@@ -316,7 +308,7 @@ static int pcm_playback_hw_free(struct snd_pcm_substream *substream)mutex_unlock (&oxfw->mutex); -return snd_pcm_lib_free_pages (substream); +return 0 ; }static int pcm_capture_prepare (struct snd_pcm_substream *substream)
@@ -454,8 +446,7 @@ int snd_oxfw_create_pcm(struct snd_oxfw *oxfw)snd_pcm_set_ops (pcm,SNDRV_PCM_STREAM_PLAYBACK , &playback_ops);if (cap >0 )snd_pcm_set_ops (pcm,SNDRV_PCM_STREAM_CAPTURE , &capture_ops); -snd_pcm_lib_preallocate_pages_for_all (pcm,SNDRV_DMA_TYPE_VMALLOC , -NULL ,0 ,0 ); +snd_pcm_set_managed_buffer_all (pcm,SNDRV_DMA_TYPE_VMALLOC ,NULL ,0 ,0 );return 0 ; }
sound/firewire/tascam/tascam-pcm.c +3 -8
@@ -119,10 +119,6 @@ static int pcm_hw_params(struct snd_pcm_substream *substream,struct snd_tscm *tscm = substream->private_data;int err; - err =snd_pcm_lib_malloc_pages (substream,params_buffer_bytes (hw_params)); -if (err <0 ) -return err; -if (substream->runtime->status->state ==SNDRV_PCM_STATE_OPEN ) {unsigned int rate =params_rate (hw_params);unsigned int frames_per_period =params_period_size (hw_params);
@@ -136,7 +132,7 @@ static int pcm_hw_params(struct snd_pcm_substream *substream,mutex_unlock (&tscm->mutex); } -return err; +return 0 ; }static int pcm_hw_free (struct snd_pcm_substream *substream)
@@ -152,7 +148,7 @@ static int pcm_hw_free(struct snd_pcm_substream *substream)mutex_unlock (&tscm->mutex); -return snd_pcm_lib_free_pages (substream); +return 0 ; }static int pcm_capture_prepare (struct snd_pcm_substream *substream)
@@ -289,8 +285,7 @@ int snd_tscm_create_pcm_devices(struct snd_tscm *tscm) "%s PCM", tscm->card->shortname);snd_pcm_set_ops (pcm,SNDRV_PCM_STREAM_PLAYBACK , &playback_ops);snd_pcm_set_ops (pcm,SNDRV_PCM_STREAM_CAPTURE , &capture_ops); -snd_pcm_lib_preallocate_pages_for_all (pcm,SNDRV_DMA_TYPE_VMALLOC , -NULL ,0 ,0 ); +snd_pcm_set_managed_buffer_all (pcm,SNDRV_DMA_TYPE_VMALLOC ,NULL ,0 ,0 );return 0 ; }
Signature · 6 lines
2.16.4 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Takashi Sakamoto
maintainerRe: [alsa-devel] [PATCH 5.6 09/71] ALSA: firewire: Use managed buffer allocation
Hi,
I'm not opposed to this patchset. The direction is preferable.
However changes in this patchset brings bugs in error path of each implementation for pcm.hw_params.
Quoted 16 lines · Takashi Iwai
sound/firewire/bebob/bebob_pcm.c +0
-4@@ -214,10 +214,6 @@ static int pcm_hw_params(struct snd_pcm_substream *substream,struct snd_bebob *bebob = substream->private_data;int err; - err =snd_pcm_lib_malloc_pages (substream,params_buffer_bytes (hw_params)); -if (err <0 ) -return err; -if (substream->runtime->status->state ==SNDRV_PCM_STATE_OPEN ) {unsigned int rate =params_rate (hw_params);unsigned int frames_per_period =params_period_size (hw_params);
sound/firewire/bebob/bebob_pcm.c static int pcm_hw_params(struct snd_pcm_substream *substream, · line 231
Quoted 6 lines
sound/firewire/bebob/bebob_pcm.c +1
-1@@ -231,7 +227,7 @@ static int pcm_hw_params(struct snd_pcm_substream *substream,mutex_unlock (&bebob->mutex); } -return err; +return 0 ; }
This should return the err variable to report failure of isochronous resources reservation.
However I found that ALSA oxfw/fireface drivers returns 0 even if it fails. This is bug since v5.3 kernel.
Would you please apply below two patches into your three, then modify your patch for all firewire drivers to return error correctly?
======== 8< --------
From a2cddad1c74e8e825739db63c17c0efabed1c93d Mon Sep 17 00:00:00 2001
From: Takashi Sakamoto <[email protected]>
Date: Tue, 10 Dec 2019 00:03:04 +0900
Subject: [PATCH 1/2] ALSA: oxfw: fix return value in error path of isochronous
resources reservation
Even if isochronous resources reservation fails, error code doesn't return in pcm.hw_params callback.
--- sound/firewire/oxfw/oxfw-pcm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/firewire/oxfw/oxfw-pcm.c +1 -1
@@ -285,7 +285,7 @@ static int pcm_playback_hw_params(struct snd_pcm_substream *substream,mutex_unlock (&oxfw->mutex); } -return 0 ; +return err; }static int pcm_capture_hw_free (struct snd_pcm_substream *substream)
Signature · 19 lines
2.20.1 ======== 8< -------- From cde8560eddc0e1f276865fa7f9bbccd27714d286 Mon Sep 17 00:00:00 2001 From: Takashi Sakamoto <[email protected]> Date: Tue, 10 Dec 2019 00:05:41 +0900 Subject: [PATCH 2/2] ALSA: fireface: fix return value in error path of isochronous resources reservation Even if isochronous resources reservation fails, error code doesn't return in pcm.hw_params callback. Cc: <[email protected]> #5.3+ Fixes: 55162d2bb0e8 ("ALSA: fireface: reserve/release isochronous resources in pcm.hw_params/hw_free callbacks") Signed-off-by: Takashi Sakamoto <[email protected]> --- sound/firewire/fireface/ff-pcm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/firewire/fireface/ff-pcm.c +1 -1
@@ -247,7 +247,7 @@ static int pcm_hw_params(struct snd_pcm_substream *substream,mutex_unlock (&ff->mutex); } -return 0 ; +return err; }static int pcm_hw_free (struct snd_pcm_substream *substream)
Signature · 12 lines
2.20.1 ======== 8< -------- Thanks Takashi Sakamoto _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Re: [alsa-devel] [PATCH 5.6 09/71] ALSA: firewire: Use managed buffer allocation
Quoted 35 lines · Takashi Sakamoto
Hi,
I'm not opposed to this patchset. The direction is preferable.
However changes in this patchset brings bugs in error path of each implementation for pcm.hw_params.
Quoted 16 lines · Takashi Iwai
sound/firewire/bebob/bebob_pcm.c +0
-4@@ -214,10 +214,6 @@ static int pcm_hw_params(struct snd_pcm_substream *substream,struct snd_bebob *bebob = substream->private_data;int err; - err =snd_pcm_lib_malloc_pages (substream,params_buffer_bytes (hw_params)); -if (err <0 ) -return err; -if (substream->runtime->status->state ==SNDRV_PCM_STATE_OPEN ) {unsigned int rate =params_rate (hw_params);unsigned int frames_per_period =params_period_size (hw_params);sound/firewire/bebob/bebob_pcm.c static int pcm_hw_params(struct snd_pcm_substream *substream, · line 231
Quoted 6 lines
sound/firewire/bebob/bebob_pcm.c +1
-1@@ -231,7 +227,7 @@ static int pcm_hw_params(struct snd_pcm_substream *substream,mutex_unlock (&bebob->mutex); } -return err; +return 0 ; }This should return the err variable to report failure of isochronous resources reservation.
Quoted 5 lines
However I found that ALSA oxfw/fireface drivers returns 0 even if it fails. This is bug since v5.3 kernel.
Would you please apply below two patches into your three, then modify your patch for all firewire drivers to return error correctly?
Yes, that sounds like a correct fix. Thank you for spotting out.
So, please go ahead, submit these two patches, then I'll update the fix containing your correction above and submit as v2 (maybe only for this, as the whole series is too big to re-submit).
Takashi
_______________________________________________
Alsa-devel mailing list
[email protected]
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Re: [alsa-devel] [PATCH 5.6 09/71] ALSA: firewire: Use managed buffer allocation
Quoted 41 lines · Takashi Iwai
Quoted 38 lines · Takashi Sakamoto
Hi,
I'm not opposed to this patchset. The direction is preferable.
However changes in this patchset brings bugs in error path of each implementation for pcm.hw_params.
Quoted 16 lines · Takashi Iwai
sound/firewire/bebob/bebob_pcm.c +0
-4@@ -214,10 +214,6 @@ static int pcm_hw_params(struct snd_pcm_substream *substream,struct snd_bebob *bebob = substream->private_data;int err; - err =snd_pcm_lib_malloc_pages (substream,params_buffer_bytes (hw_params)); -if (err <0 ) -return err; -if (substream->runtime->status->state ==SNDRV_PCM_STATE_OPEN ) {unsigned int rate =params_rate (hw_params);unsigned int frames_per_period =params_period_size (hw_params);sound/firewire/bebob/bebob_pcm.c static int pcm_hw_params(struct snd_pcm_substream *substream, · line 231
Quoted 6 lines
sound/firewire/bebob/bebob_pcm.c +1
-1@@ -231,7 +227,7 @@ static int pcm_hw_params(struct snd_pcm_substream *substream,mutex_unlock (&bebob->mutex); } -return err; +return 0 ; }This should return the err variable to report failure of isochronous resources reservation.
However I found that ALSA oxfw/fireface drivers returns 0 even if it fails. This is bug since v5.3 kernel.
Quoted 8 lines
Quoted 2 lines
Would you please apply below two patches into your three, then modify your patch for all firewire drivers to return error correctly?
Yes, that sounds like a correct fix. Thank you for spotting out.
So, please go ahead, submit these two patches, then I'll update the fix containing your correction above and submit as v2 (maybe only for this, as the whole series is too big to re-submit).
Never mind, the patches there were already good enough, so I applied these two now. Will resend v2 fix for this patch.
thanks,
Takashi
_______________________________________________
Alsa-devel mailing list
[email protected]
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
PATCH v2 1/1 ALSA: firewire: Use managed buffer allocation
Clean up the drivers with the new managed buffer allocation API. The superfluous snd_pcm_lib_malloc_pages() and snd_pcm_lib_free_pages() calls are dropped.
---v1->v2: corrected the return value to propate the error
initialize err variable for covering uninitialized compiler errors
sound/firewire/bebob/bebob_pcm.c | 11 +++-------- sound/firewire/dice/dice-pcm.c | 13 ++++--------- sound/firewire/digi00x/digi00x-pcm.c | 11 +++-------- sound/firewire/fireface/ff-pcm.c | 11 +++-------- sound/firewire/fireworks/fireworks_pcm.c | 11 +++-------- sound/firewire/isight.c | 10 ++-------- sound/firewire/motu/motu-pcm.c | 11 +++-------- sound/firewire/oxfw/oxfw-pcm.c | 19 +++++-------------- sound/firewire/tascam/tascam-pcm.c | 11 +++-------- 9 files changed, 29 insertions(+), 79 deletions(-)
sound/firewire/bebob/bebob_pcm.c +3 -8
@@ -212,11 +212,7 @@ static int pcm_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *hw_params) {struct snd_bebob *bebob = substream->private_data; -int err; - - err =snd_pcm_lib_malloc_pages (substream,params_buffer_bytes (hw_params)); -if (err <0 ) -return err; +int err =0 ;if (substream->runtime->status->state ==SNDRV_PCM_STATE_OPEN ) {unsigned int rate =params_rate (hw_params);
@@ -247,7 +243,7 @@ static int pcm_hw_free(struct snd_pcm_substream *substream)mutex_unlock (&bebob->mutex); -return snd_pcm_lib_free_pages (substream); +return 0 ; } static int
@@ -377,8 +373,7 @@ int snd_bebob_create_pcm_devices(struct snd_bebob *bebob) "%s PCM", bebob->card->shortname);snd_pcm_set_ops (pcm,SNDRV_PCM_STREAM_PLAYBACK , &playback_ops);snd_pcm_set_ops (pcm,SNDRV_PCM_STREAM_CAPTURE , &capture_ops); -snd_pcm_lib_preallocate_pages_for_all (pcm,SNDRV_DMA_TYPE_VMALLOC , -NULL ,0 ,0 ); +snd_pcm_set_managed_buffer_all (pcm,SNDRV_DMA_TYPE_VMALLOC ,NULL ,0 ,0 ); end:return err; }
sound/firewire/dice/dice-pcm.c +4 -9
@@ -264,11 +264,7 @@ static int pcm_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *hw_params) {struct snd_dice *dice = substream->private_data; -int err; - - err =snd_pcm_lib_malloc_pages (substream,params_buffer_bytes (hw_params)); -if (err <0 ) -return err; +int err =0 ;if (substream->runtime->status->state ==SNDRV_PCM_STATE_OPEN ) {unsigned int rate =params_rate (hw_params);
@@ -304,7 +300,7 @@ static int pcm_hw_free(struct snd_pcm_substream *substream)mutex_unlock (&dice->mutex); -return snd_pcm_lib_free_pages (substream); +return 0 ; }static int capture_prepare (struct snd_pcm_substream *substream)
@@ -457,9 +453,8 @@ int snd_dice_create_pcm(struct snd_dice *dice)snd_pcm_set_ops (pcm,SNDRV_PCM_STREAM_PLAYBACK , &playback_ops); -snd_pcm_lib_preallocate_pages_for_all (pcm, -SNDRV_DMA_TYPE_VMALLOC , -NULL ,0 ,0 ); +snd_pcm_set_managed_buffer_all (pcm,SNDRV_DMA_TYPE_VMALLOC , +NULL ,0 ,0 ); }return 0 ;
sound/firewire/digi00x/digi00x-pcm.c +3 -8
@@ -188,11 +188,7 @@ static int pcm_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *hw_params) {struct snd_dg00x *dg00x = substream->private_data; -int err; - - err =snd_pcm_lib_malloc_pages (substream,params_buffer_bytes (hw_params)); -if (err <0 ) -return err; +int err =0 ;if (substream->runtime->status->state ==SNDRV_PCM_STATE_OPEN ) {unsigned int rate =params_rate (hw_params);
@@ -223,7 +219,7 @@ static int pcm_hw_free(struct snd_pcm_substream *substream)mutex_unlock (&dg00x->mutex); -return snd_pcm_lib_free_pages (substream); +return 0 ; }static int pcm_capture_prepare (struct snd_pcm_substream *substream)
@@ -360,8 +356,7 @@ int snd_dg00x_create_pcm_devices(struct snd_dg00x *dg00x) "%s PCM", dg00x->card->shortname);snd_pcm_set_ops (pcm,SNDRV_PCM_STREAM_PLAYBACK , &playback_ops);snd_pcm_set_ops (pcm,SNDRV_PCM_STREAM_CAPTURE , &capture_ops); -snd_pcm_lib_preallocate_pages_for_all (pcm,SNDRV_DMA_TYPE_VMALLOC , -NULL ,0 ,0 ); +snd_pcm_set_managed_buffer_all (pcm,SNDRV_DMA_TYPE_VMALLOC ,NULL ,0 ,0 );return 0 ; }
sound/firewire/fireface/ff-pcm.c +3 -8
@@ -228,11 +228,7 @@ static int pcm_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *hw_params) {struct snd_ff *ff = substream->private_data; -int err; - - err =snd_pcm_lib_malloc_pages (substream,params_buffer_bytes (hw_params)); -if (err <0 ) -return err; +int err =0 ;if (substream->runtime->status->state ==SNDRV_PCM_STATE_OPEN ) {unsigned int rate =params_rate (hw_params);
@@ -263,7 +259,7 @@ static int pcm_hw_free(struct snd_pcm_substream *substream)mutex_unlock (&ff->mutex); -return snd_pcm_lib_free_pages (substream); +return 0 ; }static int pcm_capture_prepare (struct snd_pcm_substream *substream)
@@ -400,8 +396,7 @@ int snd_ff_create_pcm_devices(struct snd_ff *ff) "%s PCM", ff->card->shortname);snd_pcm_set_ops (pcm,SNDRV_PCM_STREAM_PLAYBACK , &pcm_playback_ops);snd_pcm_set_ops (pcm,SNDRV_PCM_STREAM_CAPTURE , &pcm_capture_ops); -snd_pcm_lib_preallocate_pages_for_all (pcm,SNDRV_DMA_TYPE_VMALLOC , -NULL ,0 ,0 ); +snd_pcm_set_managed_buffer_all (pcm,SNDRV_DMA_TYPE_VMALLOC ,NULL ,0 ,0 );return 0 ; }
sound/firewire/fireworks/fireworks_pcm.c +3 -8
@@ -248,11 +248,7 @@ static int pcm_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *hw_params) {struct snd_efw *efw = substream->private_data; -int err; - - err =snd_pcm_lib_malloc_pages (substream,params_buffer_bytes (hw_params)); -if (err <0 ) -return err; +int err =0 ;if (substream->runtime->status->state ==SNDRV_PCM_STATE_OPEN ) {unsigned int rate =params_rate (hw_params);
@@ -283,7 +279,7 @@ static int pcm_hw_free(struct snd_pcm_substream *substream)mutex_unlock (&efw->mutex); -return snd_pcm_lib_free_pages (substream); +return 0 ; }static int pcm_capture_prepare (struct snd_pcm_substream *substream)
@@ -406,8 +402,7 @@ int snd_efw_create_pcm_devices(struct snd_efw *efw)snprintf (pcm->name,sizeof (pcm->name),"%s PCM" , efw->card->shortname);snd_pcm_set_ops (pcm,SNDRV_PCM_STREAM_PLAYBACK , &playback_ops);snd_pcm_set_ops (pcm,SNDRV_PCM_STREAM_CAPTURE , &capture_ops); -snd_pcm_lib_preallocate_pages_for_all (pcm,SNDRV_DMA_TYPE_VMALLOC , -NULL ,0 ,0 ); +snd_pcm_set_managed_buffer_all (pcm,SNDRV_DMA_TYPE_VMALLOC ,NULL ,0 ,0 ); end:return err; }
sound/firewire/isight.c +2 -8
@@ -286,11 +286,6 @@ static int isight_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *hw_params) {struct isight *isight = substream->private_data; -int err; - - err =snd_pcm_lib_malloc_pages (substream,params_buffer_bytes (hw_params)); -if (err <0 ) -return err;WRITE_ONCE (isight->pcm_active, true);
@@ -336,7 +331,7 @@ static int isight_hw_free(struct snd_pcm_substream *substream)isight_stop_streaming (isight);mutex_unlock (&isight->mutex); -return snd_pcm_lib_free_pages (substream); +return 0 ; }static int isight_start_streaming (struct isight *isight)
@@ -463,8 +458,7 @@ static int isight_create_pcm(struct isight *isight)strcpy (pcm->name,"iSight" ); isight->pcm = pcm->streams[SNDRV_PCM_STREAM_CAPTURE ].substream; isight->pcm->ops = &ops; -snd_pcm_lib_preallocate_pages_for_all (pcm,SNDRV_DMA_TYPE_VMALLOC , -NULL ,0 ,0 ); +snd_pcm_set_managed_buffer_all (pcm,SNDRV_DMA_TYPE_VMALLOC ,NULL ,0 ,0 );return 0 ; }
sound/firewire/motu/motu-pcm.c +3 -8
@@ -212,11 +212,7 @@ static int pcm_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *hw_params) {struct snd_motu *motu = substream->private_data; -int err; - - err =snd_pcm_lib_malloc_pages (substream,params_buffer_bytes (hw_params)); -if (err <0 ) -return err; +int err =0 ;if (substream->runtime->status->state ==SNDRV_PCM_STATE_OPEN ) {unsigned int rate =params_rate (hw_params);
@@ -247,7 +243,7 @@ static int pcm_hw_free(struct snd_pcm_substream *substream)mutex_unlock (&motu->mutex); -return snd_pcm_lib_free_pages (substream); +return 0 ; }static int capture_prepare (struct snd_pcm_substream *substream)
@@ -374,8 +370,7 @@ int snd_motu_create_pcm_devices(struct snd_motu *motu)snd_pcm_set_ops (pcm,SNDRV_PCM_STREAM_CAPTURE , &capture_ops);snd_pcm_set_ops (pcm,SNDRV_PCM_STREAM_PLAYBACK , &playback_ops); -snd_pcm_lib_preallocate_pages_for_all (pcm,SNDRV_DMA_TYPE_VMALLOC , -NULL ,0 ,0 ); +snd_pcm_set_managed_buffer_all (pcm,SNDRV_DMA_TYPE_VMALLOC ,NULL ,0 ,0 );return 0 ; }
sound/firewire/oxfw/oxfw-pcm.c +5 -14
@@ -237,11 +237,7 @@ static int pcm_capture_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *hw_params) {struct snd_oxfw *oxfw = substream->private_data; -int err; - - err =snd_pcm_lib_malloc_pages (substream,params_buffer_bytes (hw_params)); -if (err <0 ) -return err; +int err =0 ;if (substream->runtime->status->state ==SNDRV_PCM_STATE_OPEN ) {unsigned int rate =params_rate (hw_params);
@@ -264,11 +260,7 @@ static int pcm_playback_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *hw_params) {struct snd_oxfw *oxfw = substream->private_data; -int err; - - err =snd_pcm_lib_malloc_pages (substream,params_buffer_bytes (hw_params)); -if (err <0 ) -return err; +int err =0 ;if (substream->runtime->status->state ==SNDRV_PCM_STATE_OPEN ) {unsigned int rate =params_rate (hw_params);
@@ -301,7 +293,7 @@ static int pcm_capture_hw_free(struct snd_pcm_substream *substream)mutex_unlock (&oxfw->mutex); -return snd_pcm_lib_free_pages (substream); +return 0 ; }static int pcm_playback_hw_free (struct snd_pcm_substream *substream) {
@@ -316,7 +308,7 @@ static int pcm_playback_hw_free(struct snd_pcm_substream *substream)mutex_unlock (&oxfw->mutex); -return snd_pcm_lib_free_pages (substream); +return 0 ; }static int pcm_capture_prepare (struct snd_pcm_substream *substream)
@@ -454,8 +446,7 @@ int snd_oxfw_create_pcm(struct snd_oxfw *oxfw)snd_pcm_set_ops (pcm,SNDRV_PCM_STREAM_PLAYBACK , &playback_ops);if (cap >0 )snd_pcm_set_ops (pcm,SNDRV_PCM_STREAM_CAPTURE , &capture_ops); -snd_pcm_lib_preallocate_pages_for_all (pcm,SNDRV_DMA_TYPE_VMALLOC , -NULL ,0 ,0 ); +snd_pcm_set_managed_buffer_all (pcm,SNDRV_DMA_TYPE_VMALLOC ,NULL ,0 ,0 );return 0 ; }
sound/firewire/tascam/tascam-pcm.c +3 -8
@@ -117,11 +117,7 @@ static int pcm_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *hw_params) {struct snd_tscm *tscm = substream->private_data; -int err; - - err =snd_pcm_lib_malloc_pages (substream,params_buffer_bytes (hw_params)); -if (err <0 ) -return err; +int err =0 ;if (substream->runtime->status->state ==SNDRV_PCM_STATE_OPEN ) {unsigned int rate =params_rate (hw_params);
@@ -152,7 +148,7 @@ static int pcm_hw_free(struct snd_pcm_substream *substream)mutex_unlock (&tscm->mutex); -return snd_pcm_lib_free_pages (substream); +return 0 ; }static int pcm_capture_prepare (struct snd_pcm_substream *substream)
@@ -289,8 +285,7 @@ int snd_tscm_create_pcm_devices(struct snd_tscm *tscm) "%s PCM", tscm->card->shortname);snd_pcm_set_ops (pcm,SNDRV_PCM_STREAM_PLAYBACK , &playback_ops);snd_pcm_set_ops (pcm,SNDRV_PCM_STREAM_CAPTURE , &capture_ops); -snd_pcm_lib_preallocate_pages_for_all (pcm,SNDRV_DMA_TYPE_VMALLOC , -NULL ,0 ,0 ); +snd_pcm_set_managed_buffer_all (pcm,SNDRV_DMA_TYPE_VMALLOC ,NULL ,0 ,0 );return 0 ; }
Signature · 6 lines
2.16.4 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Re: [alsa-devel] [PATCH v2] ALSA: firewire: Use managed buffer allocation
Hi,
Quoted 9 lines · Takashi Iwai
Clean up the drivers with the new managed buffer allocation API. The superfluous
snd_pcm_lib_malloc_pages()andsnd_pcm_lib_free_pages()calls are dropped.Signed-off-by Takashi Iwai <[email protected]>---
v1->v2: corrected the return value to propate the error
initialize err variable for covering uninitialized compiler errors
Quoted 10 lines
sound/firewire/bebob/bebob_pcm.c | 11 +++-------- sound/firewire/dice/dice-pcm.c | 13 ++++--------- sound/firewire/digi00x/digi00x-pcm.c | 11 +++-------- sound/firewire/fireface/ff-pcm.c | 11 +++-------- sound/firewire/fireworks/fireworks_pcm.c | 11 +++-------- sound/firewire/isight.c | 10 ++-------- sound/firewire/motu/motu-pcm.c | 11 +++-------- sound/firewire/oxfw/oxfw-pcm.c | 19 +++++-------------- sound/firewire/tascam/tascam-pcm.c | 11 +++-------- 9 files changed, 29 insertions(+), 79 deletions(-)
These changes are fine to me.
Regards
Takashi Sakamoto
_______________________________________________
Alsa-devel mailing list
[email protected]
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
PATCH 10/71 ALSA: ad1816a: Use managed buffer allocation
In reply to Takashi IwaiClean up the driver with the new managed buffer allocation API. The hw_params and hw_free callbacks became superfluous and got dropped.
--- sound/isa/ad1816a/ad1816a_lib.c | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-)
sound/isa/ad1816a/ad1816a_lib.c +2 -18
@@ -206,17 +206,6 @@ static int snd_ad1816a_capture_trigger(struct snd_pcm_substream *substream, int SNDRV_PCM_STREAM_CAPTURE, cmd, 1); } -static int snd_ad1816a_hw_params (struct snd_pcm_substream *substream, -struct snd_pcm_hw_params *hw_params) -{ -return snd_pcm_lib_malloc_pages (substream,params_buffer_bytes (hw_params)); -} - -static int snd_ad1816a_hw_free (struct snd_pcm_substream *substream) -{ -return snd_pcm_lib_free_pages (substream); -} -static int snd_ad1816a_playback_prepare (struct snd_pcm_substream *substream) {struct snd_ad1816a *chip =snd_pcm_substream_chip (substream);
@@ -645,8 +634,6 @@ static const struct snd_pcm_ops snd_ad1816a_playback_ops = { .open = snd_ad1816a_playback_open, .close = snd_ad1816a_playback_close, .ioctl = snd_pcm_lib_ioctl, - .hw_params = snd_ad1816a_hw_params, - .hw_free = snd_ad1816a_hw_free, .prepare = snd_ad1816a_playback_prepare, .trigger = snd_ad1816a_playback_trigger, .pointer = snd_ad1816a_playback_pointer,
@@ -656,8 +643,6 @@ static const struct snd_pcm_ops snd_ad1816a_capture_ops = { .open = snd_ad1816a_capture_open, .close = snd_ad1816a_capture_close, .ioctl = snd_pcm_lib_ioctl, - .hw_params = snd_ad1816a_hw_params, - .hw_free = snd_ad1816a_hw_free, .prepare = snd_ad1816a_capture_prepare, .trigger = snd_ad1816a_capture_trigger, .pointer = snd_ad1816a_capture_pointer,
@@ -680,9 +665,8 @@ int snd_ad1816a_pcm(struct snd_ad1816a *chip, int device)strcpy (pcm->name,snd_ad1816a_chip_id (chip));snd_ad1816a_init (chip); -snd_pcm_lib_preallocate_pages_for_all (pcm,SNDRV_DMA_TYPE_DEV , - chip->card->dev, -64 *1024 , chip->dma1 >3 || chip->dma2 >3 ?128 *1024 :64 *1024 ); +snd_pcm_set_managed_buffer_all (pcm,SNDRV_DMA_TYPE_DEV , chip->card->dev, +64 *1024 , chip->dma1 >3 || chip->dma2 >3 ?128 *1024 :64 *1024 ); chip->pcm = pcm;return 0 ;
Signature · 6 lines
2.16.4 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
PATCH 11/71 ALSA: cmi8330: Use managed buffer allocation
In reply to Takashi IwaiClean up the driver with the new managed buffer allocation API. The actual removal of superfluous code will be done in ad1848 and sb codec drivers later.
--- sound/isa/cmi8330.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
sound/isa/cmi8330.c +2 -3
@@ -455,9 +455,8 @@ static int snd_cmi8330_pcm(struct snd_card *card, struct snd_cmi8330 *chip)snd_pcm_set_ops (pcm,SNDRV_PCM_STREAM_PLAYBACK , &chip->streams[SNDRV_PCM_STREAM_PLAYBACK ].ops);snd_pcm_set_ops (pcm,SNDRV_PCM_STREAM_CAPTURE , &chip->streams[SNDRV_PCM_STREAM_CAPTURE ].ops); -snd_pcm_lib_preallocate_pages_for_all (pcm,SNDRV_DMA_TYPE_DEV , - card->dev, -64 *1024 ,128 *1024 ); +snd_pcm_set_managed_buffer_all (pcm,SNDRV_DMA_TYPE_DEV , + card->dev,64 *1024 ,128 *1024 ); chip->pcm = pcm;return 0 ;
Signature · 6 lines
2.16.4 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
PATCH 12/71 ALSA: es1688: Use managed buffer allocation
In reply to Takashi IwaiClean up the driver with the new managed buffer allocation API. The hw_params and hw_free callbacks became superfluous and got dropped.
--- sound/isa/es1688/es1688_lib.c | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-)
sound/isa/es1688/es1688_lib.c +2 -18
@@ -341,17 +341,6 @@ static int snd_es1688_trigger(struct snd_es1688 *chip, int cmd, unsigned char vareturn 0 ; } -static int snd_es1688_hw_params (struct snd_pcm_substream *substream, -struct snd_pcm_hw_params *hw_params) -{ -return snd_pcm_lib_malloc_pages (substream,params_buffer_bytes (hw_params)); -} - -static int snd_es1688_hw_free (struct snd_pcm_substream *substream) -{ -return snd_pcm_lib_free_pages (substream); -} -static int snd_es1688_playback_prepare (struct snd_pcm_substream *substream) {unsigned long flags;
@@ -693,8 +682,6 @@ static const struct snd_pcm_ops snd_es1688_playback_ops = { .open = snd_es1688_playback_open, .close = snd_es1688_playback_close, .ioctl = snd_es1688_ioctl, - .hw_params = snd_es1688_hw_params, - .hw_free = snd_es1688_hw_free, .prepare = snd_es1688_playback_prepare, .trigger = snd_es1688_playback_trigger, .pointer = snd_es1688_playback_pointer,
@@ -704,8 +691,6 @@ static const struct snd_pcm_ops snd_es1688_capture_ops = { .open = snd_es1688_capture_open, .close = snd_es1688_capture_close, .ioctl = snd_es1688_ioctl, - .hw_params = snd_es1688_hw_params, - .hw_free = snd_es1688_hw_free, .prepare = snd_es1688_capture_prepare, .trigger = snd_es1688_capture_trigger, .pointer = snd_es1688_capture_pointer,
@@ -728,9 +713,8 @@ int snd_es1688_pcm(struct snd_card *card, struct snd_es1688 *chip, int device)strcpy (pcm->name,snd_es1688_chip_id (chip)); chip->pcm = pcm; -snd_pcm_lib_preallocate_pages_for_all (pcm,SNDRV_DMA_TYPE_DEV , - card->dev, -64 *1024 ,64 *1024 ); +snd_pcm_set_managed_buffer_all (pcm,SNDRV_DMA_TYPE_DEV , card->dev, +64 *1024 ,64 *1024 );return 0 ; }
Signature · 6 lines
2.16.4 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
PATCH 13/71 ALSA: es18xx: Use managed buffer allocation
In reply to Takashi IwaiClean up the driver with the new managed buffer allocation API. The hw_free callback became superfluous and got dropped.
--- sound/isa/es18xx.c | 24 +++++------------------- 1 file changed, 5 insertions(+), 19 deletions(-)
sound/isa/es18xx.c +5 -19
@@ -434,7 +434,7 @@ static int snd_es18xx_playback_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *hw_params) {struct snd_es18xx *chip =snd_pcm_substream_chip (substream); -int shift, err; +int shift; shift =0 ;if (params_channels (hw_params) ==2 )
@@ -453,16 +453,9 @@ static int snd_es18xx_playback_hw_params(struct snd_pcm_substream *substream, }else { chip->dma1_shift = shift; } -if ((err =snd_pcm_lib_malloc_pages (substream,params_buffer_bytes (hw_params))) <0 ) -return err;return 0 ; } -static int snd_es18xx_pcm_hw_free (struct snd_pcm_substream *substream) -{ -return snd_pcm_lib_free_pages (substream); -} -static int snd_es18xx_playback1_prepare (struct snd_es18xx *chip,struct snd_pcm_substream *substream) {
@@ -543,7 +536,7 @@ static int snd_es18xx_capture_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *hw_params) {struct snd_es18xx *chip =snd_pcm_substream_chip (substream); -int shift, err; +int shift; shift =0 ; if ((chip->caps & ES18XX_DUPLEX_MONO) &&
@@ -557,8 +550,6 @@ static int snd_es18xx_capture_hw_params(struct snd_pcm_substream *substream,if (snd_pcm_format_width (params_format (hw_params)) ==16 ) shift++; chip->dma1_shift = shift; -if ((err =snd_pcm_lib_malloc_pages (substream,params_buffer_bytes (hw_params))) <0 ) -return err;return 0 ; }
@@ -915,7 +906,6 @@ static int snd_es18xx_playback_close(struct snd_pcm_substream *substream)else chip->playback_b_substream =NULL ; -snd_pcm_lib_free_pages (substream);return 0 ; }
@@ -924,7 +914,6 @@ static int snd_es18xx_capture_close(struct snd_pcm_substream *substream)struct snd_es18xx *chip =snd_pcm_substream_chip (substream); chip->capture_a_substream =NULL ; -snd_pcm_lib_free_pages (substream);return 0 ; }
@@ -1656,7 +1645,6 @@ static const struct snd_pcm_ops snd_es18xx_playback_ops = { .close = snd_es18xx_playback_close, .ioctl = snd_pcm_lib_ioctl, .hw_params = snd_es18xx_playback_hw_params, - .hw_free = snd_es18xx_pcm_hw_free, .prepare = snd_es18xx_playback_prepare, .trigger = snd_es18xx_playback_trigger, .pointer = snd_es18xx_playback_pointer,
@@ -1667,7 +1655,6 @@ static const struct snd_pcm_ops snd_es18xx_capture_ops = { .close = snd_es18xx_capture_close, .ioctl = snd_pcm_lib_ioctl, .hw_params = snd_es18xx_capture_hw_params, - .hw_free = snd_es18xx_pcm_hw_free, .prepare = snd_es18xx_capture_prepare, .trigger = snd_es18xx_capture_trigger, .pointer = snd_es18xx_capture_pointer,
@@ -1701,10 +1688,9 @@ static int snd_es18xx_pcm(struct snd_card *card, int device)sprintf (pcm->name,"ESS AudioDrive ES%x" , chip->version); chip->pcm = pcm; -snd_pcm_lib_preallocate_pages_for_all (pcm,SNDRV_DMA_TYPE_DEV , - card->dev, -64 *1024 , - chip->dma1 >3 || chip->dma2 >3 ?128 *1024 :64 *1024 ); +snd_pcm_set_managed_buffer_all (pcm,SNDRV_DMA_TYPE_DEV , card->dev, +64 *1024 , + chip->dma1 >3 || chip->dma2 >3 ?128 *1024 :64 *1024 );return 0 ; }
Signature · 6 lines
2.16.4 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
PATCH 14/71 ALSA: sb: Use managed buffer allocation
In reply to Takashi IwaiClean up the driver with the new managed buffer allocation API. The hw_params and hw_free callbacks became superfluous and got dropped.
--- sound/isa/sb/sb16_main.c | 21 ++------------------- sound/isa/sb/sb8_main.c | 21 ++------------------- 2 files changed, 4 insertions(+), 38 deletions(-)
sound/isa/sb/sb16_main.c +2 -19
@@ -232,18 +232,6 @@ static void snd_sb16_setup_rate(struct snd_sb *chip,spin_unlock_irqrestore (&chip->reg_lock, flags); } -static int snd_sb16_hw_params (struct snd_pcm_substream *substream, -struct snd_pcm_hw_params *hw_params) -{ -return snd_pcm_lib_malloc_pages (substream,params_buffer_bytes (hw_params)); -} - -static int snd_sb16_hw_free (struct snd_pcm_substream *substream) -{ -snd_pcm_lib_free_pages (substream); -return 0 ; -} -static int snd_sb16_playback_prepare (struct snd_pcm_substream *substream) {unsigned long flags;
@@ -830,8 +818,6 @@ static const struct snd_pcm_ops snd_sb16_playback_ops = { .open = snd_sb16_playback_open, .close = snd_sb16_playback_close, .ioctl = snd_pcm_lib_ioctl, - .hw_params = snd_sb16_hw_params, - .hw_free = snd_sb16_hw_free, .prepare = snd_sb16_playback_prepare, .trigger = snd_sb16_playback_trigger, .pointer = snd_sb16_playback_pointer,
@@ -841,8 +827,6 @@ static const struct snd_pcm_ops snd_sb16_capture_ops = { .open = snd_sb16_capture_open, .close = snd_sb16_capture_close, .ioctl = snd_pcm_lib_ioctl, - .hw_params = snd_sb16_hw_params, - .hw_free = snd_sb16_hw_free, .prepare = snd_sb16_capture_prepare, .trigger = snd_sb16_capture_trigger, .pointer = snd_sb16_capture_pointer,
@@ -873,9 +857,8 @@ int snd_sb16dsp_pcm(struct snd_sb *chip, int device) pcm->info_flags =SNDRV_PCM_INFO_HALF_DUPLEX ; } -snd_pcm_lib_preallocate_pages_for_all (pcm,SNDRV_DMA_TYPE_DEV , - card->dev, -64 *1024 ,128 *1024 ); +snd_pcm_set_managed_buffer_all (pcm,SNDRV_DMA_TYPE_DEV , + card->dev,64 *1024 ,128 *1024 );return 0 ; }
sound/isa/sb/sb8_main.c +2 -19
@@ -225,18 +225,6 @@ static int snd_sb8_playback_trigger(struct snd_pcm_substream *substream,return 0 ; } -static int snd_sb8_hw_params (struct snd_pcm_substream *substream, -struct snd_pcm_hw_params *hw_params) -{ -return snd_pcm_lib_malloc_pages (substream,params_buffer_bytes (hw_params)); -} - -static int snd_sb8_hw_free (struct snd_pcm_substream *substream) -{ -snd_pcm_lib_free_pages (substream); -return 0 ; -} -static int snd_sb8_capture_prepare (struct snd_pcm_substream *substream) {unsigned long flags;
@@ -559,8 +547,6 @@ static const struct snd_pcm_ops snd_sb8_playback_ops = { .open = snd_sb8_open, .close = snd_sb8_close, .ioctl = snd_pcm_lib_ioctl, - .hw_params = snd_sb8_hw_params, - .hw_free = snd_sb8_hw_free, .prepare = snd_sb8_playback_prepare, .trigger = snd_sb8_playback_trigger, .pointer = snd_sb8_playback_pointer,
@@ -570,8 +556,6 @@ static const struct snd_pcm_ops snd_sb8_capture_ops = { .open = snd_sb8_open, .close = snd_sb8_close, .ioctl = snd_pcm_lib_ioctl, - .hw_params = snd_sb8_hw_params, - .hw_free = snd_sb8_hw_free, .prepare = snd_sb8_capture_prepare, .trigger = snd_sb8_capture_trigger, .pointer = snd_sb8_capture_pointer,
@@ -595,9 +579,8 @@ int snd_sb8dsp_pcm(struct snd_sb *chip, int device)if (chip->dma8 >3 || chip->dma16 >=0 ) max_prealloc =128 *1024 ; -snd_pcm_lib_preallocate_pages_for_all (pcm,SNDRV_DMA_TYPE_DEV , - card->dev, -64 *1024 , max_prealloc); +snd_pcm_set_managed_buffer_all (pcm,SNDRV_DMA_TYPE_DEV , + card->dev,64 *1024 , max_prealloc);return 0 ; }
Signature · 6 lines
2.16.4 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
PATCH 15/71 ALSA: gus: Use managed buffer allocation
In reply to Takashi IwaiClean up the driver with the new managed buffer allocation API. The hw_free callback became superfluous and got dropped.
--- sound/isa/gus/gus_pcm.c | 28 +++++++++------------------- 1 file changed, 9 insertions(+), 19 deletions(-)
sound/isa/gus/gus_pcm.c +9 -19
@@ -423,11 +423,8 @@ static int snd_gf1_pcm_playback_hw_params(struct snd_pcm_substream *substream,struct snd_gus_card *gus =snd_pcm_substream_chip (substream);struct snd_pcm_runtime *runtime = substream->runtime;struct gus_pcm_private *pcmp = runtime->private_data; -int err; - -if ((err =snd_pcm_lib_malloc_pages (substream,params_buffer_bytes (hw_params))) <0 ) -return err; -if (err >0 ) {/* change */ + +if (runtime->buffer_changed) {struct snd_gf1_mem_block *block;if (pcmp->memory >0 ) {snd_gf1_mem_free (&gus->gf1.mem_alloc, pcmp->memory);
@@ -471,7 +468,6 @@ static int snd_gf1_pcm_playback_hw_free(struct snd_pcm_substream *substream)struct snd_pcm_runtime *runtime = substream->runtime;struct gus_pcm_private *pcmp = runtime->private_data; -snd_pcm_lib_free_pages (substream);if (pcmp->pvoices[0 ]) {snd_gf1_free_voice (pcmp->gus, pcmp->pvoices[0 ]); pcmp->pvoices[0 ] =NULL ;
@@ -574,12 +570,7 @@ static int snd_gf1_pcm_capture_hw_params(struct snd_pcm_substream *substream, gus->gf1.pcm_rcntrl_reg |=4 ;if (snd_pcm_format_unsigned (params_format (hw_params))) gus->gf1.pcm_rcntrl_reg |=0x80 ; -return snd_pcm_lib_malloc_pages (substream,params_buffer_bytes (hw_params)); -} - -static int snd_gf1_pcm_capture_hw_free (struct snd_pcm_substream *substream) -{ -return snd_pcm_lib_free_pages (substream); +return 0 ; }static int snd_gf1_pcm_capture_prepare (struct snd_pcm_substream *substream)
@@ -846,7 +837,6 @@ static const struct snd_pcm_ops snd_gf1_pcm_capture_ops = { .close = snd_gf1_pcm_capture_close, .ioctl = snd_pcm_lib_ioctl, .hw_params = snd_gf1_pcm_capture_hw_params, - .hw_free = snd_gf1_pcm_capture_hw_free, .prepare = snd_gf1_pcm_capture_prepare, .trigger = snd_gf1_pcm_capture_trigger, .pointer = snd_gf1_pcm_capture_pointer,
@@ -875,9 +865,9 @@ int snd_gf1_pcm_new(struct snd_gus_card *gus, int pcm_dev, int control_index)snd_pcm_set_ops (pcm,SNDRV_PCM_STREAM_PLAYBACK , &snd_gf1_pcm_playback_ops);for (substream = pcm->streams[SNDRV_PCM_STREAM_PLAYBACK ].substream; substream; substream = substream->next) -snd_pcm_lib_preallocate_pages (substream,SNDRV_DMA_TYPE_DEV , - card->dev, -64 *1024 , gus->gf1.dma1 >3 ?128 *1024 :64 *1024 ); +snd_pcm_set_managed_buffer (substream,SNDRV_DMA_TYPE_DEV , + card->dev, +64 *1024 , gus->gf1.dma1 >3 ?128 *1024 :64 *1024 ); pcm->info_flags =0 ; pcm->dev_subclass =SNDRV_PCM_SUBCLASS_GENERIC_MIX ;
@@ -885,9 +875,9 @@ int snd_gf1_pcm_new(struct snd_gus_card *gus, int pcm_dev, int control_index)snd_pcm_set_ops (pcm,SNDRV_PCM_STREAM_CAPTURE , &snd_gf1_pcm_capture_ops);if (gus->gf1.dma2 == gus->gf1.dma1) pcm->info_flags |=SNDRV_PCM_INFO_HALF_DUPLEX ; -snd_pcm_lib_preallocate_pages (pcm->streams[SNDRV_PCM_STREAM_CAPTURE ].substream, -SNDRV_DMA_TYPE_DEV , card->dev, -64 *1024 , gus->gf1.dma2 >3 ?128 *1024 :64 *1024 ); +snd_pcm_set_managed_buffer (pcm->streams[SNDRV_PCM_STREAM_CAPTURE ].substream, +SNDRV_DMA_TYPE_DEV , card->dev, +64 *1024 , gus->gf1.dma2 >3 ?128 *1024 :64 *1024 ); }strcpy (pcm->name, pcm->id);if (gus->interwave) {
Signature · 6 lines
2.16.4 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
PATCH 16/71 ALSA: wss: Use managed buffer allocation
In reply to Takashi IwaiClean up the driver with the new managed buffer allocation API. The hw_free callback became superfluous and got dropped.
--- sound/isa/wss/wss_lib.c | 23 ++--------------------- 1 file changed, 2 insertions(+), 21 deletions(-)
sound/isa/wss/wss_lib.c +2 -21
@@ -982,10 +982,7 @@ static int snd_wss_playback_hw_params(struct snd_pcm_substream *substream, {struct snd_wss *chip =snd_pcm_substream_chip (substream);unsigned char new_pdfr; -int err; -if ((err =snd_pcm_lib_malloc_pages (substream,params_buffer_bytes (hw_params))) <0 ) -return err; new_pdfr =snd_wss_get_format (chip,params_format (hw_params),params_channels (hw_params)) |snd_wss_get_rate (params_rate (hw_params));
@@ -993,11 +990,6 @@ static int snd_wss_playback_hw_params(struct snd_pcm_substream *substream,return 0 ; } -static int snd_wss_playback_hw_free (struct snd_pcm_substream *substream) -{ -return snd_pcm_lib_free_pages (substream); -} -static int snd_wss_playback_prepare (struct snd_pcm_substream *substream) {struct snd_wss *chip =snd_pcm_substream_chip (substream);
@@ -1025,10 +1017,7 @@ static int snd_wss_capture_hw_params(struct snd_pcm_substream *substream, {struct snd_wss *chip =snd_pcm_substream_chip (substream);unsigned char new_cdfr; -int err; -if ((err =snd_pcm_lib_malloc_pages (substream,params_buffer_bytes (hw_params))) <0 ) -return err; new_cdfr =snd_wss_get_format (chip,params_format (hw_params),params_channels (hw_params)) |snd_wss_get_rate (params_rate (hw_params));
@@ -1036,11 +1025,6 @@ static int snd_wss_capture_hw_params(struct snd_pcm_substream *substream,return 0 ; } -static int snd_wss_capture_hw_free (struct snd_pcm_substream *substream) -{ -return snd_pcm_lib_free_pages (substream); -} -static int snd_wss_capture_prepare (struct snd_pcm_substream *substream) {struct snd_wss *chip =snd_pcm_substream_chip (substream);
@@ -1889,7 +1873,6 @@ static const struct snd_pcm_ops snd_wss_playback_ops = { .close = snd_wss_playback_close, .ioctl = snd_pcm_lib_ioctl, .hw_params = snd_wss_playback_hw_params, - .hw_free = snd_wss_playback_hw_free, .prepare = snd_wss_playback_prepare, .trigger = snd_wss_trigger, .pointer = snd_wss_playback_pointer,
@@ -1900,7 +1883,6 @@ static const struct snd_pcm_ops snd_wss_capture_ops = { .close = snd_wss_capture_close, .ioctl = snd_pcm_lib_ioctl, .hw_params = snd_wss_capture_hw_params, - .hw_free = snd_wss_capture_hw_free, .prepare = snd_wss_capture_prepare, .trigger = snd_wss_trigger, .pointer = snd_wss_capture_pointer,
@@ -1927,9 +1909,8 @@ int snd_wss_pcm(struct snd_wss *chip, int device) pcm->info_flags |=SNDRV_PCM_INFO_JOINT_DUPLEX ;strcpy (pcm->name,snd_wss_chip_id (chip)); -snd_pcm_lib_preallocate_pages_for_all (pcm,SNDRV_DMA_TYPE_DEV , - chip->card->dev, -64 *1024 , chip->dma1 >3 || chip->dma2 >3 ?128 *1024 :64 *1024 ); +snd_pcm_set_managed_buffer_all (pcm,SNDRV_DMA_TYPE_DEV , chip->card->dev, +64 *1024 , chip->dma1 >3 || chip->dma2 >3 ?128 *1024 :64 *1024 ); chip->pcm = pcm;return 0 ;
Signature · 6 lines
2.16.4 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
PATCH 17/71 ALSA: mips: Use managed buffer allocation
In reply to Takashi IwaiClean up the drivers with the new managed buffer allocation API. The hw_params and hw_free callbacks became superfluous and got dropped.
--- sound/mips/hal2.c | 25 ++----------------------- sound/mips/sgio2audio.c | 20 ++------------------ 2 files changed, 4 insertions(+), 41 deletions(-)
sound/mips/hal2.c +2 -23
@@ -505,23 +505,6 @@ static const struct snd_pcm_hardware hal2_pcm_hw = { .periods_max = 1024, }; -static int hal2_pcm_hw_params (struct snd_pcm_substream *substream, -struct snd_pcm_hw_params *params) -{ -int err; - - err =snd_pcm_lib_malloc_pages (substream,params_buffer_bytes (params)); -if (err <0 ) -return err; - -return 0 ; -} - -static int hal2_pcm_hw_free (struct snd_pcm_substream *substream) -{ -return snd_pcm_lib_free_pages (substream); -} -static int hal2_playback_open (struct snd_pcm_substream *substream) {struct snd_pcm_runtime *runtime = substream->runtime;
@@ -702,8 +685,6 @@ static const struct snd_pcm_ops hal2_playback_ops = { .open = hal2_playback_open, .close = hal2_playback_close, .ioctl = snd_pcm_lib_ioctl, - .hw_params = hal2_pcm_hw_params, - .hw_free = hal2_pcm_hw_free, .prepare = hal2_playback_prepare, .trigger = hal2_playback_trigger, .pointer = hal2_playback_pointer,
@@ -714,8 +695,6 @@ static const struct snd_pcm_ops hal2_capture_ops = { .open = hal2_capture_open, .close = hal2_capture_close, .ioctl = snd_pcm_lib_ioctl, - .hw_params = hal2_pcm_hw_params, - .hw_free = hal2_pcm_hw_free, .prepare = hal2_capture_prepare, .trigger = hal2_capture_trigger, .pointer = hal2_capture_pointer,
@@ -740,8 +719,8 @@ static int hal2_pcm_create(struct snd_hal2 *hal2) &hal2_playback_ops);snd_pcm_set_ops (pcm,SNDRV_PCM_STREAM_CAPTURE , &hal2_capture_ops); -snd_pcm_lib_preallocate_pages_for_all (pcm,SNDRV_DMA_TYPE_CONTINUOUS , -NULL ,0 ,1024 *1024 ); +snd_pcm_set_managed_buffer_all (pcm,SNDRV_DMA_TYPE_CONTINUOUS , +NULL ,0 ,1024 *1024 );return 0 ; }
sound/mips/sgio2audio.c +2 -18
@@ -577,20 +577,6 @@ static int snd_sgio2audio_pcm_close(struct snd_pcm_substream *substream)return 0 ; } - -/* hw_params callback */ -static int snd_sgio2audio_pcm_hw_params (struct snd_pcm_substream *substream, -struct snd_pcm_hw_params *hw_params) -{ -return snd_pcm_lib_malloc_pages (substream,params_buffer_bytes (hw_params)); -} - -/* hw_free callback */ -static int snd_sgio2audio_pcm_hw_free (struct snd_pcm_substream *substream) -{ -return snd_pcm_lib_free_pages (substream); -} -/* prepare callback */ static int snd_sgio2audio_pcm_prepare (struct snd_pcm_substream *substream) {
@@ -716,8 +702,7 @@ static int snd_sgio2audio_new_pcm(struct snd_sgio2audio *chip) &snd_sgio2audio_playback1_ops);snd_pcm_set_ops (pcm,SNDRV_PCM_STREAM_CAPTURE , &snd_sgio2audio_capture_ops); -snd_pcm_lib_preallocate_pages_for_all (pcm,SNDRV_DMA_TYPE_VMALLOC , -NULL ,0 ,0 ); +snd_pcm_set_managed_buffer_all (pcm,SNDRV_DMA_TYPE_VMALLOC ,NULL ,0 ,0 );/* create second pcm device with one outputs and no input */ err =snd_pcm_new (chip->card,"SGI O2 Audio" ,1 ,1 ,0 , &pcm);
@@ -730,8 +715,7 @@ static int snd_sgio2audio_new_pcm(struct snd_sgio2audio *chip)/* set operators */ snd_pcm_set_ops (pcm,SNDRV_PCM_STREAM_PLAYBACK , &snd_sgio2audio_playback2_ops); -snd_pcm_lib_preallocate_pages_for_all (pcm,SNDRV_DMA_TYPE_VMALLOC , -NULL ,0 ,0 ); +snd_pcm_set_managed_buffer_all (pcm,SNDRV_DMA_TYPE_VMALLOC ,NULL ,0 ,0 );return 0 ; }
Signature · 6 lines
2.16.4 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
PATCH 18/71 ALSA: parisc: Use managed buffer allocation
In reply to Takashi IwaiClean up the driver with the new managed buffer allocation API. The hw_free callbacks became superfluous and got dropped.
--- sound/parisc/harmony.c | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-)
sound/parisc/harmony.c +4 -14
@@ -567,20 +567,12 @@ static int snd_harmony_hw_params(struct snd_pcm_substream *ss, struct snd_pcm_hw_params *hw) { - int err; struct snd_harmony *h = snd_pcm_substream_chip(ss); - err =snd_pcm_lib_malloc_pages (ss,params_buffer_bytes (hw)); -if (err >0 && h->dma.type ==SNDRV_DMA_TYPE_CONTINUOUS ) +if (h->dma.type ==SNDRV_DMA_TYPE_CONTINUOUS ) ss->runtime->dma_addr =__pa (ss->runtime->dma_area); - -return err; -} -static int -snd_harmony_hw_free (struct snd_pcm_substream *ss) -{ -return snd_pcm_lib_free_pages (ss); +return 0 ; } static const struct snd_pcm_ops snd_harmony_playback_ops = {
@@ -588,7 +580,6 @@ static const struct snd_pcm_ops snd_harmony_playback_ops = { .close = snd_harmony_playback_close, .ioctl = snd_pcm_lib_ioctl, .hw_params = snd_harmony_hw_params, - .hw_free = snd_harmony_hw_free, .prepare = snd_harmony_playback_prepare, .trigger = snd_harmony_playback_trigger, .pointer = snd_harmony_playback_pointer,
@@ -599,7 +590,6 @@ static const struct snd_pcm_ops snd_harmony_capture_ops = { .close = snd_harmony_capture_close, .ioctl = snd_pcm_lib_ioctl, .hw_params = snd_harmony_hw_params, - .hw_free = snd_harmony_hw_free, .prepare = snd_harmony_capture_prepare, .trigger = snd_harmony_capture_trigger, .pointer = snd_harmony_capture_pointer,
@@ -656,8 +646,8 @@ snd_harmony_pcm_init(struct snd_harmony *h) }/* pre-allocate space for DMA */ -snd_pcm_lib_preallocate_pages_for_all (pcm, h->dma.type, h->dma.dev, -MAX_BUF_SIZE ,MAX_BUF_SIZE ); +snd_pcm_set_managed_buffer_all (pcm, h->dma.type, h->dma.dev, +MAX_BUF_SIZE ,MAX_BUF_SIZE ); h->st.format =snd_harmony_set_data_format (h,SNDRV_PCM_FORMAT_S16_BE ,1 );
Signature · 6 lines
2.16.4 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
PATCH 19/71 ALSA: ad1889: Use managed buffer allocation
In reply to Takashi IwaiClean up the driver with the new managed buffer allocation API. The hw_params and hw_free callbacks became superfluous and got dropped.
--- sound/pci/ad1889.c | 24 ++---------------------- 1 file changed, 2 insertions(+), 22 deletions(-)
sound/pci/ad1889.c +2 -22
@@ -257,20 +257,6 @@ snd_ad1889_ac97_ready(struct snd_ad1889 *chip)return 0 ; } -static int -snd_ad1889_hw_params (struct snd_pcm_substream *substream, -struct snd_pcm_hw_params *hw_params) -{ -return snd_pcm_lib_malloc_pages (substream, -params_buffer_bytes (hw_params)); -} - -static int -snd_ad1889_hw_free (struct snd_pcm_substream *substream) -{ -return snd_pcm_lib_free_pages (substream); -} -static const struct snd_pcm_hardware snd_ad1889_playback_hw = { .info =SNDRV_PCM_INFO_MMAP |SNDRV_PCM_INFO_INTERLEAVED |SNDRV_PCM_INFO_MMAP_VALID |SNDRV_PCM_INFO_BLOCK_TRANSFER ,
@@ -563,8 +549,6 @@ static const struct snd_pcm_ops snd_ad1889_playback_ops = { .open = snd_ad1889_playback_open, .close = snd_ad1889_playback_close, .ioctl = snd_pcm_lib_ioctl, - .hw_params = snd_ad1889_hw_params, - .hw_free = snd_ad1889_hw_free, .prepare = snd_ad1889_playback_prepare, .trigger = snd_ad1889_playback_trigger, .pointer = snd_ad1889_playback_pointer,
@@ -574,8 +558,6 @@ static const struct snd_pcm_ops snd_ad1889_capture_ops = { .open = snd_ad1889_capture_open, .close = snd_ad1889_capture_close, .ioctl = snd_pcm_lib_ioctl, - .hw_params = snd_ad1889_hw_params, - .hw_free = snd_ad1889_hw_free, .prepare = snd_ad1889_capture_prepare, .trigger = snd_ad1889_capture_trigger, .pointer = snd_ad1889_capture_pointer,
@@ -632,10 +614,8 @@ snd_ad1889_pcm_init(struct snd_ad1889 *chip, int device) chip->psubs =NULL ; chip->csubs =NULL ; -snd_pcm_lib_preallocate_pages_for_all (pcm,SNDRV_DMA_TYPE_DEV , - &chip->pci->dev, -BUFFER_BYTES_MAX /2 , -BUFFER_BYTES_MAX ); +snd_pcm_set_managed_buffer_all (pcm,SNDRV_DMA_TYPE_DEV , &chip->pci->dev, +BUFFER_BYTES_MAX /2 ,BUFFER_BYTES_MAX );return 0 ; }
Signature · 6 lines
2.16.4 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
PATCH 20/71 ALSA: ali5451: Use managed buffer allocation
In reply to Takashi IwaiClean up the driver with the new managed buffer allocation API. The hw_params and hw_free callbacks became superfluous and got dropped.
--- sound/pci/ali5451/ali5451.c | 30 +++--------------------------- 1 file changed, 3 insertions(+), 27 deletions(-)
sound/pci/ali5451/ali5451.c +3 -27
@@ -1138,13 +1138,7 @@ static int snd_ali_playback_hw_params(struct snd_pcm_substream *substream,struct snd_pcm_runtime *runtime = substream->runtime;struct snd_ali_voice *pvoice = runtime->private_data;struct snd_ali_voice *evoice = pvoice->extra; -int err; - err =snd_pcm_lib_malloc_pages (substream, -params_buffer_bytes (hw_params)); -if (err <0 ) -return err; -/* voice management */ if (params_buffer_size(hw_params) / 2 !=
@@ -1175,7 +1169,6 @@ static int snd_ali_playback_hw_free(struct snd_pcm_substream *substream)struct snd_ali_voice *pvoice = runtime->private_data;struct snd_ali_voice *evoice = pvoice ? pvoice->extra :NULL ; -snd_pcm_lib_free_pages (substream);if (evoice) {snd_ali_free_voice (codec, evoice); pvoice->extra =NULL ;
@@ -1183,18 +1176,6 @@ static int snd_ali_playback_hw_free(struct snd_pcm_substream *substream)return 0 ; } -static int snd_ali_hw_params (struct snd_pcm_substream *substream, -struct snd_pcm_hw_params *hw_params) -{ -return snd_pcm_lib_malloc_pages (substream, -params_buffer_bytes (hw_params)); -} - -static int snd_ali_hw_free (struct snd_pcm_substream *substream) -{ -return snd_pcm_lib_free_pages (substream); -} -static int snd_ali_playback_prepare (struct snd_pcm_substream *substream) {struct snd_ali *codec =snd_pcm_substream_chip (substream);
@@ -1538,8 +1519,6 @@ static const struct snd_pcm_ops snd_ali_capture_ops = { .open = snd_ali_capture_open, .close = snd_ali_close, .ioctl = snd_pcm_lib_ioctl, - .hw_params = snd_ali_hw_params, - .hw_free = snd_ali_hw_free, .prepare = snd_ali_prepare, .trigger = snd_ali_trigger, .pointer = snd_ali_pointer,
@@ -1557,7 +1536,7 @@ static int snd_ali_modem_hw_params(struct snd_pcm_substream *substream,snd_ac97_write (chip->ac97[modem_num],AC97_LINE1_RATE ,params_rate (hw_params));snd_ac97_write (chip->ac97[modem_num],AC97_LINE1_LEVEL ,0 ); -return snd_ali_hw_params (substream, hw_params); +return 0 ; } static struct snd_pcm_hardware snd_ali_modem =
@@ -1614,7 +1593,6 @@ static const struct snd_pcm_ops snd_ali_modem_playback_ops = { .close = snd_ali_close, .ioctl = snd_pcm_lib_ioctl, .hw_params = snd_ali_modem_hw_params, - .hw_free = snd_ali_hw_free, .prepare = snd_ali_prepare, .trigger = snd_ali_trigger, .pointer = snd_ali_pointer,
@@ -1625,7 +1603,6 @@ static const struct snd_pcm_ops snd_ali_modem_capture_ops = { .close = snd_ali_close, .ioctl = snd_pcm_lib_ioctl, .hw_params = snd_ali_modem_hw_params, - .hw_free = snd_ali_hw_free, .prepare = snd_ali_prepare, .trigger = snd_ali_trigger, .pointer = snd_ali_pointer,
@@ -1671,9 +1648,8 @@ static int snd_ali_pcm(struct snd_ali *codec, int device,snd_pcm_set_ops (pcm,SNDRV_PCM_STREAM_CAPTURE , desc->capture_ops); -snd_pcm_lib_preallocate_pages_for_all (pcm,SNDRV_DMA_TYPE_DEV , - &codec->pci->dev, -64 *1024 ,128 *1024 ); +snd_pcm_set_managed_buffer_all (pcm,SNDRV_DMA_TYPE_DEV , + &codec->pci->dev,64 *1024 ,128 *1024 ); pcm->info_flags =0 ; pcm->dev_class = desc->class;
Signature · 6 lines
2.16.4 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
PATCH 21/71 ALSA: als300: Use managed buffer allocation
In reply to Takashi IwaiClean up the driver with the new managed buffer allocation API. The hw_params and hw_free callbacks became superfluous and got dropped.
--- sound/pci/als300.c | 23 ++--------------------- 1 file changed, 2 insertions(+), 21 deletions(-)
sound/pci/als300.c +2 -21
@@ -378,7 +378,6 @@ static int snd_als300_playback_close(struct snd_pcm_substream *substream) data = substream->runtime->private_data;kfree (data); chip->playback_substream =NULL ; -snd_pcm_lib_free_pages (substream);return 0 ; }
@@ -407,22 +406,9 @@ static int snd_als300_capture_close(struct snd_pcm_substream *substream) data = substream->runtime->private_data;kfree (data); chip->capture_substream =NULL ; -snd_pcm_lib_free_pages (substream);return 0 ; } -static int snd_als300_pcm_hw_params (struct snd_pcm_substream *substream, -struct snd_pcm_hw_params *hw_params) -{ -return snd_pcm_lib_malloc_pages (substream, -params_buffer_bytes (hw_params)); -} - -static int snd_als300_pcm_hw_free (struct snd_pcm_substream *substream) -{ -return snd_pcm_lib_free_pages (substream); -} -static int snd_als300_playback_prepare (struct snd_pcm_substream *substream) {u32 tmp;
@@ -554,8 +540,6 @@ static const struct snd_pcm_ops snd_als300_playback_ops = { .open = snd_als300_playback_open, .close = snd_als300_playback_close, .ioctl = snd_pcm_lib_ioctl, - .hw_params = snd_als300_pcm_hw_params, - .hw_free = snd_als300_pcm_hw_free, .prepare = snd_als300_playback_prepare, .trigger = snd_als300_trigger, .pointer = snd_als300_pointer,
@@ -565,8 +549,6 @@ static const struct snd_pcm_ops snd_als300_capture_ops = { .open = snd_als300_capture_open, .close = snd_als300_capture_close, .ioctl = snd_pcm_lib_ioctl, - .hw_params = snd_als300_pcm_hw_params, - .hw_free = snd_als300_pcm_hw_free, .prepare = snd_als300_capture_prepare, .trigger = snd_als300_trigger, .pointer = snd_als300_pointer,
@@ -591,9 +573,8 @@ static int snd_als300_new_pcm(struct snd_als300 *chip) &snd_als300_capture_ops);/* pre-allocation of buffers */ -snd_pcm_lib_preallocate_pages_for_all (pcm,SNDRV_DMA_TYPE_DEV , - &chip->pci->dev, -64 *1024 ,64 *1024 ); +snd_pcm_set_managed_buffer_all (pcm,SNDRV_DMA_TYPE_DEV , &chip->pci->dev, +64 *1024 ,64 *1024 );return 0 ; }
Signature · 6 lines
2.16.4 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
PATCH 22/71 ALSA: als4000: Use managed buffer allocation
In reply to Takashi IwaiClean up the driver with the new managed buffer allocation API. The hw_params and hw_free callbacks became superfluous and got dropped.
--- sound/pci/als4000.c | 23 ++--------------------- 1 file changed, 2 insertions(+), 21 deletions(-)
sound/pci/als4000.c +2 -21
@@ -354,18 +354,6 @@ CMD_SIGNED|CMD_STEREO, /* ALS4000_FORMAT_S16L_STEREO */ };#define capture_cmd (chip) (capture_cmd_vals[(chip)->capture_format]) -static int snd_als4000_hw_params (struct snd_pcm_substream *substream, -struct snd_pcm_hw_params *hw_params) -{ -return snd_pcm_lib_malloc_pages (substream,params_buffer_bytes (hw_params)); -} - -static int snd_als4000_hw_free (struct snd_pcm_substream *substream) -{ -snd_pcm_lib_free_pages (substream); -return 0 ; -} -static int snd_als4000_capture_prepare (struct snd_pcm_substream *substream) {struct snd_sb *chip =snd_pcm_substream_chip (substream);
@@ -633,7 +621,6 @@ static int snd_als4000_playback_close(struct snd_pcm_substream *substream)struct snd_sb *chip =snd_pcm_substream_chip (substream); chip->playback_substream =NULL ; -snd_pcm_lib_free_pages (substream);return 0 ; }
@@ -652,7 +639,6 @@ static int snd_als4000_capture_close(struct snd_pcm_substream *substream)struct snd_sb *chip =snd_pcm_substream_chip (substream); chip->capture_substream =NULL ; -snd_pcm_lib_free_pages (substream);return 0 ; }
@@ -662,8 +648,6 @@ static const struct snd_pcm_ops snd_als4000_playback_ops = { .open = snd_als4000_playback_open, .close = snd_als4000_playback_close, .ioctl = snd_pcm_lib_ioctl, - .hw_params = snd_als4000_hw_params, - .hw_free = snd_als4000_hw_free, .prepare = snd_als4000_playback_prepare, .trigger = snd_als4000_playback_trigger, .pointer = snd_als4000_playback_pointer
@@ -673,8 +657,6 @@ static const struct snd_pcm_ops snd_als4000_capture_ops = { .open = snd_als4000_capture_open, .close = snd_als4000_capture_close, .ioctl = snd_pcm_lib_ioctl, - .hw_params = snd_als4000_hw_params, - .hw_free = snd_als4000_hw_free, .prepare = snd_als4000_capture_prepare, .trigger = snd_als4000_capture_trigger, .pointer = snd_als4000_capture_pointer
@@ -693,9 +675,8 @@ static int snd_als4000_pcm(struct snd_sb *chip, int device)snd_pcm_set_ops (pcm,SNDRV_PCM_STREAM_PLAYBACK , &snd_als4000_playback_ops);snd_pcm_set_ops (pcm,SNDRV_PCM_STREAM_CAPTURE , &snd_als4000_capture_ops); -snd_pcm_lib_preallocate_pages_for_all (pcm,SNDRV_DMA_TYPE_DEV , - &chip->pci->dev, -64 *1024 ,64 *1024 ); +snd_pcm_set_managed_buffer_all (pcm,SNDRV_DMA_TYPE_DEV , + &chip->pci->dev,64 *1024 ,64 *1024 ); chip->pcm = pcm;
Signature · 6 lines
2.16.4 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
PATCH 23/71 ALSA: asihpi: Use managed buffer allocation
In reply to Takashi IwaiClean up the driver with the new managed buffer allocation API. The superfluous snd_pcm_lib_malloc_pages() and snd_pcm_lib_free_pages() calls are dropped.
--- sound/pci/asihpi/asihpi.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-)
sound/pci/asihpi/asihpi.c +3 -7
@@ -449,9 +449,6 @@ static int snd_card_asihpi_pcm_hw_params(struct snd_pcm_substream *substream,unsigned int bytes_per_sec;print_hwparams (substream, params); - err =snd_pcm_lib_malloc_pages (substream,params_buffer_bytes (params)); -if (err <0 ) -return err; err =snd_card_asihpi_format_alsa2hpi (params_format (params), &format);if (err)return err;
@@ -509,7 +506,6 @@ snd_card_asihpi_hw_free(struct snd_pcm_substream *substream)if (dpcm->hpi_buffer_attached)hpi_stream_host_buffer_detach (dpcm->h_stream); -snd_pcm_lib_free_pages (substream);return 0 ; }
@@ -1324,9 +1320,9 @@ static int snd_card_asihpi_pcm_new(struct snd_card_asihpi *asihpi, int device)/*? do we want to emulate MMAP for non-BBM cards? Jack doesn't work with ALSAs MMAP emulation - WHY NOT? */ -snd_pcm_lib_preallocate_pages_for_all (pcm,SNDRV_DMA_TYPE_DEV , - &asihpi->pci->dev, -64 *1024 ,BUFFER_BYTES_MAX ); +snd_pcm_set_managed_buffer_all (pcm,SNDRV_DMA_TYPE_DEV , + &asihpi->pci->dev, +64 *1024 ,BUFFER_BYTES_MAX );return 0 ; }
Signature · 6 lines
2.16.4 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
PATCH 24/71 ALSA: atiixp: Use managed buffer allocation
In reply to Takashi IwaiClean up the drivers with the new managed buffer allocation API. The superfluous snd_pcm_lib_malloc_pages() and snd_pcm_lib_free_pages() calls are dropped.
--- sound/pci/atiixp.c | 14 ++++---------- sound/pci/atiixp_modem.c | 9 ++------- 2 files changed, 6 insertions(+), 17 deletions(-)
sound/pci/atiixp.c +4 -10
@@ -952,9 +952,6 @@ static int snd_atiixp_pcm_hw_params(struct snd_pcm_substream *substream,struct atiixp_dma *dma = substream->runtime->private_data;int err; - err =snd_pcm_lib_malloc_pages (substream,params_buffer_bytes (hw_params)); -if (err <0 ) -return err; dma->buf_addr = substream->runtime->dma_addr; dma->buf_bytes =params_buffer_bytes (hw_params);
@@ -994,7 +991,6 @@ static int snd_atiixp_pcm_hw_free(struct snd_pcm_substream *substream) dma->pcm_open_flag =0 ; }atiixp_clear_dma_packets (chip, dma, substream); -snd_pcm_lib_free_pages (substream);return 0 ; }
@@ -1283,9 +1279,8 @@ static int snd_atiixp_pcm_new(struct atiixp *chip)strcpy (pcm->name,"ATI IXP AC97" ); chip->pcmdevs[ATI_PCMDEV_ANALOG ] = pcm; -snd_pcm_lib_preallocate_pages_for_all (pcm,SNDRV_DMA_TYPE_DEV , - &chip->pci->dev, -64 *1024 ,128 *1024 ); +snd_pcm_set_managed_buffer_all (pcm,SNDRV_DMA_TYPE_DEV , + &chip->pci->dev,64 *1024 ,128 *1024 ); err = snd_pcm_add_chmap_ctls(pcm, SNDRV_PCM_STREAM_PLAYBACK, snd_pcm_alt_chmaps, chip->max_channels, 0,
@@ -1316,9 +1311,8 @@ static int snd_atiixp_pcm_new(struct atiixp *chip)strcpy (pcm->name,"ATI IXP IEC958 (Direct)" ); chip->pcmdevs[ATI_PCMDEV_DIGITAL ] = pcm; -snd_pcm_lib_preallocate_pages_for_all (pcm,SNDRV_DMA_TYPE_DEV , - &chip->pci->dev, -64 *1024 ,128 *1024 ); +snd_pcm_set_managed_buffer_all (pcm,SNDRV_DMA_TYPE_DEV , + &chip->pci->dev,64 *1024 ,128 *1024 );/* pre-select AC97 SPDIF slots 10/11 */ for (i =0 ; i <NUM_ATI_CODECS ; i++) {
sound/pci/atiixp_modem.c +2 -7
@@ -783,9 +783,6 @@ static int snd_atiixp_pcm_hw_params(struct snd_pcm_substream *substream,int err;int i; - err =snd_pcm_lib_malloc_pages (substream,params_buffer_bytes (hw_params)); -if (err <0 ) -return err; dma->buf_addr = substream->runtime->dma_addr; dma->buf_bytes =params_buffer_bytes (hw_params);
@@ -812,7 +809,6 @@ static int snd_atiixp_pcm_hw_free(struct snd_pcm_substream *substream)struct atiixp_dma *dma = substream->runtime->private_data;atiixp_clear_dma_packets (chip, dma, substream); -snd_pcm_lib_free_pages (substream);return 0 ; }
@@ -994,9 +990,8 @@ static int snd_atiixp_pcm_new(struct atiixp_modem *chip)strcpy (pcm->name,"ATI IXP MC97" ); chip->pcmdevs[ATI_PCMDEV_ANALOG ] = pcm; -snd_pcm_lib_preallocate_pages_for_all (pcm,SNDRV_DMA_TYPE_DEV , - &chip->pci->dev, -64 *1024 ,128 *1024 ); +snd_pcm_set_managed_buffer_all (pcm,SNDRV_DMA_TYPE_DEV , + &chip->pci->dev,64 *1024 ,128 *1024 );return 0 ; }
Signature · 6 lines
2.16.4 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
PATCH 25/71 ALSA: au88x0: Use managed buffer allocation
In reply to Takashi IwaiClean up the drivers with the new managed buffer allocation API. The superfluous snd_pcm_lib_malloc_pages() and snd_pcm_lib_free_pages() calls are dropped.
--- sound/pci/au88x0/au88x0_pcm.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-)
sound/pci/au88x0/au88x0_pcm.c +3 -12
@@ -209,15 +209,7 @@ snd_vortex_pcm_hw_params(struct snd_pcm_substream *substream, {vortex_t *chip =snd_pcm_substream_chip (substream);stream_t *stream = (stream_t *) (substream->runtime->private_data); -int err; -// Alloc buffer memory. - err = -snd_pcm_lib_malloc_pages (substream,params_buffer_bytes (hw_params)); -if (err <0 ) { -dev_err (chip->card->dev,"Vortex: pcm page alloc failed!\n" ); -return err; - }/* pr_info( "Vortex: periods %d, period_bytes %d, channels = %d\n", params_periods(hw_params), params_period_bytes(hw_params), params_channels(hw_params));
@@ -304,7 +296,7 @@ static int snd_vortex_pcm_hw_free(struct snd_pcm_substream *substream) substream->runtime->private_data =NULL ;spin_unlock_irq (&chip->lock); -return snd_pcm_lib_free_pages (substream); +return 0 ; }/* prepare callback */
@@ -636,9 +628,8 @@ static int snd_vortex_new_pcm(vortex_t *chip, int idx, int nr)/* pre-allocation of Scatter-Gather buffers */ -snd_pcm_lib_preallocate_pages_for_all (pcm,SNDRV_DMA_TYPE_DEV_SG , - &chip->pci_dev->dev, -0x10000 ,0x10000 ); +snd_pcm_set_managed_buffer_all (pcm,SNDRV_DMA_TYPE_DEV_SG , + &chip->pci_dev->dev,0x10000 ,0x10000 );switch (VORTEX_PCM_TYPE (pcm)) {case VORTEX_PCM_ADB :
Signature · 6 lines
2.16.4 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
PATCH 26/71 ALSA: aw2: Use managed buffer allocation
In reply to Takashi IwaiClean up the driver with the new managed buffer allocation API. The hw_params and hw_free callbacks became superfluous and got dropped.
--- sound/pci/aw2/aw2-alsa.c | 45 ++++++++++++--------------------------------- 1 file changed, 12 insertions(+), 33 deletions(-)
sound/pci/aw2/aw2-alsa.c +12 -33
@@ -109,9 +109,6 @@ static int snd_aw2_pcm_playback_open(struct snd_pcm_substream *substream);static int snd_aw2_pcm_playback_close (struct snd_pcm_substream *substream);static int snd_aw2_pcm_capture_open (struct snd_pcm_substream *substream);static int snd_aw2_pcm_capture_close (struct snd_pcm_substream *substream); -static int snd_aw2_pcm_hw_params (struct snd_pcm_substream *substream, -struct snd_pcm_hw_params *hw_params); -static int snd_aw2_pcm_hw_free (struct snd_pcm_substream *substream);static int snd_aw2_pcm_prepare_playback (struct snd_pcm_substream *substream);static int snd_aw2_pcm_prepare_capture (struct snd_pcm_substream *substream); static int snd_aw2_pcm_trigger_playback(struct snd_pcm_substream *substream,
@@ -170,8 +167,6 @@ static const struct snd_pcm_ops snd_aw2_playback_ops = { .open = snd_aw2_pcm_playback_open, .close = snd_aw2_pcm_playback_close, .ioctl = snd_pcm_lib_ioctl, - .hw_params = snd_aw2_pcm_hw_params, - .hw_free = snd_aw2_pcm_hw_free, .prepare = snd_aw2_pcm_prepare_playback, .trigger = snd_aw2_pcm_trigger_playback, .pointer = snd_aw2_pcm_pointer_playback,
@@ -182,8 +177,6 @@ static const struct snd_pcm_ops snd_aw2_capture_ops = { .open = snd_aw2_pcm_capture_open, .close = snd_aw2_pcm_capture_close, .ioctl = snd_pcm_lib_ioctl, - .hw_params = snd_aw2_pcm_hw_params, - .hw_free = snd_aw2_pcm_hw_free, .prepare = snd_aw2_pcm_prepare_capture, .trigger = snd_aw2_pcm_trigger_capture, .pointer = snd_aw2_pcm_pointer_capture,
@@ -411,20 +404,6 @@ static int snd_aw2_pcm_capture_close(struct snd_pcm_substream *substream)return 0 ; } -/* hw_params callback */ -static int snd_aw2_pcm_hw_params (struct snd_pcm_substream *substream, -struct snd_pcm_hw_params *hw_params) -{ -return snd_pcm_lib_malloc_pages (substream, -params_buffer_bytes (hw_params)); -} - -/* hw_free callback */ -static int snd_aw2_pcm_hw_free (struct snd_pcm_substream *substream) -{ -return snd_pcm_lib_free_pages (substream); -} -/* prepare callback for playback */ static int snd_aw2_pcm_prepare_playback (struct snd_pcm_substream *substream) {
@@ -611,10 +590,10 @@ static int snd_aw2_new_pcm(struct aw2 *chip)/* pre-allocation of buffers */ /* Preallocate continuous pages. */ -snd_pcm_lib_preallocate_pages_for_all (pcm_playback_ana, -SNDRV_DMA_TYPE_DEV , - &chip->pci->dev, -64 *1024 ,64 *1024 ); +snd_pcm_set_managed_buffer_all (pcm_playback_ana, +SNDRV_DMA_TYPE_DEV , + &chip->pci->dev, +64 *1024 ,64 *1024 ); err =snd_pcm_new (chip->card,"Audiowerk2 digital playback" ,1 ,1 ,0 , &pcm_playback_num);
@@ -643,10 +622,10 @@ static int snd_aw2_new_pcm(struct aw2 *chip)/* pre-allocation of buffers */ /* Preallocate continuous pages. */ -snd_pcm_lib_preallocate_pages_for_all (pcm_playback_num, -SNDRV_DMA_TYPE_DEV , - &chip->pci->dev, -64 *1024 ,64 *1024 ); +snd_pcm_set_managed_buffer_all (pcm_playback_num, +SNDRV_DMA_TYPE_DEV , + &chip->pci->dev, +64 *1024 ,64 *1024 ); err =snd_pcm_new (chip->card,"Audiowerk2 capture" ,2 ,0 ,1 , &pcm_capture);
@@ -676,10 +655,10 @@ static int snd_aw2_new_pcm(struct aw2 *chip)/* pre-allocation of buffers */ /* Preallocate continuous pages. */ -snd_pcm_lib_preallocate_pages_for_all (pcm_capture, -SNDRV_DMA_TYPE_DEV , - &chip->pci->dev, -64 *1024 ,64 *1024 ); +snd_pcm_set_managed_buffer_all (pcm_capture, +SNDRV_DMA_TYPE_DEV , + &chip->pci->dev, +64 *1024 ,64 *1024 );/* Create control */ err =snd_ctl_add (chip->card,snd_ctl_new1 (&aw2_control, chip));
Signature · 6 lines
2.16.4 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
PATCH 27/71 ALSA: azt3328: Use managed buffer allocation
In reply to Takashi IwaiClean up the driver with the new managed buffer allocation API. The hw_params and hw_free callbacks became superfluous and got dropped.
--- sound/pci/azt3328.c | 30 ++++-------------------------- 1 file changed, 4 insertions(+), 26 deletions(-)
sound/pci/azt3328.c +4 -26
@@ -1205,20 +1205,6 @@ snd_azf3328_mixer_new(struct snd_azf3328 *chip) }#endif /* AZF_USE_AC97_LAYER */ -static int -snd_azf3328_hw_params (struct snd_pcm_substream *substream, -struct snd_pcm_hw_params *hw_params) -{ -return snd_pcm_lib_malloc_pages (substream,params_buffer_bytes (hw_params)); -} - -static int -snd_azf3328_hw_free (struct snd_pcm_substream *substream) -{ -snd_pcm_lib_free_pages (substream); -return 0 ; -} - static void snd_azf3328_codec_setfmt(struct snd_azf3328_codec_data *codec, enum azf_freq_t bitrate,
@@ -2080,8 +2066,6 @@ static const struct snd_pcm_ops snd_azf3328_playback_ops = { .open = snd_azf3328_pcm_playback_open, .close = snd_azf3328_pcm_close, .ioctl = snd_pcm_lib_ioctl, - .hw_params = snd_azf3328_hw_params, - .hw_free = snd_azf3328_hw_free, .prepare = snd_azf3328_pcm_prepare, .trigger = snd_azf3328_pcm_trigger, .pointer = snd_azf3328_pcm_pointer
@@ -2091,8 +2075,6 @@ static const struct snd_pcm_ops snd_azf3328_capture_ops = { .open = snd_azf3328_pcm_capture_open, .close = snd_azf3328_pcm_close, .ioctl = snd_pcm_lib_ioctl, - .hw_params = snd_azf3328_hw_params, - .hw_free = snd_azf3328_hw_free, .prepare = snd_azf3328_pcm_prepare, .trigger = snd_azf3328_pcm_trigger, .pointer = snd_azf3328_pcm_pointer
@@ -2102,8 +2084,6 @@ static const struct snd_pcm_ops snd_azf3328_i2s_out_ops = { .open = snd_azf3328_pcm_i2s_out_open, .close = snd_azf3328_pcm_close, .ioctl = snd_pcm_lib_ioctl, - .hw_params = snd_azf3328_hw_params, - .hw_free = snd_azf3328_hw_free, .prepare = snd_azf3328_pcm_prepare, .trigger = snd_azf3328_pcm_trigger, .pointer = snd_azf3328_pcm_pointer
@@ -2134,9 +2114,8 @@ snd_azf3328_pcm(struct snd_azf3328 *chip) chip->pcm[AZF_CODEC_PLAYBACK ] = pcm; chip->pcm[AZF_CODEC_CAPTURE ] = pcm; -snd_pcm_lib_preallocate_pages_for_all (pcm,SNDRV_DMA_TYPE_DEV , - &chip->pci->dev, -64 *1024 ,64 *1024 ); +snd_pcm_set_managed_buffer_all (pcm,SNDRV_DMA_TYPE_DEV , &chip->pci->dev, +64 *1024 ,64 *1024 ); err =snd_pcm_new (chip->card,"AZF3328 I2S OUT" ,AZF_PCMDEV_I2S_OUT ,1 ,0 , &pcm);
@@ -2150,9 +2129,8 @@ snd_azf3328_pcm(struct snd_azf3328 *chip)strcpy (pcm->name, chip->card->shortname); chip->pcm[AZF_CODEC_I2S_OUT ] = pcm; -snd_pcm_lib_preallocate_pages_for_all (pcm,SNDRV_DMA_TYPE_DEV , - &chip->pci->dev, -64 *1024 ,64 *1024 ); +snd_pcm_set_managed_buffer_all (pcm,SNDRV_DMA_TYPE_DEV , &chip->pci->dev, +64 *1024 ,64 *1024 );return 0 ; }
Signature · 6 lines
2.16.4 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
PATCH 28/71 ALSA: bt87x: Use managed buffer allocation
In reply to Takashi IwaiClean up the driver with the new managed buffer allocation API. The superfluous snd_pcm_lib_malloc_pages() and snd_pcm_lib_free_pages() calls are dropped.
--- sound/pci/bt87x.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-)
sound/pci/bt87x.c +4 -10
@@ -452,12 +452,7 @@ static int snd_bt87x_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *hw_params) {struct snd_bt87x *chip =snd_pcm_substream_chip (substream); -int err; - err =snd_pcm_lib_malloc_pages (substream, -params_buffer_bytes (hw_params)); -if (err <0 ) -return err;return snd_bt87x_create_risc (chip, substream,params_periods (hw_params),params_period_bytes (hw_params));
@@ -468,7 +463,6 @@ static int snd_bt87x_hw_free(struct snd_pcm_substream *substream)struct snd_bt87x *chip =snd_pcm_substream_chip (substream);snd_bt87x_free_risc (chip); -snd_pcm_lib_free_pages (substream);return 0 ; }
@@ -699,10 +693,10 @@ static int snd_bt87x_pcm(struct snd_bt87x *chip, int device, char *name) pcm->private_data = chip;strcpy (pcm->name, name);snd_pcm_set_ops (pcm,SNDRV_PCM_STREAM_CAPTURE , &snd_bt87x_pcm_ops); -snd_pcm_lib_preallocate_pages_for_all (pcm,SNDRV_DMA_TYPE_DEV_SG , - &chip->pci->dev, -128 *1024 , -ALIGN (255 *4092 ,1024 )); +snd_pcm_set_managed_buffer_all (pcm,SNDRV_DMA_TYPE_DEV_SG , + &chip->pci->dev, +128 *1024 , +ALIGN (255 *4092 ,1024 ));return 0 ; }
Signature · 6 lines
2.16.4 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
PATCH 29/71 ALSA: ca0106: Use managed buffer allocation
In reply to Takashi IwaiClean up the driver with the new managed buffer allocation API. The hw_params and hw_free callbacks became superfluous and got dropped.
--- sound/pci/ca0106/ca0106_main.c | 56 +++++------------------------------------- 1 file changed, 6 insertions(+), 50 deletions(-)
sound/pci/ca0106/ca0106_main.c +6 -50
@@ -707,34 +707,6 @@ static int snd_ca0106_pcm_open_3_capture(struct snd_pcm_substream *substream)return snd_ca0106_pcm_open_capture_channel (substream,3 ); } -/* hw_params callback */ -static int snd_ca0106_pcm_hw_params_playback (struct snd_pcm_substream *substream, -struct snd_pcm_hw_params *hw_params) -{ -return snd_pcm_lib_malloc_pages (substream, -params_buffer_bytes (hw_params)); -} - -/* hw_free callback */ -static int snd_ca0106_pcm_hw_free_playback (struct snd_pcm_substream *substream) -{ -return snd_pcm_lib_free_pages (substream); -} - -/* hw_params callback */ -static int snd_ca0106_pcm_hw_params_capture (struct snd_pcm_substream *substream, -struct snd_pcm_hw_params *hw_params) -{ -return snd_pcm_lib_malloc_pages (substream, -params_buffer_bytes (hw_params)); -} - -/* hw_free callback */ -static int snd_ca0106_pcm_hw_free_capture (struct snd_pcm_substream *substream) -{ -return snd_pcm_lib_free_pages (substream); -} -/* prepare playback callback */ static int snd_ca0106_pcm_prepare_playback (struct snd_pcm_substream *substream) {
@@ -1097,8 +1069,6 @@ static const struct snd_pcm_ops snd_ca0106_playback_front_ops = { .open = snd_ca0106_pcm_open_playback_front, .close = snd_ca0106_pcm_close_playback, .ioctl = snd_pcm_lib_ioctl, - .hw_params = snd_ca0106_pcm_hw_params_playback, - .hw_free = snd_ca0106_pcm_hw_free_playback, .prepare = snd_ca0106_pcm_prepare_playback, .trigger = snd_ca0106_pcm_trigger_playback, .pointer = snd_ca0106_pcm_pointer_playback,
@@ -1108,8 +1078,6 @@ static const struct snd_pcm_ops snd_ca0106_capture_0_ops = { .open = snd_ca0106_pcm_open_0_capture, .close = snd_ca0106_pcm_close_capture, .ioctl = snd_pcm_lib_ioctl, - .hw_params = snd_ca0106_pcm_hw_params_capture, - .hw_free = snd_ca0106_pcm_hw_free_capture, .prepare = snd_ca0106_pcm_prepare_capture, .trigger = snd_ca0106_pcm_trigger_capture, .pointer = snd_ca0106_pcm_pointer_capture,
@@ -1119,8 +1087,6 @@ static const struct snd_pcm_ops snd_ca0106_capture_1_ops = { .open = snd_ca0106_pcm_open_1_capture, .close = snd_ca0106_pcm_close_capture, .ioctl = snd_pcm_lib_ioctl, - .hw_params = snd_ca0106_pcm_hw_params_capture, - .hw_free = snd_ca0106_pcm_hw_free_capture, .prepare = snd_ca0106_pcm_prepare_capture, .trigger = snd_ca0106_pcm_trigger_capture, .pointer = snd_ca0106_pcm_pointer_capture,
@@ -1130,8 +1096,6 @@ static const struct snd_pcm_ops snd_ca0106_capture_2_ops = { .open = snd_ca0106_pcm_open_2_capture, .close = snd_ca0106_pcm_close_capture, .ioctl = snd_pcm_lib_ioctl, - .hw_params = snd_ca0106_pcm_hw_params_capture, - .hw_free = snd_ca0106_pcm_hw_free_capture, .prepare = snd_ca0106_pcm_prepare_capture, .trigger = snd_ca0106_pcm_trigger_capture, .pointer = snd_ca0106_pcm_pointer_capture,
@@ -1141,8 +1105,6 @@ static const struct snd_pcm_ops snd_ca0106_capture_3_ops = { .open = snd_ca0106_pcm_open_3_capture, .close = snd_ca0106_pcm_close_capture, .ioctl = snd_pcm_lib_ioctl, - .hw_params = snd_ca0106_pcm_hw_params_capture, - .hw_free = snd_ca0106_pcm_hw_free_capture, .prepare = snd_ca0106_pcm_prepare_capture, .trigger = snd_ca0106_pcm_trigger_capture, .pointer = snd_ca0106_pcm_pointer_capture,
@@ -1152,8 +1114,6 @@ static const struct snd_pcm_ops snd_ca0106_playback_center_lfe_ops = { .open = snd_ca0106_pcm_open_playback_center_lfe, .close = snd_ca0106_pcm_close_playback, .ioctl = snd_pcm_lib_ioctl, - .hw_params = snd_ca0106_pcm_hw_params_playback, - .hw_free = snd_ca0106_pcm_hw_free_playback, .prepare = snd_ca0106_pcm_prepare_playback, .trigger = snd_ca0106_pcm_trigger_playback, .pointer = snd_ca0106_pcm_pointer_playback,
@@ -1163,8 +1123,6 @@ static const struct snd_pcm_ops snd_ca0106_playback_unknown_ops = { .open = snd_ca0106_pcm_open_playback_unknown, .close = snd_ca0106_pcm_close_playback, .ioctl = snd_pcm_lib_ioctl, - .hw_params = snd_ca0106_pcm_hw_params_playback, - .hw_free = snd_ca0106_pcm_hw_free_playback, .prepare = snd_ca0106_pcm_prepare_playback, .trigger = snd_ca0106_pcm_trigger_playback, .pointer = snd_ca0106_pcm_pointer_playback,
@@ -1174,8 +1132,6 @@ static const struct snd_pcm_ops snd_ca0106_playback_rear_ops = { .open = snd_ca0106_pcm_open_playback_rear, .close = snd_ca0106_pcm_close_playback, .ioctl = snd_pcm_lib_ioctl, - .hw_params = snd_ca0106_pcm_hw_params_playback, - .hw_free = snd_ca0106_pcm_hw_free_playback, .prepare = snd_ca0106_pcm_prepare_playback, .trigger = snd_ca0106_pcm_trigger_playback, .pointer = snd_ca0106_pcm_pointer_playback,
@@ -1388,17 +1344,17 @@ static int snd_ca0106_pcm(struct snd_ca0106 *emu, int device)for (substream = pcm->streams[SNDRV_PCM_STREAM_PLAYBACK ].substream; substream; substream = substream->next) { -snd_pcm_lib_preallocate_pages (substream,SNDRV_DMA_TYPE_DEV , - &emu->pci->dev, -64 *1024 ,64 *1024 ); +snd_pcm_set_managed_buffer (substream,SNDRV_DMA_TYPE_DEV , + &emu->pci->dev, +64 *1024 ,64 *1024 ); }for (substream = pcm->streams[SNDRV_PCM_STREAM_CAPTURE ].substream; substream; substream = substream->next) { -snd_pcm_lib_preallocate_pages (substream,SNDRV_DMA_TYPE_DEV , - &emu->pci->dev, -64 *1024 ,64 *1024 ); +snd_pcm_set_managed_buffer (substream,SNDRV_DMA_TYPE_DEV , + &emu->pci->dev, +64 *1024 ,64 *1024 ); } err = snd_pcm_add_chmap_ctls(pcm, SNDRV_PCM_STREAM_PLAYBACK, map, 2,
Signature · 6 lines
2.16.4 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
PATCH 30/71 ALSA: cmipci: Use managed buffer allocation
In reply to Takashi IwaiClean up the driver with the new managed buffer allocation API. The hw_params and hw_free callbacks became superfluous and got dropped.
--- sound/pci/cmipci.c | 36 ++++++++++-------------------------- 1 file changed, 10 insertions(+), 26 deletions(-)
sound/pci/cmipci.c +10 -26
@@ -666,12 +666,6 @@ static void snd_cmipci_set_pll(struct cmipci *cm, unsigned int rate, unsigned in }#endif /* USE_VAR48KRATE */ -static int snd_cmipci_hw_params (struct snd_pcm_substream *substream, -struct snd_pcm_hw_params *hw_params) -{ -return snd_pcm_lib_malloc_pages (substream,params_buffer_bytes (hw_params)); -} -static int snd_cmipci_playback2_hw_params (struct snd_pcm_substream *substream,struct snd_pcm_hw_params *hw_params) {
@@ -686,7 +680,7 @@ static int snd_cmipci_playback2_hw_params(struct snd_pcm_substream *substream, cm->opened[CM_CH_PLAY ] =CM_OPEN_PLAYBACK_MULTI ;mutex_unlock (&cm->open_mutex); } -return snd_pcm_lib_malloc_pages (substream,params_buffer_bytes (hw_params)); +return 0 ; }static void snd_cmipci_ch_reset (struct cmipci *cm,int ch)
@@ -697,11 +691,6 @@ static void snd_cmipci_ch_reset(struct cmipci *cm, int ch)udelay (10 ); } -static int snd_cmipci_hw_free (struct snd_pcm_substream *substream) -{ -return snd_pcm_lib_free_pages (substream); -} -/* */
@@ -1371,14 +1360,14 @@ static int snd_cmipci_playback_hw_free(struct snd_pcm_substream *substream)setup_spdif_playback (cm, substream,0 ,0 );restore_mixer_state (cm);snd_cmipci_silence_hack (cm, &cm->channel[0 ]); -return snd_cmipci_hw_free (substream); +return 0 ; }static int snd_cmipci_playback2_hw_free (struct snd_pcm_substream *substream) {struct cmipci *cm =snd_pcm_substream_chip (substream);snd_cmipci_silence_hack (cm, &cm->channel[1 ]); -return snd_cmipci_hw_free (substream); +return 0 ; }/* capture */
@@ -1420,7 +1409,7 @@ static int snd_cmipci_capture_spdif_hw_free(struct snd_pcm_substream *subs)snd_cmipci_clear_bit (cm,CM_REG_MISC_CTRL ,CM_SPD32SEL );spin_unlock_irq (&cm->reg_lock); -return snd_cmipci_hw_free (subs); +return 0 ; }
@@ -1829,7 +1818,6 @@ static const struct snd_pcm_ops snd_cmipci_playback_ops = { .open = snd_cmipci_playback_open, .close = snd_cmipci_playback_close, .ioctl = snd_pcm_lib_ioctl, - .hw_params = snd_cmipci_hw_params, .hw_free = snd_cmipci_playback_hw_free, .prepare = snd_cmipci_playback_prepare, .trigger = snd_cmipci_playback_trigger,
@@ -1840,8 +1828,6 @@ static const struct snd_pcm_ops snd_cmipci_capture_ops = { .open = snd_cmipci_capture_open, .close = snd_cmipci_capture_close, .ioctl = snd_pcm_lib_ioctl, - .hw_params = snd_cmipci_hw_params, - .hw_free = snd_cmipci_hw_free, .prepare = snd_cmipci_capture_prepare, .trigger = snd_cmipci_capture_trigger, .pointer = snd_cmipci_capture_pointer,
@@ -1862,7 +1848,6 @@ static const struct snd_pcm_ops snd_cmipci_playback_spdif_ops = { .open = snd_cmipci_playback_spdif_open, .close = snd_cmipci_playback_spdif_close, .ioctl = snd_pcm_lib_ioctl, - .hw_params = snd_cmipci_hw_params, .hw_free = snd_cmipci_playback_hw_free, .prepare = snd_cmipci_playback_spdif_prepare, /* set up rate */ .trigger = snd_cmipci_playback_trigger,
@@ -1873,7 +1858,6 @@ static const struct snd_pcm_ops snd_cmipci_capture_spdif_ops = { .open = snd_cmipci_capture_spdif_open, .close = snd_cmipci_capture_spdif_close, .ioctl = snd_pcm_lib_ioctl, - .hw_params = snd_cmipci_hw_params, .hw_free = snd_cmipci_capture_spdif_hw_free, .prepare = snd_cmipci_capture_spdif_prepare, .trigger = snd_cmipci_capture_trigger,
@@ -1901,8 +1885,8 @@ static int snd_cmipci_pcm_new(struct cmipci *cm, int device)strcpy (pcm->name,"C-Media PCI DAC/ADC" ); cm->pcm = pcm; -snd_pcm_lib_preallocate_pages_for_all (pcm,SNDRV_DMA_TYPE_DEV , - &cm->pci->dev,64 *1024 ,128 *1024 ); +snd_pcm_set_managed_buffer_all (pcm,SNDRV_DMA_TYPE_DEV , + &cm->pci->dev,64 *1024 ,128 *1024 );return 0 ; }
@@ -1923,8 +1907,8 @@ static int snd_cmipci_pcm2_new(struct cmipci *cm, int device)strcpy (pcm->name,"C-Media PCI 2nd DAC" ); cm->pcm2 = pcm; -snd_pcm_lib_preallocate_pages_for_all (pcm,SNDRV_DMA_TYPE_DEV , - &cm->pci->dev,64 *1024 ,128 *1024 ); +snd_pcm_set_managed_buffer_all (pcm,SNDRV_DMA_TYPE_DEV , + &cm->pci->dev,64 *1024 ,128 *1024 );return 0 ; }
@@ -1946,8 +1930,8 @@ static int snd_cmipci_pcm_spdif_new(struct cmipci *cm, int device)strcpy (pcm->name,"C-Media PCI IEC958" ); cm->pcm_spdif = pcm; -snd_pcm_lib_preallocate_pages_for_all (pcm,SNDRV_DMA_TYPE_DEV , - &cm->pci->dev,64 *1024 ,128 *1024 ); +snd_pcm_set_managed_buffer_all (pcm,SNDRV_DMA_TYPE_DEV , + &cm->pci->dev,64 *1024 ,128 *1024 ); err = snd_pcm_add_chmap_ctls(pcm, SNDRV_PCM_STREAM_PLAYBACK, snd_pcm_alt_chmaps, cm->max_channels, 0,
Signature · 6 lines
2.16.4 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
PATCH 31/71 ALSA: cs4281: Use managed buffer allocation
In reply to Takashi IwaiClean up the driver with the new managed buffer allocation API. The hw_params and hw_free callbacks became superfluous and got dropped.
--- sound/pci/cs4281.c | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-)
sound/pci/cs4281.c +2 -18
@@ -780,17 +780,6 @@ static void snd_cs4281_mode(struct cs4281 *chip, struct cs4281_dma *dma,snd_cs4281_pokeBA0 (chip, dma->regFSIC,0 ); } -static int snd_cs4281_hw_params (struct snd_pcm_substream *substream, -struct snd_pcm_hw_params *hw_params) -{ -return snd_pcm_lib_malloc_pages (substream,params_buffer_bytes (hw_params)); -} - -static int snd_cs4281_hw_free (struct snd_pcm_substream *substream) -{ -return snd_pcm_lib_free_pages (substream); -} -static int snd_cs4281_playback_prepare (struct snd_pcm_substream *substream) {struct snd_pcm_runtime *runtime = substream->runtime;
@@ -939,8 +928,6 @@ static const struct snd_pcm_ops snd_cs4281_playback_ops = { .open = snd_cs4281_playback_open, .close = snd_cs4281_playback_close, .ioctl = snd_pcm_lib_ioctl, - .hw_params = snd_cs4281_hw_params, - .hw_free = snd_cs4281_hw_free, .prepare = snd_cs4281_playback_prepare, .trigger = snd_cs4281_trigger, .pointer = snd_cs4281_pointer,
@@ -950,8 +937,6 @@ static const struct snd_pcm_ops snd_cs4281_capture_ops = { .open = snd_cs4281_capture_open, .close = snd_cs4281_capture_close, .ioctl = snd_pcm_lib_ioctl, - .hw_params = snd_cs4281_hw_params, - .hw_free = snd_cs4281_hw_free, .prepare = snd_cs4281_capture_prepare, .trigger = snd_cs4281_trigger, .pointer = snd_cs4281_pointer,
@@ -974,9 +959,8 @@ static int snd_cs4281_pcm(struct cs4281 *chip, int device)strcpy (pcm->name,"CS4281" ); chip->pcm = pcm; -snd_pcm_lib_preallocate_pages_for_all (pcm,SNDRV_DMA_TYPE_DEV , - &chip->pci->dev, -64 *1024 ,512 *1024 ); +snd_pcm_set_managed_buffer_all (pcm,SNDRV_DMA_TYPE_DEV , &chip->pci->dev, +64 *1024 ,512 *1024 );return 0 ; }
Signature · 6 lines
2.16.4 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
PATCH 32/71 ALSA: cs5535: Use managed buffer allocation
In reply to Takashi IwaiClean up the driver with the new managed buffer allocation API. The superfluous snd_pcm_lib_malloc_pages() and snd_pcm_lib_free_pages() calls are dropped.
--- sound/pci/cs5535audio/cs5535audio_pcm.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-)
sound/pci/cs5535audio/cs5535audio_pcm.c +4 -8
@@ -236,10 +236,6 @@ static int snd_cs5535audio_hw_params(struct snd_pcm_substream *substream,struct cs5535audio_dma *dma = substream->runtime->private_data;int err; - err =snd_pcm_lib_malloc_pages (substream, -params_buffer_bytes (hw_params)); -if (err <0 ) -return err; dma->buf_addr = substream->runtime->dma_addr; dma->buf_bytes =params_buffer_bytes (hw_params);
@@ -267,7 +263,7 @@ static int snd_cs5535audio_hw_free(struct snd_pcm_substream *substream) dma->pcm_open_flag =0 ; }cs5535audio_clear_dma_packets (cs5535au, dma, substream); -return snd_pcm_lib_free_pages (substream); +return 0 ; }static int snd_cs5535audio_playback_prepare (struct snd_pcm_substream *substream)
@@ -431,9 +427,9 @@ int snd_cs5535audio_pcm(struct cs5535audio *cs5535au) pcm->info_flags =0 ;strcpy (pcm->name,"CS5535 Audio" ); -snd_pcm_lib_preallocate_pages_for_all (pcm,SNDRV_DMA_TYPE_DEV , - &cs5535au->pci->dev, -64 *1024 ,128 *1024 ); +snd_pcm_set_managed_buffer_all (pcm,SNDRV_DMA_TYPE_DEV , + &cs5535au->pci->dev, +64 *1024 ,128 *1024 ); cs5535au->pcm = pcm;return 0 ;
Signature · 6 lines
2.16.4 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
PATCH 33/71 ALSA: ctxfi: Use managed buffer allocation
In reply to Takashi IwaiClean up the driver with the new managed buffer allocation API. The superfluous snd_pcm_lib_malloc_pages() and snd_pcm_lib_free_pages() calls are dropped.
--- sound/pci/ctxfi/ctpcm.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-)
sound/pci/ctxfi/ctpcm.c +4 -11
@@ -178,15 +178,10 @@ static int ct_pcm_hw_params(struct snd_pcm_substream *substream, {struct ct_atc *atc =snd_pcm_substream_chip (substream);struct ct_atc_pcm *apcm = substream->runtime->private_data; -int err; - err =snd_pcm_lib_malloc_pages (substream, -params_buffer_bytes (hw_params)); -if (err <0 ) -return err;/* clear previous resources */ atc->pcm_release_resources (atc, apcm); -return err; +return 0 ; }static int ct_pcm_hw_free (struct snd_pcm_substream *substream)
@@ -196,8 +191,7 @@ static int ct_pcm_hw_free(struct snd_pcm_substream *substream)/* clear previous resources */ atc->pcm_release_resources (atc, apcm); -/* Free snd-allocated pages */ -return snd_pcm_lib_free_pages (substream); +return 0 ; }
@@ -449,9 +443,8 @@ int ct_alsa_pcm_create(struct ct_atc *atc,snd_pcm_set_ops (pcm,SNDRV_PCM_STREAM_CAPTURE , &ct_pcm_capture_ops); -snd_pcm_lib_preallocate_pages_for_all (pcm,SNDRV_DMA_TYPE_DEV_SG , - &atc->pci->dev, -128 *1024 ,128 *1024 ); +snd_pcm_set_managed_buffer_all (pcm,SNDRV_DMA_TYPE_DEV_SG , + &atc->pci->dev,128 *1024 ,128 *1024 ); chs =2 ;switch (device) {
Signature · 6 lines
2.16.4 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
PATCH 34/71 ALSA: echoaudio: Use managed buffer allocation
In reply to Takashi IwaiClean up the drivers with the new managed buffer allocation API. The superfluous snd_pcm_lib_malloc_pages() and snd_pcm_lib_free_pages() calls are dropped.
--- sound/pci/echoaudio/echoaudio.c | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-)
sound/pci/echoaudio/echoaudio.c +4 -15
@@ -547,16 +547,6 @@ static int init_engine(struct snd_pcm_substream *substream,"pcm_hw_params (bufsize=%dB periods=%d persize=%dB)\n" ,params_buffer_bytes (hw_params),params_periods (hw_params), params_period_bytes(hw_params)); - err =snd_pcm_lib_malloc_pages (substream, -params_buffer_bytes (hw_params)); -if (err <0 ) { -dev_err (chip->card->dev,"malloc_pages err=%d\n" , err); -spin_lock_irq (&chip->lock); -free_pipes (chip, pipe); -spin_unlock_irq (&chip->lock); - pipe->index =-1 ; -return err; - }sglist_init (chip, pipe); edge =PAGE_SIZE ;
@@ -671,7 +661,6 @@ static int pcm_hw_free(struct snd_pcm_substream *substream) }spin_unlock_irq (&chip->lock); -snd_pcm_lib_free_pages (substream);return 0 ; }
@@ -872,10 +861,10 @@ static void snd_echo_preallocate_pages(struct snd_pcm *pcm, struct device *dev)for (stream =0 ; stream <2 ; stream++)for (ss = pcm->streams[stream].substream; ss; ss = ss->next) -snd_pcm_lib_preallocate_pages (ss,SNDRV_DMA_TYPE_DEV_SG , - dev, - ss->number ?0 :128 <<10 , -256 <<10 ); +snd_pcm_set_managed_buffer (ss,SNDRV_DMA_TYPE_DEV_SG , + dev, + ss->number ?0 :128 <<10 , +256 <<10 ); }
Signature · 6 lines
2.16.4 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
PATCH 35/71 ALSA: emu10k1x: Use managed buffer allocation
In reply to Takashi IwaiClean up the driver with the new managed buffer allocation API. The superfluous snd_pcm_lib_malloc_pages() and snd_pcm_lib_free_pages() calls are dropped.
--- sound/pci/emu10k1/emu10k1x.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-)
sound/pci/emu10k1/emu10k1x.c +6 -9
@@ -411,8 +411,7 @@ static int snd_emu10k1x_pcm_hw_params(struct snd_pcm_substream *substream, epcm->voice->epcm = epcm; } -return snd_pcm_lib_malloc_pages (substream, -params_buffer_bytes (hw_params)); +return 0 ; }/* hw_free callback */
@@ -432,7 +431,7 @@ static int snd_emu10k1x_pcm_hw_free(struct snd_pcm_substream *substream) epcm->voice =NULL ; } -return snd_pcm_lib_free_pages (substream); +return 0 ; }/* prepare callback */
@@ -594,8 +593,7 @@ static int snd_emu10k1x_pcm_hw_params_capture(struct snd_pcm_substream *substrea epcm->voice->use =1 ; } -return snd_pcm_lib_malloc_pages (substream, -params_buffer_bytes (hw_params)); +return 0 ; }/* hw_free callback */
@@ -615,7 +613,7 @@ static int snd_emu10k1x_pcm_hw_free_capture(struct snd_pcm_substream *substream) epcm->voice =NULL ; } -return snd_pcm_lib_free_pages (substream); +return 0 ; }/* prepare capture callback */
@@ -876,9 +874,8 @@ static int snd_emu10k1x_pcm(struct emu10k1x *emu, int device) } emu->pcm = pcm; -snd_pcm_lib_preallocate_pages_for_all (pcm,SNDRV_DMA_TYPE_DEV , - &emu->pci->dev, -32 *1024 ,32 *1024 ); +snd_pcm_set_managed_buffer_all (pcm,SNDRV_DMA_TYPE_DEV , + &emu->pci->dev,32 *1024 ,32 *1024 );return snd_pcm_add_chmap_ctls (pcm,SNDRV_PCM_STREAM_PLAYBACK , map,2 ,1 <<2 ,NULL );
Signature · 6 lines
2.16.4 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
PATCH 36/71 ALSA: emu10k1: Use managed buffer allocation
In reply to Takashi IwaiClean up the driver with the new managed buffer allocation API. The normal playback streams need a workaround for the aligned buffer, and cannot apply the straight snd_pcm_lib_malloc() stuff, so they remain untouched, while other streams are converted to the new managed mode.
Most of hw_params and hw_free callbacks became superfluous and got dropped.
--- sound/pci/emu10k1/emupcm.c | 41 +++++++-------------------------------- sound/pci/emu10k1/p16v.c | 48 +++++++--------------------------------------- 2 files changed, 14 insertions(+), 75 deletions(-)
sound/pci/emu10k1/emupcm.c +7 -34
@@ -569,17 +569,6 @@ static const struct snd_pcm_hardware snd_emu10k1_efx_playback = .fifo_size = 0, }; -static int snd_emu10k1_capture_hw_params (struct snd_pcm_substream *substream, -struct snd_pcm_hw_params *hw_params) -{ -return snd_pcm_lib_malloc_pages (substream,params_buffer_bytes (hw_params)); -} - -static int snd_emu10k1_capture_hw_free (struct snd_pcm_substream *substream) -{ -return snd_pcm_lib_free_pages (substream); -} -static int snd_emu10k1_capture_prepare (struct snd_pcm_substream *substream) {struct snd_emu10k1 *emu =snd_pcm_substream_chip (substream);
@@ -1372,8 +1361,6 @@ static const struct snd_pcm_ops snd_emu10k1_capture_ops = { .open = snd_emu10k1_capture_open, .close = snd_emu10k1_capture_close, .ioctl = snd_pcm_lib_ioctl, - .hw_params = snd_emu10k1_capture_hw_params, - .hw_free = snd_emu10k1_capture_hw_free, .prepare = snd_emu10k1_capture_prepare, .trigger = snd_emu10k1_capture_trigger, .pointer = snd_emu10k1_capture_pointer,
@@ -1410,15 +1397,15 @@ int snd_emu10k1_pcm(struct snd_emu10k1 *emu, int device)strcpy (pcm->name,"ADC Capture/Standard PCM Playback" ); emu->pcm = pcm; +/* playback substream can't use managed buffers due to alignment */ for (substream = pcm->streams[SNDRV_PCM_STREAM_PLAYBACK ].substream; substream; substream = substream->next)snd_pcm_lib_preallocate_pages (substream,SNDRV_DMA_TYPE_DEV_SG , &emu->pci->dev,64 *1024 ,64 *1024 );for (substream = pcm->streams[SNDRV_PCM_STREAM_CAPTURE ].substream; substream; substream = substream->next) -snd_pcm_lib_preallocate_pages (substream,SNDRV_DMA_TYPE_DEV , - &emu->pci->dev, -64 *1024 ,64 *1024 ); +snd_pcm_set_managed_buffer (substream,SNDRV_DMA_TYPE_DEV , + &emu->pci->dev,64 *1024 ,64 *1024 );return 0 ; }
@@ -1454,8 +1441,6 @@ static const struct snd_pcm_ops snd_emu10k1_capture_mic_ops = { .open = snd_emu10k1_capture_mic_open, .close = snd_emu10k1_capture_mic_close, .ioctl = snd_pcm_lib_ioctl, - .hw_params = snd_emu10k1_capture_hw_params, - .hw_free = snd_emu10k1_capture_hw_free, .prepare = snd_emu10k1_capture_prepare, .trigger = snd_emu10k1_capture_trigger, .pointer = snd_emu10k1_capture_pointer,
@@ -1477,9 +1462,8 @@ int snd_emu10k1_pcm_mic(struct snd_emu10k1 *emu, int device)strcpy (pcm->name,"Mic Capture" ); emu->pcm_mic = pcm; -snd_pcm_lib_preallocate_pages_for_all (pcm,SNDRV_DMA_TYPE_DEV , - &emu->pci->dev, -64 *1024 ,64 *1024 ); +snd_pcm_set_managed_buffer_all (pcm,SNDRV_DMA_TYPE_DEV , &emu->pci->dev, +64 *1024 ,64 *1024 );return 0 ; }
@@ -1551,8 +1535,6 @@ static const struct snd_pcm_ops snd_emu10k1_capture_efx_ops = { .open = snd_emu10k1_capture_efx_open, .close = snd_emu10k1_capture_efx_close, .ioctl = snd_pcm_lib_ioctl, - .hw_params = snd_emu10k1_capture_hw_params, - .hw_free = snd_emu10k1_capture_hw_free, .prepare = snd_emu10k1_capture_prepare, .trigger = snd_emu10k1_capture_trigger, .pointer = snd_emu10k1_capture_pointer,
@@ -1633,12 +1615,6 @@ static int snd_emu10k1_fx8010_playback_transfer(struct snd_pcm_substream *substr fx8010_pb_trans_copy); } -static int snd_emu10k1_fx8010_playback_hw_params (struct snd_pcm_substream *substream, -struct snd_pcm_hw_params *hw_params) -{ -return snd_pcm_lib_malloc_pages (substream,params_buffer_bytes (hw_params)); -} -static int snd_emu10k1_fx8010_playback_hw_free (struct snd_pcm_substream *substream) {struct snd_emu10k1 *emu =snd_pcm_substream_chip (substream);
@@ -1647,7 +1623,6 @@ static int snd_emu10k1_fx8010_playback_hw_free(struct snd_pcm_substream *substrefor (i =0 ; i < pcm->channels; i++)snd_emu10k1_ptr_write (emu,TANKMEMADDRREGBASE +0x80 + pcm->etram[i],0 ,0 ); -snd_pcm_lib_free_pages (substream);return 0 ; }
@@ -1793,7 +1768,6 @@ static const struct snd_pcm_ops snd_emu10k1_fx8010_playback_ops = { .open = snd_emu10k1_fx8010_playback_open, .close = snd_emu10k1_fx8010_playback_close, .ioctl = snd_pcm_lib_ioctl, - .hw_params = snd_emu10k1_fx8010_playback_hw_params, .hw_free = snd_emu10k1_fx8010_playback_hw_free, .prepare = snd_emu10k1_fx8010_playback_prepare, .trigger = snd_emu10k1_fx8010_playback_trigger,
@@ -1852,9 +1826,8 @@ int snd_emu10k1_pcm_efx(struct snd_emu10k1 *emu, int device)if (err <0 )return err; -snd_pcm_lib_preallocate_pages_for_all (pcm,SNDRV_DMA_TYPE_DEV , - &emu->pci->dev, -64 *1024 ,64 *1024 ); +snd_pcm_set_managed_buffer_all (pcm,SNDRV_DMA_TYPE_DEV , &emu->pci->dev, +64 *1024 ,64 *1024 );return 0 ; }
sound/pci/emu10k1/p16v.c +7 -41
78 lines not on this page · raw message
Signature · 6 lines
2.16.4 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
PATCH 37/71 ALSA: ens137x: Use managed buffer allocation
In reply to Takashi IwaiClean up the driver with the new managed buffer allocation API. The hw_params and hw_free callbacks became superfluous and got dropped.
--- sound/pci/ens1370.c | 27 ++++----------------------- 1 file changed, 4 insertions(+), 23 deletions(-)
sound/pci/ens1370.c +4 -23
@@ -856,17 +856,6 @@ static int snd_ensoniq_trigger(struct snd_pcm_substream *substream, int cmd)* PCM part */ -static int snd_ensoniq_hw_params (struct snd_pcm_substream *substream, -struct snd_pcm_hw_params *hw_params) -{ -return snd_pcm_lib_malloc_pages (substream,params_buffer_bytes (hw_params)); -} - -static int snd_ensoniq_hw_free (struct snd_pcm_substream *substream) -{ -return snd_pcm_lib_free_pages (substream); -} -static int snd_ensoniq_playback1_prepare (struct snd_pcm_substream *substream) {struct ensoniq *ensoniq =snd_pcm_substream_chip (substream);
@@ -1216,8 +1205,6 @@ static const struct snd_pcm_ops snd_ensoniq_playback1_ops = { .open = snd_ensoniq_playback1_open, .close = snd_ensoniq_playback1_close, .ioctl = snd_pcm_lib_ioctl, - .hw_params = snd_ensoniq_hw_params, - .hw_free = snd_ensoniq_hw_free, .prepare = snd_ensoniq_playback1_prepare, .trigger = snd_ensoniq_trigger, .pointer = snd_ensoniq_playback1_pointer,
@@ -1227,8 +1214,6 @@ static const struct snd_pcm_ops snd_ensoniq_playback2_ops = { .open = snd_ensoniq_playback2_open, .close = snd_ensoniq_playback2_close, .ioctl = snd_pcm_lib_ioctl, - .hw_params = snd_ensoniq_hw_params, - .hw_free = snd_ensoniq_hw_free, .prepare = snd_ensoniq_playback2_prepare, .trigger = snd_ensoniq_trigger, .pointer = snd_ensoniq_playback2_pointer,
@@ -1238,8 +1223,6 @@ static const struct snd_pcm_ops snd_ensoniq_capture_ops = { .open = snd_ensoniq_capture_open, .close = snd_ensoniq_capture_close, .ioctl = snd_pcm_lib_ioctl, - .hw_params = snd_ensoniq_hw_params, - .hw_free = snd_ensoniq_hw_free, .prepare = snd_ensoniq_capture_prepare, .trigger = snd_ensoniq_trigger, .pointer = snd_ensoniq_capture_pointer,
@@ -1274,9 +1257,8 @@ static int snd_ensoniq_pcm(struct ensoniq *ensoniq, int device)strcpy (pcm->name,CHIP_NAME " DAC2/ADC" ); ensoniq->pcm1 = pcm; -snd_pcm_lib_preallocate_pages_for_all (pcm,SNDRV_DMA_TYPE_DEV , - &ensoniq->pci->dev, -64 *1024 ,128 *1024 ); +snd_pcm_set_managed_buffer_all (pcm,SNDRV_DMA_TYPE_DEV , + &ensoniq->pci->dev,64 *1024 ,128 *1024 );#ifdef CHIP1370 err = snd_pcm_add_chmap_ctls(pcm, SNDRV_PCM_STREAM_PLAYBACK,
@@ -1307,9 +1289,8 @@ static int snd_ensoniq_pcm2(struct ensoniq *ensoniq, int device)strcpy (pcm->name,CHIP_NAME " DAC1" ); ensoniq->pcm2 = pcm; -snd_pcm_lib_preallocate_pages_for_all (pcm,SNDRV_DMA_TYPE_DEV , - &ensoniq->pci->dev, -64 *1024 ,128 *1024 ); +snd_pcm_set_managed_buffer_all (pcm,SNDRV_DMA_TYPE_DEV , + &ensoniq->pci->dev,64 *1024 ,128 *1024 );#ifdef CHIP1370 err = snd_pcm_add_chmap_ctls(pcm, SNDRV_PCM_STREAM_PLAYBACK,
Signature · 6 lines
2.16.4 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
PATCH 38/71 ALSA: es1938: Use managed buffer allocation
In reply to Takashi IwaiClean up the driver with the new managed buffer allocation API. The hw_params and hw_free callbacks became superfluous and got dropped.
--- sound/pci/es1938.c | 28 ++-------------------------- 1 file changed, 2 insertions(+), 26 deletions(-)
sound/pci/es1938.c +2 -26
@@ -863,25 +863,6 @@ static int snd_es1938_capture_copy_kernel(struct snd_pcm_substream *substream,return 0 ; } -/* -* buffer management -*/ -static int snd_es1938_pcm_hw_params (struct snd_pcm_substream *substream, -struct snd_pcm_hw_params *hw_params) - -{ -int err; - -if ((err =snd_pcm_lib_malloc_pages (substream,params_buffer_bytes (hw_params))) <0 ) -return err; -return 0 ; -} - -static int snd_es1938_pcm_hw_free (struct snd_pcm_substream *substream) -{ -return snd_pcm_lib_free_pages (substream); -} -/* ---------------------------------------------------------------------- * Audio1 Capture (ADC) * ----------------------------------------------------------------------*/
@@ -997,8 +978,6 @@ static const struct snd_pcm_ops snd_es1938_playback_ops = { .open = snd_es1938_playback_open, .close = snd_es1938_playback_close, .ioctl = snd_pcm_lib_ioctl, - .hw_params = snd_es1938_pcm_hw_params, - .hw_free = snd_es1938_pcm_hw_free, .prepare = snd_es1938_playback_prepare, .trigger = snd_es1938_playback_trigger, .pointer = snd_es1938_playback_pointer,
@@ -1008,8 +987,6 @@ static const struct snd_pcm_ops snd_es1938_capture_ops = { .open = snd_es1938_capture_open, .close = snd_es1938_capture_close, .ioctl = snd_pcm_lib_ioctl, - .hw_params = snd_es1938_pcm_hw_params, - .hw_free = snd_es1938_pcm_hw_free, .prepare = snd_es1938_capture_prepare, .trigger = snd_es1938_capture_trigger, .pointer = snd_es1938_capture_pointer,
@@ -1031,9 +1008,8 @@ static int snd_es1938_new_pcm(struct es1938 *chip, int device) pcm->info_flags =0 ;strcpy (pcm->name,"ESS Solo-1" ); -snd_pcm_lib_preallocate_pages_for_all (pcm,SNDRV_DMA_TYPE_DEV , - &chip->pci->dev, -64 *1024 ,64 *1024 ); +snd_pcm_set_managed_buffer_all (pcm,SNDRV_DMA_TYPE_DEV , + &chip->pci->dev,64 *1024 ,64 *1024 ); chip->pcm = pcm;return 0 ;
Signature · 6 lines
2.16.4 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
PATCH 39/71 ALSA: fm801: Use managed buffer allocation
In reply to Takashi IwaiClean up the driver with the new managed buffer allocation API. The hw_params and hw_free callbacks became superfluous and got dropped.
--- sound/pci/fm801.c | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-)
sound/pci/fm801.c +2 -18
@@ -435,17 +435,6 @@ static int snd_fm801_capture_trigger(struct snd_pcm_substream *substream,return 0 ; } -static int snd_fm801_hw_params (struct snd_pcm_substream *substream, -struct snd_pcm_hw_params *hw_params) -{ -return snd_pcm_lib_malloc_pages (substream,params_buffer_bytes (hw_params)); -} - -static int snd_fm801_hw_free (struct snd_pcm_substream *substream) -{ -return snd_pcm_lib_free_pages (substream); -} -static int snd_fm801_playback_prepare (struct snd_pcm_substream *substream) {struct fm801 *chip =snd_pcm_substream_chip (substream);
@@ -685,8 +674,6 @@ static const struct snd_pcm_ops snd_fm801_playback_ops = { .open = snd_fm801_playback_open, .close = snd_fm801_playback_close, .ioctl = snd_pcm_lib_ioctl, - .hw_params = snd_fm801_hw_params, - .hw_free = snd_fm801_hw_free, .prepare = snd_fm801_playback_prepare, .trigger = snd_fm801_playback_trigger, .pointer = snd_fm801_playback_pointer,
@@ -696,8 +683,6 @@ static const struct snd_pcm_ops snd_fm801_capture_ops = { .open = snd_fm801_capture_open, .close = snd_fm801_capture_close, .ioctl = snd_pcm_lib_ioctl, - .hw_params = snd_fm801_hw_params, - .hw_free = snd_fm801_hw_free, .prepare = snd_fm801_capture_prepare, .trigger = snd_fm801_capture_trigger, .pointer = snd_fm801_capture_pointer,
@@ -720,9 +705,8 @@ static int snd_fm801_pcm(struct fm801 *chip, int device)strcpy (pcm->name,"FM801" ); chip->pcm = pcm; -snd_pcm_lib_preallocate_pages_for_all (pcm,SNDRV_DMA_TYPE_DEV , - &pdev->dev, - chip->multichannel ?128 *1024 :64 *1024 ,128 *1024 ); +snd_pcm_set_managed_buffer_all (pcm,SNDRV_DMA_TYPE_DEV , &pdev->dev, + chip->multichannel ?128 *1024 :64 *1024 ,128 *1024 ); return snd_pcm_add_chmap_ctls(pcm, SNDRV_PCM_STREAM_PLAYBACK, snd_pcm_alt_chmaps,
Signature · 6 lines
2.16.4 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
PATCH 40/71 ALSA: hda: Use managed buffer allocation
In reply to Takashi IwaiClean up the common driver module with the new managed buffer allocation API. The superfluous snd_pcm_lib_malloc_pages() and snd_pcm_lib_free_pages() calls are dropped.
--- sound/pci/hda/hda_controller.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-)
sound/pci/hda/hda_controller.c +4 -9
@@ -107,7 +107,7 @@ static int azx_pcm_hw_params(struct snd_pcm_substream *substream,struct azx_pcm *apcm =snd_pcm_substream_chip (substream);struct azx *chip = apcm->chip;struct azx_dev *azx_dev =get_azx_dev (substream); -int ret; +int ret =0 ;trace_azx_pcm_hw_params (chip, azx_dev);dsp_lock (azx_dev);
@@ -119,8 +119,6 @@ static int azx_pcm_hw_params(struct snd_pcm_substream *substream, azx_dev->core.bufsize =0 ; azx_dev->core.period_bytes =0 ; azx_dev->core.format_val =0 ; - ret =snd_pcm_lib_malloc_pages (substream, -params_buffer_bytes (hw_params)); unlock:dsp_unlock (azx_dev);
@@ -132,7 +130,6 @@ static int azx_pcm_hw_free(struct snd_pcm_substream *substream)struct azx_pcm *apcm =snd_pcm_substream_chip (substream);struct azx_dev *azx_dev =get_azx_dev (substream);struct hda_pcm_stream *hinfo =to_hda_pcm_stream (substream); -int err;/* reset BDL address */ dsp_lock (azx_dev);
@@ -141,10 +138,9 @@ static int azx_pcm_hw_free(struct snd_pcm_substream *substream)snd_hda_codec_cleanup (apcm->codec, hinfo, substream); - err =snd_pcm_lib_free_pages (substream);azx_stream (azx_dev)->prepared =0 ;dsp_unlock (azx_dev); -return err; +return 0 ; }static int azx_pcm_prepare (struct snd_pcm_substream *substream)
@@ -766,9 +762,8 @@ int snd_hda_attach_pcm_stream(struct hda_bus *_bus, struct hda_codec *codec, size =MAX_PREALLOC_SIZE ;if (chip->uc_buffer) type =SNDRV_DMA_TYPE_DEV_UC_SG ; -snd_pcm_lib_preallocate_pages_for_all (pcm, type, - chip->card->dev, - size,MAX_PREALLOC_SIZE ); +snd_pcm_set_managed_buffer_all (pcm, type, chip->card->dev, + size,MAX_PREALLOC_SIZE );return 0 ; }
Signature · 6 lines
2.16.4 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
PATCH 41/71 ALSA: ice1712: Use managed buffer allocation
In reply to Takashi IwaiClean up the driver with the new managed buffer allocation API. The hw_params and hw_free callbacks became superfluous and got dropped.
--- sound/pci/ice1712/ice1712.c | 42 ++++++++---------------------------------- 1 file changed, 8 insertions(+), 34 deletions(-)
sound/pci/ice1712/ice1712.c +8 -34
@@ -479,21 +479,6 @@ static irqreturn_t snd_ice1712_interrupt(int irq, void *dev_id) } -/* -* PCM part - misc -*/ - -static int snd_ice1712_hw_params (struct snd_pcm_substream *substream, -struct snd_pcm_hw_params *hw_params) -{ -return snd_pcm_lib_malloc_pages (substream,params_buffer_bytes (hw_params)); -} - -static int snd_ice1712_hw_free (struct snd_pcm_substream *substream) -{ -return snd_pcm_lib_free_pages (substream); -} -/* * PCM part - consumer I/O */
@@ -837,8 +822,6 @@ static const struct snd_pcm_ops snd_ice1712_playback_ops = { .open = snd_ice1712_playback_open, .close = snd_ice1712_playback_close, .ioctl = snd_pcm_lib_ioctl, - .hw_params = snd_ice1712_hw_params, - .hw_free = snd_ice1712_hw_free, .prepare = snd_ice1712_playback_prepare, .trigger = snd_ice1712_playback_trigger, .pointer = snd_ice1712_playback_pointer,
@@ -848,8 +831,6 @@ static const struct snd_pcm_ops snd_ice1712_playback_ds_ops = { .open = snd_ice1712_playback_ds_open, .close = snd_ice1712_playback_ds_close, .ioctl = snd_pcm_lib_ioctl, - .hw_params = snd_ice1712_hw_params, - .hw_free = snd_ice1712_hw_free, .prepare = snd_ice1712_playback_ds_prepare, .trigger = snd_ice1712_playback_ds_trigger, .pointer = snd_ice1712_playback_ds_pointer,
@@ -859,8 +840,6 @@ static const struct snd_pcm_ops snd_ice1712_capture_ops = { .open = snd_ice1712_capture_open, .close = snd_ice1712_capture_close, .ioctl = snd_pcm_lib_ioctl, - .hw_params = snd_ice1712_hw_params, - .hw_free = snd_ice1712_hw_free, .prepare = snd_ice1712_capture_prepare, .trigger = snd_ice1712_capture_trigger, .pointer = snd_ice1712_capture_pointer,
@@ -883,9 +862,8 @@ static int snd_ice1712_pcm(struct snd_ice1712 *ice, int device)strcpy (pcm->name,"ICE1712 consumer" ); ice->pcm = pcm; -snd_pcm_lib_preallocate_pages_for_all (pcm,SNDRV_DMA_TYPE_DEV , - &ice->pci->dev, -64 *1024 ,64 *1024 ); +snd_pcm_set_managed_buffer_all (pcm,SNDRV_DMA_TYPE_DEV , + &ice->pci->dev,64 *1024 ,64 *1024 );dev_warn (ice->card->dev,"Consumer PCM code does not work well at the moment --jk\n" );
@@ -909,9 +887,8 @@ static int snd_ice1712_pcm_ds(struct snd_ice1712 *ice, int device)strcpy (pcm->name,"ICE1712 consumer (DS)" ); ice->pcm_ds = pcm; -snd_pcm_lib_preallocate_pages_for_all (pcm,SNDRV_DMA_TYPE_DEV , - &ice->pci->dev, -64 *1024 ,128 *1024 ); +snd_pcm_set_managed_buffer_all (pcm,SNDRV_DMA_TYPE_DEV , + &ice->pci->dev,64 *1024 ,128 *1024 );return 0 ; }
@@ -1063,7 +1040,7 @@ static int snd_ice1712_playback_pro_hw_params(struct snd_pcm_substream *substreastruct snd_ice1712 *ice =snd_pcm_substream_chip (substream);snd_ice1712_set_pro_rate (ice,params_rate (hw_params),0 ); -return snd_pcm_lib_malloc_pages (substream,params_buffer_bytes (hw_params)); +return 0 ; }static int snd_ice1712_capture_pro_prepare (struct snd_pcm_substream *substream)
@@ -1085,7 +1062,7 @@ static int snd_ice1712_capture_pro_hw_params(struct snd_pcm_substream *substreamstruct snd_ice1712 *ice =snd_pcm_substream_chip (substream);snd_ice1712_set_pro_rate (ice,params_rate (hw_params),0 ); -return snd_pcm_lib_malloc_pages (substream,params_buffer_bytes (hw_params)); +return 0 ; }static snd_pcm_uframes_t snd_ice1712_playback_pro_pointer (struct snd_pcm_substream *substream)
@@ -1221,7 +1198,6 @@ static const struct snd_pcm_ops snd_ice1712_playback_pro_ops = { .close = snd_ice1712_playback_pro_close, .ioctl = snd_pcm_lib_ioctl, .hw_params = snd_ice1712_playback_pro_hw_params, - .hw_free = snd_ice1712_hw_free, .prepare = snd_ice1712_playback_pro_prepare, .trigger = snd_ice1712_pro_trigger, .pointer = snd_ice1712_playback_pro_pointer,
@@ -1232,7 +1208,6 @@ static const struct snd_pcm_ops snd_ice1712_capture_pro_ops = { .close = snd_ice1712_capture_pro_close, .ioctl = snd_pcm_lib_ioctl, .hw_params = snd_ice1712_capture_pro_hw_params, - .hw_free = snd_ice1712_hw_free, .prepare = snd_ice1712_capture_pro_prepare, .trigger = snd_ice1712_pro_trigger, .pointer = snd_ice1712_capture_pro_pointer,
@@ -1254,9 +1229,8 @@ static int snd_ice1712_pcm_profi(struct snd_ice1712 *ice, int device) pcm->info_flags =0 ;strcpy (pcm->name,"ICE1712 multi" ); -snd_pcm_lib_preallocate_pages_for_all (pcm,SNDRV_DMA_TYPE_DEV , - &ice->pci->dev, -256 *1024 ,256 *1024 ); +snd_pcm_set_managed_buffer_all (pcm,SNDRV_DMA_TYPE_DEV , + &ice->pci->dev,256 *1024 ,256 *1024 ); ice->pcm_pro = pcm;
Signature · 6 lines
2.16.4 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
PATCH 42/71 ALSA: ice1724: Use managed buffer allocation
In reply to Takashi IwaiClean up the driver with the new managed buffer allocation API. The superfluous snd_pcm_lib_malloc_pages() and snd_pcm_lib_free_pages() calls are dropped.
--- sound/pci/ice1712/ice1724.c | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-)
sound/pci/ice1712/ice1724.c +9 -16
@@ -704,7 +704,7 @@ static int snd_vt1724_pcm_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *hw_params) {struct snd_ice1712 *ice =snd_pcm_substream_chip (substream); -int i, chs, err; +int i, chs; chs =params_channels (hw_params);mutex_lock (&ice->open_mutex);
@@ -740,11 +740,7 @@ static int snd_vt1724_pcm_hw_params(struct snd_pcm_substream *substream, }mutex_unlock (&ice->open_mutex); - err =snd_vt1724_set_pro_rate (ice,params_rate (hw_params),0 ); -if (err <0 ) -return err; - -return snd_pcm_lib_malloc_pages (substream,params_buffer_bytes (hw_params)); +return snd_vt1724_set_pro_rate (ice,params_rate (hw_params),0 ); }static int snd_vt1724_pcm_hw_free (struct snd_pcm_substream *substream)
@@ -758,7 +754,7 @@ static int snd_vt1724_pcm_hw_free(struct snd_pcm_substream *substream)if (ice->pcm_reserved[i] == substream) ice->pcm_reserved[i] =NULL ;mutex_unlock (&ice->open_mutex); -return snd_pcm_lib_free_pages (substream); +return 0 ; }static int snd_vt1724_playback_pro_prepare (struct snd_pcm_substream *substream)
@@ -1142,9 +1138,8 @@ static int snd_vt1724_pcm_profi(struct snd_ice1712 *ice, int device) pcm->info_flags =0 ;strcpy (pcm->name,"ICE1724" ); -snd_pcm_lib_preallocate_pages_for_all (pcm,SNDRV_DMA_TYPE_DEV , - &ice->pci->dev, -256 *1024 ,256 *1024 ); +snd_pcm_set_managed_buffer_all (pcm,SNDRV_DMA_TYPE_DEV , + &ice->pci->dev,256 *1024 ,256 *1024 ); ice->pcm_pro = pcm;
@@ -1340,9 +1335,8 @@ static int snd_vt1724_pcm_spdif(struct snd_ice1712 *ice, int device) pcm->info_flags =0 ;strcpy (pcm->name, name); -snd_pcm_lib_preallocate_pages_for_all (pcm,SNDRV_DMA_TYPE_DEV , - &ice->pci->dev, -256 *1024 ,256 *1024 ); +snd_pcm_set_managed_buffer_all (pcm,SNDRV_DMA_TYPE_DEV , + &ice->pci->dev,256 *1024 ,256 *1024 ); ice->pcm = pcm;
@@ -1454,9 +1448,8 @@ static int snd_vt1724_pcm_indep(struct snd_ice1712 *ice, int device) pcm->info_flags =0 ;strcpy (pcm->name,"ICE1724 Surround PCM" ); -snd_pcm_lib_preallocate_pages_for_all (pcm,SNDRV_DMA_TYPE_DEV , - &ice->pci->dev, -256 *1024 ,256 *1024 ); +snd_pcm_set_managed_buffer_all (pcm,SNDRV_DMA_TYPE_DEV , + &ice->pci->dev,256 *1024 ,256 *1024 ); ice->pcm_ds = pcm;
Signature · 6 lines
2.16.4 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
PATCH 43/71 ALSA: intel8x0: Use managed buffer allocation
In reply to Takashi IwaiClean up the drivers with the new managed buffer allocation API. The hw_params and hw_free callbacks became superfluous and got dropped.
--- sound/pci/intel8x0.c | 11 ++++------- sound/pci/intel8x0m.c | 23 ++++------------------- 2 files changed, 8 insertions(+), 26 deletions(-)
sound/pci/intel8x0.c +4 -7
@@ -901,9 +901,6 @@ static int snd_intel8x0_hw_params(struct snd_pcm_substream *substream,int dbl =params_rate (hw_params) >48000 ;int err; - err =snd_pcm_lib_malloc_pages (substream,params_buffer_bytes (hw_params)); -if (err <0 ) -return err;if (ichdev->pcm_open_flag) {snd_ac97_pcm_close (ichdev->pcm); ichdev->pcm_open_flag =0 ;
@@ -929,7 +926,7 @@ static int snd_intel8x0_hw_free(struct snd_pcm_substream *substream)snd_ac97_pcm_close (ichdev->pcm); ichdev->pcm_open_flag =0 ; } -return snd_pcm_lib_free_pages (substream); +return 0 ; } static void snd_intel8x0_setup_pcm_out(struct intel8x0 *chip,
@@ -1487,9 +1484,9 @@ static int snd_intel8x0_pcm1(struct intel8x0 *chip, int device,strcpy (pcm->name, chip->card->shortname); chip->pcm[device] = pcm; -snd_pcm_lib_preallocate_pages_for_all (pcm,intel8x0_dma_type (chip), - &chip->pci->dev, - rec->prealloc_size, rec->prealloc_max_size); +snd_pcm_set_managed_buffer_all (pcm,intel8x0_dma_type (chip), + &chip->pci->dev, + rec->prealloc_size, rec->prealloc_max_size);if (rec->playback_ops && rec->playback_ops->open == snd_intel8x0_playback_open) {
sound/pci/intel8x0m.c +4 -19
@@ -553,17 +553,6 @@ static int snd_intel8x0m_pcm_trigger(struct snd_pcm_substream *substream, int cmreturn 0 ; } -static int snd_intel8x0m_hw_params (struct snd_pcm_substream *substream, -struct snd_pcm_hw_params *hw_params) -{ -return snd_pcm_lib_malloc_pages (substream,params_buffer_bytes (hw_params)); -} - -static int snd_intel8x0m_hw_free (struct snd_pcm_substream *substream) -{ -return snd_pcm_lib_free_pages (substream); -} -static snd_pcm_uframes_t snd_intel8x0m_pcm_pointer (struct snd_pcm_substream *substream) {struct intel8x0m *chip =snd_pcm_substream_chip (substream);
@@ -674,8 +663,6 @@ static const struct snd_pcm_ops snd_intel8x0m_playback_ops = { .open = snd_intel8x0m_playback_open, .close = snd_intel8x0m_playback_close, .ioctl = snd_pcm_lib_ioctl, - .hw_params = snd_intel8x0m_hw_params, - .hw_free = snd_intel8x0m_hw_free, .prepare = snd_intel8x0m_pcm_prepare, .trigger = snd_intel8x0m_pcm_trigger, .pointer = snd_intel8x0m_pcm_pointer,
@@ -685,8 +672,6 @@ static const struct snd_pcm_ops snd_intel8x0m_capture_ops = { .open = snd_intel8x0m_capture_open, .close = snd_intel8x0m_capture_close, .ioctl = snd_pcm_lib_ioctl, - .hw_params = snd_intel8x0m_hw_params, - .hw_free = snd_intel8x0m_hw_free, .prepare = snd_intel8x0m_pcm_prepare, .trigger = snd_intel8x0m_pcm_trigger, .pointer = snd_intel8x0m_pcm_pointer,
@@ -733,10 +718,10 @@ static int snd_intel8x0m_pcm1(struct intel8x0m *chip, int device,strcpy (pcm->name, chip->card->shortname); chip->pcm[device] = pcm; -snd_pcm_lib_preallocate_pages_for_all (pcm,SNDRV_DMA_TYPE_DEV , - &chip->pci->dev, - rec->prealloc_size, - rec->prealloc_max_size); +snd_pcm_set_managed_buffer_all (pcm,SNDRV_DMA_TYPE_DEV , + &chip->pci->dev, + rec->prealloc_size, + rec->prealloc_max_size);return 0 ; }
Signature · 6 lines
2.16.4 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
PATCH 44/71 ALSA: lola: Use managed buffer allocation
In reply to Takashi IwaiClean up the driver with the new managed buffer allocation API. The superfluous snd_pcm_lib_malloc_pages() and snd_pcm_lib_free_pages() calls are dropped.
--- sound/pci/lola/lola_pcm.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)
sound/pci/lola/lola_pcm.c +5 -6
@@ -282,8 +282,7 @@ static int lola_pcm_hw_params(struct snd_pcm_substream *substream, str->bufsize =0 ; str->period_bytes =0 ; str->format_verb =0 ; -return snd_pcm_lib_malloc_pages (substream, -params_buffer_bytes (hw_params)); +return 0 ; }static int lola_pcm_hw_free (struct snd_pcm_substream *substream)
@@ -296,7 +295,7 @@ static int lola_pcm_hw_free(struct snd_pcm_substream *substream)lola_stream_reset (chip, str);lola_cleanup_slave_streams (pcm, str);mutex_unlock (&chip->open_mutex); -return snd_pcm_lib_free_pages (substream); +return 0 ; }/*
@@ -610,9 +609,9 @@ int lola_create_pcm(struct lola *chip)snd_pcm_set_ops (pcm, i, &lola_pcm_ops); }/* buffer pre-allocation */ -snd_pcm_lib_preallocate_pages_for_all (pcm,SNDRV_DMA_TYPE_DEV_SG , - &chip->pci->dev, -1024 *64 ,32 *1024 *1024 ); +snd_pcm_set_managed_buffer_all (pcm,SNDRV_DMA_TYPE_DEV_SG , + &chip->pci->dev, +1024 *64 ,32 *1024 *1024 );return 0 ; }
Signature · 6 lines
2.16.4 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
PATCH 45/71 ALSA: lx6464es: Use managed buffer allocation
In reply to Takashi IwaiClean up the driver with the new managed buffer allocation API. The superfluous snd_pcm_lib_malloc_pages() and snd_pcm_lib_free_pages() calls are dropped.
--- sound/pci/lx6464es/lx6464es.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-)
sound/pci/lx6464es/lx6464es.c +3 -11
@@ -342,23 +342,18 @@ static int lx_pcm_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *hw_params, int is_capture) {struct lx6464es *chip =snd_pcm_substream_chip (substream); -int err =0 ;dev_dbg (chip->card->dev,"->lx_pcm_hw_params\n" );mutex_lock (&chip->setup_mutex); -/* set dma buffer */ - err =snd_pcm_lib_malloc_pages (substream, -params_buffer_bytes (hw_params)); -if (is_capture) chip->capture_stream.stream = substream;else chip->playback_stream.stream = substream;mutex_unlock (&chip->setup_mutex); -return err; +return 0 ; } static int lx_pcm_hw_params_playback(struct snd_pcm_substream *substream,
@@ -400,8 +395,6 @@ static int lx_pcm_hw_free(struct snd_pcm_substream *substream) chip->hardware_running[is_capture] =0 ; } - err =snd_pcm_lib_free_pages (substream); -if (is_capture) chip->capture_stream.stream =NULL ;else
@@ -845,9 +838,8 @@ static int lx_pcm_create(struct lx6464es *chip) pcm->nonatomic = true;strcpy (pcm->name, card_name); -snd_pcm_lib_preallocate_pages_for_all (pcm,SNDRV_DMA_TYPE_DEV , - &chip->pci->dev, - size, size); +snd_pcm_set_managed_buffer_all (pcm,SNDRV_DMA_TYPE_DEV , + &chip->pci->dev, size, size); chip->pcm = pcm; chip->capture_stream.is_capture =1 ;
Signature · 6 lines
2.16.4 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
PATCH 46/71 ALSA: maestro3: Use managed buffer allocation
In reply to Takashi IwaiClean up the driver with the new managed buffer allocation API. The superfluous snd_pcm_lib_malloc_pages() and snd_pcm_lib_free_pages() calls are dropped.
--- sound/pci/maestro3.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-)
sound/pci/maestro3.c +2 -7
@@ -1381,10 +1381,7 @@ static int snd_m3_pcm_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *hw_params) {struct m3_dma *s = substream->runtime->private_data; -int err; -if ((err =snd_pcm_lib_malloc_pages (substream,params_buffer_bytes (hw_params))) <0 ) -return err;/* set buffer address */ s->buffer_addr = substream->runtime->dma_addr;if (s->buffer_addr &0x3 ) {
@@ -1401,7 +1398,6 @@ static int snd_m3_pcm_hw_free(struct snd_pcm_substream *substream)if (substream->runtime->private_data ==NULL )return 0 ; s = substream->runtime->private_data; -snd_pcm_lib_free_pages (substream); s->buffer_addr =0 ;return 0 ; }
@@ -1860,9 +1856,8 @@ snd_m3_pcm(struct snd_m3 * chip, int device)strcpy (pcm->name, chip->card->driver); chip->pcm = pcm; -snd_pcm_lib_preallocate_pages_for_all (pcm,SNDRV_DMA_TYPE_DEV , - &chip->pci->dev, -64 *1024 ,64 *1024 ); +snd_pcm_set_managed_buffer_all (pcm,SNDRV_DMA_TYPE_DEV , + &chip->pci->dev,64 *1024 ,64 *1024 );return 0 ; }
Signature · 6 lines
2.16.4 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
PATCH 47/71 ALSA: mixart: Use managed buffer allocation
In reply to Takashi IwaiClean up the driver with the new managed buffer allocation API. The superfluous snd_pcm_lib_malloc_pages() and snd_pcm_lib_free_pages() calls are dropped.
--- sound/pci/mixart/mixart.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-)
sound/pci/mixart/mixart.c +5 -9
@@ -624,10 +624,7 @@ static int snd_mixart_hw_params(struct snd_pcm_substream *subs,return err; } -/* allocate buffer */ - err =snd_pcm_lib_malloc_pages (subs,params_buffer_bytes (hw)); - -if (err >0 ) { +if (subs->runtime->buffer_changed) {struct mixart_bufferinfo *bufferinfo;int i = (chip->chip_idx *MIXART_MAX_STREAM_PER_CARD ) + (stream->pcm_number * (MIXART_PLAYBACK_STREAMS +MIXART_CAPTURE_STREAMS )) + subs->number;if ( subs->stream ==SNDRV_PCM_STREAM_CAPTURE ) {
@@ -647,13 +644,12 @@ static int snd_mixart_hw_params(struct snd_pcm_substream *subs, }mutex_unlock (&mgr->setup_mutex); -return err; +return 0 ; }static int snd_mixart_hw_free (struct snd_pcm_substream *subs) {struct snd_mixart *chip =snd_pcm_substream_chip (subs); -snd_pcm_lib_free_pages (subs);mixart_sync_nonblock_events (chip->mgr);return 0 ; }
@@ -947,9 +943,9 @@ static void preallocate_buffers(struct snd_mixart *chip, struct snd_pcm *pcm) (chip->chip_idx + 1) << 24; }#endif -snd_pcm_lib_preallocate_pages_for_all (pcm,SNDRV_DMA_TYPE_DEV , - &chip->mgr->pci->dev, -32 *1024 ,32 *1024 ); +snd_pcm_set_managed_buffer_all (pcm,SNDRV_DMA_TYPE_DEV , + &chip->mgr->pci->dev, +32 *1024 ,32 *1024 ); }/*
Signature · 6 lines
2.16.4 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
PATCH 48/71 ALSA: oxygen: Use managed buffer allocation
In reply to Takashi IwaiClean up the drivers with the new managed buffer allocation API. The superfluous snd_pcm_lib_malloc_pages() and snd_pcm_lib_free_pages() calls are dropped.
--- sound/pci/oxygen/oxygen_pcm.c | 52 +++++++++++++++++++------------------------ 1 file changed, 23 insertions(+), 29 deletions(-)
sound/pci/oxygen/oxygen_pcm.c +23 -29
@@ -304,12 +304,6 @@ static int oxygen_hw_params(struct snd_pcm_substream *substream, {struct oxygen *chip =snd_pcm_substream_chip (substream);unsigned int channel =oxygen_substream_channel (substream); -int err; - - err =snd_pcm_lib_malloc_pages (substream, -params_buffer_bytes (hw_params)); -if (err <0 ) -return err;oxygen_write32 (chip, channel_base_registers[channel], (u32 )substream->runtime->dma_addr);
@@ -529,7 +523,7 @@ static int oxygen_hw_free(struct snd_pcm_substream *substream)oxygen_clear_bits8 (chip,OXYGEN_DMA_FLUSH , channel_mask);spin_unlock_irq (&chip->reg_lock); -return snd_pcm_lib_free_pages (substream); +return 0 ; }static int oxygen_spdif_hw_free (struct snd_pcm_substream *substream)
@@ -711,17 +705,17 @@ int oxygen_pcm_init(struct oxygen *chip) pcm->private_data = chip;strcpy (pcm->name,"Multichannel" );if (outs) -snd_pcm_lib_preallocate_pages (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK ].substream, -SNDRV_DMA_TYPE_DEV , - &chip->pci->dev, -DEFAULT_BUFFER_BYTES_MULTICH , -BUFFER_BYTES_MAX_MULTICH ); +snd_pcm_set_managed_buffer (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK ].substream, +SNDRV_DMA_TYPE_DEV , + &chip->pci->dev, +DEFAULT_BUFFER_BYTES_MULTICH , +BUFFER_BYTES_MAX_MULTICH );if (ins) -snd_pcm_lib_preallocate_pages (pcm->streams[SNDRV_PCM_STREAM_CAPTURE ].substream, -SNDRV_DMA_TYPE_DEV , - &chip->pci->dev, -DEFAULT_BUFFER_BYTES , -BUFFER_BYTES_MAX ); +snd_pcm_set_managed_buffer (pcm->streams[SNDRV_PCM_STREAM_CAPTURE ].substream, +SNDRV_DMA_TYPE_DEV , + &chip->pci->dev, +DEFAULT_BUFFER_BYTES , +BUFFER_BYTES_MAX ); } outs = !!(chip->model.device_config &PLAYBACK_1_TO_SPDIF );
@@ -738,10 +732,10 @@ int oxygen_pcm_init(struct oxygen *chip) &oxygen_rec_c_ops); pcm->private_data = chip;strcpy (pcm->name,"Digital" ); -snd_pcm_lib_preallocate_pages_for_all (pcm,SNDRV_DMA_TYPE_DEV , - &chip->pci->dev, -DEFAULT_BUFFER_BYTES , -BUFFER_BYTES_MAX ); +snd_pcm_set_managed_buffer_all (pcm,SNDRV_DMA_TYPE_DEV , + &chip->pci->dev, +DEFAULT_BUFFER_BYTES , +BUFFER_BYTES_MAX ); }if (chip->has_ac97_1) {
@@ -768,10 +762,10 @@ int oxygen_pcm_init(struct oxygen *chip) &oxygen_rec_b_ops); pcm->private_data = chip;strcpy (pcm->name, outs ?"Front Panel" :"Analog 2" ); -snd_pcm_lib_preallocate_pages_for_all (pcm,SNDRV_DMA_TYPE_DEV , - &chip->pci->dev, -DEFAULT_BUFFER_BYTES , -BUFFER_BYTES_MAX ); +snd_pcm_set_managed_buffer_all (pcm,SNDRV_DMA_TYPE_DEV , + &chip->pci->dev, +DEFAULT_BUFFER_BYTES , +BUFFER_BYTES_MAX ); } ins = !!(chip->model.device_config &CAPTURE_3_FROM_I2S_3 );
@@ -786,10 +780,10 @@ int oxygen_pcm_init(struct oxygen *chip) OXYGEN_REC_C_ROUTE_MASK); pcm->private_data = chip;strcpy (pcm->name,"Analog 3" ); -snd_pcm_lib_preallocate_pages_for_all (pcm,SNDRV_DMA_TYPE_DEV , - &chip->pci->dev, -DEFAULT_BUFFER_BYTES , -BUFFER_BYTES_MAX ); +snd_pcm_set_managed_buffer_all (pcm,SNDRV_DMA_TYPE_DEV , + &chip->pci->dev, +DEFAULT_BUFFER_BYTES , +BUFFER_BYTES_MAX ); }return 0 ; }
Signature · 6 lines
2.16.4 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
PATCH 49/71 ALSA: pcxhr: Use managed buffer allocation
In reply to Takashi IwaiClean up the driver with the new managed buffer allocation API. The hw_free callback became superfluous and got dropped.
--- sound/pci/pcxhr/pcxhr.c | 31 +++++++------------------------ 1 file changed, 7 insertions(+), 24 deletions(-)
sound/pci/pcxhr/pcxhr.c +7 -24
@@ -940,32 +940,16 @@ static int pcxhr_hw_params(struct snd_pcm_substream *subs,struct snd_pcxhr *chip =snd_pcm_substream_chip (subs);struct pcxhr_mgr *mgr = chip->mgr;struct pcxhr_stream *stream = subs->runtime->private_data; -snd_pcm_format_t format; -int err; -int channels; - -/* set up channels */ - channels =params_channels (hw); - -/* set up format for the stream */ - format =params_format (hw);mutex_lock (&mgr->setup_mutex); - stream->channels = channels; - stream->format = format; - -/* allocate buffer */ - err =snd_pcm_lib_malloc_pages (subs,params_buffer_bytes (hw)); +/* set up channels */ + stream->channels =params_channels (hw); +/* set up format for the stream */ + stream->format =params_format (hw);mutex_unlock (&mgr->setup_mutex); -return err; -} - -static int pcxhr_hw_free (struct snd_pcm_substream *subs) -{ -snd_pcm_lib_free_pages (subs);return 0 ; }
@@ -1139,7 +1123,6 @@ static const struct snd_pcm_ops pcxhr_ops = { .ioctl = snd_pcm_lib_ioctl, .prepare = pcxhr_prepare, .hw_params = pcxhr_hw_params, - .hw_free = pcxhr_hw_free, .trigger = pcxhr_trigger, .pointer = pcxhr_stream_pointer, };
@@ -1170,9 +1153,9 @@ int pcxhr_create_pcm(struct snd_pcxhr *chip) pcm->nonatomic = true;strcpy (pcm->name, name); -snd_pcm_lib_preallocate_pages_for_all (pcm,SNDRV_DMA_TYPE_DEV , - &chip->mgr->pci->dev, -32 *1024 ,32 *1024 ); +snd_pcm_set_managed_buffer_all (pcm,SNDRV_DMA_TYPE_DEV , + &chip->mgr->pci->dev, +32 *1024 ,32 *1024 ); chip->pcm = pcm;return 0 ; }
Signature · 6 lines
2.16.4 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
PATCH 50/71 ALSA: riptide: Use managed buffer allocation
In reply to Takashi IwaiClean up the driver with the new managed buffer allocation API. The superfluous snd_pcm_lib_malloc_pages() and snd_pcm_lib_free_pages() calls are dropped.
--- sound/pci/riptide/riptide.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
sound/pci/riptide/riptide.c +4 -6
@@ -1558,8 +1558,7 @@ snd_riptide_hw_params(struct snd_pcm_substream *substream,return err; } data->sgdbuf = (struct sgd *)sgdlist->area; -return snd_pcm_lib_malloc_pages (substream, -params_buffer_bytes (hw_params)); +return 0 ; }static int snd_riptide_hw_free (struct snd_pcm_substream *substream)
@@ -1581,7 +1580,7 @@ static int snd_riptide_hw_free(struct snd_pcm_substream *substream) data->sgdlist.area =NULL ; } } -return snd_pcm_lib_free_pages (substream); +return 0 ; }static int snd_riptide_playback_open (struct snd_pcm_substream *substream)
@@ -1692,9 +1691,8 @@ static int snd_riptide_pcm(struct snd_riptide *chip, int device) pcm->info_flags =0 ;strcpy (pcm->name,"RIPTIDE" ); chip->pcm = pcm; -snd_pcm_lib_preallocate_pages_for_all (pcm,SNDRV_DMA_TYPE_DEV_SG , - &chip->pci->dev, -64 *1024 ,128 *1024 ); +snd_pcm_set_managed_buffer_all (pcm,SNDRV_DMA_TYPE_DEV_SG , + &chip->pci->dev,64 *1024 ,128 *1024 );return 0 ; }
Signature · 6 lines
2.16.4 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
PATCH 51/71 ALSA: rme32: Use managed buffer allocation
In reply to Takashi IwaiClean up the driver with the new managed buffer allocation API. The hw_free callback became superfluous and got dropped.
--- sound/pci/rme32.c | 35 +++++++---------------------------- 1 file changed, 7 insertions(+), 28 deletions(-)
sound/pci/rme32.c +7 -28
@@ -662,11 +662,7 @@ snd_rme32_playback_hw_params(struct snd_pcm_substream *substream,struct rme32 *rme32 =snd_pcm_substream_chip (substream);struct snd_pcm_runtime *runtime = substream->runtime; -if (rme32->fullduplex_mode) { - err =snd_pcm_lib_malloc_pages (substream,params_buffer_bytes (params)); -if (err <0 ) -return err; - }else { +if (!rme32->fullduplex_mode) { runtime->dma_area = (void __force *)(rme32->iobase +RME32_IO_DATA_BUFFER ); runtime->dma_addr = rme32->port +RME32_IO_DATA_BUFFER ;
@@ -717,11 +713,7 @@ snd_rme32_capture_hw_params(struct snd_pcm_substream *substream,struct rme32 *rme32 =snd_pcm_substream_chip (substream);struct snd_pcm_runtime *runtime = substream->runtime; -if (rme32->fullduplex_mode) { - err =snd_pcm_lib_malloc_pages (substream,params_buffer_bytes (params)); -if (err <0 ) -return err; - }else { +if (!rme32->fullduplex_mode) { runtime->dma_area = (void __force *)rme32->iobase +RME32_IO_DATA_BUFFER ; runtime->dma_addr = rme32->port +RME32_IO_DATA_BUFFER ;
@@ -771,14 +763,6 @@ snd_rme32_capture_hw_params(struct snd_pcm_substream *substream,return 0 ; } -static int snd_rme32_pcm_hw_free (struct snd_pcm_substream *substream) -{ -struct rme32 *rme32 =snd_pcm_substream_chip (substream); -if (! rme32->fullduplex_mode) -return 0 ; -return snd_pcm_lib_free_pages (substream); -} -static void snd_rme32_pcm_start (struct rme32 * rme32,int from_pause) {if (!from_pause) {
@@ -1195,7 +1179,6 @@ static const struct snd_pcm_ops snd_rme32_playback_spdif_ops = { .close = snd_rme32_playback_close, .ioctl = snd_pcm_lib_ioctl, .hw_params = snd_rme32_playback_hw_params, - .hw_free = snd_rme32_pcm_hw_free, .prepare = snd_rme32_playback_prepare, .trigger = snd_rme32_pcm_trigger, .pointer = snd_rme32_playback_pointer,
@@ -1210,7 +1193,6 @@ static const struct snd_pcm_ops snd_rme32_capture_spdif_ops = { .close = snd_rme32_capture_close, .ioctl = snd_pcm_lib_ioctl, .hw_params = snd_rme32_capture_hw_params, - .hw_free = snd_rme32_pcm_hw_free, .prepare = snd_rme32_capture_prepare, .trigger = snd_rme32_pcm_trigger, .pointer = snd_rme32_capture_pointer,
@@ -1252,7 +1234,6 @@ static const struct snd_pcm_ops snd_rme32_playback_spdif_fd_ops = { .close = snd_rme32_playback_close, .ioctl = snd_pcm_lib_ioctl, .hw_params = snd_rme32_playback_hw_params, - .hw_free = snd_rme32_pcm_hw_free, .prepare = snd_rme32_playback_prepare, .trigger = snd_rme32_pcm_trigger, .pointer = snd_rme32_playback_fd_pointer,
@@ -1264,7 +1245,6 @@ static const struct snd_pcm_ops snd_rme32_capture_spdif_fd_ops = { .close = snd_rme32_capture_close, .ioctl = snd_pcm_lib_ioctl, .hw_params = snd_rme32_capture_hw_params, - .hw_free = snd_rme32_pcm_hw_free, .prepare = snd_rme32_capture_prepare, .trigger = snd_rme32_pcm_trigger, .pointer = snd_rme32_capture_fd_pointer,
@@ -1374,9 +1354,8 @@ static int snd_rme32_create(struct rme32 *rme32) &snd_rme32_playback_spdif_fd_ops);snd_pcm_set_ops (rme32->spdif_pcm,SNDRV_PCM_STREAM_CAPTURE , &snd_rme32_capture_spdif_fd_ops); -snd_pcm_lib_preallocate_pages_for_all (rme32->spdif_pcm,SNDRV_DMA_TYPE_CONTINUOUS , -NULL , -0 ,RME32_MID_BUFFER_SIZE ); +snd_pcm_set_managed_buffer_all (rme32->spdif_pcm,SNDRV_DMA_TYPE_CONTINUOUS , +NULL ,0 ,RME32_MID_BUFFER_SIZE ); rme32->spdif_pcm->info_flags =SNDRV_PCM_INFO_JOINT_DUPLEX ; }else { snd_pcm_set_ops(rme32->spdif_pcm, SNDRV_PCM_STREAM_PLAYBACK,
@@ -1406,9 +1385,9 @@ static int snd_rme32_create(struct rme32 *rme32) &snd_rme32_playback_adat_fd_ops);snd_pcm_set_ops (rme32->adat_pcm,SNDRV_PCM_STREAM_CAPTURE , &snd_rme32_capture_adat_fd_ops); -snd_pcm_lib_preallocate_pages_for_all (rme32->adat_pcm,SNDRV_DMA_TYPE_CONTINUOUS , -NULL , -0 ,RME32_MID_BUFFER_SIZE ); +snd_pcm_set_managed_buffer_all (rme32->adat_pcm,SNDRV_DMA_TYPE_CONTINUOUS , +NULL , +0 ,RME32_MID_BUFFER_SIZE ); rme32->adat_pcm->info_flags =SNDRV_PCM_INFO_JOINT_DUPLEX ; }else { snd_pcm_set_ops(rme32->adat_pcm, SNDRV_PCM_STREAM_PLAYBACK,
Signature · 6 lines
2.16.4 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
PATCH 52/71 ALSA: sis7019: Use managed buffer allocation
In reply to Takashi IwaiClean up the driver with the new managed buffer allocation API. The hw_params and hw_free callbacks became superfluous and got dropped.
--- sound/pci/sis7019.c | 25 ++----------------------- 1 file changed, 2 insertions(+), 23 deletions(-)
sound/pci/sis7019.c +2 -23
@@ -499,18 +499,6 @@ static int sis_substream_close(struct snd_pcm_substream *substream)return 0 ; } -static int sis_playback_hw_params (struct snd_pcm_substream *substream, -struct snd_pcm_hw_params *hw_params) -{ -return snd_pcm_lib_malloc_pages (substream, -params_buffer_bytes (hw_params)); -} - -static int sis_hw_free (struct snd_pcm_substream *substream) -{ -return snd_pcm_lib_free_pages (substream); -} -static int sis_pcm_playback_prepare (struct snd_pcm_substream *substream) {struct snd_pcm_runtime *runtime = substream->runtime;
@@ -701,11 +689,6 @@ static int sis_capture_hw_params(struct snd_pcm_substream *substream,if (rc) goto out; - rc =snd_pcm_lib_malloc_pages (substream, -params_buffer_bytes (hw_params)); -if (rc <0 ) - goto out; - rc =sis_alloc_timing_voice (substream, hw_params); out:
@@ -864,8 +847,6 @@ static const struct snd_pcm_ops sis_playback_ops = { .open = sis_playback_open, .close = sis_substream_close, .ioctl = snd_pcm_lib_ioctl, - .hw_params = sis_playback_hw_params, - .hw_free = sis_hw_free, .prepare = sis_pcm_playback_prepare, .trigger = sis_pcm_trigger, .pointer = sis_pcm_pointer,
@@ -876,7 +857,6 @@ static const struct snd_pcm_ops sis_capture_ops = { .close = sis_substream_close, .ioctl = snd_pcm_lib_ioctl, .hw_params = sis_capture_hw_params, - .hw_free = sis_hw_free, .prepare = sis_pcm_capture_prepare, .trigger = sis_pcm_trigger, .pointer = sis_pcm_pointer,
@@ -904,9 +884,8 @@ static int sis_pcm_create(struct sis7019 *sis)/* Try to preallocate some memory, but it's not the end of the * world if this fails. */ -snd_pcm_lib_preallocate_pages_for_all (pcm,SNDRV_DMA_TYPE_DEV , - &sis->pci->dev, -64 *1024 ,128 *1024 ); +snd_pcm_set_managed_buffer_all (pcm,SNDRV_DMA_TYPE_DEV , + &sis->pci->dev,64 *1024 ,128 *1024 );return 0 ; }
Signature · 6 lines
2.16.4 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
PATCH 53/71 ALSA: sonicvibes: Use managed buffer allocation
In reply to Takashi IwaiClean up the driver with the new managed buffer allocation API. The hw_params and hw_free callbacks became superfluous and got dropped.
--- sound/pci/sonicvibes.c | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-)
sound/pci/sonicvibes.c +2 -18
@@ -681,17 +681,6 @@ static int snd_sonicvibes_capture_trigger(struct snd_pcm_substream *substream,return snd_sonicvibes_trigger (sonic,2 , cmd); } -static int snd_sonicvibes_hw_params (struct snd_pcm_substream *substream, -struct snd_pcm_hw_params *hw_params) -{ -return snd_pcm_lib_malloc_pages (substream,params_buffer_bytes (hw_params)); -} - -static int snd_sonicvibes_hw_free (struct snd_pcm_substream *substream) -{ -return snd_pcm_lib_free_pages (substream); -} -static int snd_sonicvibes_playback_prepare (struct snd_pcm_substream *substream) {struct sonicvibes *sonic =snd_pcm_substream_chip (substream);
@@ -847,8 +836,6 @@ static const struct snd_pcm_ops snd_sonicvibes_playback_ops = { .open = snd_sonicvibes_playback_open, .close = snd_sonicvibes_playback_close, .ioctl = snd_pcm_lib_ioctl, - .hw_params = snd_sonicvibes_hw_params, - .hw_free = snd_sonicvibes_hw_free, .prepare = snd_sonicvibes_playback_prepare, .trigger = snd_sonicvibes_playback_trigger, .pointer = snd_sonicvibes_playback_pointer,
@@ -858,8 +845,6 @@ static const struct snd_pcm_ops snd_sonicvibes_capture_ops = { .open = snd_sonicvibes_capture_open, .close = snd_sonicvibes_capture_close, .ioctl = snd_pcm_lib_ioctl, - .hw_params = snd_sonicvibes_hw_params, - .hw_free = snd_sonicvibes_hw_free, .prepare = snd_sonicvibes_capture_prepare, .trigger = snd_sonicvibes_capture_trigger, .pointer = snd_sonicvibes_capture_pointer,
@@ -883,9 +868,8 @@ static int snd_sonicvibes_pcm(struct sonicvibes *sonic, int device)strcpy (pcm->name,"S3 SonicVibes" ); sonic->pcm = pcm; -snd_pcm_lib_preallocate_pages_for_all (pcm,SNDRV_DMA_TYPE_DEV , - &sonic->pci->dev, -64 *1024 ,128 *1024 ); +snd_pcm_set_managed_buffer_all (pcm,SNDRV_DMA_TYPE_DEV , + &sonic->pci->dev,64 *1024 ,128 *1024 );return 0 ; }
Signature · 6 lines
2.16.4 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
PATCH 54/71 ALSA: trident: Use managed buffer allocation
In reply to Takashi IwaiClean up the driver with the new managed buffer allocation API. The superfluous snd_pcm_lib_malloc_pages() and snd_pcm_lib_free_pages() calls are dropped.
--- sound/pci/trident/trident_main.c | 49 ++++++++++++++++------------------------ 1 file changed, 19 insertions(+), 30 deletions(-)
sound/pci/trident/trident_main.c +19 -30
@@ -808,12 +808,9 @@ static int snd_trident_allocate_pcm_mem(struct snd_pcm_substream *substream,struct snd_trident *trident =snd_pcm_substream_chip (substream);struct snd_pcm_runtime *runtime = substream->runtime;struct snd_trident_voice *voice = runtime->private_data; -int err; -if ((err =snd_pcm_lib_malloc_pages (substream,params_buffer_bytes (hw_params))) <0 ) -return err;if (trident->tlb.entries) { -if (err >0 ) {/* change */ +if (runtime->buffer_changed) {if (voice->memblk)snd_trident_free_pages (trident, voice->memblk); voice->memblk =snd_trident_alloc_pages (trident, substream);
@@ -911,7 +908,6 @@ static int snd_trident_hw_free(struct snd_pcm_substream *substream) voice->memblk =NULL ; } } -snd_pcm_lib_free_pages (substream);if (evoice !=NULL ) {snd_trident_free_voice (trident, evoice); voice->extra =NULL ;
@@ -1128,11 +1124,6 @@ static int snd_trident_capture_prepare(struct snd_pcm_substream *substream)static int snd_trident_si7018_capture_hw_params (struct snd_pcm_substream *substream,struct snd_pcm_hw_params *hw_params) { -int err; - -if ((err =snd_pcm_lib_malloc_pages (substream,params_buffer_bytes (hw_params))) <0 ) -return err; -return snd_trident_allocate_evoice (substream, hw_params); }
@@ -1154,7 +1145,6 @@ static int snd_trident_si7018_capture_hw_free(struct snd_pcm_substream *substreastruct snd_trident_voice *voice = runtime->private_data;struct snd_trident_voice *evoice = voice ? voice->extra :NULL ; -snd_pcm_lib_free_pages (substream);if (evoice !=NULL ) {snd_trident_free_voice (trident, evoice); voice->extra =NULL ;
@@ -2183,17 +2173,17 @@ int snd_trident_pcm(struct snd_trident *trident, int device)if (trident->tlb.entries) {struct snd_pcm_substream *substream;for (substream = pcm->streams[SNDRV_PCM_STREAM_PLAYBACK ].substream; substream; substream = substream->next) -snd_pcm_lib_preallocate_pages (substream,SNDRV_DMA_TYPE_DEV_SG , - &trident->pci->dev, -64 *1024 ,128 *1024 ); -snd_pcm_lib_preallocate_pages (pcm->streams[SNDRV_PCM_STREAM_CAPTURE ].substream, -SNDRV_DMA_TYPE_DEV , - &trident->pci->dev, -64 *1024 ,128 *1024 ); +snd_pcm_set_managed_buffer (substream,SNDRV_DMA_TYPE_DEV_SG , + &trident->pci->dev, +64 *1024 ,128 *1024 ); +snd_pcm_set_managed_buffer (pcm->streams[SNDRV_PCM_STREAM_CAPTURE ].substream, +SNDRV_DMA_TYPE_DEV , + &trident->pci->dev, +64 *1024 ,128 *1024 ); }else { -snd_pcm_lib_preallocate_pages_for_all (pcm,SNDRV_DMA_TYPE_DEV , - &trident->pci->dev, -64 *1024 ,128 *1024 ); +snd_pcm_set_managed_buffer_all (pcm,SNDRV_DMA_TYPE_DEV , + &trident->pci->dev, +64 *1024 ,128 *1024 ); }return 0 ;
@@ -2242,13 +2232,13 @@ int snd_trident_foldback_pcm(struct snd_trident *trident, int device) trident->foldback = foldback;if (trident->tlb.entries) -snd_pcm_lib_preallocate_pages_for_all (foldback,SNDRV_DMA_TYPE_DEV_SG , - &trident->pci->dev, -0 ,128 *1024 ); +snd_pcm_set_managed_buffer_all (foldback,SNDRV_DMA_TYPE_DEV_SG , + &trident->pci->dev, +0 ,128 *1024 );else -snd_pcm_lib_preallocate_pages_for_all (foldback,SNDRV_DMA_TYPE_DEV , - &trident->pci->dev, -64 *1024 ,128 *1024 ); +snd_pcm_set_managed_buffer_all (foldback,SNDRV_DMA_TYPE_DEV , + &trident->pci->dev, +64 *1024 ,128 *1024 );return 0 ; }
@@ -2282,9 +2272,8 @@ int snd_trident_spdif_pcm(struct snd_trident *trident, int device)strcpy (spdif->name,"Trident 4DWave IEC958" ); trident->spdif = spdif; -snd_pcm_lib_preallocate_pages_for_all (spdif,SNDRV_DMA_TYPE_DEV , - &trident->pci->dev, -64 *1024 ,128 *1024 ); +snd_pcm_set_managed_buffer_all (spdif,SNDRV_DMA_TYPE_DEV , + &trident->pci->dev,64 *1024 ,128 *1024 );return 0 ; }
Signature · 6 lines
2.16.4 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
PATCH 55/71 ALSA: via82xx: Use managed buffer allocation
In reply to Takashi IwaiClean up the drivers with the new managed buffer allocation API. The superfluous snd_pcm_lib_malloc_pages() and snd_pcm_lib_free_pages() calls are dropped.
--- sound/pci/via82xx.c | 45 ++++++++++++++++++--------------------------- sound/pci/via82xx_modem.c | 9 ++------- 2 files changed, 20 insertions(+), 34 deletions(-)
sound/pci/via82xx.c +18 -27
@@ -919,18 +919,10 @@ static int snd_via82xx_hw_params(struct snd_pcm_substream *substream, {struct via82xx *chip =snd_pcm_substream_chip (substream);struct viadev *viadev = substream->runtime->private_data; -int err; - err =snd_pcm_lib_malloc_pages (substream,params_buffer_bytes (hw_params)); -if (err <0 ) -return err; - err =build_via_table (viadev, substream, chip->pci, -params_periods (hw_params), -params_period_bytes (hw_params)); -if (err <0 ) -return err; - -return 0 ; +return build_via_table (viadev, substream, chip->pci, +params_periods (hw_params), +params_period_bytes (hw_params)); }/*
@@ -943,7 +935,6 @@ static int snd_via82xx_hw_free(struct snd_pcm_substream *substream)struct viadev *viadev = substream->runtime->private_data;clean_via_table (viadev, substream, chip->pci); -snd_pcm_lib_free_pages (substream);return 0 ; }
@@ -1453,9 +1444,9 @@ static int snd_via8233_pcm_new(struct via82xx *chip)/* capture */ init_viadev (chip, chip->capture_devno,VIA_REG_CAPTURE_8233_STATUS ,6 ,1 ); -snd_pcm_lib_preallocate_pages_for_all (pcm,SNDRV_DMA_TYPE_DEV_SG , - &chip->pci->dev, -64 *1024 ,VIA_MAX_BUFSIZE ); +snd_pcm_set_managed_buffer_all (pcm,SNDRV_DMA_TYPE_DEV_SG , + &chip->pci->dev, +64 *1024 ,VIA_MAX_BUFSIZE ); err = snd_pcm_add_chmap_ctls(pcm, SNDRV_PCM_STREAM_PLAYBACK, snd_pcm_std_chmaps, 2, 0,
@@ -1477,9 +1468,9 @@ static int snd_via8233_pcm_new(struct via82xx *chip)/* set up capture */ init_viadev (chip, chip->capture_devno +1 ,VIA_REG_CAPTURE_8233_STATUS +0x10 ,7 ,1 ); -snd_pcm_lib_preallocate_pages_for_all (pcm,SNDRV_DMA_TYPE_DEV_SG , - &chip->pci->dev, -64 *1024 ,VIA_MAX_BUFSIZE ); +snd_pcm_set_managed_buffer_all (pcm,SNDRV_DMA_TYPE_DEV_SG , + &chip->pci->dev, +64 *1024 ,VIA_MAX_BUFSIZE ); err = snd_pcm_add_chmap_ctls(pcm, SNDRV_PCM_STREAM_PLAYBACK, snd_pcm_alt_chmaps, 6, 0,
@@ -1520,9 +1511,9 @@ static int snd_via8233a_pcm_new(struct via82xx *chip)/* capture */ init_viadev (chip, chip->capture_devno,VIA_REG_CAPTURE_8233_STATUS ,6 ,1 ); -snd_pcm_lib_preallocate_pages_for_all (pcm,SNDRV_DMA_TYPE_DEV_SG , - &chip->pci->dev, -64 *1024 ,VIA_MAX_BUFSIZE ); +snd_pcm_set_managed_buffer_all (pcm,SNDRV_DMA_TYPE_DEV_SG , + &chip->pci->dev, +64 *1024 ,VIA_MAX_BUFSIZE ); err = snd_pcm_add_chmap_ctls(pcm, SNDRV_PCM_STREAM_PLAYBACK, snd_pcm_alt_chmaps, 6, 0,
@@ -1546,9 +1537,9 @@ static int snd_via8233a_pcm_new(struct via82xx *chip)/* set up playback */ init_viadev (chip, chip->playback_devno,0x30 ,3 ,0 ); -snd_pcm_lib_preallocate_pages_for_all (pcm,SNDRV_DMA_TYPE_DEV_SG , - &chip->pci->dev, -64 *1024 ,VIA_MAX_BUFSIZE ); +snd_pcm_set_managed_buffer_all (pcm,SNDRV_DMA_TYPE_DEV_SG , + &chip->pci->dev, +64 *1024 ,VIA_MAX_BUFSIZE );return 0 ; }
@@ -1576,9 +1567,9 @@ static int snd_via686_pcm_new(struct via82xx *chip)init_viadev (chip,0 ,VIA_REG_PLAYBACK_STATUS ,0 ,0 );init_viadev (chip,1 ,VIA_REG_CAPTURE_STATUS ,0 ,1 ); -snd_pcm_lib_preallocate_pages_for_all (pcm,SNDRV_DMA_TYPE_DEV_SG , - &chip->pci->dev, -64 *1024 ,VIA_MAX_BUFSIZE ); +snd_pcm_set_managed_buffer_all (pcm,SNDRV_DMA_TYPE_DEV_SG , + &chip->pci->dev, +64 *1024 ,VIA_MAX_BUFSIZE );return 0 ; }
sound/pci/via82xx_modem.c +2 -7
@@ -642,9 +642,6 @@ static int snd_via82xx_hw_params(struct snd_pcm_substream *substream,struct viadev *viadev = substream->runtime->private_data;int err; - err =snd_pcm_lib_malloc_pages (substream,params_buffer_bytes (hw_params)); -if (err <0 ) -return err; err =build_via_table (viadev, substream, chip->pci,params_periods (hw_params),params_period_bytes (hw_params));
@@ -667,7 +664,6 @@ static int snd_via82xx_hw_free(struct snd_pcm_substream *substream)struct viadev *viadev = substream->runtime->private_data;clean_via_table (viadev, substream, chip->pci); -snd_pcm_lib_free_pages (substream);return 0 ; }
@@ -849,9 +845,8 @@ static int snd_via686_pcm_new(struct via82xx_modem *chip)init_viadev (chip,0 ,VIA_REG_MO_STATUS ,0 );init_viadev (chip,1 ,VIA_REG_MI_STATUS ,1 ); -snd_pcm_lib_preallocate_pages_for_all (pcm,SNDRV_DMA_TYPE_DEV_SG , - &chip->pci->dev, -64 *1024 ,128 *1024 ); +snd_pcm_set_managed_buffer_all (pcm,SNDRV_DMA_TYPE_DEV_SG , + &chip->pci->dev,64 *1024 ,128 *1024 );return 0 ; }
Signature · 6 lines
2.16.4 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
PATCH 56/71 ALSA: ymfpci: Use managed buffer allocation
In reply to Takashi IwaiClean up the driver with the new managed buffer allocation API. The hw_params callback became superfluous and got dropped.
--- sound/pci/ymfpci/ymfpci_main.c | 33 +++++++++------------------------ 1 file changed, 9 insertions(+), 24 deletions(-)
sound/pci/ymfpci/ymfpci_main.c +9 -24
@@ -628,8 +628,6 @@ static int snd_ymfpci_playback_hw_params(struct snd_pcm_substream *substream,struct snd_ymfpci_pcm *ypcm = runtime->private_data;int err; -if ((err =snd_pcm_lib_malloc_pages (substream,params_buffer_bytes (hw_params))) <0 ) -return err;if ((err =snd_ymfpci_pcm_voice_alloc (ypcm,params_channels (hw_params))) <0 )return err;return 0 ;
@@ -647,7 +645,6 @@ static int snd_ymfpci_playback_hw_free(struct snd_pcm_substream *substream)/* wait, until the PCI operations are not finished */ snd_ymfpci_irq_wait (chip); -snd_pcm_lib_free_pages (substream);if (ypcm->voices[1 ]) {snd_ymfpci_voice_free (chip, ypcm->voices[1 ]); ypcm->voices[1 ] =NULL ;
@@ -683,19 +680,13 @@ static int snd_ymfpci_playback_prepare(struct snd_pcm_substream *substream)return 0 ; } -static int snd_ymfpci_capture_hw_params (struct snd_pcm_substream *substream, -struct snd_pcm_hw_params *hw_params) -{ -return snd_pcm_lib_malloc_pages (substream,params_buffer_bytes (hw_params)); -} -static int snd_ymfpci_capture_hw_free (struct snd_pcm_substream *substream) {struct snd_ymfpci *chip =snd_pcm_substream_chip (substream);/* wait, until the PCI operations are not finished */ snd_ymfpci_irq_wait (chip); -return snd_pcm_lib_free_pages (substream); +return 0 ; }static int snd_ymfpci_capture_prepare (struct snd_pcm_substream *substream)
@@ -1124,7 +1115,6 @@ static const struct snd_pcm_ops snd_ymfpci_capture_rec_ops = { .open = snd_ymfpci_capture_rec_open, .close = snd_ymfpci_capture_close, .ioctl = snd_pcm_lib_ioctl, - .hw_params = snd_ymfpci_capture_hw_params, .hw_free = snd_ymfpci_capture_hw_free, .prepare = snd_ymfpci_capture_prepare, .trigger = snd_ymfpci_capture_trigger,
@@ -1148,9 +1138,8 @@ int snd_ymfpci_pcm(struct snd_ymfpci *chip, int device)strcpy (pcm->name,"YMFPCI" ); chip->pcm = pcm; -snd_pcm_lib_preallocate_pages_for_all (pcm,SNDRV_DMA_TYPE_DEV , - &chip->pci->dev, -64 *1024 ,256 *1024 ); +snd_pcm_set_managed_buffer_all (pcm,SNDRV_DMA_TYPE_DEV , + &chip->pci->dev,64 *1024 ,256 *1024 );return snd_pcm_add_chmap_ctls (pcm,SNDRV_PCM_STREAM_PLAYBACK , snd_pcm_std_chmaps,2 ,0 ,NULL );
@@ -1160,7 +1149,6 @@ static const struct snd_pcm_ops snd_ymfpci_capture_ac97_ops = { .open = snd_ymfpci_capture_ac97_open, .close = snd_ymfpci_capture_close, .ioctl = snd_pcm_lib_ioctl, - .hw_params = snd_ymfpci_capture_hw_params, .hw_free = snd_ymfpci_capture_hw_free, .prepare = snd_ymfpci_capture_prepare, .trigger = snd_ymfpci_capture_trigger,
@@ -1184,9 +1172,8 @@ int snd_ymfpci_pcm2(struct snd_ymfpci *chip, int device) chip->device_id == PCI_DEVICE_ID_YAMAHA_754 ? "Direct Recording" : "AC'97"); chip->pcm2 = pcm; -snd_pcm_lib_preallocate_pages_for_all (pcm,SNDRV_DMA_TYPE_DEV , - &chip->pci->dev, -64 *1024 ,256 *1024 ); +snd_pcm_set_managed_buffer_all (pcm,SNDRV_DMA_TYPE_DEV , + &chip->pci->dev,64 *1024 ,256 *1024 );return 0 ; }
@@ -1218,9 +1205,8 @@ int snd_ymfpci_pcm_spdif(struct snd_ymfpci *chip, int device)strcpy (pcm->name,"YMFPCI - IEC958" ); chip->pcm_spdif = pcm; -snd_pcm_lib_preallocate_pages_for_all (pcm,SNDRV_DMA_TYPE_DEV , - &chip->pci->dev, -64 *1024 ,256 *1024 ); +snd_pcm_set_managed_buffer_all (pcm,SNDRV_DMA_TYPE_DEV , + &chip->pci->dev,64 *1024 ,256 *1024 );return 0 ; }
@@ -1260,9 +1246,8 @@ int snd_ymfpci_pcm_4ch(struct snd_ymfpci *chip, int device)strcpy (pcm->name,"YMFPCI - Rear PCM" ); chip->pcm_4ch = pcm; -snd_pcm_lib_preallocate_pages_for_all (pcm,SNDRV_DMA_TYPE_DEV , - &chip->pci->dev, -64 *1024 ,256 *1024 ); +snd_pcm_set_managed_buffer_all (pcm,SNDRV_DMA_TYPE_DEV , + &chip->pci->dev,64 *1024 ,256 *1024 );return snd_pcm_add_chmap_ctls (pcm,SNDRV_PCM_STREAM_PLAYBACK , surround_map,2 ,0 ,NULL );
Signature · 6 lines
2.16.4 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
PATCH 57/71 ALSA: pdaudiocf: Use managed buffer allocation
In reply to Takashi IwaiClean up the driver with the new managed buffer allocation API. The hw_params and hw_free callbacks became superfluous and got dropped.
--- sound/pcmcia/pdaudiocf/pdaudiocf_pcm.c | 25 +++---------------------- 1 file changed, 3 insertions(+), 22 deletions(-)
sound/pcmcia/pdaudiocf/pdaudiocf_pcm.c +3 -22
@@ -83,23 +83,6 @@ static int pdacf_pcm_trigger(struct snd_pcm_substream *subs, int cmd)return ret; } -/* -* pdacf_pcm_hw_params - hw_params callback for playback and capture -*/ -static int pdacf_pcm_hw_params (struct snd_pcm_substream *subs, -struct snd_pcm_hw_params *hw_params) -{ -return snd_pcm_lib_malloc_pages (subs,params_buffer_bytes (hw_params)); -} - -/* -* pdacf_pcm_hw_free - hw_free callback for playback and capture -*/ -static int pdacf_pcm_hw_free (struct snd_pcm_substream *subs) -{ -return snd_pcm_lib_free_pages (subs); -} -/* * pdacf_pcm_prepare - prepare callback for playback and capture */
@@ -256,8 +239,6 @@ static const struct snd_pcm_ops pdacf_pcm_capture_ops = { .open = pdacf_pcm_capture_open, .close = pdacf_pcm_capture_close, .ioctl = snd_pcm_lib_ioctl, - .hw_params = pdacf_pcm_hw_params, - .hw_free = pdacf_pcm_hw_free, .prepare = pdacf_pcm_prepare, .trigger = pdacf_pcm_trigger, .pointer = pdacf_pcm_capture_pointer,
@@ -277,9 +258,9 @@ int snd_pdacf_pcm_new(struct snd_pdacf *chip)return err;snd_pcm_set_ops (pcm,SNDRV_PCM_STREAM_CAPTURE , &pdacf_pcm_capture_ops); -snd_pcm_lib_preallocate_pages_for_all (pcm,SNDRV_DMA_TYPE_VMALLOC , -snd_dma_continuous_data (GFP_KERNEL |GFP_DMA32 ), -0 ,0 ); +snd_pcm_set_managed_buffer_all (pcm,SNDRV_DMA_TYPE_VMALLOC , +snd_dma_continuous_data (GFP_KERNEL |GFP_DMA32 ), +0 ,0 ); pcm->private_data = chip; pcm->info_flags =0 ;
Signature · 6 lines
2.16.4 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
PATCH 58/71 ALSA: pmac: Use managed buffer allocation
In reply to Takashi IwaiClean up the driver with the new managed buffer allocation API. The hw_params and hw_free callbacks became superfluous and got dropped.
--- sound/ppc/pmac.c | 28 +++------------------------- 1 file changed, 3 insertions(+), 25 deletions(-)
sound/ppc/pmac.c +3 -25
@@ -107,24 +107,6 @@ static inline int another_stream(int stream) SNDRV_PCM_STREAM_CAPTURE :SNDRV_PCM_STREAM_PLAYBACK ; } -/* -* allocate buffers -*/ -static int snd_pmac_pcm_hw_params (struct snd_pcm_substream *subs, -struct snd_pcm_hw_params *hw_params) -{ -return snd_pcm_lib_malloc_pages (subs,params_buffer_bytes (hw_params)); -} - -/* -* release buffers -*/ -static int snd_pmac_pcm_hw_free (struct snd_pcm_substream *subs) -{ -snd_pcm_lib_free_pages (subs); -return 0 ; -} -/* * get a stream of the opposite direction */
@@ -672,8 +654,6 @@ static const struct snd_pcm_ops snd_pmac_playback_ops = { .open = snd_pmac_playback_open, .close = snd_pmac_playback_close, .ioctl = snd_pcm_lib_ioctl, - .hw_params = snd_pmac_pcm_hw_params, - .hw_free = snd_pmac_pcm_hw_free, .prepare = snd_pmac_playback_prepare, .trigger = snd_pmac_playback_trigger, .pointer = snd_pmac_playback_pointer,
@@ -683,8 +663,6 @@ static const struct snd_pcm_ops snd_pmac_capture_ops = { .open = snd_pmac_capture_open, .close = snd_pmac_capture_close, .ioctl = snd_pcm_lib_ioctl, - .hw_params = snd_pmac_pcm_hw_params, - .hw_free = snd_pmac_pcm_hw_free, .prepare = snd_pmac_capture_prepare, .trigger = snd_pmac_capture_trigger, .pointer = snd_pmac_capture_pointer,
@@ -721,9 +699,9 @@ int snd_pmac_pcm_new(struct snd_pmac *chip) chip->capture.cur_freqs = chip->freqs_ok;/* preallocate 64k buffer */ -snd_pcm_lib_preallocate_pages_for_all (pcm,SNDRV_DMA_TYPE_DEV , - &chip->pdev->dev, -64 *1024 ,64 *1024 ); +snd_pcm_set_managed_buffer_all (pcm,SNDRV_DMA_TYPE_DEV , + &chip->pdev->dev, +64 *1024 ,64 *1024 );return 0 ; }
Signature · 6 lines
2.16.4 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
PATCH 59/71 ALSA: ps3: Use managed buffer allocation
In reply to Takashi IwaiClean up the driver with the new managed buffer allocation API. The hw_params and hw_free callbacks became superfluous and got dropped.
--- sound/ppc/snd_ps3.c | 28 +++++----------------------- 1 file changed, 5 insertions(+), 23 deletions(-)
sound/ppc/snd_ps3.c +5 -23
@@ -535,22 +535,6 @@ static int snd_ps3_pcm_close(struct snd_pcm_substream *substream)return 0 ; }; -static int snd_ps3_pcm_hw_params (struct snd_pcm_substream *substream, -struct snd_pcm_hw_params *hw_params) -{ -size_t size; - -/* alloc transport buffer */ - size =params_buffer_bytes (hw_params); -snd_pcm_lib_malloc_pages (substream, size); -return 0 ; -}; - -static int snd_ps3_pcm_hw_free (struct snd_pcm_substream *substream) -{ -return snd_pcm_lib_free_pages (substream); -}; -static int snd_ps3_delay_to_bytes (struct snd_pcm_substream *substream,unsigned int delay_ms) {
@@ -759,8 +743,6 @@ static const struct snd_pcm_ops snd_ps3_pcm_spdif_ops = { .open = snd_ps3_pcm_open, .close = snd_ps3_pcm_close, .ioctl = snd_pcm_lib_ioctl, - .hw_params = snd_ps3_pcm_hw_params, - .hw_free = snd_ps3_pcm_hw_free, .prepare = snd_ps3_pcm_prepare, .trigger = snd_ps3_pcm_trigger, .pointer = snd_ps3_pcm_pointer,
@@ -1007,11 +989,11 @@ static int snd_ps3_driver_probe(struct ps3_system_bus_device *dev) the_card.pcm->info_flags =SNDRV_PCM_INFO_NONINTERLEAVED ;/* pre-alloc PCM DMA buffer*/ -snd_pcm_lib_preallocate_pages_for_all (the_card.pcm, -SNDRV_DMA_TYPE_DEV , - &dev->core, -SND_PS3_PCM_PREALLOC_SIZE , -SND_PS3_PCM_PREALLOC_SIZE ); +snd_pcm_set_managed_buffer_all (the_card.pcm, +SNDRV_DMA_TYPE_DEV , + &dev->core, +SND_PS3_PCM_PREALLOC_SIZE , +SND_PS3_PCM_PREALLOC_SIZE );/* * allocate null buffer
Signature · 6 lines
2.16.4 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
PATCH 60/71 ALSA: aica: Use managed buffer allocation
In reply to Takashi IwaiClean up the driver with the new managed buffer allocation API. The hw_params and hw_free callbacks became superfluous and got dropped.
--- sound/sh/aica.c | 29 +++++------------------------ 1 file changed, 5 insertions(+), 24 deletions(-)
sound/sh/aica.c +5 -24
@@ -363,23 +363,6 @@ static int snd_aicapcm_pcm_close(struct snd_pcm_substreamreturn 0 ; } -static int snd_aicapcm_pcm_hw_free (struct snd_pcm_substream - *substream) -{ -/* Free the DMA buffer */ -return snd_pcm_lib_free_pages (substream); -} - -static int snd_aicapcm_pcm_hw_params (struct snd_pcm_substream - *substream,struct snd_pcm_hw_params - *hw_params) -{ -/* Allocate a DMA buffer using ALSA built-ins */ -return -snd_pcm_lib_malloc_pages (substream, -params_buffer_bytes (hw_params)); -} -static int snd_aicapcm_pcm_prepare (struct snd_pcm_substream *substream) {
@@ -417,8 +400,6 @@ static const struct snd_pcm_ops snd_aicapcm_playback_ops = { .open = snd_aicapcm_pcm_open, .close = snd_aicapcm_pcm_close, .ioctl = snd_pcm_lib_ioctl, - .hw_params = snd_aicapcm_pcm_hw_params, - .hw_free = snd_aicapcm_pcm_hw_free, .prepare = snd_aicapcm_pcm_prepare, .trigger = snd_aicapcm_pcm_trigger, .pointer = snd_aicapcm_pcm_pointer,
@@ -441,11 +422,11 @@ static int __init snd_aicapcmchip(struct snd_card_aicasnd_pcm_set_ops (pcm,SNDRV_PCM_STREAM_PLAYBACK , &snd_aicapcm_playback_ops);/* Allocate the DMA buffers */ -snd_pcm_lib_preallocate_pages_for_all (pcm, -SNDRV_DMA_TYPE_CONTINUOUS , -NULL , -AICA_BUFFER_SIZE , -AICA_BUFFER_SIZE ); +snd_pcm_set_managed_buffer_all (pcm, +SNDRV_DMA_TYPE_CONTINUOUS , +NULL , +AICA_BUFFER_SIZE , +AICA_BUFFER_SIZE );return 0 ; }
Signature · 6 lines
2.16.4 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
PATCH 61/71 ALSA: sh: Use managed buffer allocation
In reply to Takashi IwaiClean up the driver with the new managed buffer allocation API. The hw_params and hw_free callbacks became superfluous and got dropped.
--- sound/sh/sh_dac_audio.c | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-)
sound/sh/sh_dac_audio.c +2 -18
@@ -125,18 +125,6 @@ static int snd_sh_dac_pcm_close(struct snd_pcm_substream *substream)return 0 ; } -static int snd_sh_dac_pcm_hw_params (struct snd_pcm_substream *substream, -struct snd_pcm_hw_params *hw_params) -{ -return snd_pcm_lib_malloc_pages (substream, -params_buffer_bytes (hw_params)); -} - -static int snd_sh_dac_pcm_hw_free (struct snd_pcm_substream *substream) -{ -return snd_pcm_lib_free_pages (substream); -} -static int snd_sh_dac_pcm_prepare (struct snd_pcm_substream *substream) {struct snd_sh_dac *chip =snd_pcm_substream_chip (substream);
@@ -241,8 +229,6 @@ static const struct snd_pcm_ops snd_sh_dac_pcm_ops = { .open = snd_sh_dac_pcm_open, .close = snd_sh_dac_pcm_close, .ioctl = snd_pcm_lib_ioctl, - .hw_params = snd_sh_dac_pcm_hw_params, - .hw_free = snd_sh_dac_pcm_hw_free, .prepare = snd_sh_dac_pcm_prepare, .trigger = snd_sh_dac_pcm_trigger, .pointer = snd_sh_dac_pcm_pointer,
@@ -267,10 +253,8 @@ static int snd_sh_dac_pcm(struct snd_sh_dac *chip, int device)snd_pcm_set_ops (pcm,SNDRV_PCM_STREAM_PLAYBACK , &snd_sh_dac_pcm_ops);/* buffer size=48K */ -snd_pcm_lib_preallocate_pages_for_all (pcm,SNDRV_DMA_TYPE_CONTINUOUS , -NULL , -48 *1024 , -48 *1024 ); +snd_pcm_set_managed_buffer_all (pcm,SNDRV_DMA_TYPE_CONTINUOUS , +NULL ,48 *1024 ,48 *1024 );return 0 ; }
Signature · 6 lines
2.16.4 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
PATCH 62/71 ALSA: sparc: Use managed buffer allocation
In reply to Takashi IwaiClean up the drivers with the new managed buffer allocation API. The hw_params and hw_free callbacks became superfluous and dropped.
--- sound/sparc/amd7930.c | 20 ++------------------ sound/sparc/cs4231.c | 17 ++--------------- sound/sparc/dbri.c | 13 +++---------- 3 files changed, 7 insertions(+), 43 deletions(-)
sound/sparc/amd7930.c +2 -18
@@ -723,23 +723,10 @@ static int snd_amd7930_capture_close(struct snd_pcm_substream *substream)return 0 ; } -static int snd_amd7930_hw_params (struct snd_pcm_substream *substream, -struct snd_pcm_hw_params *hw_params) -{ -return snd_pcm_lib_malloc_pages (substream,params_buffer_bytes (hw_params)); -} - -static int snd_amd7930_hw_free (struct snd_pcm_substream *substream) -{ -return snd_pcm_lib_free_pages (substream); -} -static const struct snd_pcm_ops snd_amd7930_playback_ops = { .open = snd_amd7930_playback_open, .close = snd_amd7930_playback_close, .ioctl = snd_pcm_lib_ioctl, - .hw_params = snd_amd7930_hw_params, - .hw_free = snd_amd7930_hw_free, .prepare = snd_amd7930_playback_prepare, .trigger = snd_amd7930_playback_trigger, .pointer = snd_amd7930_playback_pointer,
@@ -749,8 +736,6 @@ static const struct snd_pcm_ops snd_amd7930_capture_ops = { .open = snd_amd7930_capture_open, .close = snd_amd7930_capture_close, .ioctl = snd_pcm_lib_ioctl, - .hw_params = snd_amd7930_hw_params, - .hw_free = snd_amd7930_hw_free, .prepare = snd_amd7930_capture_prepare, .trigger = snd_amd7930_capture_trigger, .pointer = snd_amd7930_capture_pointer,
@@ -776,9 +761,8 @@ static int snd_amd7930_pcm(struct snd_amd7930 *amd)strcpy (pcm->name, amd->card->shortname); amd->pcm = pcm; -snd_pcm_lib_preallocate_pages_for_all (pcm,SNDRV_DMA_TYPE_CONTINUOUS , -NULL , -64 *1024 ,64 *1024 ); +snd_pcm_set_managed_buffer_all (pcm,SNDRV_DMA_TYPE_CONTINUOUS , +NULL ,64 *1024 ,64 *1024 );return 0 ; }
sound/sparc/cs4231.c +2 -15
@@ -889,12 +889,7 @@ static int snd_cs4231_playback_hw_params(struct snd_pcm_substream *substream, {struct snd_cs4231 *chip =snd_pcm_substream_chip (substream);unsigned char new_pdfr; -int err; - err =snd_pcm_lib_malloc_pages (substream, -params_buffer_bytes (hw_params)); -if (err <0 ) -return err; new_pdfr =snd_cs4231_get_format (chip,params_format (hw_params),params_channels (hw_params)) |snd_cs4231_get_rate (params_rate (hw_params));
@@ -933,12 +928,7 @@ static int snd_cs4231_capture_hw_params(struct snd_pcm_substream *substream, {struct snd_cs4231 *chip =snd_pcm_substream_chip (substream);unsigned char new_cdfr; -int err; - err =snd_pcm_lib_malloc_pages (substream, -params_buffer_bytes (hw_params)); -if (err <0 ) -return err; new_cdfr =snd_cs4231_get_format (chip,params_format (hw_params),params_channels (hw_params)) |snd_cs4231_get_rate (params_rate (hw_params));
@@ -1205,7 +1195,6 @@ static const struct snd_pcm_ops snd_cs4231_playback_ops = { .close = snd_cs4231_playback_close, .ioctl = snd_pcm_lib_ioctl, .hw_params = snd_cs4231_playback_hw_params, - .hw_free = snd_pcm_lib_free_pages, .prepare = snd_cs4231_playback_prepare, .trigger = snd_cs4231_trigger, .pointer = snd_cs4231_playback_pointer,
@@ -1216,7 +1205,6 @@ static const struct snd_pcm_ops snd_cs4231_capture_ops = { .close = snd_cs4231_capture_close, .ioctl = snd_pcm_lib_ioctl, .hw_params = snd_cs4231_capture_hw_params, - .hw_free = snd_pcm_lib_free_pages, .prepare = snd_cs4231_capture_prepare, .trigger = snd_cs4231_trigger, .pointer = snd_cs4231_capture_pointer,
@@ -1242,9 +1230,8 @@ static int snd_cs4231_pcm(struct snd_card *card) pcm->info_flags =SNDRV_PCM_INFO_JOINT_DUPLEX ;strcpy (pcm->name,"CS4231" ); -snd_pcm_lib_preallocate_pages_for_all (pcm,SNDRV_DMA_TYPE_DEV , - &chip->op->dev, -64 *1024 ,128 *1024 ); +snd_pcm_set_managed_buffer_all (pcm,SNDRV_DMA_TYPE_DEV , + &chip->op->dev,64 *1024 ,128 *1024 ); chip->pcm = pcm;
sound/sparc/dbri.c +3 -10
@@ -2099,12 +2099,6 @@ static int snd_dbri_hw_params(struct snd_pcm_substream *substream,if (ret !=0 )return ret; -if ((ret =snd_pcm_lib_malloc_pages (substream, -params_buffer_bytes (hw_params))) <0 ) { -printk (KERN_ERR "malloc_pages failed with %d\n" , ret); -return ret; - } -/* hw_params can get called multiple times. Only map the DMA once. */ if (info->dvma_buffer ==0 ) {
@@ -2151,7 +2145,7 @@ static int snd_dbri_hw_free(struct snd_pcm_substream *substream) info->pipe =-1 ; } -return snd_pcm_lib_free_pages (substream); +return 0 ; }static int snd_dbri_prepare (struct snd_pcm_substream *substream)
@@ -2248,9 +2242,8 @@ static int snd_dbri_pcm(struct snd_card *card) pcm->info_flags =0 ;strcpy (pcm->name, card->shortname); -snd_pcm_lib_preallocate_pages_for_all (pcm,SNDRV_DMA_TYPE_CONTINUOUS , -NULL , -64 *1024 ,64 *1024 ); +snd_pcm_set_managed_buffer_all (pcm,SNDRV_DMA_TYPE_CONTINUOUS , +NULL ,64 *1024 ,64 *1024 );return 0 ; }
Signature · 6 lines
2.16.4 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
PATCH 63/71 ALSA: spi: Use managed buffer allocation
In reply to Takashi IwaiClean up the driver with the new managed buffer allocation API. The hw_free callback became superfluous and got dropped.
--- sound/spi/at73c213.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-)
sound/spi/at73c213.c +2 -9
@@ -242,13 +242,7 @@ static int snd_at73c213_pcm_hw_params(struct snd_pcm_substream *substream, val =SSC_BFINS (TFMR_DATNB , channels -1 , val);ssc_writel (chip->ssc->regs,TFMR , val); -return snd_pcm_lib_malloc_pages (substream, -params_buffer_bytes (hw_params)); -} - -static int snd_at73c213_pcm_hw_free (struct snd_pcm_substream *substream) -{ -return snd_pcm_lib_free_pages (substream); +return 0 ; }static int snd_at73c213_pcm_prepare (struct snd_pcm_substream *substream)
@@ -324,7 +318,6 @@ static const struct snd_pcm_ops at73c213_playback_ops = { .close = snd_at73c213_pcm_close, .ioctl = snd_pcm_lib_ioctl, .hw_params = snd_at73c213_pcm_hw_params, - .hw_free = snd_at73c213_pcm_hw_free, .prepare = snd_at73c213_pcm_prepare, .trigger = snd_at73c213_pcm_trigger, .pointer = snd_at73c213_pcm_pointer,
@@ -347,7 +340,7 @@ static int snd_at73c213_pcm_new(struct snd_at73c213 *chip, int device)snd_pcm_set_ops (pcm,SNDRV_PCM_STREAM_PLAYBACK , &at73c213_playback_ops); -snd_pcm_lib_preallocate_pages_for_all (chip->pcm, +snd_pcm_set_managed_buffer_all (chip->pcm,SNDRV_DMA_TYPE_DEV , &chip->ssc->pdev->dev,64 *1024 ,64 *1024 ); out:
Signature · 6 lines
2.16.4 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
PATCH 64/71 ALSA: 6fire: Use managed buffer allocation
In reply to Takashi IwaiClean up the driver with the new managed buffer allocation API. The hw_params and hw_free callbacks became superfluous and got dropped.
--- sound/usb/6fire/pcm.c | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-)
sound/usb/6fire/pcm.c +1 -16
@@ -446,18 +446,6 @@ static int usb6fire_pcm_close(struct snd_pcm_substream *alsa_sub)return 0 ; } -static int usb6fire_pcm_hw_params (struct snd_pcm_substream *alsa_sub, -struct snd_pcm_hw_params *hw_params) -{ -return snd_pcm_lib_malloc_pages (alsa_sub, -params_buffer_bytes (hw_params)); -} - -static int usb6fire_pcm_hw_free (struct snd_pcm_substream *alsa_sub) -{ -return snd_pcm_lib_free_pages (alsa_sub); -} -static int usb6fire_pcm_prepare (struct snd_pcm_substream *alsa_sub) {struct pcm_runtime *rt =snd_pcm_substream_chip (alsa_sub);
@@ -555,8 +543,6 @@ static const struct snd_pcm_ops pcm_ops = { .open = usb6fire_pcm_open, .close = usb6fire_pcm_close, .ioctl = snd_pcm_lib_ioctl, - .hw_params = usb6fire_pcm_hw_params, - .hw_free = usb6fire_pcm_hw_free, .prepare = usb6fire_pcm_prepare, .trigger = usb6fire_pcm_trigger, .pointer = usb6fire_pcm_pointer,
@@ -658,8 +644,7 @@ int usb6fire_pcm_init(struct sfire_chip *chip)strcpy (pcm->name,"DMX 6Fire USB" );snd_pcm_set_ops (pcm,SNDRV_PCM_STREAM_PLAYBACK , &pcm_ops);snd_pcm_set_ops (pcm,SNDRV_PCM_STREAM_CAPTURE , &pcm_ops); -snd_pcm_lib_preallocate_pages_for_all (pcm,SNDRV_DMA_TYPE_VMALLOC , -NULL ,0 ,0 ); +snd_pcm_set_managed_buffer_all (pcm,SNDRV_DMA_TYPE_VMALLOC ,NULL ,0 ,0 ); rt->instance = pcm;
Signature · 6 lines
2.16.4 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
PATCH 65/71 ALSA: caiaq: Use managed buffer allocation
In reply to Takashi IwaiClean up the driver with the new managed buffer allocation API. The hw_params callback became superfluous and dropped. The hw_free callback still remains because of the substream deactivation sync call.
--- sound/usb/caiaq/audio.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-)
sound/usb/caiaq/audio.c +3 -10
@@ -167,17 +167,11 @@ static int snd_usb_caiaq_substream_close(struct snd_pcm_substream *substream)return 0 ; } -static int snd_usb_caiaq_pcm_hw_params (struct snd_pcm_substream *sub, -struct snd_pcm_hw_params *hw_params) -{ -return snd_pcm_lib_malloc_pages (sub,params_buffer_bytes (hw_params)); -} -static int snd_usb_caiaq_pcm_hw_free (struct snd_pcm_substream *sub) {struct snd_usb_caiaqdev *cdev =snd_pcm_substream_chip (sub);deactivate_substream (cdev, sub); -return snd_pcm_lib_free_pages (sub); +return 0 ; }/* this should probably go upstream */
@@ -328,7 +322,6 @@ static const struct snd_pcm_ops snd_usb_caiaq_ops = { .open = snd_usb_caiaq_substream_open, .close = snd_usb_caiaq_substream_close, .ioctl = snd_pcm_lib_ioctl, - .hw_params = snd_usb_caiaq_pcm_hw_params, .hw_free = snd_usb_caiaq_pcm_hw_free, .prepare = snd_usb_caiaq_pcm_prepare, .trigger = snd_usb_caiaq_pcm_trigger,
@@ -841,8 +834,8 @@ int snd_usb_caiaq_audio_init(struct snd_usb_caiaqdev *cdev) &snd_usb_caiaq_ops);snd_pcm_set_ops (cdev->pcm,SNDRV_PCM_STREAM_CAPTURE , &snd_usb_caiaq_ops); -snd_pcm_lib_preallocate_pages_for_all (cdev->pcm,SNDRV_DMA_TYPE_VMALLOC , -NULL ,0 ,0 ); +snd_pcm_set_managed_buffer_all (cdev->pcm,SNDRV_DMA_TYPE_VMALLOC , +NULL ,0 ,0 ); cdev->data_cb_info = kmalloc_array(N_URBS, sizeof(struct snd_usb_caiaq_cb_info),
Signature · 6 lines
2.16.4 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
PATCH 66/71 ALSA: hiface: Use managed buffer allocation
In reply to Takashi IwaiClean up the driver with the new managed buffer allocation API. The hw_params and hw_free callbacks became superfluous and got dropped.
--- sound/usb/hiface/pcm.c | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-)
sound/usb/hiface/pcm.c +2 -16
@@ -415,18 +415,6 @@ static int hiface_pcm_close(struct snd_pcm_substream *alsa_sub)return 0 ; } -static int hiface_pcm_hw_params (struct snd_pcm_substream *alsa_sub, -struct snd_pcm_hw_params *hw_params) -{ -return snd_pcm_lib_malloc_pages (alsa_sub, -params_buffer_bytes (hw_params)); -} - -static int hiface_pcm_hw_free (struct snd_pcm_substream *alsa_sub) -{ -return snd_pcm_lib_free_pages (alsa_sub); -} -static int hiface_pcm_prepare (struct snd_pcm_substream *alsa_sub) {struct pcm_runtime *rt =snd_pcm_substream_chip (alsa_sub);
@@ -513,8 +501,6 @@ static const struct snd_pcm_ops pcm_ops = { .open = hiface_pcm_open, .close = hiface_pcm_close, .ioctl = snd_pcm_lib_ioctl, - .hw_params = hiface_pcm_hw_params, - .hw_free = hiface_pcm_hw_free, .prepare = hiface_pcm_prepare, .trigger = hiface_pcm_trigger, .pointer = hiface_pcm_pointer,
@@ -613,8 +599,8 @@ int hiface_pcm_init(struct hiface_chip *chip, u8 extra_freq)strlcpy (pcm->name,"USB-SPDIF Audio" ,sizeof (pcm->name));snd_pcm_set_ops (pcm,SNDRV_PCM_STREAM_PLAYBACK , &pcm_ops); -snd_pcm_lib_preallocate_pages_for_all (pcm,SNDRV_DMA_TYPE_VMALLOC , -NULL ,0 ,0 ); +snd_pcm_set_managed_buffer_all (pcm,SNDRV_DMA_TYPE_VMALLOC , +NULL ,0 ,0 ); rt->instance = pcm;
Signature · 6 lines
2.16.4 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
PATCH 67/71 ALSA: line6: Use managed buffer allocation
In reply to Takashi IwaiClean up the drivers with the new managed buffer allocation API. The superfluous snd_pcm_lib_malloc_pages() and snd_pcm_lib_free_pages() calls are dropped.
--- sound/usb/line6/pcm.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-)
sound/usb/line6/pcm.c +3 -10
@@ -359,13 +359,6 @@ int snd_line6_hw_params(struct snd_pcm_substream *substream,if (ret <0 ) goto error; - ret =snd_pcm_lib_malloc_pages (substream, -params_buffer_bytes (hw_params)); -if (ret <0 ) { -line6_buffer_release (line6pcm, pstr,LINE6_STREAM_PCM ); - goto error; - } - pstr->period =params_period_bytes (hw_params); error:mutex_unlock (&line6pcm->state_mutex);
@@ -381,7 +374,7 @@ int snd_line6_hw_free(struct snd_pcm_substream *substream)mutex_lock (&line6pcm->state_mutex);line6_buffer_release (line6pcm, pstr,LINE6_STREAM_PCM );mutex_unlock (&line6pcm->state_mutex); -return snd_pcm_lib_free_pages (substream); +return 0 ; }
@@ -501,8 +494,8 @@ static int snd_line6_new_pcm(struct usb_line6 *line6, struct snd_pcm **pcm_ret)snd_pcm_set_ops (pcm,SNDRV_PCM_STREAM_CAPTURE , &snd_line6_capture_ops);/* pre-allocation of buffers */ -snd_pcm_lib_preallocate_pages_for_all (pcm,SNDRV_DMA_TYPE_CONTINUOUS , -NULL ,64 *1024 ,128 *1024 ); +snd_pcm_set_managed_buffer_all (pcm,SNDRV_DMA_TYPE_CONTINUOUS , +NULL ,64 *1024 ,128 *1024 );return 0 ; }
Signature · 6 lines
2.16.4 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
PATCH 68/71 ALSA: ua101: Use managed buffer allocation
In reply to Takashi IwaiClean up the driver with the new managed buffer allocation API. The hw_free callback became superfluous and got dropped.
--- sound/usb/misc/ua101.c | 23 ++++------------------- 1 file changed, 4 insertions(+), 19 deletions(-)
sound/usb/misc/ua101.c +4 -19
@@ -730,11 +730,7 @@ static int capture_pcm_hw_params(struct snd_pcm_substream *substream,mutex_lock (&ua->mutex); err =start_usb_capture (ua);mutex_unlock (&ua->mutex); -if (err <0 ) -return err; - -return snd_pcm_lib_malloc_pages (substream, -params_buffer_bytes (hw_params)); +return err; } static int playback_pcm_hw_params(struct snd_pcm_substream *substream,
@@ -748,16 +744,7 @@ static int playback_pcm_hw_params(struct snd_pcm_substream *substream,if (err >=0 ) err =start_usb_playback (ua);mutex_unlock (&ua->mutex); -if (err <0 ) -return err; - -return snd_pcm_lib_malloc_pages (substream, -params_buffer_bytes (hw_params)); -} - -static int ua101_pcm_hw_free (struct snd_pcm_substream *substream) -{ -return snd_pcm_lib_free_pages (substream); +return err; }static int capture_pcm_prepare (struct snd_pcm_substream *substream)
@@ -885,7 +872,6 @@ static const struct snd_pcm_ops capture_pcm_ops = { .close = capture_pcm_close, .ioctl = snd_pcm_lib_ioctl, .hw_params = capture_pcm_hw_params, - .hw_free = ua101_pcm_hw_free, .prepare = capture_pcm_prepare, .trigger = capture_pcm_trigger, .pointer = capture_pcm_pointer,
@@ -896,7 +882,6 @@ static const struct snd_pcm_ops playback_pcm_ops = { .close = playback_pcm_close, .ioctl = snd_pcm_lib_ioctl, .hw_params = playback_pcm_hw_params, - .hw_free = ua101_pcm_hw_free, .prepare = playback_pcm_prepare, .trigger = playback_pcm_trigger, .pointer = playback_pcm_pointer,
@@ -1294,8 +1279,8 @@ static int ua101_probe(struct usb_interface *interface,strcpy (ua->pcm->name, name);snd_pcm_set_ops (ua->pcm,SNDRV_PCM_STREAM_PLAYBACK , &playback_pcm_ops);snd_pcm_set_ops (ua->pcm,SNDRV_PCM_STREAM_CAPTURE , &capture_pcm_ops); -snd_pcm_lib_preallocate_pages_for_all (ua->pcm,SNDRV_DMA_TYPE_VMALLOC , -NULL ,0 ,0 ); +snd_pcm_set_managed_buffer_all (ua->pcm,SNDRV_DMA_TYPE_VMALLOC , +NULL ,0 ,0 ); err =snd_usbmidi_create (card, ua->intf[INTF_MIDI ], &ua->midi_list, &midi_quirk);
Signature · 6 lines
2.16.4 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
PATCH 69/71 ALSA: usx2y: Use managed buffer allocation
In reply to Takashi IwaiClean up the driver with the new managed buffer allocation API. The superfluous snd_pcm_lib_malloc_pages() and snd_pcm_lib_free_pages() calls are dropped.
--- sound/usb/usx2y/usbusx2yaudio.c | 26 +++++++++----------------- sound/usb/usx2y/usx2yhwdeppcm.c | 18 +++++++++--------- 2 files changed, 18 insertions(+), 26 deletions(-)
sound/usb/usx2y/usbusx2yaudio.c +9 -17
@@ -764,14 +764,6 @@ static int snd_usX2Y_pcm_hw_params(struct snd_pcm_substream *substream, } } - err =snd_pcm_lib_malloc_pages (substream, -params_buffer_bytes (hw_params)); -if (err <0 ) { -snd_printk (KERN_ERR "snd_pcm_lib_malloc_pages(%p, %i) returned %i\n" , - substream,params_buffer_bytes (hw_params), err); - goto error; - } - error:mutex_unlock (&usX2Y (card)->pcm_mutex);return err;
@@ -806,7 +798,7 @@ static int snd_usX2Y_pcm_hw_free(struct snd_pcm_substream *substream) } }mutex_unlock (&subs->usX2Y->pcm_mutex); -return snd_pcm_lib_free_pages (substream); +return 0 ; }/* * prepare callback
@@ -968,16 +960,16 @@ static int usX2Y_audio_stream_new(struct snd_card *card, int playback_endpoint,sprintf (pcm->name,NAME_ALLCAPS " Audio #%d" ,usX2Y (card)->pcm_devs);if (playback_endpoint) { -snd_pcm_lib_preallocate_pages (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK ].substream, -SNDRV_DMA_TYPE_CONTINUOUS , -NULL , -64 *1024 ,128 *1024 ); +snd_pcm_set_managed_buffer (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK ].substream, +SNDRV_DMA_TYPE_CONTINUOUS , +NULL , +64 *1024 ,128 *1024 ); } -snd_pcm_lib_preallocate_pages (pcm->streams[SNDRV_PCM_STREAM_CAPTURE ].substream, -SNDRV_DMA_TYPE_CONTINUOUS , -NULL , -64 *1024 ,128 *1024 ); +snd_pcm_set_managed_buffer (pcm->streams[SNDRV_PCM_STREAM_CAPTURE ].substream, +SNDRV_DMA_TYPE_CONTINUOUS , +NULL , +64 *1024 ,128 *1024 );usX2Y (card)->pcm_devs++;return 0 ;
sound/usb/usx2y/usx2yhwdeppcm.c +9 -9
@@ -376,7 +376,7 @@ static int snd_usX2Y_usbpcm_hw_free(struct snd_pcm_substream *substream) } }mutex_unlock (&subs->usX2Y->pcm_mutex); -return snd_pcm_lib_free_pages (substream); +return 0 ; }static void usX2Y_usbpcm_subs_startup (struct snd_usX2Y_substream *subs)
@@ -726,14 +726,14 @@ int usX2Y_hwdep_pcm_new(struct snd_card *card) pcm->info_flags =0 ;sprintf (pcm->name,NAME_ALLCAPS " hwdep Audio" ); -snd_pcm_lib_preallocate_pages (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK ].substream, -SNDRV_DMA_TYPE_CONTINUOUS , -NULL , -64 *1024 ,128 *1024 ); -snd_pcm_lib_preallocate_pages (pcm->streams[SNDRV_PCM_STREAM_CAPTURE ].substream, -SNDRV_DMA_TYPE_CONTINUOUS , -NULL , -64 *1024 ,128 *1024 ); +snd_pcm_set_managed_buffer (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK ].substream, +SNDRV_DMA_TYPE_CONTINUOUS , +NULL , +64 *1024 ,128 *1024 ); +snd_pcm_set_managed_buffer (pcm->streams[SNDRV_PCM_STREAM_CAPTURE ].substream, +SNDRV_DMA_TYPE_CONTINUOUS , +NULL , +64 *1024 ,128 *1024 );return 0 ; }
Signature · 6 lines
2.16.4 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
PATCH 70/71 ALSA: usb-audio: Use managed buffer allocation
In reply to Takashi IwaiClean up the driver with the new managed buffer allocation API. The superfluous snd_pcm_lib_malloc_pages() and snd_pcm_lib_free_pages() calls are dropped.
--- sound/usb/pcm.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-)
sound/usb/pcm.c +5 -10
@@ -785,11 +785,6 @@ static int snd_usb_hw_params(struct snd_pcm_substream *substream,if (ret)return ret; - ret =snd_pcm_lib_malloc_pages (substream, -params_buffer_bytes (hw_params)); -if (ret <0 ) - goto stop_pipeline; - subs->pcm_format =params_format (hw_params); subs->period_bytes =params_period_bytes (hw_params); subs->period_frames =params_period_size (hw_params);
@@ -853,7 +848,7 @@ static int snd_usb_hw_free(struct snd_pcm_substream *substream)snd_usb_unlock_shutdown (subs->stream->chip); } -return snd_pcm_lib_free_pages (substream); +return 0 ; }/*
@@ -1803,9 +1798,9 @@ void snd_usb_preallocate_buffer(struct snd_usb_substream *subs)struct device *dev = subs->dev->bus->controller;if (snd_usb_use_vmalloc) -snd_pcm_lib_preallocate_pages (s,SNDRV_DMA_TYPE_VMALLOC , -NULL ,0 ,0 ); +snd_pcm_set_managed_buffer (s,SNDRV_DMA_TYPE_VMALLOC , +NULL ,0 ,0 );else -snd_pcm_lib_preallocate_pages (s,SNDRV_DMA_TYPE_DEV_SG , - dev,64 *1024 ,512 *1024 ); +snd_pcm_set_managed_buffer (s,SNDRV_DMA_TYPE_DEV_SG , + dev,64 *1024 ,512 *1024 ); }
Signature · 6 lines
2.16.4 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
PATCH 71/71 ALSA: hdml-lpe-audio: Use managed buffer allocation
In reply to Takashi IwaiClean up the driver with the new managed buffer allocation API. The superfluous snd_pcm_lib_malloc_pages() and snd_pcm_lib_free_pages() calls are dropped.
--- sound/x86/intel_hdmi_audio.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-)
sound/x86/intel_hdmi_audio.c +6 -10
@@ -1132,16 +1132,13 @@ static int had_pcm_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *hw_params) {struct snd_intelhad *intelhaddata; -int buf_size, retval; +int buf_size; intelhaddata =snd_pcm_substream_chip (substream); buf_size =params_buffer_bytes (hw_params); - retval =snd_pcm_lib_malloc_pages (substream, buf_size); -if (retval <0 ) -return retval;dev_dbg (intelhaddata->dev,"%s:allocated memory = %d\n" , __func__, buf_size); -return retval; +return 0 ; }/*
@@ -1154,7 +1151,7 @@ static int had_pcm_hw_free(struct snd_pcm_substream *substream) intelhaddata =snd_pcm_substream_chip (substream);had_do_reset (intelhaddata); -return snd_pcm_lib_free_pages (substream); +return 0 ; }/*
@@ -1801,10 +1798,9 @@ static int hdmi_lpe_audio_probe(struct platform_device *pdev)/* allocate dma pages; * try to allocate 600k buffer as default which is large enough */ -snd_pcm_lib_preallocate_pages_for_all (pcm, -SNDRV_DMA_TYPE_DEV_UC , - card->dev, -HAD_DEFAULT_BUFFER ,HAD_MAX_BUFFER ); +snd_pcm_set_managed_buffer_all (pcm,SNDRV_DMA_TYPE_DEV_UC , + card->dev,HAD_DEFAULT_BUFFER , +HAD_MAX_BUFFER );/* create controls */ for (i =0 ; i <ARRAY_SIZE (had_controls); i++) {
Signature · 6 lines
2.16.4 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel