ALSA: add private_data to struct snd_jack
authorTakashi Iwai <tiwai@suse.de>
Tue, 14 Apr 2009 14:13:58 +0000 (16:13 +0200)
committerTakashi Iwai <tiwai@suse.de>
Tue, 14 Apr 2009 14:15:09 +0000 (16:15 +0200)
Added private_data and private_free fields to struct snd_jack so that
the caller can assign the data.  It'll be helpful for avoiding the
double-free of the jack instance.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
include/sound/jack.h
sound/core/jack.c

index 6b013c6..f236e42 100644 (file)
@@ -50,6 +50,8 @@ struct snd_jack {
        int type;
        const char *id;
        char name[100];
+       void *private_data;
+       void (*private_free)(struct snd_jack *);
 };
 
 #ifdef CONFIG_SND_JACK
index c8254c6..d54d1a0 100644 (file)
@@ -35,6 +35,9 @@ static int snd_jack_dev_free(struct snd_device *device)
 {
        struct snd_jack *jack = device->device_data;
 
+       if (jack->private_free)
+               jack->private_free(jack);
+
        /* If the input device is registered with the input subsystem
         * then we need to use a different deallocator. */
        if (jack->registered)