From 0562f7882d968463119bb63d47ef4bdaba7d6631 Mon Sep 17 00:00:00 2001 From: Mika Westerberg Date: Wed, 13 Oct 2010 11:30:32 +0300 Subject: ASoC: don't register AC97 devices twice With generic AC97 ASoC glue driver (codec/ac97.c), we get following warning when the device is registered (slightly stripped the backtrace): kobject (c5a863e8): tried to init an initialized object, something is seriously wrong. [] (unwind_backtrace+0x0/0xec) [] (kobject_init+0x38/0x70) [] (device_initialize+0x20/0x70) [] (device_register+0xc/0x18) [] (snd_soc_instantiate_cards+0x924/0xacc [snd_soc_core]) [] (snd_soc_register_platform+0x16c/0x198 [snd_soc_core]) [] (platform_drv_probe+0x18/0x1c) [] (driver_probe_device+0xb0/0x16c) [] (__driver_attach+0x5c/0x7c) [] (bus_for_each_dev+0x48/0x78) [] (bus_add_driver+0x98/0x214) [] (driver_register+0xa4/0x130) [] (do_one_initcall+0xd0/0x1a4) [] (sys_init_module+0x12b0/0x1454) This happens because the generic AC97 glue driver creates its codec->ac97 via calling snd_ac97_mixer(). snd_ac97_mixer() provides own version of snd_device.register which handles the device registration when snd_card_register() is called. To avoid registering the AC97 device twice, we add a new flag to the snd_soc_codec: ac97_created which tells whether the AC97 device was created by SoC subsystem. Signed-off-by: Mika Westerberg Acked-by: Liam Girdwood Signed-off-by: Mark Brown --- include/sound/soc.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include/sound') diff --git a/include/sound/soc.h b/include/sound/soc.h index 4fb079e14e16..5c3bce83f28a 100644 --- a/include/sound/soc.h +++ b/include/sound/soc.h @@ -442,6 +442,7 @@ struct snd_soc_codec { unsigned int suspended:1; /* Codec is in suspend PM state */ unsigned int probed:1; /* Codec has been probed */ unsigned int ac97_registered:1; /* Codec has been AC97 registered */ + unsigned int ac97_created:1; /* Codec has been created by SoC */ unsigned int sysfs_registered:1; /* codec has been sysfs registered */ /* codec IO */ -- cgit v1.2.3-59-g8ed1b