aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2009-03-23 19:35:41 -0400
committerTakashi Iwai <tiwai@suse.de>2009-03-23 19:35:41 -0400
commitc2f43981e5dbc92884149aa2234064cc2c340acd (patch)
treebd5273bc7ae92a1ef47fa3f35ec6ef79d28ba270
parentdec14f8c0eff54549e5747f8a4d1dc6c0347e2dd (diff)
parent28b7e343ee63454d563a71d2d5f769fc297fd5ad (diff)
Merge branch 'topic/hwdep-cleanup' into for-linus
-rw-r--r--include/sound/hwdep.h38
-rw-r--r--sound/core/hwdep.c9
-rw-r--r--sound/drivers/vx/vx_hwdep.c12
-rw-r--r--sound/pci/mixart/mixart_hwdep.c12
-rw-r--r--sound/pci/pcxhr/pcxhr_hwdep.c12
-rw-r--r--sound/pci/rme9652/hdsp.c9
-rw-r--r--sound/pci/rme9652/hdspm.c9
-rw-r--r--sound/synth/emux/emux_hwdep.c21
-rw-r--r--sound/usb/usbmixer.c22
-rw-r--r--sound/usb/usx2y/usX2Yhwdep.c12
10 files changed, 30 insertions, 126 deletions
diff --git a/include/sound/hwdep.h b/include/sound/hwdep.h
index d9eea013c753..8c05e47a4090 100644
--- a/include/sound/hwdep.h
+++ b/include/sound/hwdep.h
@@ -27,18 +27,28 @@
27 27
28struct snd_hwdep; 28struct snd_hwdep;
29 29
30/* hwdep file ops; all ops can be NULL */
30struct snd_hwdep_ops { 31struct snd_hwdep_ops {
31 long long (*llseek) (struct snd_hwdep *hw, struct file * file, long long offset, int orig); 32 long long (*llseek)(struct snd_hwdep *hw, struct file *file,
32 long (*read) (struct snd_hwdep *hw, char __user *buf, long count, loff_t *offset); 33 long long offset, int orig);
33 long (*write) (struct snd_hwdep *hw, const char __user *buf, long count, loff_t *offset); 34 long (*read)(struct snd_hwdep *hw, char __user *buf,
34 int (*open) (struct snd_hwdep * hw, struct file * file); 35 long count, loff_t *offset);
35 int (*release) (struct snd_hwdep *hw, struct file * file); 36 long (*write)(struct snd_hwdep *hw, const char __user *buf,
36 unsigned int (*poll) (struct snd_hwdep *hw, struct file * file, poll_table * wait); 37 long count, loff_t *offset);
37 int (*ioctl) (struct snd_hwdep *hw, struct file * file, unsigned int cmd, unsigned long arg); 38 int (*open)(struct snd_hwdep *hw, struct file * file);
38 int (*ioctl_compat) (struct snd_hwdep *hw, struct file * file, unsigned int cmd, unsigned long arg); 39 int (*release)(struct snd_hwdep *hw, struct file * file);
39 int (*mmap) (struct snd_hwdep *hw, struct file * file, struct vm_area_struct * vma); 40 unsigned int (*poll)(struct snd_hwdep *hw, struct file *file,
40 int (*dsp_status) (struct snd_hwdep *hw, struct snd_hwdep_dsp_status *status); 41 poll_table *wait);
41 int (*dsp_load) (struct snd_hwdep *hw, struct snd_hwdep_dsp_image *image); 42 int (*ioctl)(struct snd_hwdep *hw, struct file *file,
43 unsigned int cmd, unsigned long arg);
44 int (*ioctl_compat)(struct snd_hwdep *hw, struct file *file,
45 unsigned int cmd, unsigned long arg);
46 int (*mmap)(struct snd_hwdep *hw, struct file *file,
47 struct vm_area_struct *vma);
48 int (*dsp_status)(struct snd_hwdep *hw,
49 struct snd_hwdep_dsp_status *status);
50 int (*dsp_load)(struct snd_hwdep *hw,
51 struct snd_hwdep_dsp_image *image);
42}; 52};
43 53
44struct snd_hwdep { 54struct snd_hwdep {
@@ -61,9 +71,9 @@ struct snd_hwdep {
61 void (*private_free) (struct snd_hwdep *hwdep); 71 void (*private_free) (struct snd_hwdep *hwdep);
62 72
63 struct mutex open_mutex; 73 struct mutex open_mutex;
64 int used; 74 int used; /* reference counter */
65 unsigned int dsp_loaded; 75 unsigned int dsp_loaded; /* bit fields of loaded dsp indices */
66 unsigned int exclusive: 1; 76 unsigned int exclusive:1; /* exclusive access mode */
67}; 77};
68 78
69extern int snd_hwdep_new(struct snd_card *card, char *id, int device, 79extern int snd_hwdep_new(struct snd_card *card, char *id, int device,
diff --git a/sound/core/hwdep.c b/sound/core/hwdep.c
index 195cafc5a553..a70ee7f1ed98 100644
--- a/sound/core/hwdep.c
+++ b/sound/core/hwdep.c
@@ -99,9 +99,6 @@ static int snd_hwdep_open(struct inode *inode, struct file * file)
99 if (hw == NULL) 99 if (hw == NULL)
100 return -ENODEV; 100 return -ENODEV;
101 101
102 if (!hw->ops.open)
103 return -ENXIO;
104
105 if (!try_module_get(hw->card->module)) 102 if (!try_module_get(hw->card->module))
106 return -EFAULT; 103 return -EFAULT;
107 104
@@ -113,6 +110,10 @@ static int snd_hwdep_open(struct inode *inode, struct file * file)
113 err = -EBUSY; 110 err = -EBUSY;
114 break; 111 break;
115 } 112 }
113 if (!hw->ops.open) {
114 err = 0;
115 break;
116 }
116 err = hw->ops.open(hw, file); 117 err = hw->ops.open(hw, file);
117 if (err >= 0) 118 if (err >= 0)
118 break; 119 break;
@@ -151,7 +152,7 @@ static int snd_hwdep_open(struct inode *inode, struct file * file)
151 152
152static int snd_hwdep_release(struct inode *inode, struct file * file) 153static int snd_hwdep_release(struct inode *inode, struct file * file)
153{ 154{
154 int err = -ENXIO; 155 int err = 0;
155 struct snd_hwdep *hw = file->private_data; 156 struct snd_hwdep *hw = file->private_data;
156 struct module *mod = hw->card->module; 157 struct module *mod = hw->card->module;
157 158
diff --git a/sound/drivers/vx/vx_hwdep.c b/sound/drivers/vx/vx_hwdep.c
index 8d6362e2d4c9..46df8817c18f 100644
--- a/sound/drivers/vx/vx_hwdep.c
+++ b/sound/drivers/vx/vx_hwdep.c
@@ -119,16 +119,6 @@ void snd_vx_free_firmware(struct vx_core *chip)
119 119
120#else /* old style firmware loading */ 120#else /* old style firmware loading */
121 121
122static int vx_hwdep_open(struct snd_hwdep *hw, struct file *file)
123{
124 return 0;
125}
126
127static int vx_hwdep_release(struct snd_hwdep *hw, struct file *file)
128{
129 return 0;
130}
131
132static int vx_hwdep_dsp_status(struct snd_hwdep *hw, 122static int vx_hwdep_dsp_status(struct snd_hwdep *hw,
133 struct snd_hwdep_dsp_status *info) 123 struct snd_hwdep_dsp_status *info)
134{ 124{
@@ -243,8 +233,6 @@ int snd_vx_setup_firmware(struct vx_core *chip)
243 233
244 hw->iface = SNDRV_HWDEP_IFACE_VX; 234 hw->iface = SNDRV_HWDEP_IFACE_VX;
245 hw->private_data = chip; 235 hw->private_data = chip;
246 hw->ops.open = vx_hwdep_open;
247 hw->ops.release = vx_hwdep_release;
248 hw->ops.dsp_status = vx_hwdep_dsp_status; 236 hw->ops.dsp_status = vx_hwdep_dsp_status;
249 hw->ops.dsp_load = vx_hwdep_dsp_load; 237 hw->ops.dsp_load = vx_hwdep_dsp_load;
250 hw->exclusive = 1; 238 hw->exclusive = 1;
diff --git a/sound/pci/mixart/mixart_hwdep.c b/sound/pci/mixart/mixart_hwdep.c
index 3782b52bc0e8..fa4de985fc4c 100644
--- a/sound/pci/mixart/mixart_hwdep.c
+++ b/sound/pci/mixart/mixart_hwdep.c
@@ -581,16 +581,6 @@ MODULE_FIRMWARE("mixart/miXart8AES.xlx");
581/* miXart hwdep interface id string */ 581/* miXart hwdep interface id string */
582#define SND_MIXART_HWDEP_ID "miXart Loader" 582#define SND_MIXART_HWDEP_ID "miXart Loader"
583 583
584static int mixart_hwdep_open(struct snd_hwdep *hw, struct file *file)
585{
586 return 0;
587}
588
589static int mixart_hwdep_release(struct snd_hwdep *hw, struct file *file)
590{
591 return 0;
592}
593
594static int mixart_hwdep_dsp_status(struct snd_hwdep *hw, 584static int mixart_hwdep_dsp_status(struct snd_hwdep *hw,
595 struct snd_hwdep_dsp_status *info) 585 struct snd_hwdep_dsp_status *info)
596{ 586{
@@ -643,8 +633,6 @@ int snd_mixart_setup_firmware(struct mixart_mgr *mgr)
643 633
644 hw->iface = SNDRV_HWDEP_IFACE_MIXART; 634 hw->iface = SNDRV_HWDEP_IFACE_MIXART;
645 hw->private_data = mgr; 635 hw->private_data = mgr;
646 hw->ops.open = mixart_hwdep_open;
647 hw->ops.release = mixart_hwdep_release;
648 hw->ops.dsp_status = mixart_hwdep_dsp_status; 636 hw->ops.dsp_status = mixart_hwdep_dsp_status;
649 hw->ops.dsp_load = mixart_hwdep_dsp_load; 637 hw->ops.dsp_load = mixart_hwdep_dsp_load;
650 hw->exclusive = 1; 638 hw->exclusive = 1;
diff --git a/sound/pci/pcxhr/pcxhr_hwdep.c b/sound/pci/pcxhr/pcxhr_hwdep.c
index 592743a298b0..17cb1233a903 100644
--- a/sound/pci/pcxhr/pcxhr_hwdep.c
+++ b/sound/pci/pcxhr/pcxhr_hwdep.c
@@ -471,16 +471,6 @@ static int pcxhr_hwdep_dsp_load(struct snd_hwdep *hw,
471 return 0; 471 return 0;
472} 472}
473 473
474static int pcxhr_hwdep_open(struct snd_hwdep *hw, struct file *file)
475{
476 return 0;
477}
478
479static int pcxhr_hwdep_release(struct snd_hwdep *hw, struct file *file)
480{
481 return 0;
482}
483
484int pcxhr_setup_firmware(struct pcxhr_mgr *mgr) 474int pcxhr_setup_firmware(struct pcxhr_mgr *mgr)
485{ 475{
486 int err; 476 int err;
@@ -495,8 +485,6 @@ int pcxhr_setup_firmware(struct pcxhr_mgr *mgr)
495 485
496 hw->iface = SNDRV_HWDEP_IFACE_PCXHR; 486 hw->iface = SNDRV_HWDEP_IFACE_PCXHR;
497 hw->private_data = mgr; 487 hw->private_data = mgr;
498 hw->ops.open = pcxhr_hwdep_open;
499 hw->ops.release = pcxhr_hwdep_release;
500 hw->ops.dsp_status = pcxhr_hwdep_dsp_status; 488 hw->ops.dsp_status = pcxhr_hwdep_dsp_status;
501 hw->ops.dsp_load = pcxhr_hwdep_dsp_load; 489 hw->ops.dsp_load = pcxhr_hwdep_dsp_load;
502 hw->exclusive = 1; 490 hw->exclusive = 1;
diff --git a/sound/pci/rme9652/hdsp.c b/sound/pci/rme9652/hdsp.c
index 05b3f795a168..bacfdd12619b 100644
--- a/sound/pci/rme9652/hdsp.c
+++ b/sound/pci/rme9652/hdsp.c
@@ -4413,13 +4413,6 @@ static int snd_hdsp_capture_release(struct snd_pcm_substream *substream)
4413 return 0; 4413 return 0;
4414} 4414}
4415 4415
4416static int snd_hdsp_hwdep_dummy_op(struct snd_hwdep *hw, struct file *file)
4417{
4418 /* we have nothing to initialize but the call is required */
4419 return 0;
4420}
4421
4422
4423/* helper functions for copying meter values */ 4416/* helper functions for copying meter values */
4424static inline int copy_u32_le(void __user *dest, void __iomem *src) 4417static inline int copy_u32_le(void __user *dest, void __iomem *src)
4425{ 4418{
@@ -4738,9 +4731,7 @@ static int snd_hdsp_create_hwdep(struct snd_card *card, struct hdsp *hdsp)
4738 hw->private_data = hdsp; 4731 hw->private_data = hdsp;
4739 strcpy(hw->name, "HDSP hwdep interface"); 4732 strcpy(hw->name, "HDSP hwdep interface");
4740 4733
4741 hw->ops.open = snd_hdsp_hwdep_dummy_op;
4742 hw->ops.ioctl = snd_hdsp_hwdep_ioctl; 4734 hw->ops.ioctl = snd_hdsp_hwdep_ioctl;
4743 hw->ops.release = snd_hdsp_hwdep_dummy_op;
4744 4735
4745 return 0; 4736 return 0;
4746} 4737}
diff --git a/sound/pci/rme9652/hdspm.c b/sound/pci/rme9652/hdspm.c
index d4b4e0d0fee8..bac2dc0c5d85 100644
--- a/sound/pci/rme9652/hdspm.c
+++ b/sound/pci/rme9652/hdspm.c
@@ -4100,13 +4100,6 @@ static int snd_hdspm_capture_release(struct snd_pcm_substream *substream)
4100 return 0; 4100 return 0;
4101} 4101}
4102 4102
4103static int snd_hdspm_hwdep_dummy_op(struct snd_hwdep * hw, struct file *file)
4104{
4105 /* we have nothing to initialize but the call is required */
4106 return 0;
4107}
4108
4109
4110static int snd_hdspm_hwdep_ioctl(struct snd_hwdep * hw, struct file *file, 4103static int snd_hdspm_hwdep_ioctl(struct snd_hwdep * hw, struct file *file,
4111 unsigned int cmd, unsigned long arg) 4104 unsigned int cmd, unsigned long arg)
4112{ 4105{
@@ -4213,9 +4206,7 @@ static int __devinit snd_hdspm_create_hwdep(struct snd_card *card,
4213 hw->private_data = hdspm; 4206 hw->private_data = hdspm;
4214 strcpy(hw->name, "HDSPM hwdep interface"); 4207 strcpy(hw->name, "HDSPM hwdep interface");
4215 4208
4216 hw->ops.open = snd_hdspm_hwdep_dummy_op;
4217 hw->ops.ioctl = snd_hdspm_hwdep_ioctl; 4209 hw->ops.ioctl = snd_hdspm_hwdep_ioctl;
4218 hw->ops.release = snd_hdspm_hwdep_dummy_op;
4219 4210
4220 return 0; 4211 return 0;
4221} 4212}
diff --git a/sound/synth/emux/emux_hwdep.c b/sound/synth/emux/emux_hwdep.c
index 0a5391436add..ff0b2a8fd25b 100644
--- a/sound/synth/emux/emux_hwdep.c
+++ b/sound/synth/emux/emux_hwdep.c
@@ -24,25 +24,6 @@
24#include <asm/uaccess.h> 24#include <asm/uaccess.h>
25#include "emux_voice.h" 25#include "emux_voice.h"
26 26
27/*
28 * open the hwdep device
29 */
30static int
31snd_emux_hwdep_open(struct snd_hwdep *hw, struct file *file)
32{
33 return 0;
34}
35
36
37/*
38 * close the device
39 */
40static int
41snd_emux_hwdep_release(struct snd_hwdep *hw, struct file *file)
42{
43 return 0;
44}
45
46 27
47#define TMP_CLIENT_ID 0x1001 28#define TMP_CLIENT_ID 0x1001
48 29
@@ -146,8 +127,6 @@ snd_emux_init_hwdep(struct snd_emux *emu)
146 emu->hwdep = hw; 127 emu->hwdep = hw;
147 strcpy(hw->name, SNDRV_EMUX_HWDEP_NAME); 128 strcpy(hw->name, SNDRV_EMUX_HWDEP_NAME);
148 hw->iface = SNDRV_HWDEP_IFACE_EMUX_WAVETABLE; 129 hw->iface = SNDRV_HWDEP_IFACE_EMUX_WAVETABLE;
149 hw->ops.open = snd_emux_hwdep_open;
150 hw->ops.release = snd_emux_hwdep_release;
151 hw->ops.ioctl = snd_emux_hwdep_ioctl; 130 hw->ops.ioctl = snd_emux_hwdep_ioctl;
152 hw->exclusive = 1; 131 hw->exclusive = 1;
153 hw->private_data = emu; 132 hw->private_data = emu;
diff --git a/sound/usb/usbmixer.c b/sound/usb/usbmixer.c
index 00397c8a765b..2bde79216fa5 100644
--- a/sound/usb/usbmixer.c
+++ b/sound/usb/usbmixer.c
@@ -78,7 +78,6 @@ struct usb_mixer_interface {
78 78
79 /* Sound Blaster remote control stuff */ 79 /* Sound Blaster remote control stuff */
80 const struct rc_config *rc_cfg; 80 const struct rc_config *rc_cfg;
81 unsigned long rc_hwdep_open;
82 u32 rc_code; 81 u32 rc_code;
83 wait_queue_head_t rc_waitq; 82 wait_queue_head_t rc_waitq;
84 struct urb *rc_urb; 83 struct urb *rc_urb;
@@ -1797,24 +1796,6 @@ static void snd_usb_soundblaster_remote_complete(struct urb *urb)
1797 wake_up(&mixer->rc_waitq); 1796 wake_up(&mixer->rc_waitq);
1798} 1797}
1799 1798
1800static int snd_usb_sbrc_hwdep_open(struct snd_hwdep *hw, struct file *file)
1801{
1802 struct usb_mixer_interface *mixer = hw->private_data;
1803
1804 if (test_and_set_bit(0, &mixer->rc_hwdep_open))
1805 return -EBUSY;
1806 return 0;
1807}
1808
1809static int snd_usb_sbrc_hwdep_release(struct snd_hwdep *hw, struct file *file)
1810{
1811 struct usb_mixer_interface *mixer = hw->private_data;
1812
1813 clear_bit(0, &mixer->rc_hwdep_open);
1814 smp_mb__after_clear_bit();
1815 return 0;
1816}
1817
1818static long snd_usb_sbrc_hwdep_read(struct snd_hwdep *hw, char __user *buf, 1799static long snd_usb_sbrc_hwdep_read(struct snd_hwdep *hw, char __user *buf,
1819 long count, loff_t *offset) 1800 long count, loff_t *offset)
1820{ 1801{
@@ -1867,9 +1848,8 @@ static int snd_usb_soundblaster_remote_init(struct usb_mixer_interface *mixer)
1867 hwdep->iface = SNDRV_HWDEP_IFACE_SB_RC; 1848 hwdep->iface = SNDRV_HWDEP_IFACE_SB_RC;
1868 hwdep->private_data = mixer; 1849 hwdep->private_data = mixer;
1869 hwdep->ops.read = snd_usb_sbrc_hwdep_read; 1850 hwdep->ops.read = snd_usb_sbrc_hwdep_read;
1870 hwdep->ops.open = snd_usb_sbrc_hwdep_open;
1871 hwdep->ops.release = snd_usb_sbrc_hwdep_release;
1872 hwdep->ops.poll = snd_usb_sbrc_hwdep_poll; 1851 hwdep->ops.poll = snd_usb_sbrc_hwdep_poll;
1852 hwdep->exclusive = 1;
1873 1853
1874 mixer->rc_urb = usb_alloc_urb(0, GFP_KERNEL); 1854 mixer->rc_urb = usb_alloc_urb(0, GFP_KERNEL);
1875 if (!mixer->rc_urb) 1855 if (!mixer->rc_urb)
diff --git a/sound/usb/usx2y/usX2Yhwdep.c b/sound/usb/usx2y/usX2Yhwdep.c
index 1558a5c4094f..a26d8d83d3eb 100644
--- a/sound/usb/usx2y/usX2Yhwdep.c
+++ b/sound/usb/usx2y/usX2Yhwdep.c
@@ -106,16 +106,6 @@ static unsigned int snd_us428ctls_poll(struct snd_hwdep *hw, struct file *file,
106} 106}
107 107
108 108
109static int snd_usX2Y_hwdep_open(struct snd_hwdep *hw, struct file *file)
110{
111 return 0;
112}
113
114static int snd_usX2Y_hwdep_release(struct snd_hwdep *hw, struct file *file)
115{
116 return 0;
117}
118
119static int snd_usX2Y_hwdep_dsp_status(struct snd_hwdep *hw, 109static int snd_usX2Y_hwdep_dsp_status(struct snd_hwdep *hw,
120 struct snd_hwdep_dsp_status *info) 110 struct snd_hwdep_dsp_status *info)
121{ 111{
@@ -267,8 +257,6 @@ int usX2Y_hwdep_new(struct snd_card *card, struct usb_device* device)
267 257
268 hw->iface = SNDRV_HWDEP_IFACE_USX2Y; 258 hw->iface = SNDRV_HWDEP_IFACE_USX2Y;
269 hw->private_data = usX2Y(card); 259 hw->private_data = usX2Y(card);
270 hw->ops.open = snd_usX2Y_hwdep_open;
271 hw->ops.release = snd_usX2Y_hwdep_release;
272 hw->ops.dsp_status = snd_usX2Y_hwdep_dsp_status; 260 hw->ops.dsp_status = snd_usX2Y_hwdep_dsp_status;
273 hw->ops.dsp_load = snd_usX2Y_hwdep_dsp_load; 261 hw->ops.dsp_load = snd_usX2Y_hwdep_dsp_load;
274 hw->ops.mmap = snd_us428ctls_mmap; 262 hw->ops.mmap = snd_us428ctls_mmap;