aboutsummaryrefslogtreecommitdiffstats
path: root/sound/core/init.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2014-01-29 06:51:12 -0500
committerTakashi Iwai <tiwai@suse.de>2014-02-12 04:58:20 -0500
commit393aa9c1cc514774332d7bc861307a76206e358d (patch)
treeb419a57e8af4b904247c0ffd3a7f0cc924bf2278 /sound/core/init.c
parent80d7d771ae839d6fc2286f443ad8445b6721a7f3 (diff)
ALSA: Mandate to pass a device pointer at card creation time
This is a part of preliminary works for modernizing the ALSA device structure. So far, we set card->dev at later point after the object creation. Because of this, the core layer doesn't always know which device is being handled before it's actually registered, and it makes impossible to show the device in error messages, for example. The first goal is to achieve a proper struct device initialization at the very beginning of probing. As a first step, this patch introduces snd_card_new() function (yes there was the same named function in the very past), in order to receive the parent device pointer from the very beginning. snd_card_create() is marked as deprecated. At this point, there is no functional change other than that. The actual change of the device creation scheme will follow later. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/core/init.c')
-rw-r--r--sound/core/init.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/sound/core/init.c b/sound/core/init.c
index a16d765cdf47..f4d3ac633ff8 100644
--- a/sound/core/init.c
+++ b/sound/core/init.c
@@ -157,7 +157,8 @@ static int get_slot_from_bitmask(int mask, int (*check)(struct module *, int),
157} 157}
158 158
159/** 159/**
160 * snd_card_create - create and initialize a soundcard structure 160 * snd_card_new - create and initialize a soundcard structure
161 * @parent: the parent device object
161 * @idx: card index (address) [0 ... (SNDRV_CARDS-1)] 162 * @idx: card index (address) [0 ... (SNDRV_CARDS-1)]
162 * @xid: card identification (ASCII string) 163 * @xid: card identification (ASCII string)
163 * @module: top level module for locking 164 * @module: top level module for locking
@@ -172,7 +173,7 @@ static int get_slot_from_bitmask(int mask, int (*check)(struct module *, int),
172 * 173 *
173 * Return: Zero if successful or a negative error code. 174 * Return: Zero if successful or a negative error code.
174 */ 175 */
175int snd_card_create(int idx, const char *xid, 176int snd_card_new(struct device *parent, int idx, const char *xid,
176 struct module *module, int extra_size, 177 struct module *module, int extra_size,
177 struct snd_card **card_ret) 178 struct snd_card **card_ret)
178{ 179{
@@ -213,6 +214,7 @@ int snd_card_create(int idx, const char *xid,
213 if (idx >= snd_ecards_limit) 214 if (idx >= snd_ecards_limit)
214 snd_ecards_limit = idx + 1; /* increase the limit */ 215 snd_ecards_limit = idx + 1; /* increase the limit */
215 mutex_unlock(&snd_card_mutex); 216 mutex_unlock(&snd_card_mutex);
217 card->dev = parent;
216 card->number = idx; 218 card->number = idx;
217 card->module = module; 219 card->module = module;
218 INIT_LIST_HEAD(&card->devices); 220 INIT_LIST_HEAD(&card->devices);
@@ -251,7 +253,7 @@ int snd_card_create(int idx, const char *xid,
251 kfree(card); 253 kfree(card);
252 return err; 254 return err;
253} 255}
254EXPORT_SYMBOL(snd_card_create); 256EXPORT_SYMBOL(snd_card_new);
255 257
256/* return non-zero if a card is already locked */ 258/* return non-zero if a card is already locked */
257int snd_card_locked(int card) 259int snd_card_locked(int card)