Commit 31bbf8f5 authored by Alexey Dobriyan's avatar Alexey Dobriyan Committed by Linus Torvalds

[PATCH] sb16_csp: remove home-grown le??_to_cpu macros

Signed-off-by: default avatarAlexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: default avatarDomen Puncer <domen@coderock.org>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 1ac19f4c
...@@ -42,8 +42,6 @@ MODULE_LICENSE("GPL"); ...@@ -42,8 +42,6 @@ MODULE_LICENSE("GPL");
#else #else
#define CSP_HDR_VALUE(a,b,c,d) ((d) | ((c)<<8) | ((b)<<16) | ((a)<<24)) #define CSP_HDR_VALUE(a,b,c,d) ((d) | ((c)<<8) | ((b)<<16) | ((a)<<24))
#endif #endif
#define LE_SHORT(v) le16_to_cpu(v)
#define LE_INT(v) le32_to_cpu(v)
#define RIFF_HEADER CSP_HDR_VALUE('R', 'I', 'F', 'F') #define RIFF_HEADER CSP_HDR_VALUE('R', 'I', 'F', 'F')
#define CSP__HEADER CSP_HDR_VALUE('C', 'S', 'P', ' ') #define CSP__HEADER CSP_HDR_VALUE('C', 'S', 'P', ' ')
...@@ -316,12 +314,12 @@ static int snd_sb_csp_riff_load(snd_sb_csp_t * p, snd_sb_csp_microcode_t __user ...@@ -316,12 +314,12 @@ static int snd_sb_csp_riff_load(snd_sb_csp_t * p, snd_sb_csp_microcode_t __user
if (copy_from_user(&file_h, data_ptr, sizeof(file_h))) if (copy_from_user(&file_h, data_ptr, sizeof(file_h)))
return -EFAULT; return -EFAULT;
if ((file_h.name != RIFF_HEADER) || if ((file_h.name != RIFF_HEADER) ||
(LE_INT(file_h.len) >= SNDRV_SB_CSP_MAX_MICROCODE_FILE_SIZE - sizeof(file_h))) { (le32_to_cpu(file_h.len) >= SNDRV_SB_CSP_MAX_MICROCODE_FILE_SIZE - sizeof(file_h))) {
snd_printd("%s: Invalid RIFF header\n", __FUNCTION__); snd_printd("%s: Invalid RIFF header\n", __FUNCTION__);
return -EINVAL; return -EINVAL;
} }
data_ptr += sizeof(file_h); data_ptr += sizeof(file_h);
data_end = data_ptr + LE_INT(file_h.len); data_end = data_ptr + le32_to_cpu(file_h.len);
if (copy_from_user(&item_type, data_ptr, sizeof(item_type))) if (copy_from_user(&item_type, data_ptr, sizeof(item_type)))
return -EFAULT; return -EFAULT;
...@@ -331,7 +329,7 @@ static int snd_sb_csp_riff_load(snd_sb_csp_t * p, snd_sb_csp_microcode_t __user ...@@ -331,7 +329,7 @@ static int snd_sb_csp_riff_load(snd_sb_csp_t * p, snd_sb_csp_microcode_t __user
} }
data_ptr += sizeof (item_type); data_ptr += sizeof (item_type);
for (; data_ptr < data_end; data_ptr += LE_INT(item_h.len)) { for (; data_ptr < data_end; data_ptr += le32_to_cpu(item_h.len)) {
if (copy_from_user(&item_h, data_ptr, sizeof(item_h))) if (copy_from_user(&item_h, data_ptr, sizeof(item_h)))
return -EFAULT; return -EFAULT;
data_ptr += sizeof(item_h); data_ptr += sizeof(item_h);
...@@ -344,7 +342,7 @@ static int snd_sb_csp_riff_load(snd_sb_csp_t * p, snd_sb_csp_microcode_t __user ...@@ -344,7 +342,7 @@ static int snd_sb_csp_riff_load(snd_sb_csp_t * p, snd_sb_csp_microcode_t __user
case FUNC_HEADER: case FUNC_HEADER:
if (copy_from_user(&funcdesc_h, data_ptr + sizeof(item_type), sizeof(funcdesc_h))) if (copy_from_user(&funcdesc_h, data_ptr + sizeof(item_type), sizeof(funcdesc_h)))
return -EFAULT; return -EFAULT;
func_nr = LE_SHORT(funcdesc_h.func_nr); func_nr = le16_to_cpu(funcdesc_h.func_nr);
break; break;
case CODE_HEADER: case CODE_HEADER:
if (func_nr != info.func_req) if (func_nr != info.func_req)
...@@ -370,11 +368,11 @@ static int snd_sb_csp_riff_load(snd_sb_csp_t * p, snd_sb_csp_microcode_t __user ...@@ -370,11 +368,11 @@ static int snd_sb_csp_riff_load(snd_sb_csp_t * p, snd_sb_csp_microcode_t __user
if (code_h.name != INIT_HEADER) if (code_h.name != INIT_HEADER)
break; break;
data_ptr += sizeof(code_h); data_ptr += sizeof(code_h);
err = snd_sb_csp_load_user(p, data_ptr, LE_INT(code_h.len), err = snd_sb_csp_load_user(p, data_ptr, le32_to_cpu(code_h.len),
SNDRV_SB_CSP_LOAD_INITBLOCK); SNDRV_SB_CSP_LOAD_INITBLOCK);
if (err) if (err)
return err; return err;
data_ptr += LE_INT(code_h.len); data_ptr += le32_to_cpu(code_h.len);
} }
/* main microcode block */ /* main microcode block */
if (copy_from_user(&code_h, data_ptr, sizeof(code_h))) if (copy_from_user(&code_h, data_ptr, sizeof(code_h)))
...@@ -386,17 +384,17 @@ static int snd_sb_csp_riff_load(snd_sb_csp_t * p, snd_sb_csp_microcode_t __user ...@@ -386,17 +384,17 @@ static int snd_sb_csp_riff_load(snd_sb_csp_t * p, snd_sb_csp_microcode_t __user
} }
data_ptr += sizeof(code_h); data_ptr += sizeof(code_h);
err = snd_sb_csp_load_user(p, data_ptr, err = snd_sb_csp_load_user(p, data_ptr,
LE_INT(code_h.len), 0); le32_to_cpu(code_h.len), 0);
if (err) if (err)
return err; return err;
/* fill in codec header */ /* fill in codec header */
strlcpy(p->codec_name, info.codec_name, sizeof(p->codec_name)); strlcpy(p->codec_name, info.codec_name, sizeof(p->codec_name));
p->func_nr = func_nr; p->func_nr = func_nr;
p->mode = LE_SHORT(funcdesc_h.flags_play_rec); p->mode = le16_to_cpu(funcdesc_h.flags_play_rec);
switch (LE_SHORT(funcdesc_h.VOC_type)) { switch (le16_to_cpu(funcdesc_h.VOC_type)) {
case 0x0001: /* QSound decoder */ case 0x0001: /* QSound decoder */
if (LE_SHORT(funcdesc_h.flags_play_rec) == SNDRV_SB_CSP_MODE_DSP_WRITE) { if (le16_to_cpu(funcdesc_h.flags_play_rec) == SNDRV_SB_CSP_MODE_DSP_WRITE) {
if (snd_sb_qsound_build(p) == 0) if (snd_sb_qsound_build(p) == 0)
/* set QSound flag and clear all other mode flags */ /* set QSound flag and clear all other mode flags */
p->mode = SNDRV_SB_CSP_MODE_QSOUND; p->mode = SNDRV_SB_CSP_MODE_QSOUND;
...@@ -426,12 +424,12 @@ static int snd_sb_csp_riff_load(snd_sb_csp_t * p, snd_sb_csp_microcode_t __user ...@@ -426,12 +424,12 @@ static int snd_sb_csp_riff_load(snd_sb_csp_t * p, snd_sb_csp_microcode_t __user
p->mode = 0; p->mode = 0;
snd_printd("%s: Unsupported CSP codec type: 0x%04x\n", snd_printd("%s: Unsupported CSP codec type: 0x%04x\n",
__FUNCTION__, __FUNCTION__,
LE_SHORT(funcdesc_h.VOC_type)); le16_to_cpu(funcdesc_h.VOC_type));
return -EINVAL; return -EINVAL;
} }
p->acc_channels = LE_SHORT(funcdesc_h.flags_stereo_mono); p->acc_channels = le16_to_cpu(funcdesc_h.flags_stereo_mono);
p->acc_width = LE_SHORT(funcdesc_h.flags_16bit_8bit); p->acc_width = le16_to_cpu(funcdesc_h.flags_16bit_8bit);
p->acc_rates = LE_SHORT(funcdesc_h.flags_rates); p->acc_rates = le16_to_cpu(funcdesc_h.flags_rates);
/* Decouple CSP from IRQ and DMAREQ lines */ /* Decouple CSP from IRQ and DMAREQ lines */
spin_lock_irqsave(&p->chip->reg_lock, flags); spin_lock_irqsave(&p->chip->reg_lock, flags);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment