From patchwork Sun Nov 8 22:40:41 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julia Lawall X-Patchwork-Id: 7579771 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id A74C59F2F7 for ; Sun, 8 Nov 2015 22:52:38 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9067920650 for ; Sun, 8 Nov 2015 22:52:37 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 205DB20643 for ; Sun, 8 Nov 2015 22:52:36 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id D01952612C6; Sun, 8 Nov 2015 23:52:29 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,NO_DNS_FOR_FROM, RCVD_IN_DNSWL_LOW, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 0B09F2606CA; Sun, 8 Nov 2015 23:52:22 +0100 (CET) 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 A4B872606D2; Sun, 8 Nov 2015 23:52:20 +0100 (CET) Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by alsa0.perex.cz (Postfix) with ESMTP id 791742606BA for ; Sun, 8 Nov 2015 23:52:13 +0100 (CET) X-IronPort-AV: E=Sophos;i="5.20,264,1444687200"; d="scan'208";a="186639522" Received: from palace.lip6.fr (HELO localhost.localdomain) ([132.227.105.202]) by mail2-relais-roc.national.inria.fr with ESMTP/TLS/AES128-SHA256; 08 Nov 2015 23:52:13 +0100 From: Julia Lawall To: Jaroslav Kysela Date: Sun, 8 Nov 2015 23:40:41 +0100 Message-Id: <1447022441-18364-1-git-send-email-Julia.Lawall@lip6.fr> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1447021024-10392-1-git-send-email-Julia.Lawall@lip6.fr> References: <1447021024-10392-1-git-send-email-Julia.Lawall@lip6.fr> Cc: alsa-devel@alsa-project.org, kernel-janitors@vger.kernel.org, Takashi Iwai , linux-kernel@vger.kernel.org Subject: [alsa-devel] [PATCH v2] ALSA: ctxfi: constify rsc 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 The various rsc ops structures are never modified, so declare them as const. Done with the help of Coccinelle. Signed-off-by: Julia Lawall --- v2: This does the following types all at once: dao_rsc_ops, dai_rsc_ops, amixer_rsc_ops, src_rsc_ops, srcimp_rsc_ops, rsc_ops. Most of these types are only used in specific files, but the rsc_ops structures appear in all of the files, so just do them all at once. This patch thus also replaces the one with the subject "ALSA: ctxfi: constify dao and dai rsc ops structures" sound/pci/ctxfi/ctamixer.c | 6 +++--- sound/pci/ctxfi/ctamixer.h | 2 +- sound/pci/ctxfi/ctdaio.c | 10 +++++----- sound/pci/ctxfi/ctdaio.h | 4 ++-- sound/pci/ctxfi/ctresource.c | 2 +- sound/pci/ctxfi/ctresource.h | 2 +- sound/pci/ctxfi/ctsrc.c | 6 +++--- sound/pci/ctxfi/ctsrc.h | 4 ++-- 8 files changed, 18 insertions(+), 18 deletions(-) diff --git a/sound/pci/ctxfi/ctamixer.c b/sound/pci/ctxfi/ctamixer.c index c7dc38d..5fcbb06 100644 --- a/sound/pci/ctxfi/ctamixer.c +++ b/sound/pci/ctxfi/ctamixer.c @@ -49,7 +49,7 @@ static int amixer_output_slot(const struct rsc *rsc) return (amixer_index(rsc) << 4) + 0x4; } -static struct rsc_ops amixer_basic_rsc_ops = { +static const struct rsc_ops amixer_basic_rsc_ops = { .master = amixer_master, .next_conj = amixer_next_conj, .index = amixer_index, @@ -186,7 +186,7 @@ static int amixer_setup(struct amixer *amixer, struct rsc *input, return 0; } -static struct amixer_rsc_ops amixer_ops = { +static const struct amixer_rsc_ops amixer_ops = { .set_input = amixer_set_input, .set_invalid_squash = amixer_set_invalid_squash, .set_scale = amixer_set_y, @@ -357,7 +357,7 @@ static int sum_output_slot(const struct rsc *rsc) return (sum_index(rsc) << 4) + 0xc; } -static struct rsc_ops sum_basic_rsc_ops = { +static const struct rsc_ops sum_basic_rsc_ops = { .master = sum_master, .next_conj = sum_next_conj, .index = sum_index, diff --git a/sound/pci/ctxfi/ctamixer.h b/sound/pci/ctxfi/ctamixer.h index 72f42f2..2de18aa 100644 --- a/sound/pci/ctxfi/ctamixer.h +++ b/sound/pci/ctxfi/ctamixer.h @@ -58,7 +58,7 @@ struct amixer { unsigned char idx[8]; struct rsc *input; /* pointer to a resource acting as source */ struct sum *sum; /* Put amixer output to this summation node */ - struct amixer_rsc_ops *ops; /* AMixer specific operations */ + const struct amixer_rsc_ops *ops; /* AMixer specific operations */ }; struct amixer_rsc_ops { diff --git a/sound/pci/ctxfi/ctdaio.c b/sound/pci/ctxfi/ctdaio.c index 9b87dd2..7f089cb 100644 --- a/sound/pci/ctxfi/ctdaio.c +++ b/sound/pci/ctxfi/ctdaio.c @@ -83,21 +83,21 @@ static int daio_in_next_conj_20k2(struct rsc *rsc) return rsc->conj += 0x100; } -static struct rsc_ops daio_out_rsc_ops = { +static const struct rsc_ops daio_out_rsc_ops = { .master = daio_master, .next_conj = daio_out_next_conj, .index = daio_index, .output_slot = NULL, }; -static struct rsc_ops daio_in_rsc_ops_20k1 = { +static const struct rsc_ops daio_in_rsc_ops_20k1 = { .master = daio_master, .next_conj = daio_in_next_conj_20k1, .index = NULL, .output_slot = daio_index, }; -static struct rsc_ops daio_in_rsc_ops_20k2 = { +static const struct rsc_ops daio_in_rsc_ops_20k2 = { .master = daio_master, .next_conj = daio_in_next_conj_20k2, .index = NULL, @@ -263,7 +263,7 @@ static int dao_clear_right_input(struct dao *dao) return 0; } -static struct dao_rsc_ops dao_ops = { +static const struct dao_rsc_ops dao_ops = { .set_spos = dao_spdif_set_spos, .commit_write = dao_commit_write, .get_spos = dao_spdif_get_spos, @@ -318,7 +318,7 @@ static int dai_commit_write(struct dai *dai) return 0; } -static struct dai_rsc_ops dai_ops = { +static const struct dai_rsc_ops dai_ops = { .set_srt_srcl = dai_set_srt_srcl, .set_srt_srcr = dai_set_srt_srcr, .set_srt_msr = dai_set_srt_msr, diff --git a/sound/pci/ctxfi/ctdaio.h b/sound/pci/ctxfi/ctdaio.h index 0ebbf35..a30be73 100644 --- a/sound/pci/ctxfi/ctdaio.h +++ b/sound/pci/ctxfi/ctdaio.h @@ -51,7 +51,7 @@ struct daio { struct dao { struct daio daio; - struct dao_rsc_ops *ops; /* DAO specific operations */ + const struct dao_rsc_ops *ops; /* DAO specific operations */ struct imapper **imappers; struct daio_mgr *mgr; struct hw *hw; @@ -60,7 +60,7 @@ struct dao { struct dai { struct daio daio; - struct dai_rsc_ops *ops; /* DAI specific operations */ + const struct dai_rsc_ops *ops; /* DAI specific operations */ struct hw *hw; void *ctrl_blk; }; diff --git a/sound/pci/ctxfi/ctresource.c b/sound/pci/ctxfi/ctresource.c index 1a97e40..c5124c3 100644 --- a/sound/pci/ctxfi/ctresource.c +++ b/sound/pci/ctxfi/ctresource.c @@ -127,7 +127,7 @@ static int rsc_master(struct rsc *rsc) return rsc->conj = rsc->idx; } -static struct rsc_ops rsc_generic_ops = { +static const struct rsc_ops rsc_generic_ops = { .index = rsc_index, .output_slot = audio_ring_slot, .master = rsc_master, diff --git a/sound/pci/ctxfi/ctresource.h b/sound/pci/ctxfi/ctresource.h index 9b746c3..736d9f7 100644 --- a/sound/pci/ctxfi/ctresource.h +++ b/sound/pci/ctxfi/ctresource.h @@ -39,7 +39,7 @@ struct rsc { u32 msr:4; /* The Master Sample Rate a resource working on */ void *ctrl_blk; /* Chip specific control info block for a resource */ struct hw *hw; /* Chip specific object for hardware access means */ - struct rsc_ops *ops; /* Generic resource operations */ + const struct rsc_ops *ops; /* Generic resource operations */ }; struct rsc_ops { diff --git a/sound/pci/ctxfi/ctsrc.c b/sound/pci/ctxfi/ctsrc.c index ec1f084..a5a72df 100644 --- a/sound/pci/ctxfi/ctsrc.c +++ b/sound/pci/ctxfi/ctsrc.c @@ -335,7 +335,7 @@ static int src_default_config_arcrw(struct src *src) return 0; } -static struct src_rsc_ops src_rsc_ops = { +static const struct src_rsc_ops src_rsc_ops = { .set_state = src_set_state, .set_bm = src_set_bm, .set_sf = src_set_sf, @@ -611,7 +611,7 @@ static int srcimp_index(const struct rsc *rsc) return container_of(rsc, struct srcimp, rsc)->idx[rsc->conj]; } -static struct rsc_ops srcimp_basic_rsc_ops = { +static const struct rsc_ops srcimp_basic_rsc_ops = { .master = srcimp_master, .next_conj = srcimp_next_conj, .index = srcimp_index, @@ -662,7 +662,7 @@ static int srcimp_unmap(struct srcimp *srcimp) return 0; } -static struct srcimp_rsc_ops srcimp_ops = { +static const struct srcimp_rsc_ops srcimp_ops = { .map = srcimp_map, .unmap = srcimp_unmap }; diff --git a/sound/pci/ctxfi/ctsrc.h b/sound/pci/ctxfi/ctsrc.h index da7573c..92944a0 100644 --- a/sound/pci/ctxfi/ctsrc.h +++ b/sound/pci/ctxfi/ctsrc.h @@ -48,7 +48,7 @@ struct src_rsc_ops; struct src { struct rsc rsc; /* Basic resource info */ struct src *intlv; /* Pointer to next interleaved SRC in a series */ - struct src_rsc_ops *ops; /* SRC specific operations */ + const struct src_rsc_ops *ops; /* SRC specific operations */ /* Number of contiguous srcs for interleaved usage */ unsigned char multi; unsigned char mode; /* Working mode of this SRC resource */ @@ -110,7 +110,7 @@ struct srcimp { struct imapper *imappers; unsigned int mapped; /* A bit-map indicating which conj rsc is mapped */ struct srcimp_mgr *mgr; - struct srcimp_rsc_ops *ops; + const struct srcimp_rsc_ops *ops; }; struct srcimp_rsc_ops {