lkml.org 
[lkml]   [2020]   [Oct]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] ASoC: wm5102: Use get_unaligned_be16() for dac_comp_coeff
Date
Replace the two-step copy-and-convert in
wm5102_out_comp_coeff_put() with get_unaligned_be16(). Apart from
looking nicer, it avoids this sparse warning:

wm5102.c:687:35: sparse: sparse: cast to restricted __be16

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
---
sound/soc/codecs/wm5102.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/sound/soc/codecs/wm5102.c b/sound/soc/codecs/wm5102.c
index 2ed3fa67027d..70d353b63fe0 100644
--- a/sound/soc/codecs/wm5102.c
+++ b/sound/soc/codecs/wm5102.c
@@ -682,9 +682,7 @@ static int wm5102_out_comp_coeff_put(struct snd_kcontrol *kcontrol,
struct arizona *arizona = dev_get_drvdata(component->dev->parent);

mutex_lock(&arizona->dac_comp_lock);
- memcpy(&arizona->dac_comp_coeff, ucontrol->value.bytes.data,
- sizeof(arizona->dac_comp_coeff));
- arizona->dac_comp_coeff = be16_to_cpu(arizona->dac_comp_coeff);
+ arizona->dac_comp_coeff = get_unaligned_be16(ucontrol->value.bytes.data);
mutex_unlock(&arizona->dac_comp_lock);

return 0;
base-commit: 2ebefde9de62a0828936e47b62975501993b5ee9
--
2.20.1

\
 
 \ /
  Last update: 2020-10-15 12:28    [W:0.032 / U:0.088 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site