mirror of https://gitee.com/openkylin/linux.git
ALSA: hda: Remove substream allocation/free ops
Since we dropped the memory page fiddling in the own allocators in hda_intel.c, the substream allocation and free ops in both hda_intel.c and hda_tegra.c became nothing but the simple calls of the standard snd_pcm_lib helpers. As both are identical, there is no longer need for indirect calls via ops; it's a good opportunity for removing ops and simplifying the codes. Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
parent
fc47814369
commit
193c7e1476
|
@ -130,8 +130,9 @@ 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 = chip->ops->substream_alloc_pages(chip, substream,
|
||||
params_buffer_bytes(hw_params));
|
||||
ret = snd_pcm_lib_malloc_pages(substream,
|
||||
params_buffer_bytes(hw_params));
|
||||
|
||||
unlock:
|
||||
dsp_unlock(azx_dev);
|
||||
return ret;
|
||||
|
@ -141,7 +142,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 azx *chip = apcm->chip;
|
||||
struct hda_pcm_stream *hinfo = to_hda_pcm_stream(substream);
|
||||
int err;
|
||||
|
||||
|
@ -152,7 +152,7 @@ static int azx_pcm_hw_free(struct snd_pcm_substream *substream)
|
|||
|
||||
snd_hda_codec_cleanup(apcm->codec, hinfo, substream);
|
||||
|
||||
err = chip->ops->substream_free_pages(chip, substream);
|
||||
err = snd_pcm_lib_free_pages(substream);
|
||||
azx_stream(azx_dev)->prepared = 0;
|
||||
dsp_unlock(azx_dev);
|
||||
return err;
|
||||
|
|
|
@ -87,11 +87,6 @@ struct azx;
|
|||
struct hda_controller_ops {
|
||||
/* Disable msi if supported, PCI only */
|
||||
int (*disable_msi_reset_irq)(struct azx *);
|
||||
int (*substream_alloc_pages)(struct azx *chip,
|
||||
struct snd_pcm_substream *substream,
|
||||
size_t size);
|
||||
int (*substream_free_pages)(struct azx *chip,
|
||||
struct snd_pcm_substream *substream);
|
||||
void (*pcm_mmap_prepare)(struct snd_pcm_substream *substream,
|
||||
struct vm_area_struct *area);
|
||||
/* Check if current position is acceptable */
|
||||
|
|
|
@ -2010,19 +2010,6 @@ static void dma_free_pages(struct hdac_bus *bus, struct snd_dma_buffer *buf)
|
|||
snd_dma_free_pages(buf);
|
||||
}
|
||||
|
||||
static int substream_alloc_pages(struct azx *chip,
|
||||
struct snd_pcm_substream *substream,
|
||||
size_t size)
|
||||
{
|
||||
return snd_pcm_lib_malloc_pages(substream, size);
|
||||
}
|
||||
|
||||
static int substream_free_pages(struct azx *chip,
|
||||
struct snd_pcm_substream *substream)
|
||||
{
|
||||
return snd_pcm_lib_free_pages(substream);
|
||||
}
|
||||
|
||||
static void pcm_mmap_prepare(struct snd_pcm_substream *substream,
|
||||
struct vm_area_struct *area)
|
||||
{
|
||||
|
@ -2047,8 +2034,6 @@ static const struct hdac_io_ops pci_hda_io_ops = {
|
|||
|
||||
static const struct hda_controller_ops pci_hda_ops = {
|
||||
.disable_msi_reset_irq = disable_msi_reset_irq,
|
||||
.substream_alloc_pages = substream_alloc_pages,
|
||||
.substream_free_pages = substream_free_pages,
|
||||
.pcm_mmap_prepare = pcm_mmap_prepare,
|
||||
.position_check = azx_position_check,
|
||||
.link_power = azx_intel_link_power,
|
||||
|
|
|
@ -99,19 +99,6 @@ static void dma_free_pages(struct hdac_bus *bus, struct snd_dma_buffer *buf)
|
|||
snd_dma_free_pages(buf);
|
||||
}
|
||||
|
||||
static int substream_alloc_pages(struct azx *chip,
|
||||
struct snd_pcm_substream *substream,
|
||||
size_t size)
|
||||
{
|
||||
return snd_pcm_lib_malloc_pages(substream, size);
|
||||
}
|
||||
|
||||
static int substream_free_pages(struct azx *chip,
|
||||
struct snd_pcm_substream *substream)
|
||||
{
|
||||
return snd_pcm_lib_free_pages(substream);
|
||||
}
|
||||
|
||||
/*
|
||||
* Register access ops. Tegra HDA register access is DWORD only.
|
||||
*/
|
||||
|
@ -180,10 +167,7 @@ static const struct hdac_io_ops hda_tegra_io_ops = {
|
|||
.dma_free_pages = dma_free_pages,
|
||||
};
|
||||
|
||||
static const struct hda_controller_ops hda_tegra_ops = {
|
||||
.substream_alloc_pages = substream_alloc_pages,
|
||||
.substream_free_pages = substream_free_pages,
|
||||
};
|
||||
static const struct hda_controller_ops hda_tegra_ops; /* nothing special */
|
||||
|
||||
static void hda_tegra_init(struct hda_tegra *hda)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue