From patchwork Thu Sep 1 22:13:13 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julia Lawall X-Patchwork-Id: 9310011 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 391FB60756 for ; Thu, 1 Sep 2016 22:34:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E9CF4293DE for ; Thu, 1 Sep 2016 22:34:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DE5CB2955E; Thu, 1 Sep 2016 22:34:31 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1257E293DE for ; Thu, 1 Sep 2016 22:34:31 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 60A5E267570; Fri, 2 Sep 2016 00:34:28 +0200 (CEST) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 5A8262673A0; Fri, 2 Sep 2016 00:31:27 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id E62152672B3; Fri, 2 Sep 2016 00:31:24 +0200 (CEST) Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by alsa0.perex.cz (Postfix) with ESMTP id C7AF42672C1 for ; Fri, 2 Sep 2016 00:31:09 +0200 (CEST) X-IronPort-AV: E=Sophos;i="5.30,268,1470693600"; d="scan'208";a="191765099" Received: from palace.rsr.lip6.fr (HELO localhost.localdomain) ([132.227.105.202]) by mail3-relais-sop.national.inria.fr with ESMTP/TLS/AES128-SHA256; 02 Sep 2016 00:31:08 +0200 From: Julia Lawall To: Clemens Ladisch Date: Fri, 2 Sep 2016 00:13:13 +0200 Message-Id: <1472767994-26269-6-git-send-email-Julia.Lawall@lip6.fr> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1472767994-26269-1-git-send-email-Julia.Lawall@lip6.fr> References: <1472767994-26269-1-git-send-email-Julia.Lawall@lip6.fr> Cc: linux-kernel@vger.kernel.org, alsa-devel@alsa-project.org, kernel-janitors@vger.kernel.org, Takashi Iwai Subject: [alsa-devel] [PATCH 5/6] ALSA: oxygen: constify snd_pcm_ops structures X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP Check for snd_pcm_ops structures that are only stored in the ops field of a snd_soc_platform_driver structure or passed as the third argument to snd_pcm_set_ops. The corresponding field or parameter is declared const, so snd_pcm_ops structures that have this property can be declared as const also. The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // @r disable optional_qualifier@ identifier i; position p; @@ static struct snd_pcm_ops i@p = { ... }; @ok1@ identifier r.i; struct snd_soc_platform_driver e; position p; @@ e.ops = &i@p; @ok2@ identifier r.i; expression e1, e2; position p; @@ snd_pcm_set_ops(e1, e2, &i@p) @bad@ position p != {r.p,ok1.p,ok2.p}; identifier r.i; struct snd_pcm_ops e; @@ e@i@p @depends on !bad disable optional_qualifier@ identifier r.i; @@ static +const struct snd_pcm_ops i = { ... }; // Signed-off-by: Julia Lawall --- sound/pci/oxygen/oxygen_pcm.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/sound/pci/oxygen/oxygen_pcm.c b/sound/pci/oxygen/oxygen_pcm.c index aa2ebd1..042a243 100644 --- a/sound/pci/oxygen/oxygen_pcm.c +++ b/sound/pci/oxygen/oxygen_pcm.c @@ -631,7 +631,7 @@ static snd_pcm_uframes_t oxygen_pointer(struct snd_pcm_substream *substream) return bytes_to_frames(runtime, curr_addr - (u32)runtime->dma_addr); } -static struct snd_pcm_ops oxygen_rec_a_ops = { +static const struct snd_pcm_ops oxygen_rec_a_ops = { .open = oxygen_rec_a_open, .close = oxygen_close, .ioctl = snd_pcm_lib_ioctl, @@ -642,7 +642,7 @@ static struct snd_pcm_ops oxygen_rec_a_ops = { .pointer = oxygen_pointer, }; -static struct snd_pcm_ops oxygen_rec_b_ops = { +static const struct snd_pcm_ops oxygen_rec_b_ops = { .open = oxygen_rec_b_open, .close = oxygen_close, .ioctl = snd_pcm_lib_ioctl, @@ -653,7 +653,7 @@ static struct snd_pcm_ops oxygen_rec_b_ops = { .pointer = oxygen_pointer, }; -static struct snd_pcm_ops oxygen_rec_c_ops = { +static const struct snd_pcm_ops oxygen_rec_c_ops = { .open = oxygen_rec_c_open, .close = oxygen_close, .ioctl = snd_pcm_lib_ioctl, @@ -664,7 +664,7 @@ static struct snd_pcm_ops oxygen_rec_c_ops = { .pointer = oxygen_pointer, }; -static struct snd_pcm_ops oxygen_spdif_ops = { +static const struct snd_pcm_ops oxygen_spdif_ops = { .open = oxygen_spdif_open, .close = oxygen_close, .ioctl = snd_pcm_lib_ioctl, @@ -675,7 +675,7 @@ static struct snd_pcm_ops oxygen_spdif_ops = { .pointer = oxygen_pointer, }; -static struct snd_pcm_ops oxygen_multich_ops = { +static const struct snd_pcm_ops oxygen_multich_ops = { .open = oxygen_multich_open, .close = oxygen_close, .ioctl = snd_pcm_lib_ioctl, @@ -686,7 +686,7 @@ static struct snd_pcm_ops oxygen_multich_ops = { .pointer = oxygen_pointer, }; -static struct snd_pcm_ops oxygen_ac97_ops = { +static const struct snd_pcm_ops oxygen_ac97_ops = { .open = oxygen_ac97_open, .close = oxygen_close, .ioctl = snd_pcm_lib_ioctl,