diff options
author | Vaishali Thakkar <vthakkar1994@gmail.com> | 2015-01-07 22:29:39 -0500 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2015-01-08 13:06:54 -0500 |
commit | a6b3db2c837a2db359bf7f846346680883dbb032 (patch) | |
tree | 72bd88ec13a07a1c99e9bc1be76f6fd2c2d46baa | |
parent | 97bf6af1f928216fd6c5a66e8a57bfa95a659672 (diff) |
ASoC: wm5102: Use put_unaligned_be16
This patch introduces the use of function put_unaligned_be16.
This is done using Coccinelle and semantic patch used is as follows:
@a@
typedef u16, __be16, uint16_t;
{u16,__be16,uint16_t} e16;
identifier tmp;
expression ptr;
expression y,e;
type T;
@@
- tmp = cpu_to_be16(y);
<+... when != tmp
(
- memcpy(ptr, (T)&tmp, \(2\|sizeof(u16)\|sizeof(__be16)\|sizeof(uint16_t)\|sizeof(e16)\));
+ put_unaligned_be16(y,ptr);
|
- memcpy(ptr, (T)&tmp, ...);
+ put_unaligned_be16(y,ptr);
)
...+>
? tmp = e
@@ type T; identifier a.tmp; @@
- T tmp;
...when != tmp
Signed-off-by: Vaishali Thakkar <vthakkar1994@gmail.com>
Acked-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
--
Changes Since v2:
Make the patch compatible for current code
sound/soc/codecs/wm5102.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r-- | sound/soc/codecs/wm5102.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/sound/soc/codecs/wm5102.c b/sound/soc/codecs/wm5102.c index f439ae052128..7dbac8a98f6d 100644 --- a/sound/soc/codecs/wm5102.c +++ b/sound/soc/codecs/wm5102.c | |||
@@ -28,6 +28,7 @@ | |||
28 | 28 | ||
29 | #include <linux/mfd/arizona/core.h> | 29 | #include <linux/mfd/arizona/core.h> |
30 | #include <linux/mfd/arizona/registers.h> | 30 | #include <linux/mfd/arizona/registers.h> |
31 | #include <asm/unaligned.h> | ||
31 | 32 | ||
32 | #include "arizona.h" | 33 | #include "arizona.h" |
33 | #include "wm5102.h" | 34 | #include "wm5102.h" |
@@ -617,11 +618,10 @@ static int wm5102_out_comp_coeff_get(struct snd_kcontrol *kcontrol, | |||
617 | { | 618 | { |
618 | struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); | 619 | struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); |
619 | struct arizona *arizona = dev_get_drvdata(codec->dev->parent); | 620 | struct arizona *arizona = dev_get_drvdata(codec->dev->parent); |
620 | uint16_t data; | ||
621 | 621 | ||
622 | mutex_lock(&arizona->dac_comp_lock); | 622 | mutex_lock(&arizona->dac_comp_lock); |
623 | data = cpu_to_be16(arizona->dac_comp_coeff); | 623 | put_unaligned_be16(arizona->dac_comp_coeff, |
624 | memcpy(ucontrol->value.bytes.data, &data, sizeof(data)); | 624 | ucontrol->value.bytes.data); |
625 | mutex_unlock(&arizona->dac_comp_lock); | 625 | mutex_unlock(&arizona->dac_comp_lock); |
626 | 626 | ||
627 | return 0; | 627 | return 0; |