Commit 345d0b19 authored by Takashi Iwai's avatar Takashi Iwai

ALSA: hwdep - Make open callback optional

Don't require the open callback as mandatory.
Now all hwdeps ops can be optional.
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 18e352e4
...@@ -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;
......
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