Commit 345d0b1964df83a6c3fff815fabd34e37265581f
1 parent
18e352e4a7
Exists in
master
and in
20 other branches
ALSA: hwdep - Make open callback optional
Don't require the open callback as mandatory. Now all hwdeps ops can be optional. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Showing 1 changed file with 5 additions and 4 deletions Side-by-side Diff
sound/core/hwdep.c
... | ... | @@ -99,9 +99,6 @@ |
99 | 99 | if (hw == NULL) |
100 | 100 | return -ENODEV; |
101 | 101 | |
102 | - if (!hw->ops.open) | |
103 | - return -ENXIO; | |
104 | - | |
105 | 102 | if (!try_module_get(hw->card->module)) |
106 | 103 | return -EFAULT; |
107 | 104 | |
... | ... | @@ -113,6 +110,10 @@ |
113 | 110 | err = -EBUSY; |
114 | 111 | break; |
115 | 112 | } |
113 | + if (!hw->ops.open) { | |
114 | + err = 0; | |
115 | + break; | |
116 | + } | |
116 | 117 | err = hw->ops.open(hw, file); |
117 | 118 | if (err >= 0) |
118 | 119 | break; |
... | ... | @@ -151,7 +152,7 @@ |
151 | 152 | |
152 | 153 | static int snd_hwdep_release(struct inode *inode, struct file * file) |
153 | 154 | { |
154 | - int err = -ENXIO; | |
155 | + int err = 0; | |
155 | 156 | struct snd_hwdep *hw = file->private_data; |
156 | 157 | struct module *mod = hw->card->module; |
157 | 158 |