From: Takashi Iwai Date: Tue, 14 Apr 2009 14:13:58 +0000 (+0200) Subject: ALSA: add private_data to struct snd_jack X-Git-Tag: upstream/snapshot3+hdmi~19138^2^2~2^2~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9d59065cd6fae841ca56c281189d5b8d0817d35f;p=platform%2Fadaptation%2Frenesas_rcar%2Frenesas_kernel.git ALSA: add private_data to struct snd_jack 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 --- diff --git a/include/sound/jack.h b/include/sound/jack.h index 6b013c6..f236e42 100644 --- a/include/sound/jack.h +++ b/include/sound/jack.h @@ -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 diff --git a/sound/core/jack.c b/sound/core/jack.c index c8254c6..d54d1a0 100644 --- a/sound/core/jack.c +++ b/sound/core/jack.c @@ -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)