diff options
author | Takashi Iwai <tiwai@suse.de> | 2007-01-26 06:40:31 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2007-01-29 17:32:53 -0500 |
commit | 7d2aae1e88660cf09be913e9754e45189dc33412 (patch) | |
tree | af56ebcced14fb8e40640d9555129aab2ffa0532 /include/sound | |
parent | 5263bf65d6342e12ab716db8e529501670979321 (diff) |
[PATCH] ALSA: Fix sysfs breakage
The recent change for a new sysfs tree with card* object breaks the
/sys/class/sound tree if CONFIG_SYSFS_DEPRECATED is enabled.
The device in each entry doesn't point the correct device object:
/sys/class/sound
...
|-- pcmC0D0c
| |-- dev
| |-- device -> ../../../class/sound/card0
| |-- pcm_class
| |-- power
| | `-- wakeup
| |-- subsystem -> ../../../class/sound
| `-- uevent
Also, this change breaks some drivers (like sound/arm/*) referring
card->dev directly to obtain the device object for memory handling.
This patch reverts the semantics of card->dev to the former version,
which points to a real device object. The card* object is stored in a
new card->card_dev field, instead. The device parent is chosen either
card->dev or card->card_dev according to CONFIG_SYSFS_DEPRECATED to
keep the tree compatibility.
Also, card* isn't created if CONFIG_SYSFS_DEPRECATED is enabled. The
reason of card* object is a root of all beloing devices, and it makes
little sense if each sound device points to the real device object
directly.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Acked-by: Monty Montgomery <xiphmont@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'include/sound')
-rw-r--r-- | include/sound/core.h | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/include/sound/core.h b/include/sound/core.h index a994bea09cd6..521f036cce99 100644 --- a/include/sound/core.h +++ b/include/sound/core.h | |||
@@ -132,8 +132,10 @@ struct snd_card { | |||
132 | int shutdown; /* this card is going down */ | 132 | int shutdown; /* this card is going down */ |
133 | int free_on_last_close; /* free in context of file_release */ | 133 | int free_on_last_close; /* free in context of file_release */ |
134 | wait_queue_head_t shutdown_sleep; | 134 | wait_queue_head_t shutdown_sleep; |
135 | struct device *parent; | 135 | struct device *dev; /* device assigned to this card */ |
136 | struct device *dev; | 136 | #ifndef CONFIG_SYSFS_DEPRECATED |
137 | struct device *card_dev; /* cardX object for sysfs */ | ||
138 | #endif | ||
137 | 139 | ||
138 | #ifdef CONFIG_PM | 140 | #ifdef CONFIG_PM |
139 | unsigned int power_state; /* power state */ | 141 | unsigned int power_state; /* power state */ |
@@ -191,6 +193,16 @@ struct snd_minor { | |||
191 | struct device *dev; /* device for sysfs */ | 193 | struct device *dev; /* device for sysfs */ |
192 | }; | 194 | }; |
193 | 195 | ||
196 | /* return a device pointer linked to each sound device as a parent */ | ||
197 | static inline struct device *snd_card_get_device_link(struct snd_card *card) | ||
198 | { | ||
199 | #ifdef CONFIG_SYSFS_DEPRECATED | ||
200 | return card ? card->dev : NULL; | ||
201 | #else | ||
202 | return card ? card->card_dev : NULL; | ||
203 | #endif | ||
204 | } | ||
205 | |||
194 | /* sound.c */ | 206 | /* sound.c */ |
195 | 207 | ||
196 | extern int snd_major; | 208 | extern int snd_major; |
@@ -257,7 +269,7 @@ int snd_card_file_add(struct snd_card *card, struct file *file); | |||
257 | int snd_card_file_remove(struct snd_card *card, struct file *file); | 269 | int snd_card_file_remove(struct snd_card *card, struct file *file); |
258 | 270 | ||
259 | #ifndef snd_card_set_dev | 271 | #ifndef snd_card_set_dev |
260 | #define snd_card_set_dev(card,devptr) ((card)->parent = (devptr)) | 272 | #define snd_card_set_dev(card,devptr) ((card)->dev = (devptr)) |
261 | #endif | 273 | #endif |
262 | 274 | ||
263 | /* device.c */ | 275 | /* device.c */ |