1
0
Files
Greg Kroah-Hartman 7f4810a2b3 Merge 4.9.332 into android-4.9-q
Changes in 4.9.332
	ocfs2: clear dinode links count in case of error
	ocfs2: fix BUG when iput after ocfs2_mknod fails
	ata: ahci-imx: Fix MODULE_ALIAS
	ata: ahci: Match EM_MAX_SLOTS with SATA_PMP_MAX_PORTS
	arm64: errata: Remove AES hwcap for COMPAT tasks
	HID: magicmouse: Do not set BTN_MOUSE on double report
	net/atm: fix proc_mpc_write incorrect return value
	net: hns: fix possible memory leak in hnae_ae_register()
	ACPI: video: Force backlight native for more TongFang devices
	ALSA: Use del_timer_sync() before freeing timer
	ALSA: au88x0: use explicitly signed char
	USB: add RESET_RESUME quirk for NVIDIA Jetson devices in RCM
	usb: bdc: change state when port disconnected
	xhci: Remove device endpoints from bandwidth list when freeing the device
	tools: iio: iio_utils: fix digit calculation
	fbdev: smscufx: Fix several use-after-free bugs
	mac802154: Fix LQI recording
	drm/msm/hdmi: fix memory corruption with too many bridges
	mmc: core: Fix kernel panic when remove non-standard SDIO card
	kernfs: fix use-after-free in __kernfs_remove
	s390/futex: add missing EX_TABLE entry to __futex_atomic_op()
	Xen/gntdev: don't ignore kernel unmapping error
	xen/gntdev: Prevent leaking grants
	mm,hugetlb: take hugetlb_lock before decrementing h->resv_huge_pages
	net: ieee802154: fix error return code in dgram_bind()
	drm/msm: Fix return type of mdp4_lvds_connector_mode_valid
	arc: iounmap() arg is volatile
	ALSA: ac97: fix possible memory leak in snd_ac97_dev_register()
	kcm: annotate data-races around kcm->rx_psock
	kcm: annotate data-races around kcm->rx_wait
	net: lantiq_etop: don't free skb when returning NETDEV_TX_BUSY
	tcp: fix indefinite deferral of RTO with SACK reneging
	can: mscan: mpc5xxx: mpc5xxx_can_probe(): add missing put_clock() in error path
	media: vivid: s_fbuf: add more sanity checks
	media: vivid: dev->bitmap_cap wasn't freed in all cases
	media: v4l2-dv-timings: add sanity checks for blanking values
	media: videodev2.h: V4L2_DV_BT_BLANKING_HEIGHT should check 'interlaced'
	i40e: Fix ethtool rx-flow-hash setting for X722
	net: ksz884x: fix missing pci_disable_device() on error in pcidev_init()
	ALSA: aoa: i2sbus: fix possible memory leak in i2sbus_add_dev()
	ALSA: aoa: Fix I2S device accounting
	openvswitch: switch from WARN to pr_warn
	net: ehea: fix possible memory leak in ehea_register_port()
	can: rcar_canfd: rcar_canfd_handle_global_receive(): fix IRQ storm on global FIFO receive
	Linux 4.9.332

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I34f534c6b1ba325afd8991a2731dab1bac206c0c
2022-11-08 20:22:06 +03:00

178 lines
4.0 KiB
C

/*
* Copyright (C) 2000 Takashi Iwai <tiwai@suse.de>
*
* Routines for control of EMU WaveTable chip
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <linux/wait.h>
#include <linux/slab.h>
#include <linux/string.h>
#include <sound/core.h>
#include <sound/emux_synth.h>
#include <linux/init.h>
#include <linux/module.h>
#include "emux_voice.h"
MODULE_AUTHOR("Takashi Iwai");
MODULE_DESCRIPTION("Routines for control of EMU WaveTable chip");
MODULE_LICENSE("GPL");
/*
* create a new hardware dependent device for Emu8000/Emu10k1
*/
int snd_emux_new(struct snd_emux **remu)
{
struct snd_emux *emu;
*remu = NULL;
emu = kzalloc(sizeof(*emu), GFP_KERNEL);
if (emu == NULL)
return -ENOMEM;
spin_lock_init(&emu->voice_lock);
mutex_init(&emu->register_mutex);
emu->client = -1;
#ifdef CONFIG_SND_SEQUENCER_OSS
emu->oss_synth = NULL;
#endif
emu->max_voices = 0;
emu->use_time = 0;
setup_timer(&emu->tlist, snd_emux_timer_callback, (unsigned long)emu);
emu->timer_active = 0;
*remu = emu;
return 0;
}
EXPORT_SYMBOL(snd_emux_new);
/*
*/
static int sf_sample_new(void *private_data, struct snd_sf_sample *sp,
struct snd_util_memhdr *hdr,
const void __user *buf, long count)
{
struct snd_emux *emu = private_data;
return emu->ops.sample_new(emu, sp, hdr, buf, count);
}
static int sf_sample_free(void *private_data, struct snd_sf_sample *sp,
struct snd_util_memhdr *hdr)
{
struct snd_emux *emu = private_data;
return emu->ops.sample_free(emu, sp, hdr);
}
static void sf_sample_reset(void *private_data)
{
struct snd_emux *emu = private_data;
emu->ops.sample_reset(emu);
}
int snd_emux_register(struct snd_emux *emu, struct snd_card *card, int index, char *name)
{
int err;
struct snd_sf_callback sf_cb;
if (snd_BUG_ON(!emu->hw || emu->max_voices <= 0))
return -EINVAL;
if (snd_BUG_ON(!card || !name))
return -EINVAL;
emu->card = card;
emu->name = kstrdup(name, GFP_KERNEL);
emu->voices = kcalloc(emu->max_voices, sizeof(struct snd_emux_voice),
GFP_KERNEL);
if (emu->name == NULL || emu->voices == NULL)
return -ENOMEM;
/* create soundfont list */
memset(&sf_cb, 0, sizeof(sf_cb));
sf_cb.private_data = emu;
if (emu->ops.sample_new)
sf_cb.sample_new = sf_sample_new;
if (emu->ops.sample_free)
sf_cb.sample_free = sf_sample_free;
if (emu->ops.sample_reset)
sf_cb.sample_reset = sf_sample_reset;
emu->sflist = snd_sf_new(&sf_cb, emu->memhdr);
if (emu->sflist == NULL)
return -ENOMEM;
if ((err = snd_emux_init_hwdep(emu)) < 0)
return err;
snd_emux_init_voices(emu);
snd_emux_init_seq(emu, card, index);
#ifdef CONFIG_SND_SEQUENCER_OSS
snd_emux_init_seq_oss(emu);
#endif
snd_emux_init_virmidi(emu, card);
snd_emux_proc_init(emu, card, index);
return 0;
}
EXPORT_SYMBOL(snd_emux_register);
/*
*/
int snd_emux_free(struct snd_emux *emu)
{
if (! emu)
return -EINVAL;
del_timer_sync(&emu->tlist);
snd_emux_proc_free(emu);
snd_emux_delete_virmidi(emu);
#ifdef CONFIG_SND_SEQUENCER_OSS
snd_emux_detach_seq_oss(emu);
#endif
snd_emux_detach_seq(emu);
snd_emux_delete_hwdep(emu);
snd_sf_free(emu->sflist);
kfree(emu->voices);
kfree(emu->name);
kfree(emu);
return 0;
}
EXPORT_SYMBOL(snd_emux_free);
/*
* INIT part
*/
static int __init alsa_emux_init(void)
{
return 0;
}
static void __exit alsa_emux_exit(void)
{
}
module_init(alsa_emux_init)
module_exit(alsa_emux_exit)