From patchwork Fri Jul 16 14:46:57 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Raffaele Recalcati X-Patchwork-Id: 112449 Received: from bear.ext.ti.com (bear.ext.ti.com [192.94.94.41]) by demeter.kernel.org (8.14.4/8.14.3) with ESMTP id o6GEo6Q3029440 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 16 Jul 2010 14:50:42 GMT Received: from dlep35.itg.ti.com ([157.170.170.118]) by bear.ext.ti.com (8.13.7/8.13.7) with ESMTP id o6GElGgK002320 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 16 Jul 2010 09:47:16 -0500 Received: from linux.omap.com (localhost [127.0.0.1]) by dlep35.itg.ti.com (8.13.7/8.13.7) with ESMTP id o6GElFvi013591; Fri, 16 Jul 2010 09:47:15 -0500 (CDT) Received: from linux.omap.com (localhost [127.0.0.1]) by linux.omap.com (Postfix) with ESMTP id 706AF80627; Fri, 16 Jul 2010 09:47:15 -0500 (CDT) X-Original-To: davinci-linux-open-source@linux.davincidsp.com Delivered-To: davinci-linux-open-source@linux.davincidsp.com Received: from dflp52.itg.ti.com (dflp52.itg.ti.com [128.247.22.96]) by linux.omap.com (Postfix) with ESMTP id B131580626 for ; Fri, 16 Jul 2010 09:47:12 -0500 (CDT) Received: from red.ext.ti.com (localhost [127.0.0.1]) by dflp52.itg.ti.com (8.13.7/8.13.7) with ESMTP id o6GEl9U2015455 for ; Fri, 16 Jul 2010 09:47:09 -0500 (CDT) Received: from psmtp.com (na3sys009amx226.postini.com [74.125.149.110]) by red.ext.ti.com (8.13.7/8.13.7) with SMTP id o6GEl8GY032622 for ; Fri, 16 Jul 2010 09:47:09 -0500 Received: from source ([209.85.161.45]) by na3sys009amx226.postini.com ([74.125.148.10]) with SMTP; Fri, 16 Jul 2010 07:47:09 PDT Received: by fxm5 with SMTP id 5so1229498fxm.4 for ; Fri, 16 Jul 2010 07:47:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:subject:date :message-id:x-mailer:in-reply-to:references; bh=bDZxVarR0W0n0O4Tz+ZtRtDs3uMgJ2MvmMZ5JMS5yvk=; b=nLO9CQknmE2wOeNn3INxg3KatNcJIc1PI6VNzDKi8ih78rwOF3jYe9vfUHppLuE73w ftyh8v4PGhJGY6oID/+51U/LETRypgfn/jcFxHLvMZwwzSvHIj/viPuwEOz2lwaGueG9 Pdvrj4hXQLcPJxQHwwTL0WKztttt5CmG9NVcs= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; b=BU7Uno2xTHOKyoUHTJqc4bGRXpbTsvsmvid1SUH12z+G+xIpR2HfanHrCgKhNgY8ub YSTDNL4QA2GtR/g83g3YrITcB6Vqx6W5gLJClCsEgk6kpkarPz1OSp7yJmgwHl6pMyZU YqdHH6wQq/3v8dpxpGYQmXpH9FymV6k9chjX8= Received: by 10.216.159.76 with SMTP id r54mr863296wek.77.1279291627538; Fri, 16 Jul 2010 07:47:07 -0700 (PDT) Received: from localhost.localdomain (host81-90-static.72-81-b.business.telecomitalia.it [81.72.90.81]) by mx.google.com with ESMTPS id l55sm783885weq.41.2010.07.16.07.47.04 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 16 Jul 2010 07:47:06 -0700 (PDT) From: Raffaele Recalcati To: davinci-linux-open-source@linux.davincidsp.com Subject: [PATCH 1/3] ASoC: soc-core: soc_pcm_ops dynamically allocated Date: Fri, 16 Jul 2010 16:46:57 +0200 Message-Id: <1279291619-5081-2-git-send-email-lamiaposta71@gmail.com> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: <1279291619-5081-1-git-send-email-lamiaposta71@gmail.com> References: <1279291619-5081-1-git-send-email-lamiaposta71@gmail.com> X-pstn-neptune: 0/0/0.00/0 X-pstn-levels: (S:48.05836/99.90000 CV:99.9000 FC:95.5390 LC:95.5390 R:95.9108 P:95.9108 M:97.0282 C:98.6951 ) X-pstn-settings: 2 (0.5000:0.5000) s cv gt3 gt2 gt1 r p m c X-pstn-addresses: from [db-null] Cc: alsa-devel@alsa-project.org, Barry Song <21cnbao@gmail.com>, Mark Brown , Peter Ujfalusi , Eero Nurkkala , Liam Girdwood X-BeenThere: davinci-linux-open-source@linux.davincidsp.com X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: davinci-linux-open-source-bounces@linux.davincidsp.com Errors-To: davinci-linux-open-source-bounces@linux.davincidsp.com X-Greylist: Sender succeeded STARTTLS authentication, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Fri, 16 Jul 2010 14:50:42 +0000 (UTC) diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index ad7f952..6500686 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -801,17 +801,6 @@ static int soc_pcm_trigger(struct snd_pcm_substream *substream, int cmd) } return 0; } - -/* ASoC PCM operations */ -static struct snd_pcm_ops soc_pcm_ops = { - .open = soc_pcm_open, - .close = soc_codec_close, - .hw_params = soc_pcm_hw_params, - .hw_free = soc_pcm_hw_free, - .prepare = soc_pcm_prepare, - .trigger = soc_pcm_trigger, -}; - #ifdef CONFIG_PM /* powers down audio subsystem for suspend */ static int soc_suspend(struct device *dev) @@ -1306,6 +1295,7 @@ static int soc_new_pcm(struct snd_soc_device *socdev, struct snd_pcm *pcm; char new_name[64]; int ret = 0, playback = 0, capture = 0; + struct snd_pcm_ops *soc_pcm_ops; rtd = kzalloc(sizeof(struct snd_soc_pcm_runtime), GFP_KERNEL); if (rtd == NULL) @@ -1335,19 +1325,25 @@ static int soc_new_pcm(struct snd_soc_device *socdev, dai_link->pcm = pcm; pcm->private_data = rtd; - soc_pcm_ops.mmap = platform->pcm_ops->mmap; - soc_pcm_ops.pointer = platform->pcm_ops->pointer; - soc_pcm_ops.ioctl = platform->pcm_ops->ioctl; - soc_pcm_ops.copy = platform->pcm_ops->copy; - soc_pcm_ops.silence = platform->pcm_ops->silence; - soc_pcm_ops.ack = platform->pcm_ops->ack; - soc_pcm_ops.page = platform->pcm_ops->page; + soc_pcm_ops = kmalloc(sizeof(struct snd_pcm_ops), GFP_KERNEL); + soc_pcm_ops->open = soc_pcm_open; + soc_pcm_ops->close = soc_codec_close; + soc_pcm_ops->hw_params = soc_pcm_hw_params; + soc_pcm_ops->hw_free = soc_pcm_hw_free; + soc_pcm_ops->prepare = soc_pcm_prepare; + soc_pcm_ops->trigger = soc_pcm_trigger; + soc_pcm_ops->mmap = platform->pcm_ops->mmap; + soc_pcm_ops->pointer = platform->pcm_ops->pointer; + soc_pcm_ops->ioctl = platform->pcm_ops->ioctl; + soc_pcm_ops->copy = platform->pcm_ops->copy; + soc_pcm_ops->silence = platform->pcm_ops->silence; + soc_pcm_ops->ack = platform->pcm_ops->ack; + soc_pcm_ops->page = platform->pcm_ops->page; if (playback) - snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &soc_pcm_ops); - + snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, soc_pcm_ops); if (capture) - snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &soc_pcm_ops); + snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, soc_pcm_ops); ret = platform->pcm_new(codec->card, codec_dai, pcm); if (ret < 0) {