Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'sound-fix-5.6-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound

Pull sound fixes from Takashi Iwai:
"A collection of pending small fixes:

ALSA core:
- PCM memory leak fix

ASoC:
- Lots of SOF and Intel driver fixes
- Addition of COMMON_CLK for wcd934x
- Regression fixes for AMD and Tegra platforms

HD-audio:
- DP-MST HDMI regression fix, Tegra workarounds, HP quirk fix

Others:
- A few fixes relevant with the recent uapi-updates
- Sparse warnings and endianness fixes"

* tag 'sound-fix-5.6-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound: (35 commits)
ALSA: hda: Clear RIRB status before reading WP
ALSA: hda/realtek - Fixed one of HP ALC671 platform Headset Mic supported
ASoC: wcd934x: Add missing COMMON_CLK dependency to SND_SOC_ALL_CODECS
ALSA: hda - Fix DP-MST support for NVIDIA codecs
ASoC: wcd934x: Add missing COMMON_CLK dependency
MAINTAINERS: Remove the Bard Liao from the MAINTAINERS of Realtek CODECs
ASoC: tegra: Revert 24 and 32 bit support
ASoC: SOF: Intel: add PCI ID for JasperLake
ALSA: hdsp: Make the firmware loading ioctl a bit more readable
ALSA: emu10k1: Fix annotation and cast for the recent uapi header change
ALSA: dummy: Fix PCM format loop in proc output
ALSA: usb-audio: Annotate endianess in Scarlett gen2 quirk
ALSA: usb-audio: Fix endianess in descriptor validation
ALSA: hda: Add JasperLake PCI ID and codec vid
ALSA: pcm: Fix sparse warnings wrt snd_pcm_state_t
ALSA: pcm: Fix memory leak at closing a stream without hw_free
ALSA: uapi: Fix sparse warning
ASoC: rt715: Add __maybe_unused to PM callbacks
ASoC: rt711: Add __maybe_unused to PM callbacks
ASoC: rt700: Add __maybe_unused to PM callbacks
...

+491 -364
-1
MAINTAINERS
··· 14106 14106 F: tools/testing/selftests/rtc/ 14107 14107 14108 14108 REALTEK AUDIO CODECS 14109 - M: Bard Liao <bardliao@realtek.com> 14110 14109 M: Oder Chiou <oder_chiou@realtek.com> 14111 14110 S: Maintained 14112 14111 F: sound/soc/codecs/rt*
+2 -2
include/sound/pcm.h
··· 1450 1450 #define SNDRV_PCM_IOCTL_STATUS_EXT64 _IOWR('A', 0x24, struct snd_pcm_status64) 1451 1451 1452 1452 struct snd_pcm_status32 { 1453 - s32 state; /* stream state */ 1453 + snd_pcm_state_t state; /* stream state */ 1454 1454 s32 trigger_tstamp_sec; /* time when stream was started/stopped/paused */ 1455 1455 s32 trigger_tstamp_nsec; 1456 1456 s32 tstamp_sec; /* reference timestamp */ ··· 1461 1461 u32 avail; /* number of frames available */ 1462 1462 u32 avail_max; /* max frames available on hw since last status */ 1463 1463 u32 overrange; /* count of ADC (capture) overrange detections from last status */ 1464 - s32 suspended_state; /* suspended stream state */ 1464 + snd_pcm_state_t suspended_state; /* suspended stream state */ 1465 1465 u32 audio_tstamp_data; /* needed for 64-bit alignment, used for configs/report to/from userspace */ 1466 1466 s32 audio_tstamp_sec; /* sample counter, wall clock, PHC or on-demand sync'ed */ 1467 1467 s32 audio_tstamp_nsec;
+2 -2
include/uapi/sound/asound.h
··· 564 564 #endif 565 565 566 566 struct __snd_pcm_mmap_status64 { 567 - __s32 state; /* RO: state - SNDRV_PCM_STATE_XXXX */ 567 + snd_pcm_state_t state; /* RO: state - SNDRV_PCM_STATE_XXXX */ 568 568 __u32 pad1; /* Needed for 64 bit alignment */ 569 569 __pad_before_uframe __pad1; 570 570 snd_pcm_uframes_t hw_ptr; /* RO: hw ptr (0...boundary-1) */ 571 571 __pad_after_uframe __pad2; 572 572 struct __snd_timespec64 tstamp; /* Timestamp */ 573 - __s32 suspended_state; /* RO: suspended stream state */ 573 + snd_pcm_state_t suspended_state;/* RO: suspended stream state */ 574 574 __u32 pad3; /* Needed for 64 bit alignment */ 575 575 struct __snd_timespec64 audio_tstamp; /* sample counter or wall clock */ 576 576 };
+4 -4
sound/core/pcm_compat.c
··· 156 156 #endif /* CONFIG_X86_X32 */ 157 157 158 158 struct compat_snd_pcm_status64 { 159 - s32 state; 159 + snd_pcm_state_t state; 160 160 u8 rsvd[4]; /* alignment */ 161 161 s64 trigger_tstamp_sec; 162 162 s64 trigger_tstamp_nsec; ··· 168 168 u32 avail; 169 169 u32 avail_max; 170 170 u32 overrange; 171 - s32 suspended_state; 171 + snd_pcm_state_t suspended_state; 172 172 u32 audio_tstamp_data; 173 173 s64 audio_tstamp_sec; 174 174 s64 audio_tstamp_nsec; ··· 376 376 #ifdef CONFIG_X86_X32 377 377 /* X32 ABI has 64bit timespec and 64bit alignment */ 378 378 struct snd_pcm_mmap_status_x32 { 379 - s32 state; 379 + snd_pcm_state_t state; 380 380 s32 pad1; 381 381 u32 hw_ptr; 382 382 u32 pad2; /* alignment */ 383 383 s64 tstamp_sec; 384 384 s64 tstamp_nsec; 385 - s32 suspended_state; 385 + snd_pcm_state_t suspended_state; 386 386 s32 pad3; 387 387 s64 audio_tstamp_sec; 388 388 s64 audio_tstamp_nsec;
+136 -75
sound/core/pcm_native.c
··· 551 551 return usecs; 552 552 } 553 553 554 - static void snd_pcm_set_state(struct snd_pcm_substream *substream, int state) 554 + static void snd_pcm_set_state(struct snd_pcm_substream *substream, 555 + snd_pcm_state_t state) 555 556 { 556 557 snd_pcm_stream_lock_irq(substream); 557 558 if (substream->runtime->status->state != SNDRV_PCM_STATE_DISCONNECTED) ··· 787 786 return err; 788 787 } 789 788 789 + static int do_hw_free(struct snd_pcm_substream *substream) 790 + { 791 + int result = 0; 792 + 793 + snd_pcm_sync_stop(substream); 794 + if (substream->ops->hw_free) 795 + result = substream->ops->hw_free(substream); 796 + if (substream->managed_buffer_alloc) 797 + snd_pcm_lib_free_pages(substream); 798 + return result; 799 + } 800 + 790 801 static int snd_pcm_hw_free(struct snd_pcm_substream *substream) 791 802 { 792 803 struct snd_pcm_runtime *runtime; 793 - int result = 0; 804 + int result; 794 805 795 806 if (PCM_RUNTIME_CHECK(substream)) 796 807 return -ENXIO; ··· 819 806 snd_pcm_stream_unlock_irq(substream); 820 807 if (atomic_read(&substream->mmap_count)) 821 808 return -EBADFD; 822 - snd_pcm_sync_stop(substream); 823 - if (substream->ops->hw_free) 824 - result = substream->ops->hw_free(substream); 825 - if (substream->managed_buffer_alloc) 826 - snd_pcm_lib_free_pages(substream); 809 + result = do_hw_free(substream); 827 810 snd_pcm_set_state(substream, SNDRV_PCM_STATE_OPEN); 828 811 pm_qos_remove_request(&substream->latency_pm_qos_req); 829 812 return result; ··· 1106 1097 runtime->trigger_master = NULL; 1107 1098 } 1108 1099 1100 + #define ACTION_ARG_IGNORE (__force snd_pcm_state_t)0 1101 + 1109 1102 struct action_ops { 1110 - int (*pre_action)(struct snd_pcm_substream *substream, int state); 1111 - int (*do_action)(struct snd_pcm_substream *substream, int state); 1112 - void (*undo_action)(struct snd_pcm_substream *substream, int state); 1113 - void (*post_action)(struct snd_pcm_substream *substream, int state); 1103 + int (*pre_action)(struct snd_pcm_substream *substream, 1104 + snd_pcm_state_t state); 1105 + int (*do_action)(struct snd_pcm_substream *substream, 1106 + snd_pcm_state_t state); 1107 + void (*undo_action)(struct snd_pcm_substream *substream, 1108 + snd_pcm_state_t state); 1109 + void (*post_action)(struct snd_pcm_substream *substream, 1110 + snd_pcm_state_t state); 1114 1111 }; 1115 1112 1116 1113 /* ··· 1126 1111 */ 1127 1112 static int snd_pcm_action_group(const struct action_ops *ops, 1128 1113 struct snd_pcm_substream *substream, 1129 - int state, int do_lock) 1114 + snd_pcm_state_t state, 1115 + bool do_lock) 1130 1116 { 1131 1117 struct snd_pcm_substream *s = NULL; 1132 1118 struct snd_pcm_substream *s1; ··· 1184 1168 */ 1185 1169 static int snd_pcm_action_single(const struct action_ops *ops, 1186 1170 struct snd_pcm_substream *substream, 1187 - int state) 1171 + snd_pcm_state_t state) 1188 1172 { 1189 1173 int res; 1190 1174 ··· 1265 1249 */ 1266 1250 static int snd_pcm_action(const struct action_ops *ops, 1267 1251 struct snd_pcm_substream *substream, 1268 - int state) 1252 + snd_pcm_state_t state) 1269 1253 { 1270 1254 struct snd_pcm_group *group; 1271 1255 int res; 1272 1256 1273 1257 group = snd_pcm_stream_group_ref(substream); 1274 1258 if (group) 1275 - res = snd_pcm_action_group(ops, substream, state, 1); 1259 + res = snd_pcm_action_group(ops, substream, state, true); 1276 1260 else 1277 1261 res = snd_pcm_action_single(ops, substream, state); 1278 1262 snd_pcm_group_unref(group, substream); ··· 1284 1268 */ 1285 1269 static int snd_pcm_action_lock_irq(const struct action_ops *ops, 1286 1270 struct snd_pcm_substream *substream, 1287 - int state) 1271 + snd_pcm_state_t state) 1288 1272 { 1289 1273 int res; 1290 1274 ··· 1298 1282 */ 1299 1283 static int snd_pcm_action_nonatomic(const struct action_ops *ops, 1300 1284 struct snd_pcm_substream *substream, 1301 - int state) 1285 + snd_pcm_state_t state) 1302 1286 { 1303 1287 int res; 1304 1288 1305 1289 /* Guarantee the group members won't change during non-atomic action */ 1306 1290 down_read(&snd_pcm_link_rwsem); 1307 1291 if (snd_pcm_stream_linked(substream)) 1308 - res = snd_pcm_action_group(ops, substream, state, 0); 1292 + res = snd_pcm_action_group(ops, substream, state, false); 1309 1293 else 1310 1294 res = snd_pcm_action_single(ops, substream, state); 1311 1295 up_read(&snd_pcm_link_rwsem); ··· 1315 1299 /* 1316 1300 * start callbacks 1317 1301 */ 1318 - static int snd_pcm_pre_start(struct snd_pcm_substream *substream, int state) 1302 + static int snd_pcm_pre_start(struct snd_pcm_substream *substream, 1303 + snd_pcm_state_t state) 1319 1304 { 1320 1305 struct snd_pcm_runtime *runtime = substream->runtime; 1321 1306 if (runtime->status->state != SNDRV_PCM_STATE_PREPARED) ··· 1329 1312 return 0; 1330 1313 } 1331 1314 1332 - static int snd_pcm_do_start(struct snd_pcm_substream *substream, int state) 1315 + static int snd_pcm_do_start(struct snd_pcm_substream *substream, 1316 + snd_pcm_state_t state) 1333 1317 { 1334 1318 if (substream->runtime->trigger_master != substream) 1335 1319 return 0; 1336 1320 return substream->ops->trigger(substream, SNDRV_PCM_TRIGGER_START); 1337 1321 } 1338 1322 1339 - static void snd_pcm_undo_start(struct snd_pcm_substream *substream, int state) 1323 + static void snd_pcm_undo_start(struct snd_pcm_substream *substream, 1324 + snd_pcm_state_t state) 1340 1325 { 1341 1326 if (substream->runtime->trigger_master == substream) 1342 1327 substream->ops->trigger(substream, SNDRV_PCM_TRIGGER_STOP); 1343 1328 } 1344 1329 1345 - static void snd_pcm_post_start(struct snd_pcm_substream *substream, int state) 1330 + static void snd_pcm_post_start(struct snd_pcm_substream *substream, 1331 + snd_pcm_state_t state) 1346 1332 { 1347 1333 struct snd_pcm_runtime *runtime = substream->runtime; 1348 1334 snd_pcm_trigger_tstamp(substream); ··· 1389 1369 /* 1390 1370 * stop callbacks 1391 1371 */ 1392 - static int snd_pcm_pre_stop(struct snd_pcm_substream *substream, int state) 1372 + static int snd_pcm_pre_stop(struct snd_pcm_substream *substream, 1373 + snd_pcm_state_t state) 1393 1374 { 1394 1375 struct snd_pcm_runtime *runtime = substream->runtime; 1395 1376 if (runtime->status->state == SNDRV_PCM_STATE_OPEN) ··· 1399 1378 return 0; 1400 1379 } 1401 1380 1402 - static int snd_pcm_do_stop(struct snd_pcm_substream *substream, int state) 1381 + static int snd_pcm_do_stop(struct snd_pcm_substream *substream, 1382 + snd_pcm_state_t state) 1403 1383 { 1404 1384 if (substream->runtime->trigger_master == substream && 1405 1385 snd_pcm_running(substream)) ··· 1408 1386 return 0; /* unconditonally stop all substreams */ 1409 1387 } 1410 1388 1411 - static void snd_pcm_post_stop(struct snd_pcm_substream *substream, int state) 1389 + static void snd_pcm_post_stop(struct snd_pcm_substream *substream, 1390 + snd_pcm_state_t state) 1412 1391 { 1413 1392 struct snd_pcm_runtime *runtime = substream->runtime; 1414 1393 if (runtime->status->state != state) { ··· 1480 1457 EXPORT_SYMBOL_GPL(snd_pcm_stop_xrun); 1481 1458 1482 1459 /* 1483 - * pause callbacks 1460 + * pause callbacks: pass boolean (to start pause or resume) as state argument 1484 1461 */ 1485 - static int snd_pcm_pre_pause(struct snd_pcm_substream *substream, int push) 1462 + #define pause_pushed(state) (__force bool)(state) 1463 + 1464 + static int snd_pcm_pre_pause(struct snd_pcm_substream *substream, 1465 + snd_pcm_state_t state) 1486 1466 { 1487 1467 struct snd_pcm_runtime *runtime = substream->runtime; 1488 1468 if (!(runtime->info & SNDRV_PCM_INFO_PAUSE)) 1489 1469 return -ENOSYS; 1490 - if (push) { 1470 + if (pause_pushed(state)) { 1491 1471 if (runtime->status->state != SNDRV_PCM_STATE_RUNNING) 1492 1472 return -EBADFD; 1493 1473 } else if (runtime->status->state != SNDRV_PCM_STATE_PAUSED) ··· 1499 1473 return 0; 1500 1474 } 1501 1475 1502 - static int snd_pcm_do_pause(struct snd_pcm_substream *substream, int push) 1476 + static int snd_pcm_do_pause(struct snd_pcm_substream *substream, 1477 + snd_pcm_state_t state) 1503 1478 { 1504 1479 if (substream->runtime->trigger_master != substream) 1505 1480 return 0; 1506 1481 /* some drivers might use hw_ptr to recover from the pause - 1507 1482 update the hw_ptr now */ 1508 - if (push) 1483 + if (pause_pushed(state)) 1509 1484 snd_pcm_update_hw_ptr(substream); 1510 1485 /* The jiffies check in snd_pcm_update_hw_ptr*() is done by 1511 1486 * a delta between the current jiffies, this gives a large enough ··· 1514 1487 */ 1515 1488 substream->runtime->hw_ptr_jiffies = jiffies - HZ * 1000; 1516 1489 return substream->ops->trigger(substream, 1517 - push ? SNDRV_PCM_TRIGGER_PAUSE_PUSH : 1518 - SNDRV_PCM_TRIGGER_PAUSE_RELEASE); 1490 + pause_pushed(state) ? 1491 + SNDRV_PCM_TRIGGER_PAUSE_PUSH : 1492 + SNDRV_PCM_TRIGGER_PAUSE_RELEASE); 1519 1493 } 1520 1494 1521 - static void snd_pcm_undo_pause(struct snd_pcm_substream *substream, int push) 1495 + static void snd_pcm_undo_pause(struct snd_pcm_substream *substream, 1496 + snd_pcm_state_t state) 1522 1497 { 1523 1498 if (substream->runtime->trigger_master == substream) 1524 1499 substream->ops->trigger(substream, 1525 - push ? SNDRV_PCM_TRIGGER_PAUSE_RELEASE : 1500 + pause_pushed(state) ? 1501 + SNDRV_PCM_TRIGGER_PAUSE_RELEASE : 1526 1502 SNDRV_PCM_TRIGGER_PAUSE_PUSH); 1527 1503 } 1528 1504 1529 - static void snd_pcm_post_pause(struct snd_pcm_substream *substream, int push) 1505 + static void snd_pcm_post_pause(struct snd_pcm_substream *substream, 1506 + snd_pcm_state_t state) 1530 1507 { 1531 1508 struct snd_pcm_runtime *runtime = substream->runtime; 1532 1509 snd_pcm_trigger_tstamp(substream); 1533 - if (push) { 1510 + if (pause_pushed(state)) { 1534 1511 runtime->status->state = SNDRV_PCM_STATE_PAUSED; 1535 1512 snd_pcm_timer_notify(substream, SNDRV_TIMER_EVENT_MPAUSE); 1536 1513 wake_up(&runtime->sleep); ··· 1555 1524 /* 1556 1525 * Push/release the pause for all linked streams. 1557 1526 */ 1558 - static int snd_pcm_pause(struct snd_pcm_substream *substream, int push) 1527 + static int snd_pcm_pause(struct snd_pcm_substream *substream, bool push) 1559 1528 { 1560 - return snd_pcm_action(&snd_pcm_action_pause, substream, push); 1529 + return snd_pcm_action(&snd_pcm_action_pause, substream, 1530 + (__force snd_pcm_state_t)push); 1531 + } 1532 + 1533 + static int snd_pcm_pause_lock_irq(struct snd_pcm_substream *substream, 1534 + bool push) 1535 + { 1536 + return snd_pcm_action_lock_irq(&snd_pcm_action_pause, substream, 1537 + (__force snd_pcm_state_t)push); 1561 1538 } 1562 1539 1563 1540 #ifdef CONFIG_PM 1564 - /* suspend */ 1541 + /* suspend callback: state argument ignored */ 1565 1542 1566 - static int snd_pcm_pre_suspend(struct snd_pcm_substream *substream, int state) 1543 + static int snd_pcm_pre_suspend(struct snd_pcm_substream *substream, 1544 + snd_pcm_state_t state) 1567 1545 { 1568 1546 struct snd_pcm_runtime *runtime = substream->runtime; 1569 1547 switch (runtime->status->state) { ··· 1588 1548 return 0; 1589 1549 } 1590 1550 1591 - static int snd_pcm_do_suspend(struct snd_pcm_substream *substream, int state) 1551 + static int snd_pcm_do_suspend(struct snd_pcm_substream *substream, 1552 + snd_pcm_state_t state) 1592 1553 { 1593 1554 struct snd_pcm_runtime *runtime = substream->runtime; 1594 1555 if (runtime->trigger_master != substream) ··· 1600 1559 return 0; /* suspend unconditionally */ 1601 1560 } 1602 1561 1603 - static void snd_pcm_post_suspend(struct snd_pcm_substream *substream, int state) 1562 + static void snd_pcm_post_suspend(struct snd_pcm_substream *substream, 1563 + snd_pcm_state_t state) 1604 1564 { 1605 1565 struct snd_pcm_runtime *runtime = substream->runtime; 1606 1566 snd_pcm_trigger_tstamp(substream); ··· 1632 1590 unsigned long flags; 1633 1591 1634 1592 snd_pcm_stream_lock_irqsave(substream, flags); 1635 - err = snd_pcm_action(&snd_pcm_action_suspend, substream, 0); 1593 + err = snd_pcm_action(&snd_pcm_action_suspend, substream, 1594 + ACTION_ARG_IGNORE); 1636 1595 snd_pcm_stream_unlock_irqrestore(substream, flags); 1637 1596 return err; 1638 1597 } ··· 1677 1634 } 1678 1635 EXPORT_SYMBOL(snd_pcm_suspend_all); 1679 1636 1680 - /* resume */ 1637 + /* resume callbacks: state argument ignored */ 1681 1638 1682 - static int snd_pcm_pre_resume(struct snd_pcm_substream *substream, int state) 1639 + static int snd_pcm_pre_resume(struct snd_pcm_substream *substream, 1640 + snd_pcm_state_t state) 1683 1641 { 1684 1642 struct snd_pcm_runtime *runtime = substream->runtime; 1685 1643 if (!(runtime->info & SNDRV_PCM_INFO_RESUME)) ··· 1689 1645 return 0; 1690 1646 } 1691 1647 1692 - static int snd_pcm_do_resume(struct snd_pcm_substream *substream, int state) 1648 + static int snd_pcm_do_resume(struct snd_pcm_substream *substream, 1649 + snd_pcm_state_t state) 1693 1650 { 1694 1651 struct snd_pcm_runtime *runtime = substream->runtime; 1695 1652 if (runtime->trigger_master != substream) ··· 1703 1658 return substream->ops->trigger(substream, SNDRV_PCM_TRIGGER_RESUME); 1704 1659 } 1705 1660 1706 - static void snd_pcm_undo_resume(struct snd_pcm_substream *substream, int state) 1661 + static void snd_pcm_undo_resume(struct snd_pcm_substream *substream, 1662 + snd_pcm_state_t state) 1707 1663 { 1708 1664 if (substream->runtime->trigger_master == substream && 1709 1665 snd_pcm_running(substream)) 1710 1666 substream->ops->trigger(substream, SNDRV_PCM_TRIGGER_SUSPEND); 1711 1667 } 1712 1668 1713 - static void snd_pcm_post_resume(struct snd_pcm_substream *substream, int state) 1669 + static void snd_pcm_post_resume(struct snd_pcm_substream *substream, 1670 + snd_pcm_state_t state) 1714 1671 { 1715 1672 struct snd_pcm_runtime *runtime = substream->runtime; 1716 1673 snd_pcm_trigger_tstamp(substream); ··· 1730 1683 1731 1684 static int snd_pcm_resume(struct snd_pcm_substream *substream) 1732 1685 { 1733 - return snd_pcm_action_lock_irq(&snd_pcm_action_resume, substream, 0); 1686 + return snd_pcm_action_lock_irq(&snd_pcm_action_resume, substream, 1687 + ACTION_ARG_IGNORE); 1734 1688 } 1735 1689 1736 1690 #else ··· 1772 1724 /* 1773 1725 * reset ioctl 1774 1726 */ 1775 - static int snd_pcm_pre_reset(struct snd_pcm_substream *substream, int state) 1727 + /* reset callbacks: state argument ignored */ 1728 + static int snd_pcm_pre_reset(struct snd_pcm_substream *substream, 1729 + snd_pcm_state_t state) 1776 1730 { 1777 1731 struct snd_pcm_runtime *runtime = substream->runtime; 1778 1732 switch (runtime->status->state) { ··· 1788 1738 } 1789 1739 } 1790 1740 1791 - static int snd_pcm_do_reset(struct snd_pcm_substream *substream, int state) 1741 + static int snd_pcm_do_reset(struct snd_pcm_substream *substream, 1742 + snd_pcm_state_t state) 1792 1743 { 1793 1744 struct snd_pcm_runtime *runtime = substream->runtime; 1794 1745 int err = snd_pcm_ops_ioctl(substream, SNDRV_PCM_IOCTL1_RESET, NULL); ··· 1803 1752 return 0; 1804 1753 } 1805 1754 1806 - static void snd_pcm_post_reset(struct snd_pcm_substream *substream, int state) 1755 + static void snd_pcm_post_reset(struct snd_pcm_substream *substream, 1756 + snd_pcm_state_t state) 1807 1757 { 1808 1758 struct snd_pcm_runtime *runtime = substream->runtime; 1809 1759 runtime->control->appl_ptr = runtime->status->hw_ptr; ··· 1821 1769 1822 1770 static int snd_pcm_reset(struct snd_pcm_substream *substream) 1823 1771 { 1824 - return snd_pcm_action_nonatomic(&snd_pcm_action_reset, substream, 0); 1772 + return snd_pcm_action_nonatomic(&snd_pcm_action_reset, substream, 1773 + ACTION_ARG_IGNORE); 1825 1774 } 1826 1775 1827 1776 /* 1828 1777 * prepare ioctl 1829 1778 */ 1830 - /* we use the second argument for updating f_flags */ 1779 + /* pass f_flags as state argument */ 1831 1780 static int snd_pcm_pre_prepare(struct snd_pcm_substream *substream, 1832 - int f_flags) 1781 + snd_pcm_state_t state) 1833 1782 { 1834 1783 struct snd_pcm_runtime *runtime = substream->runtime; 1784 + int f_flags = (__force int)state; 1785 + 1835 1786 if (runtime->status->state == SNDRV_PCM_STATE_OPEN || 1836 1787 runtime->status->state == SNDRV_PCM_STATE_DISCONNECTED) 1837 1788 return -EBADFD; ··· 1844 1789 return 0; 1845 1790 } 1846 1791 1847 - static int snd_pcm_do_prepare(struct snd_pcm_substream *substream, int state) 1792 + static int snd_pcm_do_prepare(struct snd_pcm_substream *substream, 1793 + snd_pcm_state_t state) 1848 1794 { 1849 1795 int err; 1850 1796 snd_pcm_sync_stop(substream); 1851 1797 err = substream->ops->prepare(substream); 1852 1798 if (err < 0) 1853 1799 return err; 1854 - return snd_pcm_do_reset(substream, 0); 1800 + return snd_pcm_do_reset(substream, state); 1855 1801 } 1856 1802 1857 - static void snd_pcm_post_prepare(struct snd_pcm_substream *substream, int state) 1803 + static void snd_pcm_post_prepare(struct snd_pcm_substream *substream, 1804 + snd_pcm_state_t state) 1858 1805 { 1859 1806 struct snd_pcm_runtime *runtime = substream->runtime; 1860 1807 runtime->control->appl_ptr = runtime->status->hw_ptr; ··· 1889 1832 snd_pcm_stream_lock_irq(substream); 1890 1833 switch (substream->runtime->status->state) { 1891 1834 case SNDRV_PCM_STATE_PAUSED: 1892 - snd_pcm_pause(substream, 0); 1835 + snd_pcm_pause(substream, false); 1893 1836 /* fallthru */ 1894 1837 case SNDRV_PCM_STATE_SUSPENDED: 1895 1838 snd_pcm_stop(substream, SNDRV_PCM_STATE_SETUP); ··· 1898 1841 snd_pcm_stream_unlock_irq(substream); 1899 1842 1900 1843 return snd_pcm_action_nonatomic(&snd_pcm_action_prepare, 1901 - substream, f_flags); 1844 + substream, 1845 + (__force snd_pcm_state_t)f_flags); 1902 1846 } 1903 1847 1904 1848 /* 1905 1849 * drain ioctl 1906 1850 */ 1907 1851 1908 - static int snd_pcm_pre_drain_init(struct snd_pcm_substream *substream, int state) 1852 + /* drain init callbacks: state argument ignored */ 1853 + static int snd_pcm_pre_drain_init(struct snd_pcm_substream *substream, 1854 + snd_pcm_state_t state) 1909 1855 { 1910 1856 struct snd_pcm_runtime *runtime = substream->runtime; 1911 1857 switch (runtime->status->state) { ··· 1921 1861 return 0; 1922 1862 } 1923 1863 1924 - static int snd_pcm_do_drain_init(struct snd_pcm_substream *substream, int state) 1864 + static int snd_pcm_do_drain_init(struct snd_pcm_substream *substream, 1865 + snd_pcm_state_t state) 1925 1866 { 1926 1867 struct snd_pcm_runtime *runtime = substream->runtime; 1927 1868 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { ··· 1948 1887 } else { 1949 1888 /* stop running stream */ 1950 1889 if (runtime->status->state == SNDRV_PCM_STATE_RUNNING) { 1951 - int new_state = snd_pcm_capture_avail(runtime) > 0 ? 1890 + snd_pcm_state_t new_state; 1891 + 1892 + new_state = snd_pcm_capture_avail(runtime) > 0 ? 1952 1893 SNDRV_PCM_STATE_DRAINING : SNDRV_PCM_STATE_SETUP; 1953 1894 snd_pcm_do_stop(substream, new_state); 1954 1895 snd_pcm_post_stop(substream, new_state); ··· 1966 1903 return 0; 1967 1904 } 1968 1905 1969 - static void snd_pcm_post_drain_init(struct snd_pcm_substream *substream, int state) 1906 + static void snd_pcm_post_drain_init(struct snd_pcm_substream *substream, 1907 + snd_pcm_state_t state) 1970 1908 { 1971 1909 } 1972 1910 ··· 2010 1946 snd_pcm_stream_lock_irq(substream); 2011 1947 /* resume pause */ 2012 1948 if (runtime->status->state == SNDRV_PCM_STATE_PAUSED) 2013 - snd_pcm_pause(substream, 0); 1949 + snd_pcm_pause(substream, false); 2014 1950 2015 1951 /* pre-start/stop - all running streams are changed to DRAINING state */ 2016 - result = snd_pcm_action(&snd_pcm_action_drain_init, substream, 0); 1952 + result = snd_pcm_action(&snd_pcm_action_drain_init, substream, 1953 + ACTION_ARG_IGNORE); 2017 1954 if (result < 0) 2018 1955 goto unlock; 2019 1956 /* in non-blocking, we don't wait in ioctl but let caller poll */ ··· 2115 2050 snd_pcm_stream_lock_irq(substream); 2116 2051 /* resume pause */ 2117 2052 if (runtime->status->state == SNDRV_PCM_STATE_PAUSED) 2118 - snd_pcm_pause(substream, 0); 2053 + snd_pcm_pause(substream, false); 2119 2054 2120 2055 snd_pcm_stop(substream, SNDRV_PCM_STATE_SETUP); 2121 2056 /* runtime->control->appl_ptr = runtime->status->hw_ptr; */ ··· 2594 2529 2595 2530 snd_pcm_drop(substream); 2596 2531 if (substream->hw_opened) { 2597 - if (substream->ops->hw_free && 2598 - substream->runtime->status->state != SNDRV_PCM_STATE_OPEN) 2599 - substream->ops->hw_free(substream); 2532 + do_hw_free(substream); 2600 2533 substream->ops->close(substream); 2601 2534 substream->hw_opened = 0; 2602 2535 } ··· 2957 2894 } 2958 2895 2959 2896 struct snd_pcm_mmap_status32 { 2960 - s32 state; 2897 + snd_pcm_state_t state; 2961 2898 s32 pad1; 2962 2899 u32 hw_ptr; 2963 2900 s32 tstamp_sec; 2964 2901 s32 tstamp_nsec; 2965 - s32 suspended_state; 2902 + snd_pcm_state_t suspended_state; 2966 2903 s32 audio_tstamp_sec; 2967 2904 s32 audio_tstamp_nsec; 2968 2905 } __attribute__((packed)); ··· 3240 3177 case SNDRV_PCM_IOCTL_DROP: 3241 3178 return snd_pcm_drop(substream); 3242 3179 case SNDRV_PCM_IOCTL_PAUSE: 3243 - return snd_pcm_action_lock_irq(&snd_pcm_action_pause, 3244 - substream, 3245 - (int)(unsigned long)arg); 3180 + return snd_pcm_pause_lock_irq(substream, (unsigned long)arg); 3246 3181 case SNDRV_PCM_IOCTL_WRITEI_FRAMES: 3247 3182 case SNDRV_PCM_IOCTL_READI_FRAMES: 3248 3183 return snd_pcm_xferi_frames_ioctl(substream, arg);
+1 -1
sound/drivers/dummy.c
··· 903 903 { 904 904 int i; 905 905 906 - for (i = 0; i < SNDRV_PCM_FORMAT_LAST; i++) { 906 + for (i = 0; i <= SNDRV_PCM_FORMAT_LAST; i++) { 907 907 if (dummy->pcm_hw.formats & (1ULL << i)) 908 908 snd_iprintf(buffer, " %s", snd_pcm_format_name(i)); 909 909 }
+19 -12
sound/hda/hdac_stream.c
··· 631 631 nwait = 0; 632 632 i = 0; 633 633 list_for_each_entry(s, &bus->stream_list, list) { 634 - if (streams & (1 << i)) { 635 - if (start) { 636 - /* check FIFO gets ready */ 637 - if (!(snd_hdac_stream_readb(s, SD_STS) & 638 - SD_STS_FIFO_READY)) 639 - nwait++; 640 - } else { 641 - /* check RUN bit is cleared */ 642 - if (snd_hdac_stream_readb(s, SD_CTL) & 643 - SD_CTL_DMA_START) 644 - nwait++; 634 + if (!(streams & (1 << i++))) 635 + continue; 636 + 637 + if (start) { 638 + /* check FIFO gets ready */ 639 + if (!(snd_hdac_stream_readb(s, SD_STS) & 640 + SD_STS_FIFO_READY)) 641 + nwait++; 642 + } else { 643 + /* check RUN bit is cleared */ 644 + if (snd_hdac_stream_readb(s, SD_CTL) & 645 + SD_CTL_DMA_START) { 646 + nwait++; 647 + /* 648 + * Perform stream reset if DMA RUN 649 + * bit not cleared within given timeout 650 + */ 651 + if (timeout == 1) 652 + snd_hdac_stream_reset(s); 645 653 } 646 654 } 647 - i++; 648 655 } 649 656 if (!nwait) 650 657 break;
+101 -79
sound/pci/emu10k1/emufx.c
··· 463 463 u_int32_t *code; 464 464 if (snd_BUG_ON(*ptr >= 512)) 465 465 return; 466 - code = (u_int32_t __force *)icode->code + (*ptr) * 2; 466 + code = icode->code + (*ptr) * 2; 467 467 set_bit(*ptr, icode->code_valid); 468 468 code[0] = ((x & 0x3ff) << 10) | (y & 0x3ff); 469 469 code[1] = ((op & 0x0f) << 20) | ((r & 0x3ff) << 10) | (a & 0x3ff); ··· 480 480 u_int32_t *code; 481 481 if (snd_BUG_ON(*ptr >= 1024)) 482 482 return; 483 - code = (u_int32_t __force *)icode->code + (*ptr) * 2; 483 + code = icode->code + (*ptr) * 2; 484 484 set_bit(*ptr, icode->code_valid); 485 485 code[0] = ((x & 0x7ff) << 12) | (y & 0x7ff); 486 486 code[1] = ((op & 0x0f) << 24) | ((r & 0x7ff) << 12) | (a & 0x7ff); ··· 513 513 if (!test_bit(gpr, icode->gpr_valid)) 514 514 continue; 515 515 if (in_kernel) 516 - val = *(__force u32 *)&icode->gpr_map[gpr]; 517 - else if (get_user(val, &icode->gpr_map[gpr])) 516 + val = icode->gpr_map[gpr]; 517 + else if (get_user(val, (__user u32 *)&icode->gpr_map[gpr])) 518 518 return -EFAULT; 519 519 snd_emu10k1_ptr_write(emu, emu->gpr_base + gpr, 0, val); 520 520 } ··· 530 530 for (gpr = 0; gpr < (emu->audigy ? 0x200 : 0x100); gpr++) { 531 531 set_bit(gpr, icode->gpr_valid); 532 532 val = snd_emu10k1_ptr_read(emu, emu->gpr_base + gpr, 0); 533 - if (put_user(val, &icode->gpr_map[gpr])) 533 + if (put_user(val, (__user u32 *)&icode->gpr_map[gpr])) 534 534 return -EFAULT; 535 535 } 536 536 return 0; ··· 547 547 if (!test_bit(tram, icode->tram_valid)) 548 548 continue; 549 549 if (in_kernel) { 550 - val = *(__force u32 *)&icode->tram_data_map[tram]; 551 - addr = *(__force u32 *)&icode->tram_addr_map[tram]; 550 + val = icode->tram_data_map[tram]; 551 + addr = icode->tram_addr_map[tram]; 552 552 } else { 553 - if (get_user(val, &icode->tram_data_map[tram]) || 554 - get_user(addr, &icode->tram_addr_map[tram])) 553 + if (get_user(val, (__user __u32 *)&icode->tram_data_map[tram]) || 554 + get_user(addr, (__user __u32 *)&icode->tram_addr_map[tram])) 555 555 return -EFAULT; 556 556 } 557 557 snd_emu10k1_ptr_write(emu, TANKMEMDATAREGBASE + tram, 0, val); ··· 581 581 addr = snd_emu10k1_ptr_read(emu, TANKMEMADDRREGBASE + tram, 0) >> 12; 582 582 addr |= snd_emu10k1_ptr_read(emu, A_TANKMEMCTLREGBASE + tram, 0) << 20; 583 583 } 584 - if (put_user(val, &icode->tram_data_map[tram]) || 585 - put_user(addr, &icode->tram_addr_map[tram])) 584 + if (put_user(val, (__user u32 *)&icode->tram_data_map[tram]) || 585 + put_user(addr, (__user u32 *)&icode->tram_addr_map[tram])) 586 586 return -EFAULT; 587 587 } 588 588 return 0; ··· 598 598 if (!test_bit(pc / 2, icode->code_valid)) 599 599 continue; 600 600 if (in_kernel) { 601 - lo = *(__force u32 *)&icode->code[pc + 0]; 602 - hi = *(__force u32 *)&icode->code[pc + 1]; 601 + lo = icode->code[pc + 0]; 602 + hi = icode->code[pc + 1]; 603 603 } else { 604 - if (get_user(lo, &icode->code[pc + 0]) || 605 - get_user(hi, &icode->code[pc + 1])) 604 + if (get_user(lo, (__user u32 *)&icode->code[pc + 0]) || 605 + get_user(hi, (__user u32 *)&icode->code[pc + 1])) 606 606 return -EFAULT; 607 607 } 608 608 snd_emu10k1_efx_write(emu, pc + 0, lo); ··· 619 619 memset(icode->code_valid, 0, sizeof(icode->code_valid)); 620 620 for (pc = 0; pc < (emu->audigy ? 2*1024 : 2*512); pc += 2) { 621 621 set_bit(pc / 2, icode->code_valid); 622 - if (put_user(snd_emu10k1_efx_read(emu, pc + 0), &icode->code[pc + 0])) 622 + if (put_user(snd_emu10k1_efx_read(emu, pc + 0), 623 + (__user u32 *)&icode->code[pc + 0])) 623 624 return -EFAULT; 624 - if (put_user(snd_emu10k1_efx_read(emu, pc + 1), &icode->code[pc + 1])) 625 + if (put_user(snd_emu10k1_efx_read(emu, pc + 1), 626 + (__user u32 *)&icode->code[pc + 1])) 625 627 return -EFAULT; 626 628 } 627 629 return 0; 628 630 } 629 631 630 632 static struct snd_emu10k1_fx8010_ctl * 631 - snd_emu10k1_look_for_ctl(struct snd_emu10k1 *emu, struct emu10k1_ctl_elem_id *id) 633 + snd_emu10k1_look_for_ctl(struct snd_emu10k1 *emu, 634 + struct emu10k1_ctl_elem_id *_id) 632 635 { 636 + struct snd_ctl_elem_id *id = (struct snd_ctl_elem_id *)_id; 633 637 struct snd_emu10k1_fx8010_ctl *ctl; 634 638 struct snd_kcontrol *kcontrol; 635 639 ··· 676 672 } 677 673 678 674 static int copy_gctl(struct snd_emu10k1 *emu, 679 - struct snd_emu10k1_fx8010_control_gpr *gctl, 680 - struct snd_emu10k1_fx8010_control_gpr __user *_gctl, 675 + struct snd_emu10k1_fx8010_control_gpr *dst, 676 + struct snd_emu10k1_fx8010_control_gpr *src, 681 677 int idx, bool in_kernel) 682 678 { 683 - struct snd_emu10k1_fx8010_control_old_gpr __user *octl; 679 + struct snd_emu10k1_fx8010_control_gpr __user *_src; 680 + struct snd_emu10k1_fx8010_control_old_gpr *octl; 681 + struct snd_emu10k1_fx8010_control_old_gpr __user *_octl; 684 682 683 + _src = (struct snd_emu10k1_fx8010_control_gpr __user *)src; 685 684 if (emu->support_tlv) { 686 685 if (in_kernel) 687 - memcpy(gctl, (__force void *)&_gctl[idx], sizeof(*gctl)); 688 - else if (copy_from_user(gctl, &_gctl[idx], sizeof(*gctl))) 686 + *dst = src[idx]; 687 + else if (copy_from_user(dst, &_src[idx], sizeof(*src))) 689 688 return -EFAULT; 690 689 return 0; 691 690 } 692 691 693 - octl = (struct snd_emu10k1_fx8010_control_old_gpr __user *)_gctl; 692 + octl = (struct snd_emu10k1_fx8010_control_old_gpr *)src; 693 + _octl = (struct snd_emu10k1_fx8010_control_old_gpr __user *)octl; 694 694 if (in_kernel) 695 - memcpy(gctl, (__force void *)&octl[idx], sizeof(*octl)); 696 - else if (copy_from_user(gctl, &octl[idx], sizeof(*octl))) 695 + memcpy(dst, &octl[idx], sizeof(*octl)); 696 + else if (copy_from_user(dst, &_octl[idx], sizeof(*octl))) 697 697 return -EFAULT; 698 - gctl->tlv = NULL; 698 + dst->tlv = NULL; 699 699 return 0; 700 700 } 701 701 702 702 static int copy_gctl_to_user(struct snd_emu10k1 *emu, 703 - struct snd_emu10k1_fx8010_control_gpr __user *_gctl, 704 - struct snd_emu10k1_fx8010_control_gpr *gctl, 703 + struct snd_emu10k1_fx8010_control_gpr *dst, 704 + struct snd_emu10k1_fx8010_control_gpr *src, 705 705 int idx) 706 706 { 707 + struct snd_emu10k1_fx8010_control_gpr __user *_dst; 707 708 struct snd_emu10k1_fx8010_control_old_gpr __user *octl; 708 709 710 + _dst = (struct snd_emu10k1_fx8010_control_gpr __user *)dst; 709 711 if (emu->support_tlv) 710 - return copy_to_user(&_gctl[idx], gctl, sizeof(*gctl)); 712 + return copy_to_user(&_dst[idx], src, sizeof(*src)); 711 713 712 - octl = (struct snd_emu10k1_fx8010_control_old_gpr __user *)_gctl; 713 - return copy_to_user(&octl[idx], gctl, sizeof(*octl)); 714 + octl = (struct snd_emu10k1_fx8010_control_old_gpr __user *)dst; 715 + return copy_to_user(&octl[idx], src, sizeof(*octl)); 716 + } 717 + 718 + static int copy_ctl_elem_id(const struct emu10k1_ctl_elem_id *list, int i, 719 + struct emu10k1_ctl_elem_id *ret, bool in_kernel) 720 + { 721 + struct emu10k1_ctl_elem_id __user *_id = 722 + (struct emu10k1_ctl_elem_id __user *)&list[i]; 723 + 724 + if (in_kernel) 725 + *ret = list[i]; 726 + else if (copy_from_user(ret, _id, sizeof(*ret))) 727 + return -EFAULT; 728 + return 0; 714 729 } 715 730 716 731 static int snd_emu10k1_verify_controls(struct snd_emu10k1 *emu, ··· 737 714 bool in_kernel) 738 715 { 739 716 unsigned int i; 740 - struct emu10k1_ctl_elem_id __user *_id; 741 717 struct emu10k1_ctl_elem_id id; 742 718 struct snd_emu10k1_fx8010_control_gpr *gctl; 719 + struct snd_ctl_elem_id *gctl_id; 743 720 int err; 744 721 745 - _id = (__force struct emu10k1_ctl_elem_id __user *)icode->gpr_del_controls; 746 - for (i = 0; i < icode->gpr_del_control_count; i++, _id++) { 747 - if (in_kernel) 748 - id = *(__force struct emu10k1_ctl_elem_id *)_id; 749 - else if (copy_from_user(&id, _id, sizeof(id))) 750 - return -EFAULT; 722 + for (i = 0; i < icode->gpr_del_control_count; i++) { 723 + err = copy_ctl_elem_id(icode->gpr_del_controls, i, &id, 724 + in_kernel); 725 + if (err < 0) 726 + return err; 751 727 if (snd_emu10k1_look_for_ctl(emu, &id) == NULL) 752 728 return -ENOENT; 753 729 } ··· 762 740 } 763 741 if (snd_emu10k1_look_for_ctl(emu, &gctl->id)) 764 742 continue; 743 + gctl_id = (struct snd_ctl_elem_id *)&gctl->id; 765 744 down_read(&emu->card->controls_rwsem); 766 - if (snd_ctl_find_id(emu->card, 767 - (struct snd_ctl_elem_id *)&gctl->id)) { 745 + if (snd_ctl_find_id(emu->card, gctl_id)) { 768 746 up_read(&emu->card->controls_rwsem); 769 747 err = -EEXIST; 770 748 goto __error; 771 749 } 772 750 up_read(&emu->card->controls_rwsem); 773 - if (gctl->id.iface != SNDRV_CTL_ELEM_IFACE_MIXER && 774 - gctl->id.iface != SNDRV_CTL_ELEM_IFACE_PCM) { 751 + if (gctl_id->iface != SNDRV_CTL_ELEM_IFACE_MIXER && 752 + gctl_id->iface != SNDRV_CTL_ELEM_IFACE_PCM) { 775 753 err = -EINVAL; 776 754 goto __error; 777 755 } ··· 806 784 { 807 785 unsigned int i, j; 808 786 struct snd_emu10k1_fx8010_control_gpr *gctl; 787 + struct snd_ctl_elem_id *gctl_id; 809 788 struct snd_emu10k1_fx8010_ctl *ctl, *nctl; 810 789 struct snd_kcontrol_new knew; 811 790 struct snd_kcontrol *kctl; ··· 827 804 err = -EFAULT; 828 805 goto __error; 829 806 } 830 - if (gctl->id.iface != SNDRV_CTL_ELEM_IFACE_MIXER && 831 - gctl->id.iface != SNDRV_CTL_ELEM_IFACE_PCM) { 807 + gctl_id = (struct snd_ctl_elem_id *)&gctl->id; 808 + if (gctl_id->iface != SNDRV_CTL_ELEM_IFACE_MIXER && 809 + gctl_id->iface != SNDRV_CTL_ELEM_IFACE_PCM) { 832 810 err = -EINVAL; 833 811 goto __error; 834 812 } 835 - if (! gctl->id.name[0]) { 813 + if (!*gctl_id->name) { 836 814 err = -EINVAL; 837 815 goto __error; 838 816 } 839 817 ctl = snd_emu10k1_look_for_ctl(emu, &gctl->id); 840 818 memset(&knew, 0, sizeof(knew)); 841 - knew.iface = gctl->id.iface; 842 - knew.name = gctl->id.name; 843 - knew.index = gctl->id.index; 844 - knew.device = gctl->id.device; 845 - knew.subdevice = gctl->id.subdevice; 819 + knew.iface = gctl_id->iface; 820 + knew.name = gctl_id->name; 821 + knew.index = gctl_id->index; 822 + knew.device = gctl_id->device; 823 + knew.subdevice = gctl_id->subdevice; 846 824 knew.info = snd_emu10k1_gpr_ctl_info; 847 - knew.tlv.p = copy_tlv((__force const unsigned int __user *)gctl->tlv, in_kernel); 825 + knew.tlv.p = copy_tlv((const unsigned int __user *)gctl->tlv, in_kernel); 848 826 if (knew.tlv.p) 849 827 knew.access = SNDRV_CTL_ELEM_ACCESS_READWRITE | 850 828 SNDRV_CTL_ELEM_ACCESS_TLV_READ; ··· 902 878 { 903 879 unsigned int i; 904 880 struct emu10k1_ctl_elem_id id; 905 - struct emu10k1_ctl_elem_id __user *_id; 906 881 struct snd_emu10k1_fx8010_ctl *ctl; 907 882 struct snd_card *card = emu->card; 883 + int err; 908 884 909 - _id = (__force struct emu10k1_ctl_elem_id __user *)icode->gpr_del_controls; 910 - 911 - for (i = 0; i < icode->gpr_del_control_count; i++, _id++) { 912 - if (in_kernel) 913 - id = *(__force struct emu10k1_ctl_elem_id *)_id; 914 - else if (copy_from_user(&id, _id, sizeof(id))) 915 - return -EFAULT; 885 + for (i = 0; i < icode->gpr_del_control_count; i++) { 886 + err = copy_ctl_elem_id(icode->gpr_del_controls, i, &id, 887 + in_kernel); 888 + if (err < 0) 889 + return err; 916 890 down_write(&card->controls_rwsem); 917 891 ctl = snd_emu10k1_look_for_ctl(emu, &id); 918 892 if (ctl) ··· 939 917 i < icode->gpr_list_control_count) { 940 918 memset(gctl, 0, sizeof(*gctl)); 941 919 id = &ctl->kcontrol->id; 942 - gctl->id.iface = id->iface; 920 + gctl->id.iface = (__force int)id->iface; 943 921 strlcpy(gctl->id.name, id->name, sizeof(gctl->id.name)); 944 922 gctl->id.index = id->index; 945 923 gctl->id.device = id->device; ··· 1117 1095 snd_emu10k1_init_mono_control(struct snd_emu10k1_fx8010_control_gpr *ctl, 1118 1096 const char *name, int gpr, int defval) 1119 1097 { 1120 - ctl->id.iface = SNDRV_CTL_ELEM_IFACE_MIXER; 1098 + ctl->id.iface = (__force int)SNDRV_CTL_ELEM_IFACE_MIXER; 1121 1099 strcpy(ctl->id.name, name); 1122 1100 ctl->vcount = ctl->count = 1; 1123 1101 ctl->gpr[0] = gpr + 0; ctl->value[0] = defval; ··· 1138 1116 snd_emu10k1_init_stereo_control(struct snd_emu10k1_fx8010_control_gpr *ctl, 1139 1117 const char *name, int gpr, int defval) 1140 1118 { 1141 - ctl->id.iface = SNDRV_CTL_ELEM_IFACE_MIXER; 1119 + ctl->id.iface = (__force int)SNDRV_CTL_ELEM_IFACE_MIXER; 1142 1120 strcpy(ctl->id.name, name); 1143 1121 ctl->vcount = ctl->count = 2; 1144 1122 ctl->gpr[0] = gpr + 0; ctl->value[0] = defval; ··· 1160 1138 snd_emu10k1_init_mono_onoff_control(struct snd_emu10k1_fx8010_control_gpr *ctl, 1161 1139 const char *name, int gpr, int defval) 1162 1140 { 1163 - ctl->id.iface = SNDRV_CTL_ELEM_IFACE_MIXER; 1141 + ctl->id.iface = (__force int)SNDRV_CTL_ELEM_IFACE_MIXER; 1164 1142 strcpy(ctl->id.name, name); 1165 1143 ctl->vcount = ctl->count = 1; 1166 1144 ctl->gpr[0] = gpr + 0; ctl->value[0] = defval; ··· 1173 1151 snd_emu10k1_init_stereo_onoff_control(struct snd_emu10k1_fx8010_control_gpr *ctl, 1174 1152 const char *name, int gpr, int defval) 1175 1153 { 1176 - ctl->id.iface = SNDRV_CTL_ELEM_IFACE_MIXER; 1154 + ctl->id.iface = (__force int)SNDRV_CTL_ELEM_IFACE_MIXER; 1177 1155 strcpy(ctl->id.name, name); 1178 1156 ctl->vcount = ctl->count = 2; 1179 1157 ctl->gpr[0] = gpr + 0; ctl->value[0] = defval; ··· 1226 1204 if (!icode) 1227 1205 return err; 1228 1206 1229 - icode->gpr_map = (u_int32_t __user *) kcalloc(512 + 256 + 256 + 2 * 1024, 1230 - sizeof(u_int32_t), GFP_KERNEL); 1207 + icode->gpr_map = kcalloc(512 + 256 + 256 + 2 * 1024, 1208 + sizeof(u_int32_t), GFP_KERNEL); 1231 1209 if (!icode->gpr_map) 1232 1210 goto __err_gpr; 1233 1211 controls = kcalloc(SND_EMU10K1_GPR_CONTROLS, ··· 1235 1213 if (!controls) 1236 1214 goto __err_ctrls; 1237 1215 1238 - gpr_map = (u32 __force *)icode->gpr_map; 1216 + gpr_map = icode->gpr_map; 1239 1217 1240 1218 icode->tram_data_map = icode->gpr_map + 512; 1241 1219 icode->tram_addr_map = icode->tram_data_map + 256; ··· 1490 1468 1491 1469 1492 1470 ctl = &controls[nctl + 0]; 1493 - ctl->id.iface = SNDRV_CTL_ELEM_IFACE_MIXER; 1471 + ctl->id.iface = (__force int)SNDRV_CTL_ELEM_IFACE_MIXER; 1494 1472 strcpy(ctl->id.name, "Tone Control - Bass"); 1495 1473 ctl->vcount = 2; 1496 1474 ctl->count = 10; ··· 1499 1477 ctl->value[0] = ctl->value[1] = 20; 1500 1478 ctl->translation = EMU10K1_GPR_TRANSLATION_BASS; 1501 1479 ctl = &controls[nctl + 1]; 1502 - ctl->id.iface = SNDRV_CTL_ELEM_IFACE_MIXER; 1480 + ctl->id.iface = (__force int)SNDRV_CTL_ELEM_IFACE_MIXER; 1503 1481 strcpy(ctl->id.name, "Tone Control - Treble"); 1504 1482 ctl->vcount = 2; 1505 1483 ctl->count = 10; ··· 1780 1758 A_OP(icode, &ptr, 0x0f, 0xc0, 0xc0, 0xcf, 0xc0); 1781 1759 1782 1760 icode->gpr_add_control_count = nctl; 1783 - icode->gpr_add_controls = (struct snd_emu10k1_fx8010_control_gpr __user *)controls; 1761 + icode->gpr_add_controls = controls; 1784 1762 emu->support_tlv = 1; /* support TLV */ 1785 1763 err = snd_emu10k1_icode_poke(emu, icode, true); 1786 1764 emu->support_tlv = 0; /* clear again */ ··· 1788 1766 __err: 1789 1767 kfree(controls); 1790 1768 __err_ctrls: 1791 - kfree((void __force *)icode->gpr_map); 1769 + kfree(icode->gpr_map); 1792 1770 __err_gpr: 1793 1771 kfree(icode); 1794 1772 return err; ··· 1861 1839 if (!icode) 1862 1840 return err; 1863 1841 1864 - icode->gpr_map = (u_int32_t __user *) kcalloc(256 + 160 + 160 + 2 * 512, 1865 - sizeof(u_int32_t), GFP_KERNEL); 1842 + icode->gpr_map = kcalloc(256 + 160 + 160 + 2 * 512, 1843 + sizeof(u_int32_t), GFP_KERNEL); 1866 1844 if (!icode->gpr_map) 1867 1845 goto __err_gpr; 1868 1846 ··· 1876 1854 if (!ipcm) 1877 1855 goto __err_ipcm; 1878 1856 1879 - gpr_map = (u32 __force *)icode->gpr_map; 1857 + gpr_map = icode->gpr_map; 1880 1858 1881 1859 icode->tram_data_map = icode->gpr_map + 256; 1882 1860 icode->tram_addr_map = icode->tram_data_map + 160; ··· 2210 2188 OP(icode, &ptr, iACC3, GPR(playback + SND_EMU10K1_PLAYBACK_CHANNELS + 5), GPR(playback + 5), C_00000000, C_00000000); /* LFE */ 2211 2189 2212 2190 ctl = &controls[i + 0]; 2213 - ctl->id.iface = SNDRV_CTL_ELEM_IFACE_MIXER; 2191 + ctl->id.iface = (__force int)SNDRV_CTL_ELEM_IFACE_MIXER; 2214 2192 strcpy(ctl->id.name, "Tone Control - Bass"); 2215 2193 ctl->vcount = 2; 2216 2194 ctl->count = 10; ··· 2220 2198 ctl->tlv = snd_emu10k1_bass_treble_db_scale; 2221 2199 ctl->translation = EMU10K1_GPR_TRANSLATION_BASS; 2222 2200 ctl = &controls[i + 1]; 2223 - ctl->id.iface = SNDRV_CTL_ELEM_IFACE_MIXER; 2201 + ctl->id.iface = (__force int)SNDRV_CTL_ELEM_IFACE_MIXER; 2224 2202 strcpy(ctl->id.name, "Tone Control - Treble"); 2225 2203 ctl->vcount = 2; 2226 2204 ctl->count = 10; ··· 2406 2384 if ((err = snd_emu10k1_fx8010_tram_setup(emu, ipcm->buffer_size)) < 0) 2407 2385 goto __err; 2408 2386 icode->gpr_add_control_count = i; 2409 - icode->gpr_add_controls = (struct snd_emu10k1_fx8010_control_gpr __user *)controls; 2387 + icode->gpr_add_controls = controls; 2410 2388 emu->support_tlv = 1; /* support TLV */ 2411 2389 err = snd_emu10k1_icode_poke(emu, icode, true); 2412 2390 emu->support_tlv = 0; /* clear again */ ··· 2417 2395 __err_ipcm: 2418 2396 kfree(controls); 2419 2397 __err_ctrls: 2420 - kfree((void __force *)icode->gpr_map); 2398 + kfree(icode->gpr_map); 2421 2399 __err_gpr: 2422 2400 kfree(icode); 2423 2401 return err;
+9 -2
sound/pci/hda/hda_controller.c
··· 1110 1110 if (snd_hdac_bus_handle_stream_irq(bus, status, stream_update)) 1111 1111 active = true; 1112 1112 1113 - /* clear rirb int */ 1114 1113 status = azx_readb(chip, RIRBSTS); 1115 1114 if (status & RIRB_INT_MASK) { 1115 + /* 1116 + * Clearing the interrupt status here ensures that no 1117 + * interrupt gets masked after the RIRB wp is read in 1118 + * snd_hdac_bus_update_rirb. This avoids a possible 1119 + * race condition where codec response in RIRB may 1120 + * remain unserviced by IRQ, eventually falling back 1121 + * to polling mode in azx_rirb_get_response. 1122 + */ 1123 + azx_writeb(chip, RIRBSTS, RIRB_INT_MASK); 1116 1124 active = true; 1117 1125 if (status & RIRB_INT_RESPONSE) { 1118 1126 if (chip->driver_caps & AZX_DCAPS_CTX_WORKAROUND) 1119 1127 udelay(80); 1120 1128 snd_hdac_bus_update_rirb(bus); 1121 1129 } 1122 - azx_writeb(chip, RIRBSTS, RIRB_INT_MASK); 1123 1130 } 1124 1131 } while (active && ++repeat < 10); 1125 1132
+2
sound/pci/hda/hda_intel.c
··· 2451 2451 /* Jasperlake */ 2452 2452 { PCI_DEVICE(0x8086, 0x38c8), 2453 2453 .driver_data = AZX_DRIVER_SKL | AZX_DCAPS_INTEL_SKYLAKE}, 2454 + { PCI_DEVICE(0x8086, 0x4dc8), 2455 + .driver_data = AZX_DRIVER_SKL | AZX_DCAPS_INTEL_SKYLAKE}, 2454 2456 /* Tigerlake */ 2455 2457 { PCI_DEVICE(0x8086, 0xa0c8), 2456 2458 .driver_data = AZX_DRIVER_SKL | AZX_DCAPS_INTEL_SKYLAKE},
+66 -33
sound/pci/hda/patch_hdmi.c
··· 1550 1550 return eld_changed; 1551 1551 } 1552 1552 1553 + static struct snd_jack *pin_idx_to_pcm_jack(struct hda_codec *codec, 1554 + struct hdmi_spec_per_pin *per_pin) 1555 + { 1556 + struct hdmi_spec *spec = codec->spec; 1557 + struct snd_jack *jack = NULL; 1558 + struct hda_jack_tbl *jack_tbl; 1559 + 1560 + /* if !dyn_pcm_assign, get jack from hda_jack_tbl 1561 + * in !dyn_pcm_assign case, spec->pcm_rec[].jack is not 1562 + * NULL even after snd_hda_jack_tbl_clear() is called to 1563 + * free snd_jack. This may cause access invalid memory 1564 + * when calling snd_jack_report 1565 + */ 1566 + if (per_pin->pcm_idx >= 0 && spec->dyn_pcm_assign) { 1567 + jack = spec->pcm_rec[per_pin->pcm_idx].jack; 1568 + } else if (!spec->dyn_pcm_assign) { 1569 + /* 1570 + * jack tbl doesn't support DP MST 1571 + * DP MST will use dyn_pcm_assign, 1572 + * so DP MST will never come here 1573 + */ 1574 + jack_tbl = snd_hda_jack_tbl_get_mst(codec, per_pin->pin_nid, 1575 + per_pin->dev_id); 1576 + if (jack_tbl) 1577 + jack = jack_tbl->jack; 1578 + } 1579 + return jack; 1580 + } 1553 1581 /* update ELD and jack state via HD-audio verbs */ 1554 1582 static bool hdmi_present_sense_via_verbs(struct hdmi_spec_per_pin *per_pin, 1555 1583 int repoll) ··· 1599 1571 int present; 1600 1572 bool ret; 1601 1573 bool do_repoll = false; 1574 + struct snd_jack *pcm_jack = NULL; 1602 1575 1603 1576 present = snd_hda_jack_pin_sense(codec, pin_nid, dev_id); 1604 1577 ··· 1627 1598 do_repoll = true; 1628 1599 } 1629 1600 1630 - if (do_repoll) 1601 + if (do_repoll) { 1631 1602 schedule_delayed_work(&per_pin->work, msecs_to_jiffies(300)); 1632 - else 1603 + } else { 1604 + /* 1605 + * pcm_idx >=0 before update_eld() means it is in monitor 1606 + * disconnected event. Jack must be fetched before 1607 + * update_eld(). 1608 + */ 1609 + pcm_jack = pin_idx_to_pcm_jack(codec, per_pin); 1633 1610 update_eld(codec, per_pin, eld); 1611 + if (!pcm_jack) 1612 + pcm_jack = pin_idx_to_pcm_jack(codec, per_pin); 1613 + } 1634 1614 1635 1615 ret = !repoll || !eld->monitor_present || eld->eld_valid; 1636 1616 ··· 1648 1610 jack->block_report = !ret; 1649 1611 jack->pin_sense = (eld->monitor_present && eld->eld_valid) ? 1650 1612 AC_PINSENSE_PRESENCE : 0; 1613 + 1614 + if (spec->dyn_pcm_assign && pcm_jack && !do_repoll) { 1615 + int state = 0; 1616 + 1617 + if (jack->pin_sense & AC_PINSENSE_PRESENCE) 1618 + state = SND_JACK_AVOUT; 1619 + snd_jack_report(pcm_jack, state); 1620 + } 1621 + 1622 + /* 1623 + * snd_hda_jack_pin_sense() call at the beginning of this 1624 + * function, updates jack->pins_sense and clears 1625 + * jack->jack_dirty, therefore snd_hda_jack_report_sync() will 1626 + * not override the jack->pin_sense. 1627 + * 1628 + * snd_hda_jack_report_sync() is superfluous for dyn_pcm_assign 1629 + * case. The jack->pin_sense update was already performed, and 1630 + * hda_jack->jack is NULL for dyn_pcm_assign. 1631 + * 1632 + * Don't call snd_hda_jack_report_sync() for 1633 + * dyn_pcm_assign. 1634 + */ 1635 + ret = ret && !spec->dyn_pcm_assign; 1651 1636 } 1652 1637 mutex_unlock(&per_pin->lock); 1653 1638 return ret; 1654 - } 1655 - 1656 - static struct snd_jack *pin_idx_to_jack(struct hda_codec *codec, 1657 - struct hdmi_spec_per_pin *per_pin) 1658 - { 1659 - struct hdmi_spec *spec = codec->spec; 1660 - struct snd_jack *jack = NULL; 1661 - struct hda_jack_tbl *jack_tbl; 1662 - 1663 - /* if !dyn_pcm_assign, get jack from hda_jack_tbl 1664 - * in !dyn_pcm_assign case, spec->pcm_rec[].jack is not 1665 - * NULL even after snd_hda_jack_tbl_clear() is called to 1666 - * free snd_jack. This may cause access invalid memory 1667 - * when calling snd_jack_report 1668 - */ 1669 - if (per_pin->pcm_idx >= 0 && spec->dyn_pcm_assign) 1670 - jack = spec->pcm_rec[per_pin->pcm_idx].jack; 1671 - else if (!spec->dyn_pcm_assign) { 1672 - /* 1673 - * jack tbl doesn't support DP MST 1674 - * DP MST will use dyn_pcm_assign, 1675 - * so DP MST will never come here 1676 - */ 1677 - jack_tbl = snd_hda_jack_tbl_get_mst(codec, per_pin->pin_nid, 1678 - per_pin->dev_id); 1679 - if (jack_tbl) 1680 - jack = jack_tbl->jack; 1681 - } 1682 - return jack; 1683 1639 } 1684 1640 1685 1641 /* update ELD and jack state via audio component */ ··· 1709 1677 /* pcm_idx >=0 before update_eld() means it is in monitor 1710 1678 * disconnected event. Jack must be fetched before update_eld() 1711 1679 */ 1712 - jack = pin_idx_to_jack(codec, per_pin); 1680 + jack = pin_idx_to_pcm_jack(codec, per_pin); 1713 1681 changed = update_eld(codec, per_pin, eld); 1714 1682 if (jack == NULL) 1715 - jack = pin_idx_to_jack(codec, per_pin); 1683 + jack = pin_idx_to_pcm_jack(codec, per_pin); 1716 1684 if (changed && jack) 1717 1685 snd_jack_report(jack, 1718 1686 (eld->monitor_present && eld->eld_valid) ? ··· 4288 4256 HDA_CODEC_ENTRY(0x8086280d, "Geminilake HDMI", patch_i915_glk_hdmi), 4289 4257 HDA_CODEC_ENTRY(0x8086280f, "Icelake HDMI", patch_i915_icl_hdmi), 4290 4258 HDA_CODEC_ENTRY(0x80862812, "Tigerlake HDMI", patch_i915_tgl_hdmi), 4259 + HDA_CODEC_ENTRY(0x8086281a, "Jasperlake HDMI", patch_i915_icl_hdmi), 4291 4260 HDA_CODEC_ENTRY(0x80862880, "CedarTrail HDMI", patch_generic_hdmi), 4292 4261 HDA_CODEC_ENTRY(0x80862882, "Valleyview2 HDMI", patch_i915_byt_hdmi), 4293 4262 HDA_CODEC_ENTRY(0x80862883, "Braswell HDMI", patch_i915_byt_hdmi),
+1
sound/pci/hda/patch_realtek.c
··· 9111 9111 SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2, 9112 9112 {0x14, 0x01014010}, 9113 9113 {0x17, 0x90170150}, 9114 + {0x19, 0x02a11060}, 9114 9115 {0x1b, 0x01813030}, 9115 9116 {0x21, 0x02211020}), 9116 9117 SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2,
+3 -4
sound/pci/rme9652/hdsp.c
··· 4802 4802 break; 4803 4803 } 4804 4804 case SNDRV_HDSP_IOCTL_UPLOAD_FIRMWARE: { 4805 - struct hdsp_firmware __user *firmware; 4805 + struct hdsp_firmware firmware; 4806 4806 u32 __user *firmware_data; 4807 4807 int err; 4808 4808 ··· 4815 4815 4816 4816 dev_info(hdsp->card->dev, 4817 4817 "initializing firmware upload\n"); 4818 - firmware = (struct hdsp_firmware __user *)argp; 4819 - 4820 - if (get_user(firmware_data, (__force void __user **)&firmware->firmware_data)) 4818 + if (copy_from_user(&firmware, argp, sizeof(firmware))) 4821 4819 return -EFAULT; 4820 + firmware_data = (u32 __user *)firmware.firmware_data; 4822 4821 4823 4822 if (hdsp_check_for_iobox (hdsp)) 4824 4823 return -EIO;
+7 -5
sound/soc/amd/raven/acp3x-i2s.c
··· 234 234 switch (rtd->i2s_instance) { 235 235 case I2S_BT_INSTANCE: 236 236 reg_val = mmACP_BTTDM_ITER; 237 - ier_val = mmACP_BTTDM_IER; 238 237 break; 239 238 case I2S_SP_INSTANCE: 240 239 default: 241 240 reg_val = mmACP_I2STDM_ITER; 242 - ier_val = mmACP_I2STDM_IER; 243 241 } 244 242 245 243 } else { 246 244 switch (rtd->i2s_instance) { 247 245 case I2S_BT_INSTANCE: 248 246 reg_val = mmACP_BTTDM_IRER; 249 - ier_val = mmACP_BTTDM_IER; 250 247 break; 251 248 case I2S_SP_INSTANCE: 252 249 default: 253 250 reg_val = mmACP_I2STDM_IRER; 254 - ier_val = mmACP_I2STDM_IER; 255 251 } 256 252 } 257 253 val = rv_readl(rtd->acp3x_base + reg_val); 258 254 val = val & ~BIT(0); 259 255 rv_writel(val, rtd->acp3x_base + reg_val); 260 - rv_writel(0, rtd->acp3x_base + ier_val); 256 + 257 + if (!(rv_readl(rtd->acp3x_base + mmACP_BTTDM_ITER) & BIT(0)) && 258 + !(rv_readl(rtd->acp3x_base + mmACP_BTTDM_IRER) & BIT(0))) 259 + rv_writel(0, rtd->acp3x_base + mmACP_BTTDM_IER); 260 + if (!(rv_readl(rtd->acp3x_base + mmACP_I2STDM_ITER) & BIT(0)) && 261 + !(rv_readl(rtd->acp3x_base + mmACP_I2STDM_IRER) & BIT(0))) 262 + rv_writel(0, rtd->acp3x_base + mmACP_I2STDM_IER); 261 263 ret = 0; 262 264 break; 263 265 default:
+7 -7
sound/soc/amd/raven/acp3x-pcm-dma.c
··· 349 349 component = snd_soc_rtdcom_lookup(prtd, DRV_NAME); 350 350 adata = dev_get_drvdata(component->dev); 351 351 352 - if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { 353 - adata->play_stream = NULL; 354 - adata->i2ssp_play_stream = NULL; 355 - } else { 356 - adata->capture_stream = NULL; 357 - adata->i2ssp_capture_stream = NULL; 358 - } 359 352 360 353 /* Disable ACP irq, when the current stream is being closed and 361 354 * another stream is also not active. ··· 356 363 if (!adata->play_stream && !adata->capture_stream && 357 364 !adata->i2ssp_play_stream && !adata->i2ssp_capture_stream) 358 365 rv_writel(0, adata->acp3x_base + mmACP_EXTERNAL_INTR_ENB); 366 + if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { 367 + adata->play_stream = NULL; 368 + adata->i2ssp_play_stream = NULL; 369 + } else { 370 + adata->capture_stream = NULL; 371 + adata->i2ssp_capture_stream = NULL; 372 + } 359 373 return 0; 360 374 } 361 375
+2 -1
sound/soc/codecs/Kconfig
··· 214 214 select SND_SOC_UDA134X 215 215 select SND_SOC_UDA1380 if I2C 216 216 select SND_SOC_WCD9335 if SLIMBUS 217 - select SND_SOC_WCD934X if MFD_WCD934X 217 + select SND_SOC_WCD934X if MFD_WCD934X && COMMON_CLK 218 218 select SND_SOC_WL1273 if MFD_WL1273_CORE 219 219 select SND_SOC_WM0010 if SPI_MASTER 220 220 select SND_SOC_WM1250_EV1 if I2C ··· 1334 1334 1335 1335 config SND_SOC_WCD934X 1336 1336 tristate "WCD9340/WCD9341 Codec" 1337 + depends on COMMON_CLK 1337 1338 depends on MFD_WCD934X 1338 1339 help 1339 1340 The WCD9340/9341 is a audio codec IC Integrated in
+2 -1
sound/soc/codecs/max98090.c
··· 52 52 53 53 static void max98090_shdn_save(struct max98090_priv *max98090) 54 54 { 55 - mutex_lock(&max98090->component->card->dapm_mutex); 55 + mutex_lock_nested(&max98090->component->card->dapm_mutex, 56 + SND_SOC_DAPM_CLASS_RUNTIME); 56 57 max98090_shdn_save_locked(max98090); 57 58 } 58 59
+1 -1
sound/soc/codecs/rt1015.c
··· 389 389 "Bypass", "Adaptive", "Fixed Adaptive" 390 390 }; 391 391 392 - static const SOC_ENUM_SINGLE_DECL(rt1015_boost_mode_enum, 0, 0, 392 + static SOC_ENUM_SINGLE_DECL(rt1015_boost_mode_enum, 0, 0, 393 393 rt1015_boost_mode); 394 394 395 395 static int rt1015_boost_mode_get(struct snd_kcontrol *kcontrol,
+2 -2
sound/soc/codecs/rt1308-sdw.c
··· 673 673 }; 674 674 MODULE_DEVICE_TABLE(sdw, rt1308_id); 675 675 676 - static int rt1308_dev_suspend(struct device *dev) 676 + static int __maybe_unused rt1308_dev_suspend(struct device *dev) 677 677 { 678 678 struct rt1308_sdw_priv *rt1308 = dev_get_drvdata(dev); 679 679 ··· 687 687 688 688 #define RT1308_PROBE_TIMEOUT 2000 689 689 690 - static int rt1308_dev_resume(struct device *dev) 690 + static int __maybe_unused rt1308_dev_resume(struct device *dev) 691 691 { 692 692 struct sdw_slave *slave = dev_to_sdw_dev(dev); 693 693 struct rt1308_sdw_priv *rt1308 = dev_get_drvdata(dev);
+2 -2
sound/soc/codecs/rt700-sdw.c
··· 486 486 }; 487 487 MODULE_DEVICE_TABLE(sdw, rt700_id); 488 488 489 - static int rt700_dev_suspend(struct device *dev) 489 + static int __maybe_unused rt700_dev_suspend(struct device *dev) 490 490 { 491 491 struct rt700_priv *rt700 = dev_get_drvdata(dev); 492 492 ··· 500 500 501 501 #define RT700_PROBE_TIMEOUT 2000 502 502 503 - static int rt700_dev_resume(struct device *dev) 503 + static int __maybe_unused rt700_dev_resume(struct device *dev) 504 504 { 505 505 struct sdw_slave *slave = dev_to_sdw_dev(dev); 506 506 struct rt700_priv *rt700 = dev_get_drvdata(dev);
+2 -2
sound/soc/codecs/rt711-sdw.c
··· 487 487 }; 488 488 MODULE_DEVICE_TABLE(sdw, rt711_id); 489 489 490 - static int rt711_dev_suspend(struct device *dev) 490 + static int __maybe_unused rt711_dev_suspend(struct device *dev) 491 491 { 492 492 struct rt711_priv *rt711 = dev_get_drvdata(dev); 493 493 ··· 501 501 502 502 #define RT711_PROBE_TIMEOUT 2000 503 503 504 - static int rt711_dev_resume(struct device *dev) 504 + static int __maybe_unused rt711_dev_resume(struct device *dev) 505 505 { 506 506 struct sdw_slave *slave = dev_to_sdw_dev(dev); 507 507 struct rt711_priv *rt711 = dev_get_drvdata(dev);
+2 -2
sound/soc/codecs/rt715-sdw.c
··· 549 549 }; 550 550 MODULE_DEVICE_TABLE(sdw, rt715_id); 551 551 552 - static int rt715_dev_suspend(struct device *dev) 552 + static int __maybe_unused rt715_dev_suspend(struct device *dev) 553 553 { 554 554 struct rt715_priv *rt715 = dev_get_drvdata(dev); 555 555 ··· 563 563 564 564 #define RT715_PROBE_TIMEOUT 2000 565 565 566 - static int rt715_dev_resume(struct device *dev) 566 + static int __maybe_unused rt715_dev_resume(struct device *dev) 567 567 { 568 568 struct sdw_slave *slave = dev_to_sdw_dev(dev); 569 569 struct rt715_priv *rt715 = dev_get_drvdata(dev);
+7 -7
sound/soc/intel/boards/bxt_da7219_max98357a.c
··· 617 617 snd_soc_dapm_add_routes(&card->dapm, broxton_map, 618 618 ARRAY_SIZE(broxton_map)); 619 619 620 - pcm = list_first_entry(&ctx->hdmi_pcm_list, struct bxt_hdmi_pcm, 621 - head); 622 - component = pcm->codec_dai->component; 620 + if (list_empty(&ctx->hdmi_pcm_list)) 621 + return -EINVAL; 623 622 624 - if (ctx->common_hdmi_codec_drv) 623 + if (ctx->common_hdmi_codec_drv) { 624 + pcm = list_first_entry(&ctx->hdmi_pcm_list, struct bxt_hdmi_pcm, 625 + head); 626 + component = pcm->codec_dai->component; 625 627 return hda_dsp_hdmi_build_controls(card, component); 628 + } 626 629 627 630 list_for_each_entry(pcm, &ctx->hdmi_pcm_list, head) { 628 631 component = pcm->codec_dai->component; ··· 645 642 646 643 i++; 647 644 } 648 - 649 - if (!component) 650 - return -EINVAL; 651 645 652 646 return hdac_hdmi_jack_port_init(component, &card->dapm); 653 647 }
+7 -7
sound/soc/intel/boards/bxt_rt298.c
··· 529 529 int err, i = 0; 530 530 char jack_name[NAME_SIZE]; 531 531 532 - pcm = list_first_entry(&ctx->hdmi_pcm_list, struct bxt_hdmi_pcm, 533 - head); 534 - component = pcm->codec_dai->component; 532 + if (list_empty(&ctx->hdmi_pcm_list)) 533 + return -EINVAL; 535 534 536 - if (ctx->common_hdmi_codec_drv) 535 + if (ctx->common_hdmi_codec_drv) { 536 + pcm = list_first_entry(&ctx->hdmi_pcm_list, struct bxt_hdmi_pcm, 537 + head); 538 + component = pcm->codec_dai->component; 537 539 return hda_dsp_hdmi_build_controls(card, component); 540 + } 538 541 539 542 list_for_each_entry(pcm, &ctx->hdmi_pcm_list, head) { 540 543 component = pcm->codec_dai->component; ··· 557 554 558 555 i++; 559 556 } 560 - 561 - if (!component) 562 - return -EINVAL; 563 557 564 558 return hdac_hdmi_jack_port_init(component, &card->dapm); 565 559 }
+7 -6
sound/soc/intel/boards/cml_rt1011_rt5682.c
··· 241 241 struct hdmi_pcm *pcm; 242 242 int ret, i = 0; 243 243 244 - pcm = list_first_entry(&ctx->hdmi_pcm_list, struct hdmi_pcm, 245 - head); 246 - component = pcm->codec_dai->component; 244 + if (list_empty(&ctx->hdmi_pcm_list)) 245 + return -EINVAL; 247 246 248 - if (ctx->common_hdmi_codec_drv) 247 + if (ctx->common_hdmi_codec_drv) { 248 + pcm = list_first_entry(&ctx->hdmi_pcm_list, struct hdmi_pcm, 249 + head); 250 + component = pcm->codec_dai->component; 249 251 return hda_dsp_hdmi_build_controls(card, component); 252 + } 250 253 251 254 list_for_each_entry(pcm, &ctx->hdmi_pcm_list, head) { 252 255 component = pcm->codec_dai->component; ··· 268 265 269 266 i++; 270 267 } 271 - if (!component) 272 - return -EINVAL; 273 268 274 269 return hdac_hdmi_jack_port_init(component, &card->dapm); 275 270 }
+8 -8
sound/soc/intel/boards/glk_rt5682_max98357a.c
··· 534 534 struct snd_soc_component *component = NULL; 535 535 char jack_name[NAME_SIZE]; 536 536 struct glk_hdmi_pcm *pcm; 537 - int err = 0; 537 + int err; 538 538 int i = 0; 539 539 540 - pcm = list_first_entry(&ctx->hdmi_pcm_list, struct glk_hdmi_pcm, 541 - head); 542 - component = pcm->codec_dai->component; 540 + if (list_empty(&ctx->hdmi_pcm_list)) 541 + return -EINVAL; 543 542 544 - if (ctx->common_hdmi_codec_drv) 543 + if (ctx->common_hdmi_codec_drv) { 544 + pcm = list_first_entry(&ctx->hdmi_pcm_list, struct glk_hdmi_pcm, 545 + head); 546 + component = pcm->codec_dai->component; 545 547 return hda_dsp_hdmi_build_controls(card, component); 548 + } 546 549 547 550 list_for_each_entry(pcm, &ctx->hdmi_pcm_list, head) { 548 551 component = pcm->codec_dai->component; ··· 565 562 566 563 i++; 567 564 } 568 - 569 - if (!component) 570 - return -EINVAL; 571 565 572 566 return hdac_hdmi_jack_port_init(component, &card->dapm); 573 567 }
+8 -7
sound/soc/intel/boards/sof_rt5682.c
··· 273 273 struct snd_soc_component *component = NULL; 274 274 char jack_name[NAME_SIZE]; 275 275 struct sof_hdmi_pcm *pcm; 276 - int err = 0; 276 + int err; 277 277 int i = 0; 278 278 279 279 /* HDMI is not supported by SOF on Baytrail/CherryTrail */ 280 280 if (is_legacy_cpu) 281 281 return 0; 282 282 283 - pcm = list_first_entry(&ctx->hdmi_pcm_list, struct sof_hdmi_pcm, 284 - head); 285 - component = pcm->codec_dai->component; 283 + if (list_empty(&ctx->hdmi_pcm_list)) 284 + return -EINVAL; 286 285 287 - if (ctx->common_hdmi_codec_drv) 286 + if (ctx->common_hdmi_codec_drv) { 287 + pcm = list_first_entry(&ctx->hdmi_pcm_list, struct sof_hdmi_pcm, 288 + head); 289 + component = pcm->codec_dai->component; 288 290 return hda_dsp_hdmi_build_controls(card, component); 291 + } 289 292 290 293 list_for_each_entry(pcm, &ctx->hdmi_pcm_list, head) { 291 294 component = pcm->codec_dai->component; ··· 308 305 309 306 i++; 310 307 } 311 - if (!component) 312 - return -EINVAL; 313 308 314 309 return hdac_hdmi_jack_port_init(component, &card->dapm); 315 310 }
+1 -1
sound/soc/intel/common/soc-acpi-intel-icl-match.c
··· 59 59 }; 60 60 61 61 static const u64 rt715_3_adr[] = { 62 - 0x000310025D715000 62 + 0x000310025D071500 63 63 }; 64 64 65 65 static const struct snd_soc_acpi_link_adr icl_3_in_1_default[] = {
+16 -22
sound/soc/sof/core.c
··· 224 224 if (ret < 0) { 225 225 dev_err(sdev->dev, 226 226 "error: failed to register DSP DAI driver %d\n", ret); 227 - goto fw_run_err; 227 + goto fw_trace_err; 228 228 } 229 229 230 230 ret = snd_sof_machine_register(sdev, plat_data); 231 231 if (ret < 0) 232 - goto fw_run_err; 232 + goto fw_trace_err; 233 233 234 234 /* 235 235 * Some platforms in SOF, ex: BYT, may not have their platform PM ··· 244 244 245 245 return 0; 246 246 247 - #if !IS_ENABLED(CONFIG_SND_SOC_SOF_PROBE_WORK_QUEUE) 247 + fw_trace_err: 248 + snd_sof_free_trace(sdev); 248 249 fw_run_err: 249 250 snd_sof_fw_unload(sdev); 250 251 fw_load_err: ··· 254 253 snd_sof_free_debug(sdev); 255 254 dbg_err: 256 255 snd_sof_remove(sdev); 257 - #else 258 256 259 - /* 260 - * when the probe_continue is handled in a work queue, the 261 - * probe does not fail so we don't release resources here. 262 - * They will be released with an explicit call to 263 - * snd_sof_device_remove() when the PCI/ACPI device is removed 264 - */ 265 - 266 - fw_run_err: 267 - fw_load_err: 268 - ipc_err: 269 - dbg_err: 270 - 271 - #endif 257 + /* all resources freed, update state to match */ 258 + sdev->fw_state = SOF_FW_BOOT_NOT_STARTED; 259 + sdev->first_boot = true; 272 260 273 261 return ret; 274 262 } ··· 340 350 if (IS_ENABLED(CONFIG_SND_SOC_SOF_PROBE_WORK_QUEUE)) 341 351 cancel_work_sync(&sdev->probe_work); 342 352 343 - snd_sof_fw_unload(sdev); 344 - snd_sof_ipc_free(sdev); 345 - snd_sof_free_debug(sdev); 346 - snd_sof_free_trace(sdev); 353 + if (sdev->fw_state > SOF_FW_BOOT_NOT_STARTED) { 354 + snd_sof_fw_unload(sdev); 355 + snd_sof_ipc_free(sdev); 356 + snd_sof_free_debug(sdev); 357 + snd_sof_free_trace(sdev); 358 + } 347 359 348 360 /* 349 361 * Unregister machine driver. This will unbind the snd_card which ··· 353 361 * before freeing the snd_card. 354 362 */ 355 363 snd_sof_machine_unregister(sdev, pdata); 364 + 356 365 /* 357 366 * Unregistering the machine driver results in unloading the topology. 358 367 * Some widgets, ex: scheduler, attempt to power down the core they are 359 368 * scheduled on, when they are unloaded. Therefore, the DSP must be 360 369 * removed only after the topology has been unloaded. 361 370 */ 362 - snd_sof_remove(sdev); 371 + if (sdev->fw_state > SOF_FW_BOOT_NOT_STARTED) 372 + snd_sof_remove(sdev); 363 373 364 374 /* release firmware */ 365 375 release_firmware(pdata->fw);
+6 -15
sound/soc/sof/intel/hda-codec.c
··· 170 170 #if IS_ENABLED(CONFIG_SND_HDA_CODEC_HDMI) || \ 171 171 IS_ENABLED(CONFIG_SND_SOC_HDAC_HDMI) 172 172 173 - void hda_codec_i915_get(struct snd_sof_dev *sdev) 173 + void hda_codec_i915_display_power(struct snd_sof_dev *sdev, bool enable) 174 174 { 175 175 struct hdac_bus *bus = sof_to_bus(sdev); 176 176 177 - dev_dbg(bus->dev, "Turning i915 HDAC power on\n"); 178 - snd_hdac_display_power(bus, HDA_CODEC_IDX_CONTROLLER, true); 177 + dev_dbg(bus->dev, "Turning i915 HDAC power %d\n", enable); 178 + snd_hdac_display_power(bus, HDA_CODEC_IDX_CONTROLLER, enable); 179 179 } 180 - EXPORT_SYMBOL_NS(hda_codec_i915_get, SND_SOC_SOF_HDA_AUDIO_CODEC_I915); 181 - 182 - void hda_codec_i915_put(struct snd_sof_dev *sdev) 183 - { 184 - struct hdac_bus *bus = sof_to_bus(sdev); 185 - 186 - dev_dbg(bus->dev, "Turning i915 HDAC power off\n"); 187 - snd_hdac_display_power(bus, HDA_CODEC_IDX_CONTROLLER, false); 188 - } 189 - EXPORT_SYMBOL_NS(hda_codec_i915_put, SND_SOC_SOF_HDA_AUDIO_CODEC_I915); 180 + EXPORT_SYMBOL_NS(hda_codec_i915_display_power, SND_SOC_SOF_HDA_AUDIO_CODEC_I915); 190 181 191 182 int hda_codec_i915_init(struct snd_sof_dev *sdev) 192 183 { ··· 189 198 if (ret < 0) 190 199 return ret; 191 200 192 - hda_codec_i915_get(sdev); 201 + hda_codec_i915_display_power(sdev, true); 193 202 194 203 return 0; 195 204 } ··· 200 209 struct hdac_bus *bus = sof_to_bus(sdev); 201 210 int ret; 202 211 203 - hda_codec_i915_put(sdev); 212 + hda_codec_i915_display_power(sdev, false); 204 213 205 214 ret = snd_hdac_i915_exit(bus); 206 215
+2 -1
sound/soc/sof/intel/hda.c
··· 380 380 /* create codec instances */ 381 381 hda_codec_probe_bus(sdev, hda_codec_use_common_hdmi); 382 382 383 - hda_codec_i915_put(sdev); 383 + if (!HDA_IDISP_CODEC(bus->codec_mask)) 384 + hda_codec_i915_display_power(sdev, false); 384 385 385 386 /* 386 387 * we are done probing so decrement link counts
+3 -4
sound/soc/sof/intel/hda.h
··· 586 586 (IS_ENABLED(CONFIG_SND_HDA_CODEC_HDMI) || \ 587 587 IS_ENABLED(CONFIG_SND_SOC_HDAC_HDMI)) 588 588 589 - void hda_codec_i915_get(struct snd_sof_dev *sdev); 590 - void hda_codec_i915_put(struct snd_sof_dev *sdev); 589 + void hda_codec_i915_display_power(struct snd_sof_dev *sdev, bool enable); 591 590 int hda_codec_i915_init(struct snd_sof_dev *sdev); 592 591 int hda_codec_i915_exit(struct snd_sof_dev *sdev); 593 592 594 593 #else 595 594 596 - static inline void hda_codec_i915_get(struct snd_sof_dev *sdev) { } 597 - static inline void hda_codec_i915_put(struct snd_sof_dev *sdev) { } 595 + static inline void hda_codec_i915_display_power(struct snd_sof_dev *sdev, 596 + bool enable) { } 598 597 static inline int hda_codec_i915_init(struct snd_sof_dev *sdev) { return 0; } 599 598 static inline int hda_codec_i915_exit(struct snd_sof_dev *sdev) { return 0; } 600 599
+10
sound/soc/sof/pcm.c
··· 591 591 "spcm: allocate %s playback DMA buffer size 0x%x max 0x%x\n", 592 592 caps->name, caps->buffer_size_min, caps->buffer_size_max); 593 593 594 + if (!pcm->streams[stream].substream) { 595 + dev_err(component->dev, "error: NULL playback substream!\n"); 596 + return -EINVAL; 597 + } 598 + 594 599 snd_pcm_set_managed_buffer(pcm->streams[stream].substream, 595 600 SNDRV_DMA_TYPE_DEV_SG, sdev->dev, 596 601 le32_to_cpu(caps->buffer_size_min), ··· 613 608 dev_dbg(component->dev, 614 609 "spcm: allocate %s capture DMA buffer size 0x%x max 0x%x\n", 615 610 caps->name, caps->buffer_size_min, caps->buffer_size_max); 611 + 612 + if (!pcm->streams[stream].substream) { 613 + dev_err(component->dev, "error: NULL capture substream!\n"); 614 + return -EINVAL; 615 + } 616 616 617 617 snd_pcm_set_managed_buffer(pcm->streams[stream].substream, 618 618 SNDRV_DMA_TYPE_DEV_SG, sdev->dev,
+4
sound/soc/sof/pm.c
··· 56 56 if (!sof_ops(sdev)->resume || !sof_ops(sdev)->runtime_resume) 57 57 return 0; 58 58 59 + /* DSP was never successfully started, nothing to resume */ 60 + if (sdev->first_boot) 61 + return 0; 62 + 59 63 /* 60 64 * if the runtime_resume flag is set, call the runtime_resume routine 61 65 * or else call the system resume routine
+3
sound/soc/sof/sof-pci-dev.c
··· 235 235 .chip_info = &jsl_chip_info, 236 236 .default_fw_path = "intel/sof", 237 237 .default_tplg_path = "intel/sof-tplg", 238 + .default_fw_filename = "sof-jsl.ri", 238 239 .nocodec_tplg_filename = "sof-jsl-nocodec.tplg", 239 240 .ops = &sof_cnl_ops, 240 241 }; ··· 416 415 #endif 417 416 #if IS_ENABLED(CONFIG_SND_SOC_SOF_JASPERLAKE) 418 417 { PCI_DEVICE(0x8086, 0x38c8), 418 + .driver_data = (unsigned long)&jsl_desc}, 419 + { PCI_DEVICE(0x8086, 0x4dc8), 419 420 .driver_data = (unsigned long)&jsl_desc}, 420 421 #endif 421 422 #if IS_ENABLED(CONFIG_SND_SOC_SOF_COMETLAKE_LP)
+5 -2
sound/soc/sof/trace.c
··· 343 343 344 344 snd_sof_release_trace(sdev); 345 345 346 - snd_dma_free_pages(&sdev->dmatb); 347 - snd_dma_free_pages(&sdev->dmatp); 346 + if (sdev->dma_trace_pages) { 347 + snd_dma_free_pages(&sdev->dmatb); 348 + snd_dma_free_pages(&sdev->dmatp); 349 + sdev->dma_trace_pages = 0; 350 + } 348 351 } 349 352 EXPORT_SYMBOL(snd_sof_free_trace);
+5 -20
sound/soc/tegra/tegra30_i2s.c
··· 127 127 struct device *dev = dai->dev; 128 128 struct tegra30_i2s *i2s = snd_soc_dai_get_drvdata(dai); 129 129 unsigned int mask, val, reg; 130 - int ret, sample_size, srate, i2sclock, bitcnt, audio_bits; 130 + int ret, sample_size, srate, i2sclock, bitcnt; 131 131 struct tegra30_ahub_cif_conf cif_conf; 132 132 133 133 if (params_channels(params) != 2) ··· 137 137 switch (params_format(params)) { 138 138 case SNDRV_PCM_FORMAT_S16_LE: 139 139 val = TEGRA30_I2S_CTRL_BIT_SIZE_16; 140 - audio_bits = TEGRA30_AUDIOCIF_BITS_16; 141 140 sample_size = 16; 142 - break; 143 - case SNDRV_PCM_FORMAT_S24_LE: 144 - val = TEGRA30_I2S_CTRL_BIT_SIZE_24; 145 - audio_bits = TEGRA30_AUDIOCIF_BITS_24; 146 - sample_size = 24; 147 - break; 148 - case SNDRV_PCM_FORMAT_S32_LE: 149 - val = TEGRA30_I2S_CTRL_BIT_SIZE_32; 150 - audio_bits = TEGRA30_AUDIOCIF_BITS_32; 151 - sample_size = 32; 152 141 break; 153 142 default: 154 143 return -EINVAL; ··· 170 181 cif_conf.threshold = 0; 171 182 cif_conf.audio_channels = 2; 172 183 cif_conf.client_channels = 2; 173 - cif_conf.audio_bits = audio_bits; 174 - cif_conf.client_bits = audio_bits; 184 + cif_conf.audio_bits = TEGRA30_AUDIOCIF_BITS_16; 185 + cif_conf.client_bits = TEGRA30_AUDIOCIF_BITS_16; 175 186 cif_conf.expand = 0; 176 187 cif_conf.stereo_conv = 0; 177 188 cif_conf.replicate = 0; ··· 306 317 .channels_min = 2, 307 318 .channels_max = 2, 308 319 .rates = SNDRV_PCM_RATE_8000_96000, 309 - .formats = SNDRV_PCM_FMTBIT_S32_LE | 310 - SNDRV_PCM_FMTBIT_S24_LE | 311 - SNDRV_PCM_FMTBIT_S16_LE, 320 + .formats = SNDRV_PCM_FMTBIT_S16_LE, 312 321 }, 313 322 .capture = { 314 323 .stream_name = "Capture", 315 324 .channels_min = 2, 316 325 .channels_max = 2, 317 326 .rates = SNDRV_PCM_RATE_8000_96000, 318 - .formats = SNDRV_PCM_FMTBIT_S32_LE | 319 - SNDRV_PCM_FMTBIT_S24_LE | 320 - SNDRV_PCM_FMTBIT_S16_LE, 327 + .formats = SNDRV_PCM_FMTBIT_S16_LE, 321 328 }, 322 329 .ops = &tegra30_i2s_dai_ops, 323 330 .symmetric_rates = 1,
+23 -23
sound/usb/mixer_scarlett_gen2.c
··· 558 558 559 559 /* proprietary request/response format */ 560 560 struct scarlett2_usb_packet { 561 - u32 cmd; 562 - u16 size; 563 - u16 seq; 564 - u32 error; 565 - u32 pad; 561 + __le32 cmd; 562 + __le16 size; 563 + __le16 seq; 564 + __le32 error; 565 + __le32 pad; 566 566 u8 data[]; 567 567 }; 568 568 ··· 664 664 "Scarlett Gen 2 USB invalid response; " 665 665 "cmd tx/rx %d/%d seq %d/%d size %d/%d " 666 666 "error %d pad %d\n", 667 - le16_to_cpu(req->cmd), le16_to_cpu(resp->cmd), 667 + le32_to_cpu(req->cmd), le32_to_cpu(resp->cmd), 668 668 le16_to_cpu(req->seq), le16_to_cpu(resp->seq), 669 669 resp_size, le16_to_cpu(resp->size), 670 - le16_to_cpu(resp->error), 671 - le16_to_cpu(resp->pad)); 670 + le32_to_cpu(resp->error), 671 + le32_to_cpu(resp->pad)); 672 672 err = -EINVAL; 673 673 goto unlock; 674 674 } ··· 687 687 /* Send SCARLETT2_USB_DATA_CMD SCARLETT2_USB_CONFIG_SAVE */ 688 688 static void scarlett2_config_save(struct usb_mixer_interface *mixer) 689 689 { 690 - u32 req = cpu_to_le32(SCARLETT2_USB_CONFIG_SAVE); 690 + __le32 req = cpu_to_le32(SCARLETT2_USB_CONFIG_SAVE); 691 691 692 692 scarlett2_usb(mixer, SCARLETT2_USB_DATA_CMD, 693 693 &req, sizeof(u32), ··· 713 713 const struct scarlett2_config config_item = 714 714 scarlett2_config_items[config_item_num]; 715 715 struct { 716 - u32 offset; 717 - u32 bytes; 718 - s32 value; 716 + __le32 offset; 717 + __le32 bytes; 718 + __le32 value; 719 719 } __packed req; 720 - u32 req2; 720 + __le32 req2; 721 721 int err; 722 722 struct scarlett2_mixer_data *private = mixer->private_data; 723 723 ··· 753 753 int offset, void *buf, int size) 754 754 { 755 755 struct { 756 - u32 offset; 757 - u32 size; 756 + __le32 offset; 757 + __le32 size; 758 758 } __packed req; 759 759 760 760 req.offset = cpu_to_le32(offset); ··· 794 794 const struct scarlett2_device_info *info = private->info; 795 795 796 796 struct { 797 - u16 mix_num; 798 - u16 data[SCARLETT2_INPUT_MIX_MAX]; 797 + __le16 mix_num; 798 + __le16 data[SCARLETT2_INPUT_MIX_MAX]; 799 799 } __packed req; 800 800 801 801 int i, j; ··· 850 850 }; 851 851 852 852 struct { 853 - u16 pad; 854 - u16 num; 855 - u32 data[SCARLETT2_MUX_MAX]; 853 + __le16 pad; 854 + __le16 num; 855 + __le32 data[SCARLETT2_MUX_MAX]; 856 856 } __packed req; 857 857 858 858 req.pad = 0; ··· 911 911 u16 *levels) 912 912 { 913 913 struct { 914 - u16 pad; 915 - u16 num_meters; 916 - u32 magic; 914 + __le16 pad; 915 + __le16 num_meters; 916 + __le32 magic; 917 917 } __packed req; 918 918 u32 resp[SCARLETT2_NUM_METERS]; 919 919 int i, err;
+3 -3
sound/usb/validate.c
··· 110 110 default: 111 111 if (v->type == UAC1_EXTENSION_UNIT) 112 112 return true; /* OK */ 113 - switch (d->wProcessType) { 113 + switch (le16_to_cpu(d->wProcessType)) { 114 114 case UAC_PROCESS_UP_DOWNMIX: 115 115 case UAC_PROCESS_DOLBY_PROLOGIC: 116 116 if (d->bLength < len + 1) /* bNrModes */ ··· 125 125 case UAC_VERSION_2: 126 126 if (v->type == UAC2_EXTENSION_UNIT_V2) 127 127 return true; /* OK */ 128 - switch (d->wProcessType) { 128 + switch (le16_to_cpu(d->wProcessType)) { 129 129 case UAC2_PROCESS_UP_DOWNMIX: 130 130 case UAC2_PROCESS_DOLBY_PROLOCIC: /* SiC! */ 131 131 if (d->bLength < len + 1) /* bNrModes */ ··· 142 142 len += 2; /* wClusterDescrID */ 143 143 break; 144 144 } 145 - switch (d->wProcessType) { 145 + switch (le16_to_cpu(d->wProcessType)) { 146 146 case UAC3_PROCESS_UP_DOWNMIX: 147 147 if (d->bLength < len + 1) /* bNrModes */ 148 148 return false;