digi00x.c (edfbeecd92b0c4a648ed96a7e255bfc9a1bc4642) | digi00x.c (61ccc6f6b27c03bb32ca38a3c580d49ce1612d43) |
---|---|
1/* 2 * digi00x.c - a part of driver for Digidesign Digi 002/003 family 3 * 4 * Copyright (c) 2014-2015 Takashi Sakamoto 5 * 6 * Licensed under the terms of the GNU General Public License, version 2. 7 */ 8 --- 32 unchanged lines hidden (view full) --- 41 return 0; 42} 43 44static void dg00x_free(struct snd_dg00x *dg00x) 45{ 46 snd_dg00x_stream_destroy_duplex(dg00x); 47 snd_dg00x_transaction_unregister(dg00x); 48 | 1/* 2 * digi00x.c - a part of driver for Digidesign Digi 002/003 family 3 * 4 * Copyright (c) 2014-2015 Takashi Sakamoto 5 * 6 * Licensed under the terms of the GNU General Public License, version 2. 7 */ 8 --- 32 unchanged lines hidden (view full) --- 41 return 0; 42} 43 44static void dg00x_free(struct snd_dg00x *dg00x) 45{ 46 snd_dg00x_stream_destroy_duplex(dg00x); 47 snd_dg00x_transaction_unregister(dg00x); 48 |
49 fw_unit_put(dg00x->unit); 50 | |
51 mutex_destroy(&dg00x->mutex); | 49 mutex_destroy(&dg00x->mutex); |
52 kfree(dg00x); | 50 fw_unit_put(dg00x->unit); |
53} 54 55static void dg00x_card_free(struct snd_card *card) 56{ 57 dg00x_free(card->private_data); 58} 59 60static void do_registration(struct work_struct *work) --- 54 unchanged lines hidden (view full) --- 115} 116 117static int snd_dg00x_probe(struct fw_unit *unit, 118 const struct ieee1394_device_id *entry) 119{ 120 struct snd_dg00x *dg00x; 121 122 /* Allocate this independent of sound card instance. */ | 51} 52 53static void dg00x_card_free(struct snd_card *card) 54{ 55 dg00x_free(card->private_data); 56} 57 58static void do_registration(struct work_struct *work) --- 54 unchanged lines hidden (view full) --- 113} 114 115static int snd_dg00x_probe(struct fw_unit *unit, 116 const struct ieee1394_device_id *entry) 117{ 118 struct snd_dg00x *dg00x; 119 120 /* Allocate this independent of sound card instance. */ |
123 dg00x = kzalloc(sizeof(struct snd_dg00x), GFP_KERNEL); 124 if (dg00x == NULL) | 121 dg00x = devm_kzalloc(&unit->device, sizeof(struct snd_dg00x), 122 GFP_KERNEL); 123 if (!dg00x) |
125 return -ENOMEM; 126 127 dg00x->unit = fw_unit_get(unit); 128 dev_set_drvdata(&unit->device, dg00x); 129 130 mutex_init(&dg00x->mutex); 131 spin_lock_init(&dg00x->lock); 132 init_waitqueue_head(&dg00x->hwdep_wait); --- 35 unchanged lines hidden (view full) --- 168 /* 169 * Confirm to stop the work for registration before the sound card is 170 * going to be released. The work is not scheduled again because bus 171 * reset handler is not called anymore. 172 */ 173 cancel_delayed_work_sync(&dg00x->dwork); 174 175 if (dg00x->registered) { | 124 return -ENOMEM; 125 126 dg00x->unit = fw_unit_get(unit); 127 dev_set_drvdata(&unit->device, dg00x); 128 129 mutex_init(&dg00x->mutex); 130 spin_lock_init(&dg00x->lock); 131 init_waitqueue_head(&dg00x->hwdep_wait); --- 35 unchanged lines hidden (view full) --- 167 /* 168 * Confirm to stop the work for registration before the sound card is 169 * going to be released. The work is not scheduled again because bus 170 * reset handler is not called anymore. 171 */ 172 cancel_delayed_work_sync(&dg00x->dwork); 173 174 if (dg00x->registered) { |
176 /* No need to wait for releasing card object in this context. */ 177 snd_card_free_when_closed(dg00x->card); | 175 // Block till all of ALSA character devices are released. 176 snd_card_free(dg00x->card); |
178 } else { 179 /* Don't forget this case. */ 180 dg00x_free(dg00x); 181 } 182} 183 184static const struct ieee1394_device_id snd_dg00x_id_table[] = { 185 /* Both of 002/003 use the same ID. */ --- 40 unchanged lines hidden --- | 177 } else { 178 /* Don't forget this case. */ 179 dg00x_free(dg00x); 180 } 181} 182 183static const struct ieee1394_device_id snd_dg00x_id_table[] = { 184 /* Both of 002/003 use the same ID. */ --- 40 unchanged lines hidden --- |