From patchwork Tue Dec 13 06:31:38 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [06/19] mx27vis-aic32x4: only register when running on the right machine From: Eric Benard X-Patchwork-Id: 131008 Message-Id: <1323757911-25217-6-git-send-email-eric@eukrea.com> To: linux-arm-kernel@lists.infradead.org Cc: alsa-devel@alsa-project.org, Takashi Iwai , Mark Brown , open list , Jaroslav Kysela , Javier Martin , =?UTF-8?q?Eric=20B=C3=A9nard?= , Liam Girdwood Date: Tue, 13 Dec 2011 07:31:38 +0100 without this fix, a kernel compiled with imx_v4_v5_defconfig and running on a cpuimx25sd leads to : asoc: tlv320aic23-hifi <-> imx-ssi.0 mapping ok ------------[ cut here ]------------ WARNING: at fs/sysfs/dir.c:481 sysfs_add_one+0x90/0xb8() sysfs: cannot create duplicate filename '/devices/platform/soc-audio' Modules linked in: [] (unwind_backtrace+0x0/0xf0) from [] (warn_slowpath_common+0x48/0x60) [] (warn_slowpath_common+0x48/0x60) from [] (warn_slowpath_fmt+0x30/0x40) [] (warn_slowpath_fmt+0x30/0x40) from [] (sysfs_add_one+0x90/0xb8) [] (sysfs_add_one+0x90/0xb8) from [] (create_dir+0x60/0xc0) [] (create_dir+0x60/0xc0) from [] (sysfs_create_dir+0x84/0xcc) [] (sysfs_create_dir+0x84/0xcc) from [] (kobject_add_internal+0xac/0x1d0) [] (kobject_add_internal+0xac/0x1d0) from [] (kobject_add+0x50/0x98) [] (kobject_add+0x50/0x98) from [] (device_add+0xb0/0x610) [] (device_add+0xb0/0x610) from [] (platform_device_add+0xfc/0x238) [] (platform_device_add+0xfc/0x238) from [] (mx27vis_aic32x4_init+0x38/0x84) [] (mx27vis_aic32x4_init+0x38/0x84) from [] (do_one_initcall+0x34/0x178) [] (do_one_initcall+0x34/0x178) from [] (kernel_init+0x78/0x114) [] (kernel_init+0x78/0x114) from [] (kernel_thread_exit+0x0/0x8) ---[ end trace b6a96897e189aea3 ]--- kobject_add_internal failed for soc-audio with -EEXIST, don't try to register things with the same name in the same directory. [] (unwind_backtrace+0x0/0xf0) from [] (kobject_add_internal+0x1b8/0x1d0) [] (kobject_add_internal+0x1b8/0x1d0) from [] (kobject_add+0x50/0x98) [] (kobject_add+0x50/0x98) from [] (device_add+0xb0/0x610) [] (device_add+0xb0/0x610) from [] (platform_device_add+0xfc/0x238) [] (platform_device_add+0xfc/0x238) from [] (mx27vis_aic32x4_init+0x38/0x84) [] (mx27vis_aic32x4_init+0x38/0x84) from [] (do_one_initcall+0x34/0x178) [] (do_one_initcall+0x34/0x178) from [] (kernel_init+0x78/0x114) [] (kernel_init+0x78/0x114) from [] (kernel_thread_exit+0x0/0x8) ASoC: Platform device allocation failed mxc_audmux_v1_configure_port: not configured mxc_audmux_v1_configure_port: not configured Signed-off-by: Eric Bénard Cc: Liam Girdwood Cc: Mark Brown Cc: Javier Martin Cc: alsa-devel@alsa-project.org --- sound/soc/imx/mx27vis-aic32x4.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/sound/soc/imx/mx27vis-aic32x4.c b/sound/soc/imx/mx27vis-aic32x4.c index 054110b..224ffcc 100644 --- a/sound/soc/imx/mx27vis-aic32x4.c +++ b/sound/soc/imx/mx27vis-aic32x4.c @@ -96,6 +96,10 @@ static int __init mx27vis_aic32x4_init(void) { int ret; + if (!machine_is_imx27_visstrim_m10()) + /* return happy. We might run on a totally different machine */ + return 0; + mx27vis_aic32x4_snd_device = platform_device_alloc("soc-audio", -1); if (!mx27vis_aic32x4_snd_device) return -ENOMEM;