Skip to content

Commit

Permalink
ALSA: hwdep - Make open callback optional
Browse files Browse the repository at this point in the history
Don't require the open callback as mandatory.
Now all hwdeps ops can be optional.

Signed-off-by: Takashi Iwai <[email protected]>
  • Loading branch information
tiwai committed Feb 5, 2009
1 parent 18e352e commit 345d0b1
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions sound/core/hwdep.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,6 @@ static int snd_hwdep_open(struct inode *inode, struct file * file)
if (hw == NULL)
return -ENODEV;

if (!hw->ops.open)
return -ENXIO;

if (!try_module_get(hw->card->module))
return -EFAULT;

Expand All @@ -113,6 +110,10 @@ static int snd_hwdep_open(struct inode *inode, struct file * file)
err = -EBUSY;
break;
}
if (!hw->ops.open) {
err = 0;
break;
}
err = hw->ops.open(hw, file);
if (err >= 0)
break;
Expand Down Expand Up @@ -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)
{
int err = -ENXIO;
int err = 0;
struct snd_hwdep *hw = file->private_data;
struct module *mod = hw->card->module;

Expand Down

0 comments on commit 345d0b1

Please sign in to comment.