Commit c2f43981 authored by Takashi Iwai's avatar Takashi Iwai

Merge branch 'topic/hwdep-cleanup' into for-linus

parents dec14f8c 28b7e343
...@@ -27,18 +27,28 @@ ...@@ -27,18 +27,28 @@
struct snd_hwdep; struct snd_hwdep;
/* hwdep file ops; all ops can be NULL */
struct snd_hwdep_ops { struct snd_hwdep_ops {
long long (*llseek) (struct snd_hwdep *hw, struct file * file, long long offset, int orig); long long (*llseek)(struct snd_hwdep *hw, struct file *file,
long (*read) (struct snd_hwdep *hw, char __user *buf, long count, loff_t *offset); long long offset, int orig);
long (*write) (struct snd_hwdep *hw, const char __user *buf, long count, loff_t *offset); long (*read)(struct snd_hwdep *hw, char __user *buf,
int (*open) (struct snd_hwdep * hw, struct file * file); long count, loff_t *offset);
int (*release) (struct snd_hwdep *hw, struct file * file); long (*write)(struct snd_hwdep *hw, const char __user *buf,
unsigned int (*poll) (struct snd_hwdep *hw, struct file * file, poll_table * wait); long count, loff_t *offset);
int (*ioctl) (struct snd_hwdep *hw, struct file * file, unsigned int cmd, unsigned long arg); int (*open)(struct snd_hwdep *hw, struct file * file);
int (*ioctl_compat) (struct snd_hwdep *hw, struct file * file, unsigned int cmd, unsigned long arg); int (*release)(struct snd_hwdep *hw, struct file * file);
int (*mmap) (struct snd_hwdep *hw, struct file * file, struct vm_area_struct * vma); unsigned int (*poll)(struct snd_hwdep *hw, struct file *file,
int (*dsp_status) (struct snd_hwdep *hw, struct snd_hwdep_dsp_status *status); poll_table *wait);
int (*dsp_load) (struct snd_hwdep *hw, struct snd_hwdep_dsp_image *image); int (*ioctl)(struct snd_hwdep *hw, struct file *file,
unsigned int cmd, unsigned long arg);
int (*ioctl_compat)(struct snd_hwdep *hw, struct file *file,
unsigned int cmd, unsigned long arg);
int (*mmap)(struct snd_hwdep *hw, struct file *file,
struct vm_area_struct *vma);
int (*dsp_status)(struct snd_hwdep *hw,
struct snd_hwdep_dsp_status *status);
int (*dsp_load)(struct snd_hwdep *hw,
struct snd_hwdep_dsp_image *image);
}; };
struct snd_hwdep { struct snd_hwdep {
...@@ -61,9 +71,9 @@ struct snd_hwdep { ...@@ -61,9 +71,9 @@ struct snd_hwdep {
void (*private_free) (struct snd_hwdep *hwdep); void (*private_free) (struct snd_hwdep *hwdep);
struct mutex open_mutex; struct mutex open_mutex;
int used; int used; /* reference counter */
unsigned int dsp_loaded; unsigned int dsp_loaded; /* bit fields of loaded dsp indices */
unsigned int exclusive: 1; unsigned int exclusive:1; /* exclusive access mode */
}; };
extern int snd_hwdep_new(struct snd_card *card, char *id, int device, extern int snd_hwdep_new(struct snd_card *card, char *id, int device,
......
...@@ -99,9 +99,6 @@ static int snd_hwdep_open(struct inode *inode, struct file * file) ...@@ -99,9 +99,6 @@ static int snd_hwdep_open(struct inode *inode, struct file * file)
if (hw == NULL) if (hw == NULL)
return -ENODEV; return -ENODEV;
if (!hw->ops.open)
return -ENXIO;
if (!try_module_get(hw->card->module)) if (!try_module_get(hw->card->module))
return -EFAULT; return -EFAULT;
...@@ -113,6 +110,10 @@ static int snd_hwdep_open(struct inode *inode, struct file * file) ...@@ -113,6 +110,10 @@ static int snd_hwdep_open(struct inode *inode, struct file * file)
err = -EBUSY; err = -EBUSY;
break; break;
} }
if (!hw->ops.open) {
err = 0;
break;
}
err = hw->ops.open(hw, file); err = hw->ops.open(hw, file);
if (err >= 0) if (err >= 0)
break; break;
...@@ -151,7 +152,7 @@ static int snd_hwdep_open(struct inode *inode, struct file * file) ...@@ -151,7 +152,7 @@ static int snd_hwdep_open(struct inode *inode, struct file * file)
static int snd_hwdep_release(struct inode *inode, struct file * file) static int snd_hwdep_release(struct inode *inode, struct file * file)
{ {
int err = -ENXIO; int err = 0;
struct snd_hwdep *hw = file->private_data; struct snd_hwdep *hw = file->private_data;
struct module *mod = hw->card->module; struct module *mod = hw->card->module;
......
...@@ -119,16 +119,6 @@ void snd_vx_free_firmware(struct vx_core *chip) ...@@ -119,16 +119,6 @@ void snd_vx_free_firmware(struct vx_core *chip)
#else /* old style firmware loading */ #else /* old style firmware loading */
static int vx_hwdep_open(struct snd_hwdep *hw, struct file *file)
{
return 0;
}
static int vx_hwdep_release(struct snd_hwdep *hw, struct file *file)
{
return 0;
}
static int vx_hwdep_dsp_status(struct snd_hwdep *hw, static int vx_hwdep_dsp_status(struct snd_hwdep *hw,
struct snd_hwdep_dsp_status *info) struct snd_hwdep_dsp_status *info)
{ {
...@@ -243,8 +233,6 @@ int snd_vx_setup_firmware(struct vx_core *chip) ...@@ -243,8 +233,6 @@ int snd_vx_setup_firmware(struct vx_core *chip)
hw->iface = SNDRV_HWDEP_IFACE_VX; hw->iface = SNDRV_HWDEP_IFACE_VX;
hw->private_data = chip; hw->private_data = chip;
hw->ops.open = vx_hwdep_open;
hw->ops.release = vx_hwdep_release;
hw->ops.dsp_status = vx_hwdep_dsp_status; hw->ops.dsp_status = vx_hwdep_dsp_status;
hw->ops.dsp_load = vx_hwdep_dsp_load; hw->ops.dsp_load = vx_hwdep_dsp_load;
hw->exclusive = 1; hw->exclusive = 1;
......
...@@ -581,16 +581,6 @@ MODULE_FIRMWARE("mixart/miXart8AES.xlx"); ...@@ -581,16 +581,6 @@ MODULE_FIRMWARE("mixart/miXart8AES.xlx");
/* miXart hwdep interface id string */ /* miXart hwdep interface id string */
#define SND_MIXART_HWDEP_ID "miXart Loader" #define SND_MIXART_HWDEP_ID "miXart Loader"
static int mixart_hwdep_open(struct snd_hwdep *hw, struct file *file)
{
return 0;
}
static int mixart_hwdep_release(struct snd_hwdep *hw, struct file *file)
{
return 0;
}
static int mixart_hwdep_dsp_status(struct snd_hwdep *hw, static int mixart_hwdep_dsp_status(struct snd_hwdep *hw,
struct snd_hwdep_dsp_status *info) struct snd_hwdep_dsp_status *info)
{ {
...@@ -643,8 +633,6 @@ int snd_mixart_setup_firmware(struct mixart_mgr *mgr) ...@@ -643,8 +633,6 @@ int snd_mixart_setup_firmware(struct mixart_mgr *mgr)
hw->iface = SNDRV_HWDEP_IFACE_MIXART; hw->iface = SNDRV_HWDEP_IFACE_MIXART;
hw->private_data = mgr; hw->private_data = mgr;
hw->ops.open = mixart_hwdep_open;
hw->ops.release = mixart_hwdep_release;
hw->ops.dsp_status = mixart_hwdep_dsp_status; hw->ops.dsp_status = mixart_hwdep_dsp_status;
hw->ops.dsp_load = mixart_hwdep_dsp_load; hw->ops.dsp_load = mixart_hwdep_dsp_load;
hw->exclusive = 1; hw->exclusive = 1;
......
...@@ -471,16 +471,6 @@ static int pcxhr_hwdep_dsp_load(struct snd_hwdep *hw, ...@@ -471,16 +471,6 @@ static int pcxhr_hwdep_dsp_load(struct snd_hwdep *hw,
return 0; return 0;
} }
static int pcxhr_hwdep_open(struct snd_hwdep *hw, struct file *file)
{
return 0;
}
static int pcxhr_hwdep_release(struct snd_hwdep *hw, struct file *file)
{
return 0;
}
int pcxhr_setup_firmware(struct pcxhr_mgr *mgr) int pcxhr_setup_firmware(struct pcxhr_mgr *mgr)
{ {
int err; int err;
...@@ -495,8 +485,6 @@ int pcxhr_setup_firmware(struct pcxhr_mgr *mgr) ...@@ -495,8 +485,6 @@ int pcxhr_setup_firmware(struct pcxhr_mgr *mgr)
hw->iface = SNDRV_HWDEP_IFACE_PCXHR; hw->iface = SNDRV_HWDEP_IFACE_PCXHR;
hw->private_data = mgr; hw->private_data = mgr;
hw->ops.open = pcxhr_hwdep_open;
hw->ops.release = pcxhr_hwdep_release;
hw->ops.dsp_status = pcxhr_hwdep_dsp_status; hw->ops.dsp_status = pcxhr_hwdep_dsp_status;
hw->ops.dsp_load = pcxhr_hwdep_dsp_load; hw->ops.dsp_load = pcxhr_hwdep_dsp_load;
hw->exclusive = 1; hw->exclusive = 1;
......
...@@ -4413,13 +4413,6 @@ static int snd_hdsp_capture_release(struct snd_pcm_substream *substream) ...@@ -4413,13 +4413,6 @@ static int snd_hdsp_capture_release(struct snd_pcm_substream *substream)
return 0; return 0;
} }
static int snd_hdsp_hwdep_dummy_op(struct snd_hwdep *hw, struct file *file)
{
/* we have nothing to initialize but the call is required */
return 0;
}
/* helper functions for copying meter values */ /* helper functions for copying meter values */
static inline int copy_u32_le(void __user *dest, void __iomem *src) static inline int copy_u32_le(void __user *dest, void __iomem *src)
{ {
...@@ -4738,9 +4731,7 @@ static int snd_hdsp_create_hwdep(struct snd_card *card, struct hdsp *hdsp) ...@@ -4738,9 +4731,7 @@ static int snd_hdsp_create_hwdep(struct snd_card *card, struct hdsp *hdsp)
hw->private_data = hdsp; hw->private_data = hdsp;
strcpy(hw->name, "HDSP hwdep interface"); strcpy(hw->name, "HDSP hwdep interface");
hw->ops.open = snd_hdsp_hwdep_dummy_op;
hw->ops.ioctl = snd_hdsp_hwdep_ioctl; hw->ops.ioctl = snd_hdsp_hwdep_ioctl;
hw->ops.release = snd_hdsp_hwdep_dummy_op;
return 0; return 0;
} }
......
...@@ -4100,13 +4100,6 @@ static int snd_hdspm_capture_release(struct snd_pcm_substream *substream) ...@@ -4100,13 +4100,6 @@ static int snd_hdspm_capture_release(struct snd_pcm_substream *substream)
return 0; return 0;
} }
static int snd_hdspm_hwdep_dummy_op(struct snd_hwdep * hw, struct file *file)
{
/* we have nothing to initialize but the call is required */
return 0;
}
static int snd_hdspm_hwdep_ioctl(struct snd_hwdep * hw, struct file *file, static int snd_hdspm_hwdep_ioctl(struct snd_hwdep * hw, struct file *file,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
...@@ -4213,9 +4206,7 @@ static int __devinit snd_hdspm_create_hwdep(struct snd_card *card, ...@@ -4213,9 +4206,7 @@ static int __devinit snd_hdspm_create_hwdep(struct snd_card *card,
hw->private_data = hdspm; hw->private_data = hdspm;
strcpy(hw->name, "HDSPM hwdep interface"); strcpy(hw->name, "HDSPM hwdep interface");
hw->ops.open = snd_hdspm_hwdep_dummy_op;
hw->ops.ioctl = snd_hdspm_hwdep_ioctl; hw->ops.ioctl = snd_hdspm_hwdep_ioctl;
hw->ops.release = snd_hdspm_hwdep_dummy_op;
return 0; return 0;
} }
......
...@@ -24,25 +24,6 @@ ...@@ -24,25 +24,6 @@
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include "emux_voice.h" #include "emux_voice.h"
/*
* open the hwdep device
*/
static int
snd_emux_hwdep_open(struct snd_hwdep *hw, struct file *file)
{
return 0;
}
/*
* close the device
*/
static int
snd_emux_hwdep_release(struct snd_hwdep *hw, struct file *file)
{
return 0;
}
#define TMP_CLIENT_ID 0x1001 #define TMP_CLIENT_ID 0x1001
...@@ -146,8 +127,6 @@ snd_emux_init_hwdep(struct snd_emux *emu) ...@@ -146,8 +127,6 @@ snd_emux_init_hwdep(struct snd_emux *emu)
emu->hwdep = hw; emu->hwdep = hw;
strcpy(hw->name, SNDRV_EMUX_HWDEP_NAME); strcpy(hw->name, SNDRV_EMUX_HWDEP_NAME);
hw->iface = SNDRV_HWDEP_IFACE_EMUX_WAVETABLE; hw->iface = SNDRV_HWDEP_IFACE_EMUX_WAVETABLE;
hw->ops.open = snd_emux_hwdep_open;
hw->ops.release = snd_emux_hwdep_release;
hw->ops.ioctl = snd_emux_hwdep_ioctl; hw->ops.ioctl = snd_emux_hwdep_ioctl;
hw->exclusive = 1; hw->exclusive = 1;
hw->private_data = emu; hw->private_data = emu;
......
...@@ -78,7 +78,6 @@ struct usb_mixer_interface { ...@@ -78,7 +78,6 @@ struct usb_mixer_interface {
/* Sound Blaster remote control stuff */ /* Sound Blaster remote control stuff */
const struct rc_config *rc_cfg; const struct rc_config *rc_cfg;
unsigned long rc_hwdep_open;
u32 rc_code; u32 rc_code;
wait_queue_head_t rc_waitq; wait_queue_head_t rc_waitq;
struct urb *rc_urb; struct urb *rc_urb;
...@@ -1797,24 +1796,6 @@ static void snd_usb_soundblaster_remote_complete(struct urb *urb) ...@@ -1797,24 +1796,6 @@ static void snd_usb_soundblaster_remote_complete(struct urb *urb)
wake_up(&mixer->rc_waitq); wake_up(&mixer->rc_waitq);
} }
static int snd_usb_sbrc_hwdep_open(struct snd_hwdep *hw, struct file *file)
{
struct usb_mixer_interface *mixer = hw->private_data;
if (test_and_set_bit(0, &mixer->rc_hwdep_open))
return -EBUSY;
return 0;
}
static int snd_usb_sbrc_hwdep_release(struct snd_hwdep *hw, struct file *file)
{
struct usb_mixer_interface *mixer = hw->private_data;
clear_bit(0, &mixer->rc_hwdep_open);
smp_mb__after_clear_bit();
return 0;
}
static long snd_usb_sbrc_hwdep_read(struct snd_hwdep *hw, char __user *buf, static long snd_usb_sbrc_hwdep_read(struct snd_hwdep *hw, char __user *buf,
long count, loff_t *offset) long count, loff_t *offset)
{ {
...@@ -1867,9 +1848,8 @@ static int snd_usb_soundblaster_remote_init(struct usb_mixer_interface *mixer) ...@@ -1867,9 +1848,8 @@ static int snd_usb_soundblaster_remote_init(struct usb_mixer_interface *mixer)
hwdep->iface = SNDRV_HWDEP_IFACE_SB_RC; hwdep->iface = SNDRV_HWDEP_IFACE_SB_RC;
hwdep->private_data = mixer; hwdep->private_data = mixer;
hwdep->ops.read = snd_usb_sbrc_hwdep_read; hwdep->ops.read = snd_usb_sbrc_hwdep_read;
hwdep->ops.open = snd_usb_sbrc_hwdep_open;
hwdep->ops.release = snd_usb_sbrc_hwdep_release;
hwdep->ops.poll = snd_usb_sbrc_hwdep_poll; hwdep->ops.poll = snd_usb_sbrc_hwdep_poll;
hwdep->exclusive = 1;
mixer->rc_urb = usb_alloc_urb(0, GFP_KERNEL); mixer->rc_urb = usb_alloc_urb(0, GFP_KERNEL);
if (!mixer->rc_urb) if (!mixer->rc_urb)
......
...@@ -106,16 +106,6 @@ static unsigned int snd_us428ctls_poll(struct snd_hwdep *hw, struct file *file, ...@@ -106,16 +106,6 @@ static unsigned int snd_us428ctls_poll(struct snd_hwdep *hw, struct file *file,
} }
static int snd_usX2Y_hwdep_open(struct snd_hwdep *hw, struct file *file)
{
return 0;
}
static int snd_usX2Y_hwdep_release(struct snd_hwdep *hw, struct file *file)
{
return 0;
}
static int snd_usX2Y_hwdep_dsp_status(struct snd_hwdep *hw, static int snd_usX2Y_hwdep_dsp_status(struct snd_hwdep *hw,
struct snd_hwdep_dsp_status *info) struct snd_hwdep_dsp_status *info)
{ {
...@@ -267,8 +257,6 @@ int usX2Y_hwdep_new(struct snd_card *card, struct usb_device* device) ...@@ -267,8 +257,6 @@ int usX2Y_hwdep_new(struct snd_card *card, struct usb_device* device)
hw->iface = SNDRV_HWDEP_IFACE_USX2Y; hw->iface = SNDRV_HWDEP_IFACE_USX2Y;
hw->private_data = usX2Y(card); hw->private_data = usX2Y(card);
hw->ops.open = snd_usX2Y_hwdep_open;
hw->ops.release = snd_usX2Y_hwdep_release;
hw->ops.dsp_status = snd_usX2Y_hwdep_dsp_status; hw->ops.dsp_status = snd_usX2Y_hwdep_dsp_status;
hw->ops.dsp_load = snd_usX2Y_hwdep_dsp_load; hw->ops.dsp_load = snd_usX2Y_hwdep_dsp_load;
hw->ops.mmap = snd_us428ctls_mmap; hw->ops.mmap = snd_us428ctls_mmap;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment