diff options
Diffstat (limited to 'sound')
-rw-r--r-- | sound/isa/sb/sb16_csp.c | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/sound/isa/sb/sb16_csp.c b/sound/isa/sb/sb16_csp.c index b62920eead3d..4f1fad49dff4 100644 --- a/sound/isa/sb/sb16_csp.c +++ b/sound/isa/sb/sb16_csp.c | |||
@@ -42,8 +42,6 @@ MODULE_LICENSE("GPL"); | |||
42 | #else | 42 | #else |
43 | #define CSP_HDR_VALUE(a,b,c,d) ((d) | ((c)<<8) | ((b)<<16) | ((a)<<24)) | 43 | #define CSP_HDR_VALUE(a,b,c,d) ((d) | ((c)<<8) | ((b)<<16) | ((a)<<24)) |
44 | #endif | 44 | #endif |
45 | #define LE_SHORT(v) le16_to_cpu(v) | ||
46 | #define LE_INT(v) le32_to_cpu(v) | ||
47 | 45 | ||
48 | #define RIFF_HEADER CSP_HDR_VALUE('R', 'I', 'F', 'F') | 46 | #define RIFF_HEADER CSP_HDR_VALUE('R', 'I', 'F', 'F') |
49 | #define CSP__HEADER CSP_HDR_VALUE('C', 'S', 'P', ' ') | 47 | #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 | if (copy_from_user(&file_h, data_ptr, sizeof(file_h))) | 314 | if (copy_from_user(&file_h, data_ptr, sizeof(file_h))) |
317 | return -EFAULT; | 315 | return -EFAULT; |
318 | if ((file_h.name != RIFF_HEADER) || | 316 | if ((file_h.name != RIFF_HEADER) || |
319 | (LE_INT(file_h.len) >= SNDRV_SB_CSP_MAX_MICROCODE_FILE_SIZE - sizeof(file_h))) { | 317 | (le32_to_cpu(file_h.len) >= SNDRV_SB_CSP_MAX_MICROCODE_FILE_SIZE - sizeof(file_h))) { |
320 | snd_printd("%s: Invalid RIFF header\n", __FUNCTION__); | 318 | snd_printd("%s: Invalid RIFF header\n", __FUNCTION__); |
321 | return -EINVAL; | 319 | return -EINVAL; |
322 | } | 320 | } |
323 | data_ptr += sizeof(file_h); | 321 | data_ptr += sizeof(file_h); |
324 | data_end = data_ptr + LE_INT(file_h.len); | 322 | data_end = data_ptr + le32_to_cpu(file_h.len); |
325 | 323 | ||
326 | if (copy_from_user(&item_type, data_ptr, sizeof(item_type))) | 324 | if (copy_from_user(&item_type, data_ptr, sizeof(item_type))) |
327 | return -EFAULT; | 325 | 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 | } | 329 | } |
332 | data_ptr += sizeof (item_type); | 330 | data_ptr += sizeof (item_type); |
333 | 331 | ||
334 | for (; data_ptr < data_end; data_ptr += LE_INT(item_h.len)) { | 332 | for (; data_ptr < data_end; data_ptr += le32_to_cpu(item_h.len)) { |
335 | if (copy_from_user(&item_h, data_ptr, sizeof(item_h))) | 333 | if (copy_from_user(&item_h, data_ptr, sizeof(item_h))) |
336 | return -EFAULT; | 334 | return -EFAULT; |
337 | data_ptr += sizeof(item_h); | 335 | 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 | case FUNC_HEADER: | 342 | case FUNC_HEADER: |
345 | if (copy_from_user(&funcdesc_h, data_ptr + sizeof(item_type), sizeof(funcdesc_h))) | 343 | if (copy_from_user(&funcdesc_h, data_ptr + sizeof(item_type), sizeof(funcdesc_h))) |
346 | return -EFAULT; | 344 | return -EFAULT; |
347 | func_nr = LE_SHORT(funcdesc_h.func_nr); | 345 | func_nr = le16_to_cpu(funcdesc_h.func_nr); |
348 | break; | 346 | break; |
349 | case CODE_HEADER: | 347 | case CODE_HEADER: |
350 | if (func_nr != info.func_req) | 348 | 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 | if (code_h.name != INIT_HEADER) | 368 | if (code_h.name != INIT_HEADER) |
371 | break; | 369 | break; |
372 | data_ptr += sizeof(code_h); | 370 | data_ptr += sizeof(code_h); |
373 | err = snd_sb_csp_load_user(p, data_ptr, LE_INT(code_h.len), | 371 | err = snd_sb_csp_load_user(p, data_ptr, le32_to_cpu(code_h.len), |
374 | SNDRV_SB_CSP_LOAD_INITBLOCK); | 372 | SNDRV_SB_CSP_LOAD_INITBLOCK); |
375 | if (err) | 373 | if (err) |
376 | return err; | 374 | return err; |
377 | data_ptr += LE_INT(code_h.len); | 375 | data_ptr += le32_to_cpu(code_h.len); |
378 | } | 376 | } |
379 | /* main microcode block */ | 377 | /* main microcode block */ |
380 | if (copy_from_user(&code_h, data_ptr, sizeof(code_h))) | 378 | 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 | } | 384 | } |
387 | data_ptr += sizeof(code_h); | 385 | data_ptr += sizeof(code_h); |
388 | err = snd_sb_csp_load_user(p, data_ptr, | 386 | err = snd_sb_csp_load_user(p, data_ptr, |
389 | LE_INT(code_h.len), 0); | 387 | le32_to_cpu(code_h.len), 0); |
390 | if (err) | 388 | if (err) |
391 | return err; | 389 | return err; |
392 | 390 | ||
393 | /* fill in codec header */ | 391 | /* fill in codec header */ |
394 | strlcpy(p->codec_name, info.codec_name, sizeof(p->codec_name)); | 392 | strlcpy(p->codec_name, info.codec_name, sizeof(p->codec_name)); |
395 | p->func_nr = func_nr; | 393 | p->func_nr = func_nr; |
396 | p->mode = LE_SHORT(funcdesc_h.flags_play_rec); | 394 | p->mode = le16_to_cpu(funcdesc_h.flags_play_rec); |
397 | switch (LE_SHORT(funcdesc_h.VOC_type)) { | 395 | switch (le16_to_cpu(funcdesc_h.VOC_type)) { |
398 | case 0x0001: /* QSound decoder */ | 396 | case 0x0001: /* QSound decoder */ |
399 | if (LE_SHORT(funcdesc_h.flags_play_rec) == SNDRV_SB_CSP_MODE_DSP_WRITE) { | 397 | if (le16_to_cpu(funcdesc_h.flags_play_rec) == SNDRV_SB_CSP_MODE_DSP_WRITE) { |
400 | if (snd_sb_qsound_build(p) == 0) | 398 | if (snd_sb_qsound_build(p) == 0) |
401 | /* set QSound flag and clear all other mode flags */ | 399 | /* set QSound flag and clear all other mode flags */ |
402 | p->mode = SNDRV_SB_CSP_MODE_QSOUND; | 400 | 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 | p->mode = 0; | 424 | p->mode = 0; |
427 | snd_printd("%s: Unsupported CSP codec type: 0x%04x\n", | 425 | snd_printd("%s: Unsupported CSP codec type: 0x%04x\n", |
428 | __FUNCTION__, | 426 | __FUNCTION__, |
429 | LE_SHORT(funcdesc_h.VOC_type)); | 427 | le16_to_cpu(funcdesc_h.VOC_type)); |
430 | return -EINVAL; | 428 | return -EINVAL; |
431 | } | 429 | } |
432 | p->acc_channels = LE_SHORT(funcdesc_h.flags_stereo_mono); | 430 | p->acc_channels = le16_to_cpu(funcdesc_h.flags_stereo_mono); |
433 | p->acc_width = LE_SHORT(funcdesc_h.flags_16bit_8bit); | 431 | p->acc_width = le16_to_cpu(funcdesc_h.flags_16bit_8bit); |
434 | p->acc_rates = LE_SHORT(funcdesc_h.flags_rates); | 432 | p->acc_rates = le16_to_cpu(funcdesc_h.flags_rates); |
435 | 433 | ||
436 | /* Decouple CSP from IRQ and DMAREQ lines */ | 434 | /* Decouple CSP from IRQ and DMAREQ lines */ |
437 | spin_lock_irqsave(&p->chip->reg_lock, flags); | 435 | spin_lock_irqsave(&p->chip->reg_lock, flags); |