Skip to content

Commit 43f2cde

Browse files
JuliaLawalltiwai
authored andcommitted
ALSA: ctxfi: constify rsc ops structures
The various rsc ops structures are never modified, so declare them as const. Done with the help of Coccinelle. Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Signed-off-by: Takashi Iwai <tiwai@suse.de>
1 parent 16771c7 commit 43f2cde

8 files changed

Lines changed: 18 additions & 18 deletions

File tree

sound/pci/ctxfi/ctamixer.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ static int amixer_output_slot(const struct rsc *rsc)
4949
return (amixer_index(rsc) << 4) + 0x4;
5050
}
5151

52-
static struct rsc_ops amixer_basic_rsc_ops = {
52+
static const struct rsc_ops amixer_basic_rsc_ops = {
5353
.master = amixer_master,
5454
.next_conj = amixer_next_conj,
5555
.index = amixer_index,
@@ -186,7 +186,7 @@ static int amixer_setup(struct amixer *amixer, struct rsc *input,
186186
return 0;
187187
}
188188

189-
static struct amixer_rsc_ops amixer_ops = {
189+
static const struct amixer_rsc_ops amixer_ops = {
190190
.set_input = amixer_set_input,
191191
.set_invalid_squash = amixer_set_invalid_squash,
192192
.set_scale = amixer_set_y,
@@ -357,7 +357,7 @@ static int sum_output_slot(const struct rsc *rsc)
357357
return (sum_index(rsc) << 4) + 0xc;
358358
}
359359

360-
static struct rsc_ops sum_basic_rsc_ops = {
360+
static const struct rsc_ops sum_basic_rsc_ops = {
361361
.master = sum_master,
362362
.next_conj = sum_next_conj,
363363
.index = sum_index,

sound/pci/ctxfi/ctamixer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ struct amixer {
5858
unsigned char idx[8];
5959
struct rsc *input; /* pointer to a resource acting as source */
6060
struct sum *sum; /* Put amixer output to this summation node */
61-
struct amixer_rsc_ops *ops; /* AMixer specific operations */
61+
const struct amixer_rsc_ops *ops; /* AMixer specific operations */
6262
};
6363

6464
struct amixer_rsc_ops {

sound/pci/ctxfi/ctdaio.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,21 +83,21 @@ static int daio_in_next_conj_20k2(struct rsc *rsc)
8383
return rsc->conj += 0x100;
8484
}
8585

86-
static struct rsc_ops daio_out_rsc_ops = {
86+
static const struct rsc_ops daio_out_rsc_ops = {
8787
.master = daio_master,
8888
.next_conj = daio_out_next_conj,
8989
.index = daio_index,
9090
.output_slot = NULL,
9191
};
9292

93-
static struct rsc_ops daio_in_rsc_ops_20k1 = {
93+
static const struct rsc_ops daio_in_rsc_ops_20k1 = {
9494
.master = daio_master,
9595
.next_conj = daio_in_next_conj_20k1,
9696
.index = NULL,
9797
.output_slot = daio_index,
9898
};
9999

100-
static struct rsc_ops daio_in_rsc_ops_20k2 = {
100+
static const struct rsc_ops daio_in_rsc_ops_20k2 = {
101101
.master = daio_master,
102102
.next_conj = daio_in_next_conj_20k2,
103103
.index = NULL,
@@ -263,7 +263,7 @@ static int dao_clear_right_input(struct dao *dao)
263263
return 0;
264264
}
265265

266-
static struct dao_rsc_ops dao_ops = {
266+
static const struct dao_rsc_ops dao_ops = {
267267
.set_spos = dao_spdif_set_spos,
268268
.commit_write = dao_commit_write,
269269
.get_spos = dao_spdif_get_spos,
@@ -318,7 +318,7 @@ static int dai_commit_write(struct dai *dai)
318318
return 0;
319319
}
320320

321-
static struct dai_rsc_ops dai_ops = {
321+
static const struct dai_rsc_ops dai_ops = {
322322
.set_srt_srcl = dai_set_srt_srcl,
323323
.set_srt_srcr = dai_set_srt_srcr,
324324
.set_srt_msr = dai_set_srt_msr,

sound/pci/ctxfi/ctdaio.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ struct daio {
5151

5252
struct dao {
5353
struct daio daio;
54-
struct dao_rsc_ops *ops; /* DAO specific operations */
54+
const struct dao_rsc_ops *ops; /* DAO specific operations */
5555
struct imapper **imappers;
5656
struct daio_mgr *mgr;
5757
struct hw *hw;
@@ -60,7 +60,7 @@ struct dao {
6060

6161
struct dai {
6262
struct daio daio;
63-
struct dai_rsc_ops *ops; /* DAI specific operations */
63+
const struct dai_rsc_ops *ops; /* DAI specific operations */
6464
struct hw *hw;
6565
void *ctrl_blk;
6666
};

sound/pci/ctxfi/ctresource.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ static int rsc_master(struct rsc *rsc)
127127
return rsc->conj = rsc->idx;
128128
}
129129

130-
static struct rsc_ops rsc_generic_ops = {
130+
static const struct rsc_ops rsc_generic_ops = {
131131
.index = rsc_index,
132132
.output_slot = audio_ring_slot,
133133
.master = rsc_master,

sound/pci/ctxfi/ctresource.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ struct rsc {
3939
u32 msr:4; /* The Master Sample Rate a resource working on */
4040
void *ctrl_blk; /* Chip specific control info block for a resource */
4141
struct hw *hw; /* Chip specific object for hardware access means */
42-
struct rsc_ops *ops; /* Generic resource operations */
42+
const struct rsc_ops *ops; /* Generic resource operations */
4343
};
4444

4545
struct rsc_ops {

sound/pci/ctxfi/ctsrc.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ static int src_default_config_arcrw(struct src *src)
335335
return 0;
336336
}
337337

338-
static struct src_rsc_ops src_rsc_ops = {
338+
static const struct src_rsc_ops src_rsc_ops = {
339339
.set_state = src_set_state,
340340
.set_bm = src_set_bm,
341341
.set_sf = src_set_sf,
@@ -611,7 +611,7 @@ static int srcimp_index(const struct rsc *rsc)
611611
return container_of(rsc, struct srcimp, rsc)->idx[rsc->conj];
612612
}
613613

614-
static struct rsc_ops srcimp_basic_rsc_ops = {
614+
static const struct rsc_ops srcimp_basic_rsc_ops = {
615615
.master = srcimp_master,
616616
.next_conj = srcimp_next_conj,
617617
.index = srcimp_index,
@@ -662,7 +662,7 @@ static int srcimp_unmap(struct srcimp *srcimp)
662662
return 0;
663663
}
664664

665-
static struct srcimp_rsc_ops srcimp_ops = {
665+
static const struct srcimp_rsc_ops srcimp_ops = {
666666
.map = srcimp_map,
667667
.unmap = srcimp_unmap
668668
};

sound/pci/ctxfi/ctsrc.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ struct src_rsc_ops;
4848
struct src {
4949
struct rsc rsc; /* Basic resource info */
5050
struct src *intlv; /* Pointer to next interleaved SRC in a series */
51-
struct src_rsc_ops *ops; /* SRC specific operations */
51+
const struct src_rsc_ops *ops; /* SRC specific operations */
5252
/* Number of contiguous srcs for interleaved usage */
5353
unsigned char multi;
5454
unsigned char mode; /* Working mode of this SRC resource */
@@ -110,7 +110,7 @@ struct srcimp {
110110
struct imapper *imappers;
111111
unsigned int mapped; /* A bit-map indicating which conj rsc is mapped */
112112
struct srcimp_mgr *mgr;
113-
struct srcimp_rsc_ops *ops;
113+
const struct srcimp_rsc_ops *ops;
114114
};
115115

116116
struct srcimp_rsc_ops {

0 commit comments

Comments
 (0)