From 393aa9c1cc514774332d7bc861307a76206e358d Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Wed, 29 Jan 2014 12:51:12 +0100 Subject: 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 --- sound/core/init.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'sound/core/init.c') 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), } /** - * snd_card_create - create and initialize a soundcard structure + * snd_card_new - create and initialize a soundcard structure + * @parent: the parent device object * @idx: card index (address) [0 ... (SNDRV_CARDS-1)] * @xid: card identification (ASCII string) * @module: top level module for locking @@ -172,7 +173,7 @@ static int get_slot_from_bitmask(int mask, int (*check)(struct module *, int), * * Return: Zero if successful or a negative error code. */ -int snd_card_create(int idx, const char *xid, +int snd_card_new(struct device *parent, int idx, const char *xid, struct module *module, int extra_size, struct snd_card **card_ret) { @@ -213,6 +214,7 @@ int snd_card_create(int idx, const char *xid, if (idx >= snd_ecards_limit) snd_ecards_limit = idx + 1; /* increase the limit */ mutex_unlock(&snd_card_mutex); + card->dev = parent; card->number = idx; card->module = module; INIT_LIST_HEAD(&card->devices); @@ -251,7 +253,7 @@ int snd_card_create(int idx, const char *xid, kfree(card); return err; } -EXPORT_SYMBOL(snd_card_create); +EXPORT_SYMBOL(snd_card_new); /* return non-zero if a card is already locked */ int snd_card_locked(int card) -- cgit v1.2.1