From patchwork Mon Aug 27 21:28:30 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janusz Krzysztofik X-Patchwork-Id: 1378491 Return-Path: X-Original-To: patchwork-linux-omap@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 7B4D4DF280 for ; Mon, 27 Aug 2012 22:12:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754773Ab2H0WML (ORCPT ); Mon, 27 Aug 2012 18:12:11 -0400 Received: from d1.icnet.pl ([212.160.220.21]:37592 "EHLO d1.icnet.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754700Ab2H0WMI (ORCPT ); Mon, 27 Aug 2012 18:12:08 -0400 X-Greylist: delayed 2577 seconds by postgrey-1.27 at vger.kernel.org; Mon, 27 Aug 2012 18:12:08 EDT Received: from 87-205-12-81.ip.netia.com.pl ([87.205.12.81] helo=localhost.localdomain) by d1.icnet.pl with asmtp (TLS-1.0:DHE_RSA_3DES_EDE_CBC_SHA:24) (Exim 4.34) id 1T66vF-0000QR-Bf; Mon, 27 Aug 2012 23:32:37 +0200 From: Janusz Krzysztofik To: alsa-devel@alsa-project.org Cc: Liam Girdwood , Mark Brown , linux-omap@vger.kernel.org, linux-kernel@vger.kernel.org, Janusz Krzysztofik Subject: [PATCH] ASoC: ams-delta: fix card initalization failure Date: Mon, 27 Aug 2012 23:28:30 +0200 Message-Id: <1346102910-8610-1-git-send-email-jkrzyszt@tis.icnet.pl> X-Mailer: git-send-email 1.7.3.4 X-SA-Exim-Scanned: No (on d1.icnet); SAEximRunCond expanded to false Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org Since commit 0998d0631001288a5974afc0b2a5f568bcdecb4d, 'device-core: Ensure drvdata = NULL when no driver is bound', the Amstrad Delta sound card no longer initializes correctly due to drvdata reset to NULL by an upper layer before the codec device, required for successful card setup, is registered. Fix this by moving the codec registration bits up, before the card is probed for. Created and tested against linux-3.6-rc3 Signed-off-by: Janusz Krzysztofik --- sound/soc/omap/ams-delta.c | 18 ++++++++++-------- 1 files changed, 10 insertions(+), 8 deletions(-) diff --git a/sound/soc/omap/ams-delta.c b/sound/soc/omap/ams-delta.c index 7d4fa8e..270de9c 100644 --- a/sound/soc/omap/ams-delta.c +++ b/sound/soc/omap/ams-delta.c @@ -590,20 +590,22 @@ static int __init ams_delta_module_init(void) if (!ams_delta_audio_platform_device) return -ENOMEM; - platform_set_drvdata(ams_delta_audio_platform_device, - &ams_delta_audio_card); - - ret = platform_device_add(ams_delta_audio_platform_device); - if (ret) - goto err; - /* * Codec platform device could be registered from elsewhere (board?), * but I do it here as it makes sense only if used with the card. + * Moreover, it must be registered before the card is probed for, + * or the card setup fails due to drvdata reset by upper layers. */ cx20442_platform_device = platform_device_register_simple("cx20442-codec", -1, NULL, 0); - return 0; + + platform_set_drvdata(ams_delta_audio_platform_device, + &ams_delta_audio_card); + + ret = platform_device_add(ams_delta_audio_platform_device); + if (!ret) + return ret; + err: platform_device_put(ams_delta_audio_platform_device); return ret;