ALSA: hwdep - Make open callback optional

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Linux Kernel Mailing List
Date: Thursday, March 26, 2009 - 12:04 pm

Gitweb:     http://git.kernel.org/linus/345d0b1964df83a6c3fff815fabd34e37265581f
Commit:     345d0b1964df83a6c3fff815fabd34e37265581f
Parent:     18e352e4a73465349711a9324767e1b2453383e2
Author:     Takashi Iwai <tiwai@suse.de>
AuthorDate: Thu Feb 5 09:10:20 2009 +0100
Committer:  Takashi Iwai <tiwai@suse.de>
CommitDate: Thu Feb 5 09:10:20 2009 +0100

    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>
---
 sound/core/hwdep.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/sound/core/hwdep.c b/sound/core/hwdep.c
index 195cafc..a70ee7f 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)
 	if (hw == NULL)
 		return -ENODEV;
 
-	if (!hw->ops.open)
-		return -ENXIO;
-
 	if (!try_module_get(hw->card->module))
 		return -EFAULT;
 
@@ -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;
@@ -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;
 
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
ALSA: hwdep - Make open callback optional, Linux Kernel Mailing ..., (Thu Mar 26, 12:04 pm)