diff options
author | Axel Lin <axel.lin@ingics.com> | 2015-10-05 09:23:48 -0400 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2015-10-16 13:13:35 -0400 |
commit | 3943b9efb381531b99bf9c545736f9e1e2715b9c (patch) | |
tree | 8d60bc6a54082932150f869dc5112de197c9e412 /sound | |
parent | a5fe58fd2836987387a6ee8854c529db7f5be650 (diff) |
ASoC: rt298: Make rt298_index_def const
The index_cache is per instance run time state but rt298_index_def is not.
Make rt298_index_def const and make a copy of memory for index_cache rather
than directly use the rt298_index_def.
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/soc/codecs/rt298.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/sound/soc/codecs/rt298.c b/sound/soc/codecs/rt298.c index ff126a7cee76..d039c995c051 100644 --- a/sound/soc/codecs/rt298.c +++ b/sound/soc/codecs/rt298.c | |||
@@ -49,7 +49,7 @@ struct rt298_priv { | |||
49 | int is_hp_in; | 49 | int is_hp_in; |
50 | }; | 50 | }; |
51 | 51 | ||
52 | static struct reg_default rt298_index_def[] = { | 52 | static const struct reg_default rt298_index_def[] = { |
53 | { 0x01, 0xaaaa }, | 53 | { 0x01, 0xaaaa }, |
54 | { 0x02, 0x8aaa }, | 54 | { 0x02, 0x8aaa }, |
55 | { 0x03, 0x0002 }, | 55 | { 0x03, 0x0002 }, |
@@ -1165,7 +1165,11 @@ static int rt298_i2c_probe(struct i2c_client *i2c, | |||
1165 | return -ENODEV; | 1165 | return -ENODEV; |
1166 | } | 1166 | } |
1167 | 1167 | ||
1168 | rt298->index_cache = rt298_index_def; | 1168 | rt298->index_cache = devm_kmemdup(&i2c->dev, rt298_index_def, |
1169 | sizeof(rt298_index_def), GFP_KERNEL); | ||
1170 | if (!rt298->index_cache) | ||
1171 | return -ENOMEM; | ||
1172 | |||
1169 | rt298->index_cache_size = INDEX_CACHE_SIZE; | 1173 | rt298->index_cache_size = INDEX_CACHE_SIZE; |
1170 | rt298->i2c = i2c; | 1174 | rt298->i2c = i2c; |
1171 | i2c_set_clientdata(i2c, rt298); | 1175 | i2c_set_clientdata(i2c, rt298); |