summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorChristian Gromm <christian.gromm@microchip.com>2020-11-04 13:50:42 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-11-06 11:02:53 +0100
commiteb27cf085cc8a487ea8a35b7cbdd2f7697c52274 (patch)
treeb796e21c1e15d8597a228e9f0b50f3e3f47cce02 /drivers
parent096f64905f0c5ab82918a0bdc42d503ef1bad98c (diff)
drivers: staging: most: use swabXX functions of kernel
This patch makes use of the swab16() and swab32() functions available in the kernel instead of using own implementations. Signed-off-by: Christian Gromm <christian.gromm@microchip.com> Reported-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Link: https://lore.kernel.org/r/1604494242-3414-1-git-send-email-christian.gromm@microchip.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/staging/most/sound/sound.c14
1 files changed, 2 insertions, 12 deletions
diff --git a/drivers/staging/most/sound/sound.c b/drivers/staging/most/sound/sound.c
index 8a449ab9bdce..3a1a59058042 100644
--- a/drivers/staging/most/sound/sound.c
+++ b/drivers/staging/most/sound/sound.c
@@ -72,22 +72,12 @@ static struct list_head adpt_list;
SNDRV_PCM_INFO_INTERLEAVED | \
SNDRV_PCM_INFO_BLOCK_TRANSFER)
-#define swap16(val) ( \
- (((u16)(val) << 8) & (u16)0xFF00) | \
- (((u16)(val) >> 8) & (u16)0x00FF))
-
-#define swap32(val) ( \
- (((u32)(val) << 24) & (u32)0xFF000000) | \
- (((u32)(val) << 8) & (u32)0x00FF0000) | \
- (((u32)(val) >> 8) & (u32)0x0000FF00) | \
- (((u32)(val) >> 24) & (u32)0x000000FF))
-
static void swap_copy16(u16 *dest, const u16 *source, unsigned int bytes)
{
unsigned int i = 0;
while (i < (bytes / 2)) {
- dest[i] = swap16(source[i]);
+ dest[i] = swab16(source[i]);
i++;
}
}
@@ -109,7 +99,7 @@ static void swap_copy32(u32 *dest, const u32 *source, unsigned int bytes)
unsigned int i = 0;
while (i < bytes / 4) {
- dest[i] = swap32(source[i]);
+ dest[i] = swab32(source[i]);
i++;
}
}