From patchwork Thu Sep 6 13:45:32 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pantelis Antoniou X-Patchwork-Id: 1409861 Return-Path: X-Original-To: patchwork-linux-omap@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 1059640220 for ; Wed, 5 Sep 2012 15:57:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754331Ab2IEP5H (ORCPT ); Wed, 5 Sep 2012 11:57:07 -0400 Received: from li42-95.members.linode.com ([209.123.162.95]:41963 "EHLO li42-95.members.linode.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753985Ab2IEP5F (ORCPT ); Wed, 5 Sep 2012 11:57:05 -0400 X-Greylist: delayed 592 seconds by postgrey-1.27 at vger.kernel.org; Wed, 05 Sep 2012 11:57:05 EDT Received: from sles11esa.localdomain (unknown [195.97.110.117]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: panto) by li42-95.members.linode.com (Postfix) with ESMTPSA id 46EC79C10B; Wed, 5 Sep 2012 15:47:06 +0000 (UTC) From: Pantelis Antoniou To: linux-kernel@vger.kernel.org Cc: patches@opensource.wolfsonmicro.com, Mark Brown , linux-omap@vger.kernel.org, Pantelis Antoniou Subject: [PATCH] Don't clobber access methods when !regmap Date: Thu, 6 Sep 2012 16:45:32 +0300 Message-Id: <1346939132-20187-1-git-send-email-panto@antoniou-consulting.com> X-Mailer: git-send-email 1.7.12 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org A snd-soc driver that doesn't support regmap blow up horribly when you assume that regmap is available. Fix it by marking the driver as not supporting regmap & not clobbering the codec access methods. This is immediately noticeable on the beagleboard where we crash, since we might have REGMAP enabled, but it doesn't mean that the omap driver uses it. Signed-off-by: Pantelis Antoniou --- sound/soc/soc-io.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/sound/soc/soc-io.c b/sound/soc/soc-io.c index 29183ef..4e5b4ae 100644 --- a/sound/soc/soc-io.c +++ b/sound/soc/soc-io.c @@ -117,9 +117,6 @@ int snd_soc_codec_set_cache_io(struct snd_soc_codec *codec, int ret; memset(&config, 0, sizeof(config)); - codec->write = hw_write; - codec->read = hw_read; - codec->bulk_write_raw = snd_soc_hw_bulk_write_raw; config.reg_bits = addr_bits; config.val_bits = data_bits; @@ -151,7 +148,9 @@ int snd_soc_codec_set_cache_io(struct snd_soc_codec *codec, * multiples */ if (ret > 0) codec->val_bytes = ret; - } + } else + codec->using_regmap = false; + break; default: @@ -161,6 +160,13 @@ int snd_soc_codec_set_cache_io(struct snd_soc_codec *codec, if (IS_ERR(codec->control_data)) return PTR_ERR(codec->control_data); + /* only when using regmap; don't modify unconditionally */ + if (codec->using_regmap) { + codec->write = hw_write; + codec->read = hw_read; + codec->bulk_write_raw = snd_soc_hw_bulk_write_raw; + } + return 0; } EXPORT_SYMBOL_GPL(snd_soc_codec_set_cache_io);