diff options
author | Takashi Iwai <tiwai@suse.de> | 2014-01-29 11:46:11 +0100 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2014-02-14 08:14:12 +0100 |
commit | 8bfb181c17d20956f156e84638912e00e1aaca86 (patch) | |
tree | f5d9c93a0a5d23779d85a0378c351fa8c00aa144 /include/sound/core.h | |
parent | 133450953040c9c6af986f65821a5ccebbe16e27 (diff) | |
download | linux-8bfb181c17d20956f156e84638912e00e1aaca86.tar.bz2 |
ALSA: Embed card device into struct snd_card
As prepared in the previous patch, we are ready to create a device
struct for the card object in snd_card_create() now. This patch
changes the scheme from the old style to:
- embed a device struct for the card object into snd_card struct,
- initialize the card device in snd_card_create() (but not register),
- registration is done in snd_card_register() via device_add()
The actual card device is stored in card->card_dev. The card->dev
pointer is kept unchanged and pointing to the parent device as before
for compatibility reason.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'include/sound/core.h')
-rw-r--r-- | include/sound/core.h | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/include/sound/core.h b/include/sound/core.h index e946b2428ea0..7e4fb3e93fc7 100644 --- a/include/sound/core.h +++ b/include/sound/core.h @@ -22,6 +22,7 @@ * */ +#include <linux/device.h> #include <linux/sched.h> /* wake_up() */ #include <linux/mutex.h> /* struct mutex */ #include <linux/rwsem.h> /* struct rw_semaphore */ @@ -41,8 +42,6 @@ /* forward declarations */ struct pci_dev; struct module; -struct device; -struct device_attribute; /* device allocation stuff */ @@ -135,7 +134,8 @@ struct snd_card { wait_queue_head_t shutdown_sleep; atomic_t refcount; /* refcount for disconnection */ struct device *dev; /* device assigned to this card */ - struct device *card_dev; /* cardX object for sysfs */ + struct device card_dev; /* cardX object for sysfs */ + bool registered; /* card_dev is registered? */ #ifdef CONFIG_PM unsigned int power_state; /* power state */ @@ -149,6 +149,8 @@ struct snd_card { #endif }; +#define dev_to_snd_card(p) container_of(p, struct snd_card, card_dev) + #ifdef CONFIG_PM static inline void snd_power_lock(struct snd_card *card) { @@ -197,7 +199,7 @@ struct snd_minor { /* return a device pointer linked to each sound device as a parent */ static inline struct device *snd_card_get_device_link(struct snd_card *card) { - return card ? card->card_dev : NULL; + return card ? &card->card_dev : NULL; } /* sound.c */ |