From 1356a6071cf4d7187652cd2b18dfab4763e0dba6 Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Mon, 2 Jul 2018 06:25:11 +0000 Subject: ASoC: soc-generic-dmaengine-pcm: convert to SPDX identifiers Signed-off-by: Kuninori Morimoto Signed-off-by: Mark Brown --- sound/soc/soc-generic-dmaengine-pcm.c | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) (limited to 'sound/soc/soc-generic-dmaengine-pcm.c') diff --git a/sound/soc/soc-generic-dmaengine-pcm.c b/sound/soc/soc-generic-dmaengine-pcm.c index 56a541b9ff9e..13bdca6e41c5 100644 --- a/sound/soc/soc-generic-dmaengine-pcm.c +++ b/sound/soc/soc-generic-dmaengine-pcm.c @@ -1,17 +1,8 @@ -/* - * Copyright (C) 2013, Analog Devices Inc. - * Author: Lars-Peter Clausen - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ +// SPDX-License-Identifier: GPL-2.0+ +// +// Copyright (C) 2013, Analog Devices Inc. +// Author: Lars-Peter Clausen + #include #include #include -- cgit v1.2.3-59-g8ed1b From 40d1299f87bf915931970c8e6ea3852acacd1889 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Wed, 25 Jul 2018 22:42:08 +0200 Subject: ASoC: dmaengine: Fix missing __user prefix in copy_user callback It seems that __user prefix was forgotten to be added to dmaengine_copy_user callback while we refactored the user-copy PCM core. This patch adds the missing prefix, remove the superfluous cast, and add the needed cast (__force is needed for downgrading from user pointer to kernel pointer), too. Spotted by a sparse warning like: sound/soc/soc-generic-dmaengine-pcm.c:397:27: warning: incorrect type in initializer (incompatible argument 4 (different address spaces)) Signed-off-by: Takashi Iwai Signed-off-by: Mark Brown --- sound/soc/soc-generic-dmaengine-pcm.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'sound/soc/soc-generic-dmaengine-pcm.c') diff --git a/sound/soc/soc-generic-dmaengine-pcm.c b/sound/soc/soc-generic-dmaengine-pcm.c index 13bdca6e41c5..120f7b39e256 100644 --- a/sound/soc/soc-generic-dmaengine-pcm.c +++ b/sound/soc/soc-generic-dmaengine-pcm.c @@ -334,7 +334,7 @@ static snd_pcm_uframes_t dmaengine_pcm_pointer( static int dmaengine_copy_user(struct snd_pcm_substream *substream, int channel, unsigned long hwoff, - void *buf, unsigned long bytes) + void __user *buf, unsigned long bytes) { struct snd_soc_pcm_runtime *rtd = substream->private_data; struct snd_soc_component *component = @@ -350,18 +350,17 @@ static int dmaengine_copy_user(struct snd_pcm_substream *substream, int ret; if (is_playback) - if (copy_from_user(dma_ptr, (void __user *)buf, bytes)) + if (copy_from_user(dma_ptr, buf, bytes)) return -EFAULT; if (process) { - ret = process(substream, channel, hwoff, - (void __user *)buf, bytes); + ret = process(substream, channel, hwoff, (__force void *)buf, bytes); if (ret < 0) return ret; } if (!is_playback) - if (copy_to_user((void __user *)buf, dma_ptr, bytes)) + if (copy_to_user(buf, dma_ptr, bytes)) return -EFAULT; return 0; -- cgit v1.2.3-59-g8ed1b From 8adf3df4156345f1edcdfa8c7f7beeb0de351ce2 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Wed, 25 Jul 2018 23:17:22 +0200 Subject: ASoC: dmaengine: Use standard pcm_format_to_bits() macro The conversion from PCM format type to bits needs an explicit cast, and it'll be uglier. Since we have a standard macro for that, let's use it instead. This patch fixes the sparse warning: sound/soc/soc-generic-dmaengine-pcm.c:200:63: warning: restricted snd_pcm_format_t degrades to integer Signed-off-by: Takashi Iwai Signed-off-by: Mark Brown --- sound/soc/soc-generic-dmaengine-pcm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sound/soc/soc-generic-dmaengine-pcm.c') diff --git a/sound/soc/soc-generic-dmaengine-pcm.c b/sound/soc/soc-generic-dmaengine-pcm.c index 120f7b39e256..52fd7af952a5 100644 --- a/sound/soc/soc-generic-dmaengine-pcm.c +++ b/sound/soc/soc-generic-dmaengine-pcm.c @@ -188,7 +188,7 @@ static int dmaengine_pcm_set_runtime_hwparams(struct snd_pcm_substream *substrea case 32: case 64: if (addr_widths & (1 << (bits / 8))) - hw.formats |= (1LL << i); + hw.formats |= pcm_format_to_bits(i); break; default: /* Unsupported types */ -- cgit v1.2.3-59-g8ed1b