android_kernel_xiaomi_sm8350/include/sound/pcm.h
Michael Bestas f4b76e8165
Merge tag 'ASB-2023-04-05_11-5.4' of https://android.googlesource.com/kernel/common into android13-5.4-lahaina
https://source.android.com/docs/security/bulletin/2023-04-01
CVE-2022-4696
CVE-2023-20941

* tag 'ASB-2023-04-05_11-5.4' of https://android.googlesource.com/kernel/common:
  UPSTREAM: ext4: fix kernel BUG in 'ext4_write_inline_data_end()'
  UPSTREAM: hid: bigben_probe(): validate report count
  UPSTREAM: HID: bigben: use spinlock to safely schedule workers
  BACKPORT: of: base: Skip CPU nodes with "fail"/"fail-..." status
  UPSTREAM: HID: bigben_worker() remove unneeded check on report_field
  UPSTREAM: HID: bigben: use spinlock to protect concurrent accesses
  UPSTREAM: hwrng: virtio - add an internal buffer
  UPSTREAM: ext4: fix another off-by-one fsmap error on 1k block filesystems
  UPSTREAM: ext4: refuse to create ea block when umounted
  UPSTREAM: ext4: optimize ea_inode block expansion
  UPSTREAM: ext4: allocate extended attribute value in vmalloc area
  BACKPORT: FROMGIT: cgroup: Use separate src/dst nodes when preloading css_sets for migration
  Revert "iommu: Add gfp parameter to iommu_ops::map"
  Revert "iommu/amd: Pass gfp flags to iommu_map_page() in amd_iommu_map()"
  Revert "RDMA/usnic: use iommu_map_atomic() under spin_lock()"
  Linux 5.4.233
  bpf: add missing header file include
  Revert "net/sched: taprio: make qdisc_leaf() see the per-netdev-queue pfifo child qdiscs"
  ext4: Fix function prototype mismatch for ext4_feat_ktype
  wifi: mwifiex: Add missing compatible string for SD8787
  uaccess: Add speculation barrier to copy_from_user()
  mac80211: mesh: embedd mesh_paths and mpp_paths into ieee80211_if_mesh
  drm/i915/gvt: fix double free bug in split_2MB_gtt_entry
  alarmtimer: Prevent starvation by small intervals and SIG_IGN
  powerpc: dts: t208x: Disable 10G on MAC1 and MAC2
  can: kvaser_usb: hydra: help gcc-13 to figure out cmd_len
  KVM: VMX: Execute IBPB on emulated VM-exit when guest has IBRS
  KVM: x86: Fail emulation during EMULTYPE_SKIP on any exception
  random: always mix cycle counter in add_latent_entropy()
  powerpc: dts: t208x: Mark MAC1 and MAC2 as 10G
  wifi: rtl8xxxu: gen2: Turn on the rate control
  drm/etnaviv: don't truncate physical page address
  drm: etnaviv: fix common struct sg_table related issues
  scatterlist: add generic wrappers for iterating over sgtable objects
  dma-mapping: add generic helpers for mapping sgtable objects
  Linux 5.4.232
  iommu/amd: Pass gfp flags to iommu_map_page() in amd_iommu_map()
  net: sched: sch: Fix off by one in htb_activate_prios()
  ASoC: SOF: Intel: hda-dai: fix possible stream_tag leak
  nilfs2: fix underflow in second superblock position calculations
  kvm: initialize all of the kvm_debugregs structure before sending it to userspace
  i40e: Add checking for null for nlmsg_find_attr()
  ipv6: Fix tcp socket connection with DSCP.
  ipv6: Fix datagram socket connection with DSCP.
  ixgbe: add double of VLAN header when computing the max MTU
  net: mpls: fix stale pointer if allocation fails during device rename
  net: stmmac: Restrict warning on disabling DMA store and fwd mode
  bnxt_en: Fix mqprio and XDP ring checking logic
  net: stmmac: fix order of dwmac5 FlexPPS parametrization sequence
  net/usb: kalmia: Don't pass act_len in usb_bulk_msg error path
  dccp/tcp: Avoid negative sk_forward_alloc by ipv6_pinfo.pktoptions.
  sctp: sctp_sock_filter(): avoid list_entry() on possibly empty list
  net: bgmac: fix BCM5358 support by setting correct flags
  i40e: add double of VLAN header when computing the max MTU
  ixgbe: allow to increase MTU to 3K with XDP enabled
  revert "squashfs: harden sanity check in squashfs_read_xattr_id_table"
  net: Fix unwanted sign extension in netdev_stats_to_stats64()
  Revert "mm: Always release pages to the buddy allocator in memblock_free_late()."
  hugetlb: check for undefined shift on 32 bit architectures
  sched/psi: Fix use-after-free in ep_remove_wait_queue()
  ALSA: hda/realtek - fixed wrong gpio assigned
  ALSA: hda/conexant: add a new hda codec SN6180
  mmc: mmc_spi: fix error handling in mmc_spi_probe()
  mmc: sdio: fix possible resource leaks in some error paths
  ipv4: Fix incorrect route flushing when source address is deleted
  Revert "ipv4: Fix incorrect route flushing when source address is deleted"
  xfs: sync lazy sb accounting on quiesce of read-only mounts
  xfs: prevent UAF in xfs_log_item_in_current_chkpt
  xfs: fix the forward progress assertion in xfs_iwalk_run_callbacks
  xfs: ensure inobt record walks always make forward progress
  xfs: fix missing CoW blocks writeback conversion retry
  xfs: only relog deferred intent items if free space in the log gets low
  xfs: expose the log push threshold
  xfs: periodically relog deferred intent items
  xfs: change the order in which child and parent defer ops are finished
  xfs: fix an incore inode UAF in xfs_bui_recover
  xfs: clean up xfs_bui_item_recover iget/trans_alloc/ilock ordering
  xfs: clean up bmap intent item recovery checking
  xfs: xfs_defer_capture should absorb remaining transaction reservation
  xfs: xfs_defer_capture should absorb remaining block reservations
  xfs: proper replay of deferred ops queued during log recovery
  xfs: fix finobt btree block recovery ordering
  xfs: log new intent items created as part of finishing recovered intent items
  xfs: refactor xfs_defer_finish_noroll
  xfs: turn dfp_intent into a xfs_log_item
  xfs: merge the ->diff_items defer op into ->create_intent
  xfs: merge the ->log_item defer op into ->create_intent
  xfs: factor out a xfs_defer_create_intent helper
  xfs: remove the xfs_inode_log_item_t typedef
  xfs: remove the xfs_efd_log_item_t typedef
  xfs: remove the xfs_efi_log_item_t typedef
  netfilter: nft_tproxy: restrict to prerouting hook
  btrfs: free device in btrfs_close_devices for a single device filesystem
  aio: fix mremap after fork null-deref
  nvme-fc: fix a missing queue put in nvmet_fc_ls_create_association
  s390/decompressor: specify __decompress() buf len to avoid overflow
  net: sched: sch: Bounds check priority
  net: stmmac: do not stop RX_CLK in Rx LPI state for qcs404 SoC
  net/rose: Fix to not accept on connected socket
  tools/virtio: fix the vringh test for virtio ring changes
  ASoC: cs42l56: fix DT probe
  selftests/bpf: Verify copy_register_state() preserves parent/live fields
  migrate: hugetlb: check for hugetlb shared PMD in node migration
  bpf: Always return target ifindex in bpf_fib_lookup
  nvme-pci: Move enumeration by class to be last in the table
  arm64: dts: meson-axg: Make mmc host controller interrupts level-sensitive
  arm64: dts: meson-g12-common: Make mmc host controller interrupts level-sensitive
  arm64: dts: meson-gx: Make mmc host controller interrupts level-sensitive
  riscv: Fixup race condition on PG_dcache_clean in flush_icache_pte
  ceph: flush cap releases when the session is flushed
  usb: typec: altmodes/displayport: Fix probe pin assign check
  usb: core: add quirk for Alcor Link AK9563 smartcard reader
  net: USB: Fix wrong-direction WARNING in plusb.c
  pinctrl: intel: Restore the pins that used to be in Direct IRQ mode
  pinctrl: single: fix potential NULL dereference
  pinctrl: aspeed: Fix confusing types in return value
  ALSA: pci: lx6464es: fix a debug loop
  selftests: forwarding: lib: quote the sysctl values
  rds: rds_rm_zerocopy_callback() use list_first_entry()
  ice: Do not use WQ_MEM_RECLAIM flag for workqueue
  ionic: clean interrupt before enabling queue to avoid credit race
  net: phy: meson-gxl: use MMD access dummy stubs for GXL, internal PHY
  bonding: fix error checking in bond_debug_reregister()
  xfrm: fix bug with DSCP copy to v6 from v4 tunnel
  RDMA/usnic: use iommu_map_atomic() under spin_lock()
  iommu: Add gfp parameter to iommu_ops::map
  IB/IPoIB: Fix legacy IPoIB due to wrong number of queues
  IB/hfi1: Restore allocated resources on failed copyout
  can: j1939: do not wait 250 ms if the same addr was already claimed
  tracing: Fix poll() and select() do not work on per_cpu trace_pipe and trace_pipe_raw
  ALSA: emux: Avoid potential array out-of-bound in snd_emux_xg_control()
  btrfs: zlib: zero-initialize zlib workspace
  btrfs: limit device extents to the device size
  iio:adc:twl6030: Enable measurement of VAC
  wifi: brcmfmac: Check the count value of channel spec to prevent out-of-bounds reads
  f2fs: fix to do sanity check on i_extra_isize in is_alive()
  fbdev: smscufx: fix error handling code in ufx_usb_probe
  powerpc/imc-pmu: Revert nest_init_lock to being a mutex
  serial: 8250_dma: Fix DMA Rx rearm race
  serial: 8250_dma: Fix DMA Rx completion race
  xprtrdma: Fix regbuf data not freed in rpcrdma_req_create()
  mm: swap: properly update readahead statistics in unuse_pte_range()
  nvmem: core: fix cell removal on error
  Squashfs: fix handling and sanity checking of xattr_ids count
  mm/swapfile: add cond_resched() in get_swap_pages()
  fpga: stratix10-soc: Fix return value check in s10_ops_write_init()
  mm: hugetlb: proc: check for hugetlb shared PMD in /proc/PID/smaps
  riscv: disable generation of unwind tables
  parisc: Wire up PTRACE_GETREGS/PTRACE_SETREGS for compat case
  parisc: Fix return code of pdc_iodc_print()
  iio:adc:twl6030: Enable measurements of VUSB, VBAT and others
  iio: adc: berlin2-adc: Add missing of_node_put() in error path
  iio: hid: fix the retval in accel_3d_capture_sample
  efi: Accept version 2 of memory attributes table
  watchdog: diag288_wdt: fix __diag288() inline assembly
  watchdog: diag288_wdt: do not use stack buffers for hardware data
  fbcon: Check font dimension limits
  Input: i8042 - add Clevo PCX0DX to i8042 quirk table
  Input: i8042 - add TUXEDO devices to i8042 quirk tables
  Input: i8042 - merge quirk tables
  Input: i8042 - move __initconst to fix code styling warning
  vc_screen: move load of struct vc_data pointer in vcs_read() to avoid UAF
  usb: gadget: f_fs: Fix unbalanced spinlock in __ffs_ep0_queue_wait
  usb: dwc3: qcom: enable vbus override when in OTG dr-mode
  usb: dwc3: dwc3-qcom: Fix typo in the dwc3 vbus override API
  iio: adc: stm32-dfsdm: fill module aliases
  net/x25: Fix to not accept on connected socket
  i2c: rk3x: fix a bunch of kernel-doc warnings
  scsi: iscsi_tcp: Fix UAF during login when accessing the shost ipaddress
  scsi: target: core: Fix warning on RT kernels
  efi: fix potential NULL deref in efi_mem_reserve_persistent
  net: openvswitch: fix flow memory leak in ovs_flow_cmd_new
  virtio-net: Keep stop() to follow mirror sequence of open()
  selftests: net: udpgso_bench_tx: Cater for pending datagrams zerocopy benchmarking
  selftests: net: udpgso_bench: Fix racing bug between the rx/tx programs
  selftests: net: udpgso_bench_rx/tx: Stop when wrong CLI args are provided
  selftests: net: udpgso_bench_rx: Fix 'used uninitialized' compiler warning
  ata: libata: Fix sata_down_spd_limit() when no link speed is reported
  can: j1939: fix errant WARN_ON_ONCE in j1939_session_deactivate
  net: phy: meson-gxl: Add generic dummy stubs for MMD register access
  squashfs: harden sanity check in squashfs_read_xattr_id_table
  netfilter: br_netfilter: disable sabotage_in hook after first suppression
  netrom: Fix use-after-free caused by accept on already connected socket
  fix "direction" argument of iov_iter_kvec()
  fix iov_iter_bvec() "direction" argument
  WRITE is "data source", not destination...
  scsi: Revert "scsi: core: map PQ=1, PDT=other values to SCSI_SCAN_TARGET_PRESENT"
  arm64: dts: imx8mm: Fix pad control for UART1_DTE_RX
  ALSA: hda/via: Avoid potential array out-of-bound in add_secret_dac_path()
  ASoC: Intel: bytcr_rt5651: Drop reference count of ACPI device after use
  bus: sunxi-rsb: Fix error handling in sunxi_rsb_init()
  firewire: fix memory leak for payload of request subaction to IEC 61883-1 FCP region
  Linux 5.4.231
  Revert "xprtrdma: Fix regbuf data not freed in rpcrdma_req_create()"
  usb: host: xhci-plat: add wakeup entry at sysfs
  Bluetooth: fix null ptr deref on hci_sync_conn_complete_evt
  ipv6: ensure sane device mtu in tunnels
  exit: Use READ_ONCE() for all oops/warn limit reads
  docs: Fix path paste-o for /sys/kernel/warn_count
  panic: Expose "warn_count" to sysfs
  panic: Introduce warn_limit
  panic: Consolidate open-coded panic_on_warn checks
  exit: Allow oops_limit to be disabled
  exit: Expose "oops_count" to sysfs
  exit: Put an upper limit on how often we can oops
  ia64: make IA64_MCA_RECOVERY bool instead of tristate
  csky: Fix function name in csky_alignment() and die()
  h8300: Fix build errors from do_exit() to make_task_dead() transition
  hexagon: Fix function name in die()
  objtool: Add a missing comma to avoid string concatenation
  exit: Add and use make_task_dead.
  mm: kasan: do not panic if both panic_on_warn and kasan_multishot set
  panic: unset panic_on_warn inside panic()
  sysctl: add a new register_sysctl_init() interface
  dmaengine: imx-sdma: Fix a possible memory leak in sdma_transfer_init
  blk-cgroup: fix missing pd_online_fn() while activating policy
  bpf: Skip task with pid=1 in send_signal_common()
  ARM: dts: imx: Fix pca9547 i2c-mux node name
  x86/asm: Fix an assembler warning with current binutils
  clk: Fix pointer casting to prevent oops in devm_clk_release()
  perf/x86/amd: fix potential integer overflow on shift of a int
  netfilter: conntrack: unify established states for SCTP paths
  x86/i8259: Mark legacy PIC interrupts with IRQ_LEVEL
  block: fix and cleanup bio_check_ro
  nfsd: Ensure knfsd shuts down when the "nfsd" pseudofs is unmounted
  Revert "Input: synaptics - switch touchpad on HP Laptop 15-da3001TU to RMI mode"
  net: mdio-mux-meson-g12a: force internal PHY off on mux switch
  net: xgene: Move shared header file into include/linux
  net/phy/mdio-i2c: Move header file to include/linux/mdio
  net/tg3: resolve deadlock in tg3_reset_task() during EEH
  thermal: intel: int340x: Add locking to int340x_thermal_get_trip_type()
  net: ravb: Fix possible hang if RIS2_QFF1 happen
  sctp: fail if no bound addresses can be used for a given scope
  net/sched: sch_taprio: do not schedule in taprio_reset()
  netrom: Fix use-after-free of a listening socket.
  netfilter: conntrack: fix vtag checks for ABORT/SHUTDOWN_COMPLETE
  ipv4: prevent potential spectre v1 gadget in fib_metrics_match()
  ipv4: prevent potential spectre v1 gadget in ip_metrics_convert()
  netlink: annotate data races around sk_state
  netlink: annotate data races around dst_portid and dst_group
  netlink: annotate data races around nlk->portid
  netfilter: nft_set_rbtree: skip elements in transaction from garbage collection
  net: fix UaF in netns ops registration error path
  netlink: prevent potential spectre v1 gadgets
  EDAC/qcom: Do not pass llcc_driv_data as edac_device_ctl_info's pvt_info
  EDAC/device: Respect any driver-supplied workqueue polling value
  ARM: 9280/1: mm: fix warning on phys_addr_t to void pointer assignment
  thermal: intel: int340x: Protect trip temperature from concurrent updates
  KVM: x86/vmx: Do not skip segment attributes if unusable bit is set
  cifs: Fix oops due to uncleared server->smbd_conn in reconnect
  ftrace/scripts: Update the instructions for ftrace-bisect.sh
  trace_events_hist: add check for return value of 'create_hist_field'
  tracing: Make sure trace_printk() can output as soon as it can be used
  module: Don't wait for GOING modules
  scsi: hpsa: Fix allocation size for scsi_host_alloc()
  Bluetooth: hci_sync: cancel cmd_timer if hci_open failed
  Revert "Revert "xhci: Set HCD flag to defer primary roothub registration""
  fs: reiserfs: remove useless new_opts in reiserfs_remount
  netfilter: conntrack: do not renew entry stuck in tcp SYN_SENT state
  Revert "selftests/bpf: check null propagation only neither reg is PTR_TO_BTF_ID"
  mmc: sdhci-esdhc-imx: correct the tuning start tap and step setting
  mmc: sdhci-esdhc-imx: disable the CMD CRC check for standard tuning
  mmc: sdhci-esdhc-imx: clear pending interrupt and halt cqhci
  lockref: stop doing cpu_relax in the cmpxchg loop
  platform/x86: asus-nb-wmi: Add alternate mapping for KEY_SCREENLOCK
  platform/x86: touchscreen_dmi: Add info for the CSL Panther Tab HD
  scsi: hisi_sas: Set a port invalid only if there are no devices attached when refreshing port id
  KVM: s390: interrupt: use READ_ONCE() before cmpxchg()
  spi: spidev: remove debug messages that access spidev->spi without locking
  ASoC: fsl-asoc-card: Fix naming of AC'97 CODEC widgets
  ASoC: fsl_ssi: Rename AC'97 streams to avoid collisions with AC'97 CODEC
  cpufreq: armada-37xx: stop using 0 as NULL pointer
  s390/debug: add _ASM_S390_ prefix to header guard
  drm: Add orientation quirk for Lenovo ideapad D330-10IGL
  ASoC: fsl_micfil: Correct the number of steps on SX controls
  cpufreq: Add Tegra234 to cpufreq-dt-platdev blocklist
  tcp: fix rate_app_limited to default to 1
  net: dsa: microchip: ksz9477: port map correction in ALU table entry register
  driver core: Fix test_async_probe_init saves device in wrong array
  w1: fix WARNING after calling w1_process()
  w1: fix deadloop in __w1_remove_master_device()
  tcp: avoid the lookup process failing to get sk in ehash table
  dmaengine: xilinx_dma: call of_node_put() when breaking out of for_each_child_of_node()
  dmaengine: xilinx_dma: Fix devm_platform_ioremap_resource error handling
  dmaengine: xilinx_dma: use devm_platform_ioremap_resource()
  HID: betop: check shape of output reports
  net: macb: fix PTP TX timestamp failure due to packet padding
  dmaengine: Fix double increment of client_count in dma_chan_get()
  drm/panfrost: fix GENERIC_ATOMIC64 dependency
  net: mlx5: eliminate anonymous module_init & module_exit
  usb: gadget: f_fs: Ensure ep0req is dequeued before free_request
  usb: gadget: f_fs: Prevent race during ffs_ep0_queue_wait
  HID: revert CHERRY_MOUSE_000C quirk
  net: stmmac: fix invalid call to mdiobus_get_phy()
  HID: check empty report_list in bigben_probe()
  HID: check empty report_list in hid_validate_values()
  net: mdio: validate parameter addr in mdiobus_get_phy()
  net: usb: sr9700: Handle negative len
  l2tp: Don't sleep and disable BH under writer-side sk_callback_lock
  l2tp: Serialize access to sk_user_data with sk_callback_lock
  net: fix a concurrency bug in l2tp_tunnel_register()
  net/sched: sch_taprio: fix possible use-after-free
  wifi: rndis_wlan: Prevent buffer overflow in rndis_query_oid
  gpio: mxc: Always set GPIOs used as interrupt source to INPUT mode
  net: wan: Add checks for NULL for utdm in undo_uhdlc_init and unmap_si_regs
  net: nfc: Fix use-after-free in local_cleanup()
  phy: rockchip-inno-usb2: Fix missing clk_disable_unprepare() in rockchip_usb2phy_power_on()
  bpf: Fix pointer-leak due to insufficient speculative store bypass mitigation
  amd-xgbe: Delay AN timeout during KR training
  amd-xgbe: TX Flow Ctrl Registers are h/w ver dependent
  affs: initialize fsdata in affs_truncate()
  IB/hfi1: Fix expected receive setup error exit issues
  IB/hfi1: Reserve user expected TIDs
  IB/hfi1: Reject a zero-length user expected buffer
  RDMA/core: Fix ib block iterator counter overflow
  tomoyo: fix broken dependency on *.conf.default
  EDAC/highbank: Fix memory leak in highbank_mc_probe()
  HID: intel_ish-hid: Add check for ishtp_dma_tx_map
  ARM: imx: add missing of_node_put()
  ARM: imx35: Retrieve the IIM base address from devicetree
  ARM: imx31: Retrieve the IIM base address from devicetree
  ARM: imx27: Retrieve the SYSCTRL base address from devicetree
  ARM: dts: imx6qdl-gw560x: Remove incorrect 'uart-has-rtscts'
  memory: mvebu-devbus: Fix missing clk_disable_unprepare in mvebu_devbus_probe()
  memory: atmel-sdramc: Fix missing clk_disable_unprepare in atmel_ramc_probe()
  clk: Provide new devm_clk helpers for prepared and enabled clocks
  clk: generalize devm_clk_get() a bit
  Linux 5.4.230
  mm/khugepaged: fix collapse_pte_mapped_thp() to allow anon_vma
  x86/fpu: Use _Alignof to avoid undefined behavior in TYPE_ALIGN
  drm/amd/display: Fix COLOR_SPACE_YCBCR2020_TYPE matrix
  drm/amd/display: Fix set scaling doesn's work
  drm/i915: re-disable RC6p on Sandy Bridge
  gsmi: fix null-deref in gsmi_get_variable
  serial: atmel: fix incorrect baudrate setup
  dmaengine: tegra210-adma: fix global intr clear
  serial: pch_uart: Pass correct sg to dma_unmap_sg()
  dt-bindings: phy: g12a-usb3-pcie-phy: fix compatible string documentation
  usb-storage: apply IGNORE_UAS only for HIKSEMI MD202 on RTL9210
  usb: gadget: f_ncm: fix potential NULL ptr deref in ncm_bitrate()
  usb: gadget: g_webcam: Send color matching descriptor per frame
  usb: typec: altmodes/displayport: Fix pin assignment calculation
  usb: typec: altmodes/displayport: Add pin assignment helper
  usb: host: ehci-fsl: Fix module alias
  USB: serial: cp210x: add SCALANCE LPE-9000 device id
  USB: gadgetfs: Fix race between mounting and unmounting
  cifs: do not include page data when checking signature
  btrfs: fix race between quota rescan and disable leading to NULL pointer deref
  mmc: sunxi-mmc: Fix clock refcount imbalance during unbind
  comedi: adv_pci1760: Fix PWM instruction handling
  usb: core: hub: disable autosuspend for TI TUSB8041
  misc: fastrpc: Fix use-after-free race condition for maps
  misc: fastrpc: Don't remove map on creater_process and device_release
  USB: misc: iowarrior: fix up header size for USB_DEVICE_ID_CODEMERCS_IOW100
  USB: serial: option: add Quectel EM05CN modem
  USB: serial: option: add Quectel EM05CN (SG) modem
  USB: serial: option: add Quectel EC200U modem
  USB: serial: option: add Quectel EM05-G (RS) modem
  USB: serial: option: add Quectel EM05-G (CS) modem
  USB: serial: option: add Quectel EM05-G (GR) modem
  prlimit: do_prlimit needs to have a speculation check
  xhci: Detect lpm incapable xHC USB3 roothub ports from ACPI tables
  usb: acpi: add helper to check port lpm capability using acpi _DSM
  xhci: Add a flag to disable USB3 lpm on a xhci root port level.
  xhci: Add update_hub_device override for PCI xHCI hosts
  xhci: Fix null pointer dereference when host dies
  usb: xhci: Check endpoint is valid before dereferencing it
  xhci-pci: set the dma max_seg_size
  ALSA: hda/realtek - Turn on power early
  drm/i915/gt: Reset twice
  efi: fix userspace infinite retry read efivars after EFI runtime services page fault
  nilfs2: fix general protection fault in nilfs_btree_insert()
  Add exception protection processing for vd in axi_chan_handle_err function
  wifi: brcmfmac: fix regression for Broadcom PCIe wifi devices
  f2fs: let's avoid panic if extent_tree is not created
  RDMA/srp: Move large values to a new enum for gcc13
  net/ethtool/ioctl: return -EOPNOTSUPP if we have no phy stats
  selftests/bpf: check null propagation only neither reg is PTR_TO_BTF_ID
  pNFS/filelayout: Fix coalescing test for single DS
  Revert "net: add atomic_long_t to net_device_stats fields"
  Revert "PM/devfreq: governor: Add a private governor_data for governor"
  Linux 5.4.229
  tipc: call tipc_lxc_xmit without holding node_read_lock
  ocfs2: fix freeing uninitialized resource on ocfs2_dlm_shutdown
  tipc: Add a missing case of TIPC_DIRECT_MSG type
  tty: serial: tegra: Handle RX transfer in PIO mode if DMA wasn't started
  tipc: fix use-after-free in tipc_disc_rcv()
  Revert "usb: ulpi: defer ulpi_register on ulpi_read_id timeout"
  mm: Always release pages to the buddy allocator in memblock_free_late().
  efi: fix NULL-deref in init error path
  arm64: cmpxchg_double*: hazard against entire exchange variable
  arm64: atomics: remove LL/SC trampolines
  arm64: atomics: format whitespace consistently
  drm/virtio: Fix GEM handle creation UAF
  x86/resctrl: Fix task CLOSID/RMID update race
  x86/resctrl: Use task_curr() instead of task_struct->on_cpu to prevent unnecessary IPI
  iommu/mediatek-v1: Fix an error handling path in mtk_iommu_v1_probe()
  iommu/mediatek-v1: Add error handle for mtk_iommu_probe
  net/mlx5: Fix ptp max frequency adjustment range
  net/mlx5: Rename ptp clock info
  net/sched: act_mpls: Fix warning during failed attribute validation
  nfc: pn533: Wait for out_urb's completion in pn533_usb_send_frame()
  hvc/xen: lock console list traversal
  tipc: fix unexpected link reset due to discovery messages
  tipc: eliminate checking netns if node established
  tipc: improve throughput between nodes in netns
  regulator: da9211: Use irq handler when ready
  EDAC/device: Fix period calculation in edac_device_reset_delay_period()
  x86/boot: Avoid using Intel mnemonics in AT&T syntax asm
  powerpc/imc-pmu: Fix use of mutex in IRQs disabled section
  netfilter: ipset: Fix overflow before widen in the bitmap_ip_create() function.
  ext4: fix uninititialized value in 'ext4_evict_inode'
  ext4: fix use-after-free in ext4_orphan_cleanup
  ext4: lost matching-pair of trace in ext4_truncate
  ext4: fix bug_on in __es_tree_search caused by bad quota inode
  quota: Factor out setup of quota inode
  jbd2: use the correct print format
  usb: ulpi: defer ulpi_register on ulpi_read_id timeout
  wifi: wilc1000: sdio: fix module autoloading
  ipv6: raw: Deduct extension header length in rawv6_push_pending_frames
  ixgbe: fix pci device refcount leak
  platform/x86: sony-laptop: Don't turn off 0x153 keyboard backlight during probe
  drm/msm/adreno: Make adreno quirks not overwrite each other
  cifs: Fix uninitialized memory read for smb311 posix symlink create
  ALSA: hda/hdmi: Add a HP device 0x8715 to force connect list
  ALSA: pcm: Move rwsem lock inside snd_ctl_elem_read to prevent UAF
  net/ulp: prevent ULP without clone op from entering the LISTEN status
  s390/percpu: add READ_ONCE() to arch_this_cpu_to_op_simple()
  s390/kexec: fix ipl report address for kdump
  perf auxtrace: Fix address filter duplicate symbol selection
  docs: Fix the docs build with Sphinx 6.0
  efi: tpm: Avoid READ_ONCE() for accessing the event log
  KVM: arm64: Fix S1PTW handling on RO memslots
  net: sched: disallow noqueue for qdisc classes
  driver core: Fix bus_type.match() error handling in __driver_attach()
  selftests: set the BUILD variable to absolute path
  selftests: Fix kselftest O=objdir build from cluttering top level objdir
  parisc: Align parisc MADV_XXX constants with all other architectures
  mbcache: Avoid nesting of cache->c_list_lock under bit locks
  hfs/hfsplus: avoid WARN_ON() for sanity check, use proper error handling
  hfs/hfsplus: use WARN_ON for sanity check
  ext4: don't allow journal inode to have encrypt flag
  riscv: uaccess: fix type of 0 variable on error in get_user()
  nfsd: fix handling of readdir in v4root vs. mount upcall timeout
  x86/bugs: Flush IBP in ib_prctl_set()
  ASoC: Intel: bytcr_rt5640: Add quirk for the Advantech MICA-071 tablet
  udf: Fix extension of the last extent in the file
  caif: fix memory leak in cfctrl_linkup_request()
  drm/i915: unpin on error in intel_vgpu_shadow_mm_pin()
  usb: rndis_host: Secure rndis_query check against int overflow
  drivers/net/bonding/bond_3ad: return when there's no aggregator
  perf tools: Fix resources leak in perf_data__open_dir()
  net: sched: cbq: dont intepret cls results when asked to drop
  net: sched: atm: dont intepret cls results when asked to drop
  RDMA/mlx5: Fix validation of max_rd_atomic caps for DC
  RDMA/uverbs: Silence shiftTooManyBitsSigned warning
  net: phy: xgmiitorgmii: Fix refcount leak in xgmiitorgmii_probe
  net: amd-xgbe: add missed tasklet_kill
  vhost: fix range used in translate_desc()
  nfc: Fix potential resource leaks
  qlcnic: prevent ->dcb use-after-free on qlcnic_dcb_enable() failure
  net: sched: fix memory leak in tcindex_set_parms
  net: hns3: add interrupts re-initialization while doing VF FLR
  nfsd: shut down the NFSv4 state objects before the filecache
  bpf: pull before calling skb_postpull_rcsum()
  SUNRPC: ensure the matching upcall is in-flight upon downcall
  ext4: fix deadlock due to mbcache entry corruption
  mbcache: automatically delete entries from cache on freeing
  ext4: fix race when reusing xattr blocks
  ext4: unindent codeblock in ext4_xattr_block_set()
  ext4: remove EA inode entry from mbcache on inode eviction
  mbcache: add functions to delete entry if unused
  mbcache: don't reclaim used entries
  ext4: use kmemdup() to replace kmalloc + memcpy
  fs: ext4: initialize fsdata in pagecache_write()
  ext4: use memcpy_to_page() in pagecache_write()
  mm/highmem: Lift memcpy_[to|from]_page to core
  ext4: correct inconsistent error msg in nojournal mode
  ext4: goto right label 'failed_mount3a'
  ravb: Fix "failed to switch device to config mode" message during unbind
  KVM: nVMX: Properly expose ENABLE_USR_WAIT_PAUSE control to L1
  KVM: VMX: Fix the spelling of CPU_BASED_USE_TSC_OFFSETTING
  KVM: VMX: Rename NMI_PENDING to NMI_WINDOW
  KVM: VMX: Rename INTERRUPT_PENDING to INTERRUPT_WINDOW
  KVM: retpolines: x86: eliminate retpoline from vmx.c exit handlers
  KVM: x86: optimize more exit handlers in vmx.c
  perf probe: Fix to get the DW_AT_decl_file and DW_AT_call_file as unsinged data
  perf probe: Use dwarf_attr_integrate as generic DWARF attr accessor
  dm thin: resume even if in FAIL mode
  media: s5p-mfc: Fix in register read and write for H264
  media: s5p-mfc: Clear workbit to handle error condition
  media: s5p-mfc: Fix to handle reference queue during finishing
  PM/devfreq: governor: Add a private governor_data for governor
  btrfs: replace strncpy() with strscpy()
  ext4: allocate extended attribute value in vmalloc area
  ext4: avoid unaccounted block allocation when expanding inode
  ext4: initialize quota before expanding inode in setproject ioctl
  ext4: fix inode leak in ext4_xattr_inode_create() on an error path
  ext4: avoid BUG_ON when creating xattrs
  ext4: fix error code return to user-space in ext4_get_branch()
  ext4: fix corruption when online resizing a 1K bigalloc fs
  ext4: fix delayed allocation bug in ext4_clu_mapped for bigalloc + inline
  ext4: init quota for 'old.inode' in 'ext4_rename'
  ext4: fix bug_on in __es_tree_search caused by bad boot loader inode
  ext4: fix reserved cluster accounting in __es_remove_extent()
  ext4: add helper to check quota inums
  ext4: add EXT4_IGET_BAD flag to prevent unexpected bad inode
  ext4: fix undefined behavior in bit shift for ext4_check_flag_values
  ext4: add inode table check in __ext4_get_inode_loc to aovid possible infinite loop
  drm/vmwgfx: Validate the box size for the snooped cursor
  drm/connector: send hotplug uevent on connector cleanup
  device_cgroup: Roll back to original exceptions after copy failure
  parisc: led: Fix potential null-ptr-deref in start_task()
  iommu/amd: Fix ivrs_acpihid cmdline parsing code
  crypto: n2 - add missing hash statesize
  PCI/sysfs: Fix double free in error path
  PCI: Fix pci_device_is_present() for VFs by checking PF
  ipmi: fix use after free in _ipmi_destroy_user()
  ima: Fix a potential NULL pointer access in ima_restore_measurement_list
  mtd: spi-nor: Check for zero erase size in spi_nor_find_best_erase_type()
  ipmi: fix long wait in unload when IPMI disconnect
  efi: Add iMac Pro 2017 to uefi skip cert quirk
  md/bitmap: Fix bitmap chunk size overflow issues
  cifs: fix missing display of three mount options
  cifs: fix confusing debug message
  media: dvb-core: Fix UAF due to refcount races at releasing
  media: dvb-core: Fix double free in dvb_register_device()
  ARM: 9256/1: NWFPE: avoid compiler-generated __aeabi_uldivmod
  tracing: Fix infinite loop in tracing_read_pipe on overflowed print_trace_line
  tracing/hist: Fix wrong return value in parse_action_params()
  x86/microcode/intel: Do not retry microcode reloading on the APs
  tracing/hist: Fix out-of-bound write on 'action_data.var_ref_idx'
  dm cache: set needs_check flag after aborting metadata
  dm cache: Fix UAF in destroy()
  dm clone: Fix UAF in clone_dtr()
  dm integrity: Fix UAF in dm_integrity_dtr()
  dm thin: Fix UAF in run_timer_softirq()
  dm thin: Use last transaction's pmd->root when commit failed
  dm thin: Fix ABBA deadlock between shrink_slab and dm_pool_abort_metadata
  dm cache: Fix ABBA deadlock between shrink_slab and dm_cache_metadata_abort
  binfmt: Fix error return code in load_elf_fdpic_binary()
  binfmt: Move install_exec_creds after setup_new_exec to match binfmt_elf
  cpufreq: Init completion before kobject_init_and_add()
  selftests: Use optional USERCFLAGS and USERLDFLAGS
  arm64: dts: qcom: sdm850-lenovo-yoga-c630: correct I2C12 pins drive strength
  ARM: ux500: do not directly dereference __iomem
  btrfs: fix resolving backrefs for inline extent followed by prealloc
  mmc: sdhci-sprd: Disable CLK_AUTO when the clock is less than 400K
  ktest.pl minconfig: Unset configs instead of just removing them
  kest.pl: Fix grub2 menu handling for rebooting
  soc: qcom: Select REMAP_MMIO for LLCC driver
  media: stv0288: use explicitly signed char
  net/af_packet: make sure to pull mac header
  net/af_packet: add VLAN support for AF_PACKET SOCK_RAW GSO
  SUNRPC: Don't leak netobj memory when gss_read_proxy_verf() fails
  tpm: tpm_tis: Add the missed acpi_put_table() to fix memory leak
  tpm: tpm_crb: Add the missed acpi_put_table() to fix memory leak
  mmc: vub300: fix warning - do not call blocking ops when !TASK_RUNNING
  f2fs: should put a page when checking the summary info
  mm, compaction: fix fast_isolate_around() to stay within boundaries
  md: fix a crash in mempool_free
  pnode: terminate at peers of source
  ALSA: line6: fix stack overflow in line6_midi_transmit
  ALSA: line6: correct midi status byte when receiving data from podxt
  ovl: Use ovl mounter's fsuid and fsgid in ovl_link()
  hfsplus: fix bug causing custom uid and gid being unable to be assigned with mount
  HID: plantronics: Additional PIDs for double volume key presses quirk
  HID: multitouch: fix Asus ExpertBook P2 P2451FA trackpoint
  powerpc/rtas: avoid scheduling in rtas_os_term()
  powerpc/rtas: avoid device tree lookups in rtas_os_term()
  objtool: Fix SEGFAULT
  nvme: fix the NVME_CMD_EFFECTS_CSE_MASK definition
  nvme: resync include/linux/nvme.h with nvmecli
  ata: ahci: Fix PCS quirk application for suspend
  nvme-pci: fix doorbell buffer value endianness
  cifs: fix oops during encryption
  media: dvbdev: fix refcnt bug
  media: dvbdev: fix build warning due to comments
  gcov: add support for checksum field
  regulator: core: fix deadlock on regulator enable
  iio: adc128s052: add proper .data members in adc128_of_match table
  iio: adc: ad_sigma_delta: do not use internal iio_dev lock
  reiserfs: Add missing calls to reiserfs_security_free()
  HID: wacom: Ensure bootloader PID is usable in hidraw mode
  usb: dwc3: core: defer probe on ulpi_read_id timeout
  ALSA: hda/hdmi: Add HP Device 0x8711 to force connect list
  ALSA: hda/realtek: Add quirk for Lenovo TianYi510Pro-14IOB
  pstore: Make sure CONFIG_PSTORE_PMSG selects CONFIG_RT_MUTEXES
  pstore: Switch pmsg_lock to an rt_mutex to avoid priority inversion
  ASoC: rt5670: Remove unbalanced pm_runtime_put()
  ASoC: rockchip: spdif: Add missing clk_disable_unprepare() in rk_spdif_runtime_resume()
  ASoC: wm8994: Fix potential deadlock
  ASoC: rockchip: pdm: Add missing clk_disable_unprepare() in rockchip_pdm_runtime_resume()
  ASoC: audio-graph-card: fix refcount leak of cpu_ep in __graph_for_each_link()
  ASoC: mediatek: mt8173-rt5650-rt5514: fix refcount leak in mt8173_rt5650_rt5514_dev_probe()
  ASoC: Intel: Skylake: Fix driver hang during shutdown
  ALSA: hda: add snd_hdac_stop_streams() helper
  ALSA/ASoC: hda: move/rename snd_hdac_ext_stop_streams to hdac_stream.c
  orangefs: Fix kmemleak in orangefs_{kernel,client}_debug_init()
  orangefs: Fix kmemleak in orangefs_prepare_debugfs_help_string()
  drm/sti: Fix return type of sti_{dvo,hda,hdmi}_connector_mode_valid()
  drm/fsl-dcu: Fix return type of fsl_dcu_drm_connector_mode_valid()
  hugetlbfs: fix null-ptr-deref in hugetlbfs_parse_param()
  clk: st: Fix memory leak in st_of_quadfs_setup()
  media: si470x: Fix use-after-free in si470x_int_in_callback()
  mmc: f-sdh30: Add quirks for broken timeout clock capability
  regulator: core: fix use_count leakage when handling boot-on
  blk-mq: fix possible memleak when register 'hctx' failed
  media: dvb-usb: fix memory leak in dvb_usb_adapter_init()
  media: dvbdev: adopts refcnt to avoid UAF
  media: dvb-frontends: fix leak of memory fw
  bpf: Prevent decl_tag from being referenced in func_proto arg
  ppp: associate skb with a device at tx
  mrp: introduce active flags to prevent UAF when applicant uninit
  net: add atomic_long_t to net_device_stats fields
  md/raid1: stop mdx_raid1 thread when raid1 array run failed
  drivers/md/md-bitmap: check the return value of md_bitmap_get_counter()
  drm/sti: Use drm_mode_copy()
  drm/rockchip: Use drm_mode_copy()
  s390/lcs: Fix return type of lcs_start_xmit()
  s390/netiucv: Fix return type of netiucv_tx()
  s390/ctcm: Fix return type of ctc{mp,}m_tx()
  igb: Do not free q_vector unless new one was allocated
  wifi: brcmfmac: Fix potential shift-out-of-bounds in brcmf_fw_alloc_request()
  hamradio: baycom_epp: Fix return type of baycom_send_packet()
  net: ethernet: ti: Fix return type of netcp_ndo_start_xmit()
  bpf: make sure skb->len != 0 when redirecting to a tunneling device
  ipmi: fix memleak when unload ipmi driver
  ASoC: codecs: rt298: Add quirk for KBL-R RVP platform
  wifi: ar5523: Fix use-after-free on ar5523_cmd() timed out
  wifi: ath9k: verify the expected usb_endpoints are present
  brcmfmac: return error when getting invalid max_flowrings from dongle
  drm/etnaviv: add missing quirks for GC300
  hfs: fix OOB Read in __hfs_brec_find
  acct: fix potential integer overflow in encode_comp_t()
  nilfs2: fix shift-out-of-bounds/overflow in nilfs_sb2_bad_offset()
  ACPICA: Fix error code path in acpi_ds_call_control_method()
  fs: jfs: fix shift-out-of-bounds in dbDiscardAG
  udf: Avoid double brelse() in udf_rename()
  fs: jfs: fix shift-out-of-bounds in dbAllocAG
  binfmt_misc: fix shift-out-of-bounds in check_special_flags
  rcu: Fix __this_cpu_read() lockdep warning in rcu_force_quiescent_state()
  net: stream: purge sk_error_queue in sk_stream_kill_queues()
  myri10ge: Fix an error handling path in myri10ge_probe()
  rxrpc: Fix missing unlock in rxrpc_do_sendmsg()
  net_sched: reject TCF_EM_SIMPLE case for complex ematch module
  mailbox: zynq-ipi: fix error handling while device_register() fails
  skbuff: Account for tail adjustment during pull operations
  openvswitch: Fix flow lookup to use unmasked key
  rtc: mxc_v2: Add missing clk_disable_unprepare()
  r6040: Fix kmemleak in probe and remove
  nfc: pn533: Clear nfc_target before being used
  mISDN: hfcmulti: don't call dev_kfree_skb/kfree_skb() under spin_lock_irqsave()
  mISDN: hfcpci: don't call dev_kfree_skb/kfree_skb() under spin_lock_irqsave()
  mISDN: hfcsusb: don't call dev_kfree_skb/kfree_skb() under spin_lock_irqsave()
  nfsd: under NFSv4.1, fix double svc_xprt_put on rpc_create failure
  NFSD: Add tracepoints to NFSD's duplicate reply cache
  nfsd: Define the file access mode enum for tracing
  rtc: pic32: Move devm_rtc_allocate_device earlier in pic32_rtc_probe()
  rtc: st-lpc: Add missing clk_disable_unprepare in st_rtc_probe()
  remoteproc: qcom_q6v5_pas: Fix missing of_node_put() in adsp_alloc_memory_region()
  remoteproc: sysmon: fix memory leak in qcom_add_sysmon_subdev()
  pwm: sifive: Call pwm_sifive_update_clock() while mutex is held
  selftests/powerpc: Fix resource leaks
  powerpc/hv-gpci: Fix hv_gpci event list
  powerpc/83xx/mpc832x_rdb: call platform_device_put() in error case in of_fsl_spi_probe()
  powerpc/perf: callchain validate kernel stack pointer bounds
  powerpc/xive: add missing iounmap() in error path in xive_spapr_populate_irq_data()
  cxl: Fix refcount leak in cxl_calc_capp_routing
  powerpc/52xx: Fix a resource leak in an error handling path
  macintosh/macio-adb: check the return value of ioremap()
  macintosh: fix possible memory leak in macio_add_one_device()
  iommu/fsl_pamu: Fix resource leak in fsl_pamu_probe()
  iommu/amd: Fix pci device refcount leak in ppr_notifier()
  rtc: pcf85063: Fix reading alarm
  rtc: snvs: Allow a time difference on clock register read
  include/uapi/linux/swab: Fix potentially missing __always_inline
  RDMA/siw: Fix pointer cast warning
  power: supply: fix null pointer dereferencing in power_supply_get_battery_info
  HSI: omap_ssi_core: Fix error handling in ssi_init()
  perf symbol: correction while adjusting symbol
  perf trace: Handle failure when trace point folder is missed
  perf trace: Use macro RAW_SYSCALL_ARGS_NUM to replace number
  perf trace: Add a strtoul() method to 'struct syscall_arg_fmt'
  perf trace: Allow associating scnprintf routines with well known arg names
  perf trace: Add the syscall_arg_fmt pointer to syscall_arg
  perf trace: Factor out the initialization of syscal_arg_fmt->scnprintf
  perf trace: Separate 'struct syscall_fmt' definition from syscall_fmts variable
  perf trace: Return error if a system call doesn't exist
  power: supply: fix residue sysfs file in error handle route of __power_supply_register()
  HSI: omap_ssi_core: fix possible memory leak in ssi_probe()
  HSI: omap_ssi_core: fix unbalanced pm_runtime_disable()
  fbdev: uvesafb: Fixes an error handling path in uvesafb_probe()
  fbdev: vermilion: decrease reference count in error path
  fbdev: via: Fix error in via_core_init()
  fbdev: pm2fb: fix missing pci_disable_device()
  fbdev: ssd1307fb: Drop optional dependency
  samples: vfio-mdev: Fix missing pci_disable_device() in mdpy_fb_probe()
  tracing/hist: Fix issue of losting command info in error_log
  usb: storage: Add check for kcalloc
  i2c: ismt: Fix an out-of-bounds bug in ismt_access()
  vme: Fix error not catched in fake_init()
  staging: rtl8192e: Fix potential use-after-free in rtllib_rx_Monitor()
  staging: rtl8192u: Fix use after free in ieee80211_rx()
  i2c: pxa-pci: fix missing pci_disable_device() on error in ce4100_i2c_probe
  chardev: fix error handling in cdev_device_add()
  mcb: mcb-parse: fix error handing in chameleon_parse_gdd()
  drivers: mcb: fix resource leak in mcb_probe()
  usb: gadget: f_hid: fix refcount leak on error path
  usb: gadget: f_hid: fix f_hidg lifetime vs cdev
  usb: gadget: f_hid: optional SETUP/SET_REPORT mode
  usb: roles: fix of node refcount leak in usb_role_switch_is_parent()
  counter: stm32-lptimer-cnt: fix the check on arr and cmp registers update
  cxl: fix possible null-ptr-deref in cxl_pci_init_afu|adapter()
  cxl: fix possible null-ptr-deref in cxl_guest_init_afu|adapter()
  misc: sgi-gru: fix use-after-free error in gru_set_context_option, gru_fault and gru_handle_user_call_os
  misc: tifm: fix possible memory leak in tifm_7xx1_switch_media()
  misc: ocxl: fix possible name leak in ocxl_file_register_afu()
  test_firmware: fix memory leak in test_firmware_init()
  serial: sunsab: Fix error handling in sunsab_init()
  serial: altera_uart: fix locking in polling mode
  tty: serial: altera_uart_{r,t}x_chars() need only uart_port
  tty: serial: clean up stop-tx part in altera_uart_tx_chars()
  serial: pch: Fix PCI device refcount leak in pch_request_dma()
  serial: pl011: Do not clear RX FIFO & RX interrupt in unthrottle.
  serial: amba-pl011: avoid SBSA UART accessing DMACR register
  usb: typec: tcpci: fix of node refcount leak in tcpci_register_port()
  usb: typec: Check for ops->exit instead of ops->enter in altmode_exit
  staging: vme_user: Fix possible UAF in tsi148_dma_list_add
  usb: fotg210-udc: Fix ages old endianness issues
  uio: uio_dmem_genirq: Fix deadlock between irq config and handling
  uio: uio_dmem_genirq: Fix missing unlock in irq configuration
  vfio: platform: Do not pass return buffer to ACPI _RST method
  class: fix possible memory leak in __class_register()
  serial: tegra: Read DMA status before terminating
  tty: serial: tegra: Activate RX DMA transfer by request
  drivers: dio: fix possible memory leak in dio_init()
  IB/IPoIB: Fix queue count inconsistency for PKEY child interfaces
  hwrng: geode - Fix PCI device refcount leak
  hwrng: amd - Fix PCI device refcount leak
  crypto: img-hash - Fix variable dereferenced before check 'hdev->req'
  orangefs: Fix sysfs not cleanup when dev init failed
  RDMA/hfi1: Fix error return code in parse_platform_config()
  crypto: omap-sham - Use pm_runtime_resume_and_get() in omap_sham_probe()
  f2fs: avoid victim selection from previous victim section
  RDMA/nldev: Add checks for nla_nest_start() in fill_stat_counter_qps()
  scsi: snic: Fix possible UAF in snic_tgt_create()
  scsi: fcoe: Fix transport not deattached when fcoe_if_init() fails
  scsi: ipr: Fix WARNING in ipr_init()
  scsi: fcoe: Fix possible name leak when device_register() fails
  scsi: hpsa: Fix possible memory leak in hpsa_add_sas_device()
  scsi: hpsa: Fix error handling in hpsa_add_sas_host()
  scsi: mpt3sas: Fix possible resource leaks in mpt3sas_transport_port_add()
  crypto: tcrypt - Fix multibuffer skcipher speed test mem leak
  scsi: hpsa: Fix possible memory leak in hpsa_init_one()
  RDMA/rxe: Fix NULL-ptr-deref in rxe_qp_do_cleanup() when socket create failed
  crypto: ccree - Make cc_debugfs_global_fini() available for module init function
  RDMA/hfi: Decrease PCI device reference count in error path
  PCI: Check for alloc failure in pci_request_irq()
  crypto: ccree - Remove debugfs when platform_driver_register failed
  crypto: ccree - swap SHA384 and SHA512 larval hashes at build time
  scsi: scsi_debug: Fix a warning in resp_write_scat()
  RDMA/siw: Set defined status for work completion with undefined status
  RDMA/nldev: Return "-EAGAIN" if the cm_id isn't from expected port
  RDMA/siw: Fix immediate work request flush to completion queue
  f2fs: fix normal discard process
  RDMA/core: Fix order of nldev_exit call
  apparmor: Use pointer to struct aa_label for lbs_cred
  apparmor: Fix abi check to include v8 abi
  apparmor: fix lockdep warning when removing a namespace
  apparmor: fix a memleak in multi_transaction_new()
  stmmac: fix potential division by 0
  Bluetooth: RFCOMM: don't call kfree_skb() under spin_lock_irqsave()
  Bluetooth: hci_core: don't call kfree_skb() under spin_lock_irqsave()
  Bluetooth: hci_bcsp: don't call kfree_skb() under spin_lock_irqsave()
  Bluetooth: hci_h5: don't call kfree_skb() under spin_lock_irqsave()
  Bluetooth: hci_ll: don't call kfree_skb() under spin_lock_irqsave()
  Bluetooth: hci_qca: don't call kfree_skb() under spin_lock_irqsave()
  Bluetooth: btusb: don't call kfree_skb() under spin_lock_irqsave()
  ntb_netdev: Use dev_kfree_skb_any() in interrupt context
  net: lan9303: Fix read error execution path
  can: tcan4x5x: Remove invalid write in clear_interrupts
  net: amd-xgbe: Check only the minimum speed for active/passive cables
  net: amd-xgbe: Fix logic around active and passive cables
  net: amd: lance: don't call dev_kfree_skb() under spin_lock_irqsave()
  hamradio: don't call dev_kfree_skb() under spin_lock_irqsave()
  net: ethernet: dnet: don't call dev_kfree_skb() under spin_lock_irqsave()
  net: emaclite: don't call dev_kfree_skb() under spin_lock_irqsave()
  net: apple: bmac: don't call dev_kfree_skb() under spin_lock_irqsave()
  net: apple: mace: don't call dev_kfree_skb() under spin_lock_irqsave()
  net/tunnel: wait until all sk_user_data reader finish before releasing the sock
  net: farsync: Fix kmemleak when rmmods farsync
  ethernet: s2io: don't call dev_kfree_skb() under spin_lock_irqsave()
  of: overlay: fix null pointer dereferencing in find_dup_cset_node_entry() and find_dup_cset_prop()
  drivers: net: qlcnic: Fix potential memory leak in qlcnic_sriov_init()
  net: stmmac: selftests: fix potential memleak in stmmac_test_arpoffload()
  net: defxx: Fix missing err handling in dfx_init()
  net: vmw_vsock: vmci: Check memcpy_from_msg()
  clk: socfpga: Fix memory leak in socfpga_gate_init()
  clk: socfpga: use clk_hw_register for a5/c5
  clk: socfpga: clk-pll: Remove unused variable 'rc'
  blktrace: Fix output non-blktrace event when blk_classic option enabled
  wifi: brcmfmac: Fix error return code in brcmf_sdio_download_firmware()
  wifi: rtl8xxxu: Add __packed to struct rtl8723bu_c2h
  spi: spi-gpio: Don't set MOSI as an input if not 3WIRE mode
  clk: samsung: Fix memory leak in _samsung_clk_register_pll()
  media: coda: Add check for kmalloc
  media: coda: Add check for dcoda_iram_alloc
  media: c8sectpfe: Add of_node_put() when breaking out of loop
  mmc: mmci: fix return value check of mmc_add_host()
  mmc: wbsd: fix return value check of mmc_add_host()
  mmc: via-sdmmc: fix return value check of mmc_add_host()
  mmc: meson-gx: fix return value check of mmc_add_host()
  mmc: omap_hsmmc: fix return value check of mmc_add_host()
  mmc: atmel-mci: fix return value check of mmc_add_host()
  mmc: wmt-sdmmc: fix return value check of mmc_add_host()
  mmc: vub300: fix return value check of mmc_add_host()
  mmc: toshsd: fix return value check of mmc_add_host()
  mmc: rtsx_usb_sdmmc: fix return value check of mmc_add_host()
  mmc: pxamci: fix return value check of mmc_add_host()
  mmc: mxcmmc: fix return value check of mmc_add_host()
  mmc: moxart: fix return value check of mmc_add_host()
  mmc: alcor: fix return value check of mmc_add_host()
  NFSv4.x: Fail client initialisation if state manager thread can't run
  SUNRPC: Fix missing release socket in rpc_sockname()
  xprtrdma: Fix regbuf data not freed in rpcrdma_req_create()
  ALSA: mts64: fix possible null-ptr-defer in snd_mts64_interrupt
  media: saa7164: fix missing pci_disable_device()
  bpf, sockmap: fix race in sock_map_free()
  regulator: core: fix resource leak in regulator_register()
  configfs: fix possible memory leak in configfs_create_dir()
  hsr: Avoid double remove of a node.
  clk: qcom: clk-krait: fix wrong div2 functions
  regulator: core: fix module refcount leak in set_supply()
  wifi: cfg80211: Fix not unregister reg_pdev when load_builtin_regdb_keys() fails
  spi: spidev: mask SPI_CS_HIGH in SPI_IOC_RD_MODE
  bonding: uninitialized variable in bond_miimon_inspect()
  bpf, sockmap: Fix data loss caused by using apply_bytes on ingress redirect
  bpf, sockmap: Fix repeated calls to sock_put() when msg has more_data
  netfilter: conntrack: set icmpv6 redirects as RELATED
  ASoC: pcm512x: Fix PM disable depth imbalance in pcm512x_probe
  drm/amdgpu: Fix PCI device refcount leak in amdgpu_atrm_get_bios()
  drm/radeon: Fix PCI device refcount leak in radeon_atrm_get_bios()
  ASoC: mediatek: mt8173: Enable IRQ when pdata is ready
  wifi: iwlwifi: mvm: fix double free on tx path.
  ALSA: asihpi: fix missing pci_disable_device()
  NFSv4: Fix a deadlock between nfs4_open_recover_helper() and delegreturn
  NFSv4.2: Fix initialisation of struct nfs4_label
  NFSv4.2: Fix a memory stomp in decode_attr_security_label
  NFSv4.2: Clear FATTR4_WORD2_SECURITY_LABEL when done decoding
  ASoC: mediatek: mtk-btcvsd: Add checks for write and read of mtk_btcvsd_snd
  ASoC: dt-bindings: wcd9335: fix reset line polarity in example
  drm/tegra: Add missing clk_disable_unprepare() in tegra_dc_probe()
  media: s5p-mfc: Add variant data for MFC v7 hardware for Exynos 3250 SoC
  media: dvb-usb: az6027: fix null-ptr-deref in az6027_i2c_xfer()
  media: dvb-core: Fix ignored return value in dvb_register_frontend()
  pinctrl: pinconf-generic: add missing of_node_put()
  clk: imx: replace osc_hdmi with dummy
  clk: imx8mn: correct the usb1_ctrl parent to be usb_bus
  media: imon: fix a race condition in send_packet()
  mtd: maps: pxa2xx-flash: fix memory leak in probe
  bonding: fix link recovery in mode 2 when updelay is nonzero
  bonding: Rename slave_arr to usable_slaves
  bonding: Export skip slave logic to function
  clk: rockchip: Fix memory leak in rockchip_clk_register_pll()
  regulator: core: use kfree_const() to free space conditionally
  ALSA: seq: fix undefined behavior in bit shift for SNDRV_SEQ_FILTER_USE_EVENT
  ALSA: pcm: fix undefined behavior in bit shift for SNDRV_PCM_RATE_KNOT
  HID: hid-sensor-custom: set fixed size for custom attributes
  bpf: Move skb->len == 0 checks into __bpf_redirect
  media: videobuf-dma-contig: use dma_mmap_coherent
  media: platform: exynos4-is: Fix error handling in fimc_md_init()
  media: solo6x10: fix possible memory leak in solo_sysfs_init()
  Input: elants_i2c - properly handle the reset GPIO when power is off
  mtd: lpddr2_nvm: Fix possible null-ptr-deref
  wifi: ath10k: Fix return value in ath10k_pci_init()
  ima: Fix misuse of dereference of pointer in template_desc_init_fields()
  integrity: Fix memory leakage in keyring allocation error path
  amdgpu/pm: prevent array underflow in vega20_odn_edit_dpm_table()
  regulator: core: fix unbalanced of node refcount in regulator_dev_lookup()
  ASoC: pxa: fix null-pointer dereference in filter()
  drm/mediatek: Modify dpi power on/off sequence.
  drm/radeon: Add the missed acpi_put_table() to fix memory leak
  rxrpc: Fix ack.bufferSize to be 0 when generating an ack
  net, proc: Provide PROC_FS=n fallback for proc_create_net_single_write()
  media: camss: Clean up received buffers on failed start of streaming
  wifi: rsi: Fix handling of 802.3 EAPOL frames sent via control port
  mtd: Fix device name leak when register device failed in add_mtd_device()
  bpf: propagate precision in ALU/ALU64 operations
  media: vivid: fix compose size exceed boundary
  ima: Handle -ESTALE returned by ima_filter_rule_match()
  ima: Fix fall-through warnings for Clang
  ima: Rename internal filter rule functions
  drm/panel/panel-sitronix-st7701: Remove panel on DSI attach failure
  spi: Update reference to struct spi_controller
  clk: renesas: r9a06g032: Repair grave increment error
  can: kvaser_usb: Compare requested bittiming parameters with actual parameters in do_set_{,data}_bittiming
  can: kvaser_usb: Add struct kvaser_usb_busparams
  can: kvaser_usb_leaf: Fix bogus restart events
  can: kvaser_usb_leaf: Fix wrong CAN state after stopping
  can: kvaser_usb_leaf: Fix improved state not being reported
  can: kvaser_usb_leaf: Set Warning state even without bus errors
  can: kvaser_usb: kvaser_usb_leaf: Handle CMD_ERROR_EVENT
  can: kvaser_usb: kvaser_usb_leaf: Rename {leaf,usbcan}_cmd_error_event to {leaf,usbcan}_cmd_can_error_event
  can: kvaser_usb: kvaser_usb_leaf: Get capabilities from device
  can: kvaser_usb: do not increase tx statistics when sending error message frames
  media: i2c: ad5820: Fix error path
  pata_ipx4xx_cf: Fix unsigned comparison with less than zero
  wifi: rtl8xxxu: Fix reading the vendor of combo chips
  wifi: ath9k: hif_usb: Fix use-after-free in ath9k_hif_usb_reg_in_cb()
  wifi: ath9k: hif_usb: fix memory leak of urbs in ath9k_hif_usb_dealloc_tx_urbs()
  rapidio: devices: fix missing put_device in mport_cdev_open
  hfs: Fix OOB Write in hfs_asc2mac
  relay: fix type mismatch when allocating memory in relay_create_buf()
  eventfd: change int to __u64 in eventfd_signal() ifndef CONFIG_EVENTFD
  rapidio: fix possible UAF when kfifo_alloc() fails
  fs: sysv: Fix sysv_nblocks() returns wrong value
  MIPS: OCTEON: warn only once if deprecated link status is being used
  MIPS: BCM63xx: Add check for NULL for clk in clk_enable
  platform/x86: mxm-wmi: fix memleak in mxm_wmi_call_mx[ds|mx]()
  PM: runtime: Do not call __rpm_callback() from rpm_idle()
  PM: runtime: Improve path in rpm_idle() when no callback
  xen/privcmd: Fix a possible warning in privcmd_ioctl_mmap_resource()
  x86/xen: Fix memory leak in xen_init_lock_cpu()
  x86/xen: Fix memory leak in xen_smp_intr_init{_pv}()
  xen/events: only register debug interrupt for 2-level events
  uprobes/x86: Allow to probe a NOP instruction with 0x66 prefix
  ACPICA: Fix use-after-free in acpi_ut_copy_ipackage_to_ipackage()
  clocksource/drivers/sh_cmt: Make sure channel clock supply is enabled
  rapidio: rio: fix possible name leak in rio_register_mport()
  rapidio: fix possible name leaks when rio_add_device() fails
  ocfs2: fix memory leak in ocfs2_mount_volume()
  ocfs2: rewrite error handling of ocfs2_fill_super
  ocfs2: ocfs2_mount_volume does cleanup job before return error
  debugfs: fix error when writing negative value to atomic_t debugfs file
  docs: fault-injection: fix non-working usage of negative values
  lib/notifier-error-inject: fix error when writing -errno to debugfs file
  libfs: add DEFINE_SIMPLE_ATTRIBUTE_SIGNED for signed value
  cpufreq: amd_freq_sensitivity: Add missing pci_dev_put()
  genirq/irqdesc: Don't try to remove non-existing sysfs files
  nfsd: don't call nfsd_file_put from client states seqfile display
  EDAC/i10nm: fix refcount leak in pci_get_dev_wrapper()
  irqchip: gic-pm: Use pm_runtime_resume_and_get() in gic_probe()
  perf/x86/intel/uncore: Fix reference count leak in hswep_has_limit_sbox()
  PNP: fix name memory leak in pnp_alloc_dev()
  selftests/efivarfs: Add checking of the test return value
  MIPS: vpe-cmp: fix possible memory leak while module exiting
  MIPS: vpe-mt: fix possible memory leak while module exiting
  ocfs2: fix memory leak in ocfs2_stack_glue_init()
  lib/fonts: fix undefined behavior in bit shift for get_default_font
  proc: fixup uptime selftest
  timerqueue: Use rb_entry_safe() in timerqueue_getnext()
  perf: Fix possible memleak in pmu_dev_alloc()
  selftests/ftrace: event_triggers: wait longer for test_event_enable
  fs: don't audit the capability check in simple_xattr_list()
  PM: hibernate: Fix mistake in kerneldoc comment
  alpha: fix syscall entry in !AUDUT_SYSCALL case
  cpuidle: dt: Return the correct numbers of parsed idle states
  tpm/tpm_crb: Fix error message in __crb_relinquish_locality()
  pstore: Avoid kcore oops by vmap()ing with VM_IOREMAP
  ARM: mmp: fix timer_read delay
  pstore/ram: Fix error return code in ramoops_probe()
  arm64: dts: armada-3720-turris-mox: Add missing interrupt for RTC
  ARM: dts: turris-omnia: Add switch port 6 node
  ARM: dts: turris-omnia: Add ethernet aliases
  ARM: dts: armada-39x: Fix assigned-addresses for every PCIe Root Port
  ARM: dts: armada-38x: Fix assigned-addresses for every PCIe Root Port
  ARM: dts: armada-375: Fix assigned-addresses for every PCIe Root Port
  ARM: dts: armada-xp: Fix assigned-addresses for every PCIe Root Port
  ARM: dts: armada-370: Fix assigned-addresses for every PCIe Root Port
  ARM: dts: dove: Fix assigned-addresses for every PCIe Root Port
  arm64: dts: mediatek: mt6797: Fix 26M oscillator unit name
  arm64: dts: mt2712-evb: Fix usb vbus regulators unit names
  arm64: dts: mt2712-evb: Fix vproc fixed regulators unit names
  arm64: dts: mt2712e: Fix unit address for pinctrl node
  arm64: dts: mt2712e: Fix unit_address_vs_reg warning for oscillators
  perf/smmuv3: Fix hotplug callback leak in arm_smmu_pmu_init()
  perf: arm_dsu: Fix hotplug callback leak in dsu_pmu_init()
  soc: ti: smartreflex: Fix PM disable depth imbalance in omap_sr_probe
  soc: ti: knav_qmss_queue: Fix PM disable depth imbalance in knav_queue_probe
  soc: ti: knav_qmss_queue: Use pm_runtime_resume_and_get instead of pm_runtime_get_sync
  arm: dts: spear600: Fix clcd interrupt
  drivers: soc: ti: knav_qmss_queue: Mark knav_acc_firmwares as static
  arm64: dts: qcom: sdm845-cheza: fix AP suspend pin bias
  ARM: dts: qcom: apq8064: fix coresight compatible
  usb: musb: remove extra check in musb_gadget_vbus_draw
  net: loopback: use NET_NAME_PREDICTABLE for name_assign_type
  Bluetooth: L2CAP: Fix u8 overflow
  HID: uclogic: Add HID_QUIRK_HIDINPUT_FORCE quirk
  HID: ite: Enable QUIRK_TOUCHPAD_ON_OFF_REPORT on Acer Aspire Switch V 10
  HID: ite: Enable QUIRK_TOUCHPAD_ON_OFF_REPORT on Acer Aspire Switch 10E
  HID: ite: Add support for Acer S1002 keyboard-dock
  xen-netback: move removal of "hotplug-status" to the right place
  igb: Initialize mailbox message for VF reset
  USB: serial: f81534: fix division by zero on line-speed change
  USB: serial: f81232: fix division by zero on line-speed change
  USB: serial: cp210x: add Kamstrup RF sniffer PIDs
  USB: serial: option: add Quectel EM05-G modem
  usb: gadget: uvc: Prevent buffer overflow in setup handler
  udf: Fix extending file within last block
  udf: Do not bother looking for prealloc extents if i_lenExtents matches i_size
  udf: Fix preallocation discarding at indirect extent boundary
  udf: Discard preallocation before extending file with a hole
  tracing/ring-buffer: Only do full wait when cpu != RING_BUFFER_ALL_CPUS
  ANDROID: Add more hvc devices for virtio-console.
  Revert "can: af_can: fix NULL pointer dereference in can_rcv_filter"
  ANDROID: Revert "tracing/ring-buffer: Have polling block on watermark"
  Linux 5.4.228
  ASoC: ops: Correct bounds check for second channel on SX controls
  can: mcba_usb: Fix termination command argument
  can: sja1000: fix size of OCR_MODE_MASK define
  pinctrl: meditatek: Startup with the IRQs disabled
  ASoC: ops: Check bounds for second channel in snd_soc_put_volsw_sx()
  nfp: fix use-after-free in area_cache_get()
  block: unhash blkdev part inode when the part is deleted
  mm/hugetlb: fix races when looking up a CONT-PTE/PMD size hugetlb page
  x86/smpboot: Move rcu_cpu_starting() earlier
  net: bpf: Allow TC programs to call BPF_FUNC_skb_change_head
  Linux 5.4.227
  can: esd_usb: Allow REC and TEC to return to zero
  net: mvneta: Fix an out of bounds check
  ipv6: avoid use-after-free in ip6_fragment()
  net: plip: don't call kfree_skb/dev_kfree_skb() under spin_lock_irq()
  xen/netback: fix build warning
  ethernet: aeroflex: fix potential skb leak in greth_init_rings()
  ipv4: Fix incorrect route flushing when table ID 0 is used
  ipv4: Fix incorrect route flushing when source address is deleted
  tipc: Fix potential OOB in tipc_link_proto_rcv()
  net: hisilicon: Fix potential use-after-free in hix5hd2_rx()
  net: hisilicon: Fix potential use-after-free in hisi_femac_rx()
  net: thunderx: Fix missing destroy_workqueue of nicvf_rx_mode_wq
  net: stmmac: fix "snps,axi-config" node property parsing
  nvme initialize core quirks before calling nvme_init_subsystem
  NFC: nci: Bounds check struct nfc_target arrays
  i40e: Disallow ip4 and ip6 l4_4_bytes
  i40e: Fix for VF MAC address 0
  i40e: Fix not setting default xps_cpus after reset
  net: mvneta: Prevent out of bounds read in mvneta_config_rss()
  xen-netfront: Fix NULL sring after live migration
  net: encx24j600: Fix invalid logic in reading of MISTAT register
  net: encx24j600: Add parentheses to fix precedence
  mac802154: fix missing INIT_LIST_HEAD in ieee802154_if_add()
  selftests: rtnetlink: correct xfrm policy rule in kci_test_ipsec_offload
  net: dsa: ksz: Check return value
  Bluetooth: Fix not cleanup led when bt_init fails
  Bluetooth: 6LoWPAN: add missing hci_dev_put() in get_l2cap_conn()
  af_unix: Get user_ns from in_skb in unix_diag_get_exact().
  igb: Allocate MSI-X vector when testing
  e1000e: Fix TX dispatch condition
  gpio: amd8111: Fix PCI device reference count leak
  drm/bridge: ti-sn65dsi86: Fix output polarity setting bug
  ca8210: Fix crash by zero initializing data
  ieee802154: cc2520: Fix error return code in cc2520_hw_init()
  can: af_can: fix NULL pointer dereference in can_rcv_filter
  HID: core: fix shift-out-of-bounds in hid_report_raw_event
  HID: hid-lg4ff: Add check for empty lbuf
  HID: usbhid: Add ALWAYS_POLL quirk for some mice
  drm/shmem-helper: Remove errant put in error path
  KVM: s390: vsie: Fix the initialization of the epoch extension (epdx) field
  mm/gup: fix gup_pud_range() for dax
  memcg: fix possible use-after-free in memcg_write_event_control()
  media: v4l2-dv-timings.c: fix too strict blanking sanity checks
  Revert "net: dsa: b53: Fix valid setting for MDB entries"
  xen/netback: don't call kfree_skb() with interrupts disabled
  xen/netback: do some code cleanup
  xen/netback: Ensure protocol headers don't fall in the non-linear area
  mm/khugepaged: invoke MMU notifiers in shmem/file collapse paths
  mm/khugepaged: fix GUP-fast interaction by sending IPI
  mm/khugepaged: take the right locks for page table retraction
  net: usb: qmi_wwan: add u-blox 0x1342 composition
  9p/xen: check logical size for buffer size
  fbcon: Use kzalloc() in fbcon_prepare_logo()
  regulator: twl6030: fix get status of twl6032 regulators
  ASoC: soc-pcm: Add NULL check in BE reparenting
  btrfs: send: avoid unaligned encoded writes when attempting to clone range
  ALSA: seq: Fix function prototype mismatch in snd_seq_expand_var_event
  regulator: slg51000: Wait after asserting CS pin
  9p/fd: Use P9_HDRSZ for header size
  ARM: dts: rockchip: disable arm_global_timer on rk3066 and rk3188
  ARM: 9266/1: mm: fix no-MMU ZERO_PAGE() implementation
  ARM: 9251/1: perf: Fix stacktraces for tracepoint events in THUMB2 kernels
  ARM: dts: rockchip: rk3188: fix lcdc1-rgb24 node name
  ARM: dts: rockchip: fix ir-receiver node names
  arm: dts: rockchip: fix node name for hym8563 rtc
  arm64: dts: rockchip: keep I2S1 disabled for GPIO function on ROCK Pi 4 series

 Conflicts:
	Documentation/devicetree/bindings/phy/amlogic,meson-g12a-usb3-pcie-phy.yaml
	arch/arm64/boot/dts/vendor/bindings/phy/amlogic,g12a-usb3-pcie-phy.yaml
	arch/arm64/boot/dts/vendor/bindings/phy/amlogic,meson-g12a-usb3-pcie-phy.yaml
	arch/arm64/include/asm/atomic_ll_sc.h
	drivers/edac/qcom_edac.c
	drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c
	drivers/net/ethernet/stmicro/stmmac/stmmac_hwtstamp.c
	drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
	drivers/usb/gadget/function/f_fs.c
	drivers/usb/host/xhci-plat.c
	sound/soc/soc-pcm.c

Change-Id: I4e8cffcac6c78ecf1a16d24ee01551747552fdf2
2023-04-06 14:17:05 +03:00

1443 lines
48 KiB
C

/* SPDX-License-Identifier: GPL-2.0-or-later */
#ifndef __SOUND_PCM_H
#define __SOUND_PCM_H
/*
* Digital Audio (PCM) abstract layer
* Copyright (c) by Jaroslav Kysela <perex@perex.cz>
* Abramo Bagnara <abramo@alsa-project.org>
*/
#include <sound/asound.h>
#include <sound/memalloc.h>
#include <sound/minors.h>
#include <linux/poll.h>
#include <linux/mm.h>
#include <linux/bitops.h>
#include <linux/pm_qos.h>
#include <linux/refcount.h>
#define snd_pcm_substream_chip(substream) ((substream)->private_data)
#define snd_pcm_chip(pcm) ((pcm)->private_data)
#if IS_ENABLED(CONFIG_SND_PCM_OSS)
#include <sound/pcm_oss.h>
#endif
/*
* Hardware (lowlevel) section
*/
struct snd_pcm_hardware {
unsigned int info; /* SNDRV_PCM_INFO_* */
u64 formats; /* SNDRV_PCM_FMTBIT_* */
unsigned int rates; /* SNDRV_PCM_RATE_* */
unsigned int rate_min; /* min rate */
unsigned int rate_max; /* max rate */
unsigned int channels_min; /* min channels */
unsigned int channels_max; /* max channels */
size_t buffer_bytes_max; /* max buffer size */
size_t period_bytes_min; /* min period size */
size_t period_bytes_max; /* max period size */
unsigned int periods_min; /* min # of periods */
unsigned int periods_max; /* max # of periods */
size_t fifo_size; /* fifo size in bytes */
};
struct snd_pcm_substream;
struct snd_pcm_audio_tstamp_config; /* definitions further down */
struct snd_pcm_audio_tstamp_report;
struct snd_pcm_ops {
int (*open)(struct snd_pcm_substream *substream);
int (*close)(struct snd_pcm_substream *substream);
int (*ioctl)(struct snd_pcm_substream * substream,
unsigned int cmd, void *arg);
#ifdef CONFIG_AUDIO_QGKI
int (*compat_ioctl)(struct snd_pcm_substream *substream,
unsigned int cmd, void __user *arg);
#endif
int (*hw_params)(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params);
int (*hw_free)(struct snd_pcm_substream *substream);
int (*prepare)(struct snd_pcm_substream *substream);
int (*trigger)(struct snd_pcm_substream *substream, int cmd);
snd_pcm_uframes_t (*pointer)(struct snd_pcm_substream *substream);
int (*get_time_info)(struct snd_pcm_substream *substream,
struct timespec *system_ts, struct timespec *audio_ts,
struct snd_pcm_audio_tstamp_config *audio_tstamp_config,
struct snd_pcm_audio_tstamp_report *audio_tstamp_report);
#ifdef CONFIG_AUDIO_QGKI
int (*delay_blk)(struct snd_pcm_substream *substream);
int (*wall_clock)(struct snd_pcm_substream *substream,
struct timespec *audio_ts);
#endif
int (*fill_silence)(struct snd_pcm_substream *substream, int channel,
unsigned long pos, unsigned long bytes);
int (*copy_user)(struct snd_pcm_substream *substream, int channel,
unsigned long pos, void __user *buf,
unsigned long bytes);
int (*copy_kernel)(struct snd_pcm_substream *substream, int channel,
unsigned long pos, void *buf, unsigned long bytes);
struct page *(*page)(struct snd_pcm_substream *substream,
unsigned long offset);
int (*mmap)(struct snd_pcm_substream *substream, struct vm_area_struct *vma);
int (*ack)(struct snd_pcm_substream *substream);
};
/*
*
*/
#if defined(CONFIG_SND_DYNAMIC_MINORS)
#define SNDRV_PCM_DEVICES (SNDRV_OS_MINORS-2)
#else
#define SNDRV_PCM_DEVICES 8
#endif
#define SNDRV_PCM_IOCTL1_RESET 0
/* 1 is absent slot. */
#define SNDRV_PCM_IOCTL1_CHANNEL_INFO 2
/* 3 is absent slot. */
#define SNDRV_PCM_IOCTL1_FIFO_SIZE 4
#define SNDRV_PCM_TRIGGER_STOP 0
#define SNDRV_PCM_TRIGGER_START 1
#define SNDRV_PCM_TRIGGER_PAUSE_PUSH 3
#define SNDRV_PCM_TRIGGER_PAUSE_RELEASE 4
#define SNDRV_PCM_TRIGGER_SUSPEND 5
#define SNDRV_PCM_TRIGGER_RESUME 6
#define SNDRV_PCM_TRIGGER_DRAIN 7
#define SNDRV_PCM_POS_XRUN ((snd_pcm_uframes_t)-1)
/* If you change this don't forget to change rates[] table in pcm_native.c */
#define SNDRV_PCM_RATE_5512 (1U<<0) /* 5512Hz */
#define SNDRV_PCM_RATE_8000 (1U<<1) /* 8000Hz */
#define SNDRV_PCM_RATE_11025 (1U<<2) /* 11025Hz */
#define SNDRV_PCM_RATE_16000 (1U<<3) /* 16000Hz */
#define SNDRV_PCM_RATE_22050 (1U<<4) /* 22050Hz */
#define SNDRV_PCM_RATE_32000 (1U<<5) /* 32000Hz */
#define SNDRV_PCM_RATE_44100 (1U<<6) /* 44100Hz */
#define SNDRV_PCM_RATE_48000 (1U<<7) /* 48000Hz */
#define SNDRV_PCM_RATE_64000 (1U<<8) /* 64000Hz */
#define SNDRV_PCM_RATE_88200 (1U<<9) /* 88200Hz */
#define SNDRV_PCM_RATE_96000 (1U<<10) /* 96000Hz */
#define SNDRV_PCM_RATE_176400 (1U<<11) /* 176400Hz */
#define SNDRV_PCM_RATE_192000 (1U<<12) /* 192000Hz */
#define SNDRV_PCM_RATE_352800 (1U<<13) /* 352800Hz */
#define SNDRV_PCM_RATE_384000 (1U<<14) /* 384000Hz */
#define SNDRV_PCM_RATE_CONTINUOUS (1U<<30) /* continuous range */
#define SNDRV_PCM_RATE_KNOT (1U<<31) /* supports more non-continuos rates */
#define SNDRV_PCM_RATE_8000_44100 (SNDRV_PCM_RATE_8000|SNDRV_PCM_RATE_11025|\
SNDRV_PCM_RATE_16000|SNDRV_PCM_RATE_22050|\
SNDRV_PCM_RATE_32000|SNDRV_PCM_RATE_44100)
#define SNDRV_PCM_RATE_8000_48000 (SNDRV_PCM_RATE_8000_44100|SNDRV_PCM_RATE_48000)
#define SNDRV_PCM_RATE_8000_96000 (SNDRV_PCM_RATE_8000_48000|SNDRV_PCM_RATE_64000|\
SNDRV_PCM_RATE_88200|SNDRV_PCM_RATE_96000)
#define SNDRV_PCM_RATE_8000_192000 (SNDRV_PCM_RATE_8000_96000|SNDRV_PCM_RATE_176400|\
SNDRV_PCM_RATE_192000)
#define SNDRV_PCM_RATE_8000_384000 (SNDRV_PCM_RATE_8000_192000|\
SNDRV_PCM_RATE_352800|\
SNDRV_PCM_RATE_384000)
#define _SNDRV_PCM_FMTBIT(fmt) (1ULL << (__force int)SNDRV_PCM_FORMAT_##fmt)
#define SNDRV_PCM_FMTBIT_S8 _SNDRV_PCM_FMTBIT(S8)
#define SNDRV_PCM_FMTBIT_U8 _SNDRV_PCM_FMTBIT(U8)
#define SNDRV_PCM_FMTBIT_S16_LE _SNDRV_PCM_FMTBIT(S16_LE)
#define SNDRV_PCM_FMTBIT_S16_BE _SNDRV_PCM_FMTBIT(S16_BE)
#define SNDRV_PCM_FMTBIT_U16_LE _SNDRV_PCM_FMTBIT(U16_LE)
#define SNDRV_PCM_FMTBIT_U16_BE _SNDRV_PCM_FMTBIT(U16_BE)
#define SNDRV_PCM_FMTBIT_S24_LE _SNDRV_PCM_FMTBIT(S24_LE)
#define SNDRV_PCM_FMTBIT_S24_BE _SNDRV_PCM_FMTBIT(S24_BE)
#define SNDRV_PCM_FMTBIT_U24_LE _SNDRV_PCM_FMTBIT(U24_LE)
#define SNDRV_PCM_FMTBIT_U24_BE _SNDRV_PCM_FMTBIT(U24_BE)
#define SNDRV_PCM_FMTBIT_S32_LE _SNDRV_PCM_FMTBIT(S32_LE)
#define SNDRV_PCM_FMTBIT_S32_BE _SNDRV_PCM_FMTBIT(S32_BE)
#define SNDRV_PCM_FMTBIT_U32_LE _SNDRV_PCM_FMTBIT(U32_LE)
#define SNDRV_PCM_FMTBIT_U32_BE _SNDRV_PCM_FMTBIT(U32_BE)
#define SNDRV_PCM_FMTBIT_FLOAT_LE _SNDRV_PCM_FMTBIT(FLOAT_LE)
#define SNDRV_PCM_FMTBIT_FLOAT_BE _SNDRV_PCM_FMTBIT(FLOAT_BE)
#define SNDRV_PCM_FMTBIT_FLOAT64_LE _SNDRV_PCM_FMTBIT(FLOAT64_LE)
#define SNDRV_PCM_FMTBIT_FLOAT64_BE _SNDRV_PCM_FMTBIT(FLOAT64_BE)
#define SNDRV_PCM_FMTBIT_IEC958_SUBFRAME_LE _SNDRV_PCM_FMTBIT(IEC958_SUBFRAME_LE)
#define SNDRV_PCM_FMTBIT_IEC958_SUBFRAME_BE _SNDRV_PCM_FMTBIT(IEC958_SUBFRAME_BE)
#define SNDRV_PCM_FMTBIT_MU_LAW _SNDRV_PCM_FMTBIT(MU_LAW)
#define SNDRV_PCM_FMTBIT_A_LAW _SNDRV_PCM_FMTBIT(A_LAW)
#define SNDRV_PCM_FMTBIT_IMA_ADPCM _SNDRV_PCM_FMTBIT(IMA_ADPCM)
#define SNDRV_PCM_FMTBIT_MPEG _SNDRV_PCM_FMTBIT(MPEG)
#define SNDRV_PCM_FMTBIT_GSM _SNDRV_PCM_FMTBIT(GSM)
#define SNDRV_PCM_FMTBIT_S20_LE _SNDRV_PCM_FMTBIT(S20_LE)
#define SNDRV_PCM_FMTBIT_U20_LE _SNDRV_PCM_FMTBIT(U20_LE)
#define SNDRV_PCM_FMTBIT_S20_BE _SNDRV_PCM_FMTBIT(S20_BE)
#define SNDRV_PCM_FMTBIT_U20_BE _SNDRV_PCM_FMTBIT(U20_BE)
#define SNDRV_PCM_FMTBIT_SPECIAL _SNDRV_PCM_FMTBIT(SPECIAL)
#define SNDRV_PCM_FMTBIT_S24_3LE _SNDRV_PCM_FMTBIT(S24_3LE)
#define SNDRV_PCM_FMTBIT_U24_3LE _SNDRV_PCM_FMTBIT(U24_3LE)
#define SNDRV_PCM_FMTBIT_S24_3BE _SNDRV_PCM_FMTBIT(S24_3BE)
#define SNDRV_PCM_FMTBIT_U24_3BE _SNDRV_PCM_FMTBIT(U24_3BE)
#define SNDRV_PCM_FMTBIT_S20_3LE _SNDRV_PCM_FMTBIT(S20_3LE)
#define SNDRV_PCM_FMTBIT_U20_3LE _SNDRV_PCM_FMTBIT(U20_3LE)
#define SNDRV_PCM_FMTBIT_S20_3BE _SNDRV_PCM_FMTBIT(S20_3BE)
#define SNDRV_PCM_FMTBIT_U20_3BE _SNDRV_PCM_FMTBIT(U20_3BE)
#define SNDRV_PCM_FMTBIT_S18_3LE _SNDRV_PCM_FMTBIT(S18_3LE)
#define SNDRV_PCM_FMTBIT_U18_3LE _SNDRV_PCM_FMTBIT(U18_3LE)
#define SNDRV_PCM_FMTBIT_S18_3BE _SNDRV_PCM_FMTBIT(S18_3BE)
#define SNDRV_PCM_FMTBIT_U18_3BE _SNDRV_PCM_FMTBIT(U18_3BE)
#define SNDRV_PCM_FMTBIT_G723_24 _SNDRV_PCM_FMTBIT(G723_24)
#define SNDRV_PCM_FMTBIT_G723_24_1B _SNDRV_PCM_FMTBIT(G723_24_1B)
#define SNDRV_PCM_FMTBIT_G723_40 _SNDRV_PCM_FMTBIT(G723_40)
#define SNDRV_PCM_FMTBIT_G723_40_1B _SNDRV_PCM_FMTBIT(G723_40_1B)
#define SNDRV_PCM_FMTBIT_DSD_U8 _SNDRV_PCM_FMTBIT(DSD_U8)
#define SNDRV_PCM_FMTBIT_DSD_U16_LE _SNDRV_PCM_FMTBIT(DSD_U16_LE)
#define SNDRV_PCM_FMTBIT_DSD_U32_LE _SNDRV_PCM_FMTBIT(DSD_U32_LE)
#define SNDRV_PCM_FMTBIT_DSD_U16_BE _SNDRV_PCM_FMTBIT(DSD_U16_BE)
#define SNDRV_PCM_FMTBIT_DSD_U32_BE _SNDRV_PCM_FMTBIT(DSD_U32_BE)
#ifdef SNDRV_LITTLE_ENDIAN
#define SNDRV_PCM_FMTBIT_S16 SNDRV_PCM_FMTBIT_S16_LE
#define SNDRV_PCM_FMTBIT_U16 SNDRV_PCM_FMTBIT_U16_LE
#define SNDRV_PCM_FMTBIT_S24 SNDRV_PCM_FMTBIT_S24_LE
#define SNDRV_PCM_FMTBIT_U24 SNDRV_PCM_FMTBIT_U24_LE
#define SNDRV_PCM_FMTBIT_S32 SNDRV_PCM_FMTBIT_S32_LE
#define SNDRV_PCM_FMTBIT_U32 SNDRV_PCM_FMTBIT_U32_LE
#define SNDRV_PCM_FMTBIT_FLOAT SNDRV_PCM_FMTBIT_FLOAT_LE
#define SNDRV_PCM_FMTBIT_FLOAT64 SNDRV_PCM_FMTBIT_FLOAT64_LE
#define SNDRV_PCM_FMTBIT_IEC958_SUBFRAME SNDRV_PCM_FMTBIT_IEC958_SUBFRAME_LE
#define SNDRV_PCM_FMTBIT_S20 SNDRV_PCM_FMTBIT_S20_LE
#define SNDRV_PCM_FMTBIT_U20 SNDRV_PCM_FMTBIT_U20_LE
#endif
#ifdef SNDRV_BIG_ENDIAN
#define SNDRV_PCM_FMTBIT_S16 SNDRV_PCM_FMTBIT_S16_BE
#define SNDRV_PCM_FMTBIT_U16 SNDRV_PCM_FMTBIT_U16_BE
#define SNDRV_PCM_FMTBIT_S24 SNDRV_PCM_FMTBIT_S24_BE
#define SNDRV_PCM_FMTBIT_U24 SNDRV_PCM_FMTBIT_U24_BE
#define SNDRV_PCM_FMTBIT_S32 SNDRV_PCM_FMTBIT_S32_BE
#define SNDRV_PCM_FMTBIT_U32 SNDRV_PCM_FMTBIT_U32_BE
#define SNDRV_PCM_FMTBIT_FLOAT SNDRV_PCM_FMTBIT_FLOAT_BE
#define SNDRV_PCM_FMTBIT_FLOAT64 SNDRV_PCM_FMTBIT_FLOAT64_BE
#define SNDRV_PCM_FMTBIT_IEC958_SUBFRAME SNDRV_PCM_FMTBIT_IEC958_SUBFRAME_BE
#define SNDRV_PCM_FMTBIT_S20 SNDRV_PCM_FMTBIT_S20_BE
#define SNDRV_PCM_FMTBIT_U20 SNDRV_PCM_FMTBIT_U20_BE
#endif
struct snd_pcm_file {
struct snd_pcm_substream *substream;
int no_compat_mmap;
unsigned int user_pversion; /* supported protocol version */
};
struct snd_pcm_hw_rule;
typedef int (*snd_pcm_hw_rule_func_t)(struct snd_pcm_hw_params *params,
struct snd_pcm_hw_rule *rule);
struct snd_pcm_hw_rule {
unsigned int cond;
int var;
int deps[4];
snd_pcm_hw_rule_func_t func;
void *private;
};
struct snd_pcm_hw_constraints {
struct snd_mask masks[SNDRV_PCM_HW_PARAM_LAST_MASK -
SNDRV_PCM_HW_PARAM_FIRST_MASK + 1];
struct snd_interval intervals[SNDRV_PCM_HW_PARAM_LAST_INTERVAL -
SNDRV_PCM_HW_PARAM_FIRST_INTERVAL + 1];
unsigned int rules_num;
unsigned int rules_all;
struct snd_pcm_hw_rule *rules;
};
static inline struct snd_mask *constrs_mask(struct snd_pcm_hw_constraints *constrs,
snd_pcm_hw_param_t var)
{
return &constrs->masks[var - SNDRV_PCM_HW_PARAM_FIRST_MASK];
}
static inline struct snd_interval *constrs_interval(struct snd_pcm_hw_constraints *constrs,
snd_pcm_hw_param_t var)
{
return &constrs->intervals[var - SNDRV_PCM_HW_PARAM_FIRST_INTERVAL];
}
struct snd_ratnum {
unsigned int num;
unsigned int den_min, den_max, den_step;
};
struct snd_ratden {
unsigned int num_min, num_max, num_step;
unsigned int den;
};
struct snd_pcm_hw_constraint_ratnums {
int nrats;
const struct snd_ratnum *rats;
};
struct snd_pcm_hw_constraint_ratdens {
int nrats;
const struct snd_ratden *rats;
};
struct snd_pcm_hw_constraint_list {
const unsigned int *list;
unsigned int count;
unsigned int mask;
};
struct snd_pcm_hw_constraint_ranges {
unsigned int count;
const struct snd_interval *ranges;
unsigned int mask;
};
/*
* userspace-provided audio timestamp config to kernel,
* structure is for internal use only and filled with dedicated unpack routine
*/
struct snd_pcm_audio_tstamp_config {
/* 5 of max 16 bits used */
u32 type_requested:4;
u32 report_delay:1; /* add total delay to A/D or D/A */
};
static inline void snd_pcm_unpack_audio_tstamp_config(__u32 data,
struct snd_pcm_audio_tstamp_config *config)
{
config->type_requested = data & 0xF;
config->report_delay = (data >> 4) & 1;
}
/*
* kernel-provided audio timestamp report to user-space
* structure is for internal use only and read by dedicated pack routine
*/
struct snd_pcm_audio_tstamp_report {
/* 6 of max 16 bits used for bit-fields */
/* for backwards compatibility */
u32 valid:1;
/* actual type if hardware could not support requested timestamp */
u32 actual_type:4;
/* accuracy represented in ns units */
u32 accuracy_report:1; /* 0 if accuracy unknown, 1 if accuracy field is valid */
u32 accuracy; /* up to 4.29s, will be packed in separate field */
};
static inline void snd_pcm_pack_audio_tstamp_report(__u32 *data, __u32 *accuracy,
const struct snd_pcm_audio_tstamp_report *report)
{
u32 tmp;
tmp = report->accuracy_report;
tmp <<= 4;
tmp |= report->actual_type;
tmp <<= 1;
tmp |= report->valid;
*data &= 0xffff; /* zero-clear MSBs */
*data |= (tmp << 16);
*accuracy = report->accuracy;
}
struct snd_pcm_runtime {
/* -- Status -- */
struct snd_pcm_substream *trigger_master;
struct timespec trigger_tstamp; /* trigger timestamp */
bool trigger_tstamp_latched; /* trigger timestamp latched in low-level driver/hardware */
int overrange;
snd_pcm_uframes_t avail_max;
snd_pcm_uframes_t hw_ptr_base; /* Position at buffer restart */
snd_pcm_uframes_t hw_ptr_interrupt; /* Position at interrupt time */
unsigned long hw_ptr_jiffies; /* Time when hw_ptr is updated */
unsigned long hw_ptr_buffer_jiffies; /* buffer time in jiffies */
snd_pcm_sframes_t delay; /* extra delay; typically FIFO size */
u64 hw_ptr_wrap; /* offset for hw_ptr due to boundary wrap-around */
/* -- HW params -- */
snd_pcm_access_t access; /* access mode */
snd_pcm_format_t format; /* SNDRV_PCM_FORMAT_* */
snd_pcm_subformat_t subformat; /* subformat */
unsigned int rate; /* rate in Hz */
unsigned int channels; /* channels */
snd_pcm_uframes_t period_size; /* period size */
unsigned int periods; /* periods */
snd_pcm_uframes_t buffer_size; /* buffer size */
snd_pcm_uframes_t min_align; /* Min alignment for the format */
size_t byte_align;
unsigned int frame_bits;
unsigned int sample_bits;
unsigned int info;
unsigned int rate_num;
unsigned int rate_den;
unsigned int no_period_wakeup: 1;
/* -- SW params -- */
int tstamp_mode; /* mmap timestamp is updated */
unsigned int period_step;
snd_pcm_uframes_t start_threshold;
snd_pcm_uframes_t stop_threshold;
snd_pcm_uframes_t silence_threshold; /* Silence filling happens when
noise is nearest than this */
snd_pcm_uframes_t silence_size; /* Silence filling size */
snd_pcm_uframes_t boundary; /* pointers wrap point */
snd_pcm_uframes_t silence_start; /* starting pointer to silence area */
snd_pcm_uframes_t silence_filled; /* size filled with silence */
union snd_pcm_sync_id sync; /* hardware synchronization ID */
/* -- mmap -- */
struct snd_pcm_mmap_status *status;
struct snd_pcm_mmap_control *control;
/* -- locking / scheduling -- */
snd_pcm_uframes_t twake; /* do transfer (!poll) wakeup if non-zero */
wait_queue_head_t sleep; /* poll sleep */
wait_queue_head_t tsleep; /* transfer sleep */
struct fasync_struct *fasync;
/* -- private section -- */
void *private_data;
void (*private_free)(struct snd_pcm_runtime *runtime);
/* -- hardware description -- */
struct snd_pcm_hardware hw;
struct snd_pcm_hw_constraints hw_constraints;
/* -- timer -- */
unsigned int timer_resolution; /* timer resolution */
int tstamp_type; /* timestamp type */
/* -- DMA -- */
unsigned char *dma_area; /* DMA area */
dma_addr_t dma_addr; /* physical bus address (not accessible from main CPU) */
size_t dma_bytes; /* size of DMA area */
struct snd_dma_buffer *dma_buffer_p; /* allocated buffer */
/* -- audio timestamp config -- */
struct snd_pcm_audio_tstamp_config audio_tstamp_config;
struct snd_pcm_audio_tstamp_report audio_tstamp_report;
struct timespec driver_tstamp;
#if IS_ENABLED(CONFIG_SND_PCM_OSS)
/* -- OSS things -- */
struct snd_pcm_oss_runtime oss;
#endif
#ifndef __GENKSYMS__
struct mutex buffer_mutex; /* protect for buffer changes */
atomic_t buffer_accessing; /* >0: in r/w operation, <0: blocked */
#endif
};
struct snd_pcm_group { /* keep linked substreams */
spinlock_t lock;
struct mutex mutex;
struct list_head substreams;
refcount_t refs;
};
struct pid;
struct snd_pcm_substream {
struct snd_pcm *pcm;
struct snd_pcm_str *pstr;
void *private_data; /* copied from pcm->private_data */
int number;
char name[32]; /* substream name */
int stream; /* stream (direction) */
struct pm_qos_request latency_pm_qos_req; /* pm_qos request */
size_t buffer_bytes_max; /* limit ring buffer size */
struct snd_dma_buffer dma_buffer;
size_t dma_max;
/* -- hardware operations -- */
const struct snd_pcm_ops *ops;
/* -- runtime information -- */
struct snd_pcm_runtime *runtime;
/* -- timer section -- */
struct snd_timer *timer; /* timer */
unsigned timer_running: 1; /* time is running */
long wait_time; /* time in ms for R/W to wait for avail */
/* -- next substream -- */
struct snd_pcm_substream *next;
/* -- linked substreams -- */
struct list_head link_list; /* linked list member */
struct snd_pcm_group self_group; /* fake group for non linked substream (with substream lock inside) */
struct snd_pcm_group *group; /* pointer to current group */
/* -- assigned files -- */
int ref_count;
atomic_t mmap_count;
unsigned int f_flags;
void (*pcm_release)(struct snd_pcm_substream *);
struct pid *pid;
#if IS_ENABLED(CONFIG_SND_PCM_OSS)
/* -- OSS things -- */
struct snd_pcm_oss_substream oss;
#endif
#ifdef CONFIG_SND_VERBOSE_PROCFS
struct snd_info_entry *proc_root;
#endif /* CONFIG_SND_VERBOSE_PROCFS */
/* misc flags */
unsigned int hw_opened: 1;
#ifdef CONFIG_AUDIO_QGKI
spinlock_t runtime_lock;
#endif
unsigned int hw_no_buffer: 1; /* substream may not have a buffer */
};
#define SUBSTREAM_BUSY(substream) ((substream)->ref_count > 0)
struct snd_pcm_str {
int stream; /* stream (direction) */
struct snd_pcm *pcm;
/* -- substreams -- */
unsigned int substream_count;
unsigned int substream_opened;
struct snd_pcm_substream *substream;
#if IS_ENABLED(CONFIG_SND_PCM_OSS)
/* -- OSS things -- */
struct snd_pcm_oss_stream oss;
#endif
#ifdef CONFIG_SND_VERBOSE_PROCFS
struct snd_info_entry *proc_root;
#ifdef CONFIG_SND_PCM_XRUN_DEBUG
unsigned int xrun_debug; /* 0 = disabled, 1 = verbose, 2 = stacktrace */
#endif
#endif
struct snd_kcontrol *chmap_kctl; /* channel-mapping controls */
struct device dev;
};
struct snd_pcm {
struct snd_card *card;
struct list_head list;
int device; /* device number */
unsigned int info_flags;
unsigned short dev_class;
unsigned short dev_subclass;
char id[64];
char name[80];
struct snd_pcm_str streams[2];
struct mutex open_mutex;
wait_queue_head_t open_wait;
void *private_data;
void (*private_free) (struct snd_pcm *pcm);
bool internal; /* pcm is for internal use only */
bool nonatomic; /* whole PCM operations are in non-atomic context */
bool no_device_suspend; /* don't invoke device PM suspend */
#if IS_ENABLED(CONFIG_SND_PCM_OSS)
struct snd_pcm_oss oss;
#endif
};
/*
* Registering
*/
extern const struct file_operations snd_pcm_f_ops[2];
int snd_pcm_new(struct snd_card *card, const char *id, int device,
int playback_count, int capture_count,
struct snd_pcm **rpcm);
int snd_pcm_new_internal(struct snd_card *card, const char *id, int device,
int playback_count, int capture_count,
struct snd_pcm **rpcm);
int snd_pcm_new_stream(struct snd_pcm *pcm, int stream, int substream_count);
#if IS_ENABLED(CONFIG_SND_PCM_OSS)
struct snd_pcm_notify {
int (*n_register) (struct snd_pcm * pcm);
int (*n_disconnect) (struct snd_pcm * pcm);
int (*n_unregister) (struct snd_pcm * pcm);
struct list_head list;
};
int snd_pcm_notify(struct snd_pcm_notify *notify, int nfree);
#endif
/*
* Native I/O
*/
int snd_pcm_info(struct snd_pcm_substream *substream, struct snd_pcm_info *info);
int snd_pcm_info_user(struct snd_pcm_substream *substream,
struct snd_pcm_info __user *info);
int snd_pcm_status(struct snd_pcm_substream *substream,
struct snd_pcm_status *status);
int snd_pcm_start(struct snd_pcm_substream *substream);
int snd_pcm_stop(struct snd_pcm_substream *substream, snd_pcm_state_t status);
int snd_pcm_drain_done(struct snd_pcm_substream *substream);
int snd_pcm_stop_xrun(struct snd_pcm_substream *substream);
#ifdef CONFIG_PM
int snd_pcm_suspend_all(struct snd_pcm *pcm);
#else
static inline int snd_pcm_suspend_all(struct snd_pcm *pcm)
{
return 0;
}
#endif
int snd_pcm_kernel_ioctl(struct snd_pcm_substream *substream, unsigned int cmd, void *arg);
int snd_pcm_open_substream(struct snd_pcm *pcm, int stream, struct file *file,
struct snd_pcm_substream **rsubstream);
void snd_pcm_release_substream(struct snd_pcm_substream *substream);
int snd_pcm_attach_substream(struct snd_pcm *pcm, int stream, struct file *file,
struct snd_pcm_substream **rsubstream);
void snd_pcm_detach_substream(struct snd_pcm_substream *substream);
int snd_pcm_mmap_data(struct snd_pcm_substream *substream, struct file *file, struct vm_area_struct *area);
#ifdef CONFIG_SND_DEBUG
void snd_pcm_debug_name(struct snd_pcm_substream *substream,
char *name, size_t len);
#else
static inline void
snd_pcm_debug_name(struct snd_pcm_substream *substream, char *buf, size_t size)
{
*buf = 0;
}
#endif
/*
* PCM library
*/
/**
* snd_pcm_stream_linked - Check whether the substream is linked with others
* @substream: substream to check
*
* Returns true if the given substream is being linked with others.
*/
static inline int snd_pcm_stream_linked(struct snd_pcm_substream *substream)
{
return substream->group != &substream->self_group;
}
void snd_pcm_stream_lock(struct snd_pcm_substream *substream);
void snd_pcm_stream_unlock(struct snd_pcm_substream *substream);
void snd_pcm_stream_lock_irq(struct snd_pcm_substream *substream);
void snd_pcm_stream_unlock_irq(struct snd_pcm_substream *substream);
unsigned long _snd_pcm_stream_lock_irqsave(struct snd_pcm_substream *substream);
/**
* snd_pcm_stream_lock_irqsave - Lock the PCM stream
* @substream: PCM substream
* @flags: irq flags
*
* This locks the PCM stream like snd_pcm_stream_lock() but with the local
* IRQ (only when nonatomic is false). In nonatomic case, this is identical
* as snd_pcm_stream_lock().
*/
#define snd_pcm_stream_lock_irqsave(substream, flags) \
do { \
typecheck(unsigned long, flags); \
flags = _snd_pcm_stream_lock_irqsave(substream); \
} while (0)
void snd_pcm_stream_unlock_irqrestore(struct snd_pcm_substream *substream,
unsigned long flags);
/**
* snd_pcm_group_for_each_entry - iterate over the linked substreams
* @s: the iterator
* @substream: the substream
*
* Iterate over the all linked substreams to the given @substream.
* When @substream isn't linked with any others, this gives returns @substream
* itself once.
*/
#define snd_pcm_group_for_each_entry(s, substream) \
list_for_each_entry(s, &substream->group->substreams, link_list)
/**
* snd_pcm_running - Check whether the substream is in a running state
* @substream: substream to check
*
* Returns true if the given substream is in the state RUNNING, or in the
* state DRAINING for playback.
*/
static inline int snd_pcm_running(struct snd_pcm_substream *substream)
{
return (substream->runtime->status->state == SNDRV_PCM_STATE_RUNNING ||
(substream->runtime->status->state == SNDRV_PCM_STATE_DRAINING &&
substream->stream == SNDRV_PCM_STREAM_PLAYBACK));
}
/**
* bytes_to_samples - Unit conversion of the size from bytes to samples
* @runtime: PCM runtime instance
* @size: size in bytes
*/
static inline ssize_t bytes_to_samples(struct snd_pcm_runtime *runtime, ssize_t size)
{
return size * 8 / runtime->sample_bits;
}
/**
* bytes_to_frames - Unit conversion of the size from bytes to frames
* @runtime: PCM runtime instance
* @size: size in bytes
*/
static inline snd_pcm_sframes_t bytes_to_frames(struct snd_pcm_runtime *runtime, ssize_t size)
{
return size * 8 / runtime->frame_bits;
}
/**
* samples_to_bytes - Unit conversion of the size from samples to bytes
* @runtime: PCM runtime instance
* @size: size in samples
*/
static inline ssize_t samples_to_bytes(struct snd_pcm_runtime *runtime, ssize_t size)
{
return size * runtime->sample_bits / 8;
}
/**
* frames_to_bytes - Unit conversion of the size from frames to bytes
* @runtime: PCM runtime instance
* @size: size in frames
*/
static inline ssize_t frames_to_bytes(struct snd_pcm_runtime *runtime, snd_pcm_sframes_t size)
{
return size * runtime->frame_bits / 8;
}
/**
* frame_aligned - Check whether the byte size is aligned to frames
* @runtime: PCM runtime instance
* @bytes: size in bytes
*/
static inline int frame_aligned(struct snd_pcm_runtime *runtime, ssize_t bytes)
{
return bytes % runtime->byte_align == 0;
}
/**
* snd_pcm_lib_buffer_bytes - Get the buffer size of the current PCM in bytes
* @substream: PCM substream
*/
static inline size_t snd_pcm_lib_buffer_bytes(struct snd_pcm_substream *substream)
{
struct snd_pcm_runtime *runtime = substream->runtime;
return frames_to_bytes(runtime, runtime->buffer_size);
}
/**
* snd_pcm_lib_period_bytes - Get the period size of the current PCM in bytes
* @substream: PCM substream
*/
static inline size_t snd_pcm_lib_period_bytes(struct snd_pcm_substream *substream)
{
struct snd_pcm_runtime *runtime = substream->runtime;
return frames_to_bytes(runtime, runtime->period_size);
}
/**
* snd_pcm_playback_avail - Get the available (writable) space for playback
* @runtime: PCM runtime instance
*
* Result is between 0 ... (boundary - 1)
*/
static inline snd_pcm_uframes_t snd_pcm_playback_avail(struct snd_pcm_runtime *runtime)
{
snd_pcm_sframes_t avail = runtime->status->hw_ptr + runtime->buffer_size - runtime->control->appl_ptr;
if (avail < 0)
avail += runtime->boundary;
else if ((snd_pcm_uframes_t) avail >= runtime->boundary)
avail -= runtime->boundary;
return avail;
}
/**
* snd_pcm_capture_avail - Get the available (readable) space for capture
* @runtime: PCM runtime instance
*
* Result is between 0 ... (boundary - 1)
*/
static inline snd_pcm_uframes_t snd_pcm_capture_avail(struct snd_pcm_runtime *runtime)
{
snd_pcm_sframes_t avail = runtime->status->hw_ptr - runtime->control->appl_ptr;
if (avail < 0)
avail += runtime->boundary;
return avail;
}
/**
* snd_pcm_playback_hw_avail - Get the queued space for playback
* @runtime: PCM runtime instance
*/
static inline snd_pcm_sframes_t snd_pcm_playback_hw_avail(struct snd_pcm_runtime *runtime)
{
return runtime->buffer_size - snd_pcm_playback_avail(runtime);
}
/**
* snd_pcm_capture_hw_avail - Get the free space for capture
* @runtime: PCM runtime instance
*/
static inline snd_pcm_sframes_t snd_pcm_capture_hw_avail(struct snd_pcm_runtime *runtime)
{
return runtime->buffer_size - snd_pcm_capture_avail(runtime);
}
/**
* snd_pcm_playback_ready - check whether the playback buffer is available
* @substream: the pcm substream instance
*
* Checks whether enough free space is available on the playback buffer.
*
* Return: Non-zero if available, or zero if not.
*/
static inline int snd_pcm_playback_ready(struct snd_pcm_substream *substream)
{
struct snd_pcm_runtime *runtime = substream->runtime;
return snd_pcm_playback_avail(runtime) >= runtime->control->avail_min;
}
/**
* snd_pcm_capture_ready - check whether the capture buffer is available
* @substream: the pcm substream instance
*
* Checks whether enough capture data is available on the capture buffer.
*
* Return: Non-zero if available, or zero if not.
*/
static inline int snd_pcm_capture_ready(struct snd_pcm_substream *substream)
{
struct snd_pcm_runtime *runtime = substream->runtime;
return snd_pcm_capture_avail(runtime) >= runtime->control->avail_min;
}
/**
* snd_pcm_playback_data - check whether any data exists on the playback buffer
* @substream: the pcm substream instance
*
* Checks whether any data exists on the playback buffer.
*
* Return: Non-zero if any data exists, or zero if not. If stop_threshold
* is bigger or equal to boundary, then this function returns always non-zero.
*/
static inline int snd_pcm_playback_data(struct snd_pcm_substream *substream)
{
struct snd_pcm_runtime *runtime = substream->runtime;
if (runtime->stop_threshold >= runtime->boundary)
return 1;
return snd_pcm_playback_avail(runtime) < runtime->buffer_size;
}
/**
* snd_pcm_playback_empty - check whether the playback buffer is empty
* @substream: the pcm substream instance
*
* Checks whether the playback buffer is empty.
*
* Return: Non-zero if empty, or zero if not.
*/
static inline int snd_pcm_playback_empty(struct snd_pcm_substream *substream)
{
struct snd_pcm_runtime *runtime = substream->runtime;
return snd_pcm_playback_avail(runtime) >= runtime->buffer_size;
}
/**
* snd_pcm_capture_empty - check whether the capture buffer is empty
* @substream: the pcm substream instance
*
* Checks whether the capture buffer is empty.
*
* Return: Non-zero if empty, or zero if not.
*/
static inline int snd_pcm_capture_empty(struct snd_pcm_substream *substream)
{
struct snd_pcm_runtime *runtime = substream->runtime;
return snd_pcm_capture_avail(runtime) == 0;
}
/**
* snd_pcm_trigger_done - Mark the master substream
* @substream: the pcm substream instance
* @master: the linked master substream
*
* When multiple substreams of the same card are linked and the hardware
* supports the single-shot operation, the driver calls this in the loop
* in snd_pcm_group_for_each_entry() for marking the substream as "done".
* Then most of trigger operations are performed only to the given master
* substream.
*
* The trigger_master mark is cleared at timestamp updates at the end
* of trigger operations.
*/
static inline void snd_pcm_trigger_done(struct snd_pcm_substream *substream,
struct snd_pcm_substream *master)
{
substream->runtime->trigger_master = master;
}
static inline int hw_is_mask(int var)
{
return var >= SNDRV_PCM_HW_PARAM_FIRST_MASK &&
var <= SNDRV_PCM_HW_PARAM_LAST_MASK;
}
static inline int hw_is_interval(int var)
{
return var >= SNDRV_PCM_HW_PARAM_FIRST_INTERVAL &&
var <= SNDRV_PCM_HW_PARAM_LAST_INTERVAL;
}
static inline struct snd_mask *hw_param_mask(struct snd_pcm_hw_params *params,
snd_pcm_hw_param_t var)
{
return &params->masks[var - SNDRV_PCM_HW_PARAM_FIRST_MASK];
}
static inline struct snd_interval *hw_param_interval(struct snd_pcm_hw_params *params,
snd_pcm_hw_param_t var)
{
return &params->intervals[var - SNDRV_PCM_HW_PARAM_FIRST_INTERVAL];
}
static inline const struct snd_mask *hw_param_mask_c(const struct snd_pcm_hw_params *params,
snd_pcm_hw_param_t var)
{
return &params->masks[var - SNDRV_PCM_HW_PARAM_FIRST_MASK];
}
static inline const struct snd_interval *hw_param_interval_c(const struct snd_pcm_hw_params *params,
snd_pcm_hw_param_t var)
{
return &params->intervals[var - SNDRV_PCM_HW_PARAM_FIRST_INTERVAL];
}
/**
* params_channels - Get the number of channels from the hw params
* @p: hw params
*/
static inline unsigned int params_channels(const struct snd_pcm_hw_params *p)
{
return hw_param_interval_c(p, SNDRV_PCM_HW_PARAM_CHANNELS)->min;
}
/**
* params_rate - Get the sample rate from the hw params
* @p: hw params
*/
static inline unsigned int params_rate(const struct snd_pcm_hw_params *p)
{
return hw_param_interval_c(p, SNDRV_PCM_HW_PARAM_RATE)->min;
}
/**
* params_period_size - Get the period size (in frames) from the hw params
* @p: hw params
*/
static inline unsigned int params_period_size(const struct snd_pcm_hw_params *p)
{
return hw_param_interval_c(p, SNDRV_PCM_HW_PARAM_PERIOD_SIZE)->min;
}
/**
* params_periods - Get the number of periods from the hw params
* @p: hw params
*/
static inline unsigned int params_periods(const struct snd_pcm_hw_params *p)
{
return hw_param_interval_c(p, SNDRV_PCM_HW_PARAM_PERIODS)->min;
}
/**
* params_buffer_size - Get the buffer size (in frames) from the hw params
* @p: hw params
*/
static inline unsigned int params_buffer_size(const struct snd_pcm_hw_params *p)
{
return hw_param_interval_c(p, SNDRV_PCM_HW_PARAM_BUFFER_SIZE)->min;
}
/**
* params_buffer_bytes - Get the buffer size (in bytes) from the hw params
* @p: hw params
*/
static inline unsigned int params_buffer_bytes(const struct snd_pcm_hw_params *p)
{
return hw_param_interval_c(p, SNDRV_PCM_HW_PARAM_BUFFER_BYTES)->min;
}
int snd_interval_refine(struct snd_interval *i, const struct snd_interval *v);
int snd_interval_list(struct snd_interval *i, unsigned int count,
const unsigned int *list, unsigned int mask);
int snd_interval_ranges(struct snd_interval *i, unsigned int count,
const struct snd_interval *list, unsigned int mask);
int snd_interval_ratnum(struct snd_interval *i,
unsigned int rats_count, const struct snd_ratnum *rats,
unsigned int *nump, unsigned int *denp);
void _snd_pcm_hw_params_any(struct snd_pcm_hw_params *params);
void _snd_pcm_hw_param_setempty(struct snd_pcm_hw_params *params, snd_pcm_hw_param_t var);
int snd_pcm_hw_refine(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params);
int snd_pcm_hw_constraint_mask64(struct snd_pcm_runtime *runtime, snd_pcm_hw_param_t var,
u_int64_t mask);
int snd_pcm_hw_constraint_minmax(struct snd_pcm_runtime *runtime, snd_pcm_hw_param_t var,
unsigned int min, unsigned int max);
int snd_pcm_hw_constraint_integer(struct snd_pcm_runtime *runtime, snd_pcm_hw_param_t var);
int snd_pcm_hw_constraint_list(struct snd_pcm_runtime *runtime,
unsigned int cond,
snd_pcm_hw_param_t var,
const struct snd_pcm_hw_constraint_list *l);
int snd_pcm_hw_constraint_ranges(struct snd_pcm_runtime *runtime,
unsigned int cond,
snd_pcm_hw_param_t var,
const struct snd_pcm_hw_constraint_ranges *r);
int snd_pcm_hw_constraint_ratnums(struct snd_pcm_runtime *runtime,
unsigned int cond,
snd_pcm_hw_param_t var,
const struct snd_pcm_hw_constraint_ratnums *r);
int snd_pcm_hw_constraint_ratdens(struct snd_pcm_runtime *runtime,
unsigned int cond,
snd_pcm_hw_param_t var,
const struct snd_pcm_hw_constraint_ratdens *r);
int snd_pcm_hw_constraint_msbits(struct snd_pcm_runtime *runtime,
unsigned int cond,
unsigned int width,
unsigned int msbits);
int snd_pcm_hw_constraint_step(struct snd_pcm_runtime *runtime,
unsigned int cond,
snd_pcm_hw_param_t var,
unsigned long step);
int snd_pcm_hw_constraint_pow2(struct snd_pcm_runtime *runtime,
unsigned int cond,
snd_pcm_hw_param_t var);
int snd_pcm_hw_rule_noresample(struct snd_pcm_runtime *runtime,
unsigned int base_rate);
int snd_pcm_hw_rule_add(struct snd_pcm_runtime *runtime,
unsigned int cond,
int var,
snd_pcm_hw_rule_func_t func, void *private,
int dep, ...);
/**
* snd_pcm_hw_constraint_single() - Constrain parameter to a single value
* @runtime: PCM runtime instance
* @var: The hw_params variable to constrain
* @val: The value to constrain to
*
* Return: Positive if the value is changed, zero if it's not changed, or a
* negative error code.
*/
static inline int snd_pcm_hw_constraint_single(
struct snd_pcm_runtime *runtime, snd_pcm_hw_param_t var,
unsigned int val)
{
return snd_pcm_hw_constraint_minmax(runtime, var, val, val);
}
int snd_pcm_format_signed(snd_pcm_format_t format);
int snd_pcm_format_unsigned(snd_pcm_format_t format);
int snd_pcm_format_linear(snd_pcm_format_t format);
int snd_pcm_format_little_endian(snd_pcm_format_t format);
int snd_pcm_format_big_endian(snd_pcm_format_t format);
#if 0 /* just for kernel-doc */
/**
* snd_pcm_format_cpu_endian - Check the PCM format is CPU-endian
* @format: the format to check
*
* Return: 1 if the given PCM format is CPU-endian, 0 if
* opposite, or a negative error code if endian not specified.
*/
int snd_pcm_format_cpu_endian(snd_pcm_format_t format);
#endif /* DocBook */
#ifdef SNDRV_LITTLE_ENDIAN
#define snd_pcm_format_cpu_endian(format) snd_pcm_format_little_endian(format)
#else
#define snd_pcm_format_cpu_endian(format) snd_pcm_format_big_endian(format)
#endif
int snd_pcm_format_width(snd_pcm_format_t format); /* in bits */
int snd_pcm_format_physical_width(snd_pcm_format_t format); /* in bits */
ssize_t snd_pcm_format_size(snd_pcm_format_t format, size_t samples);
const unsigned char *snd_pcm_format_silence_64(snd_pcm_format_t format);
int snd_pcm_format_set_silence(snd_pcm_format_t format, void *buf, unsigned int frames);
void snd_pcm_set_ops(struct snd_pcm * pcm, int direction,
const struct snd_pcm_ops *ops);
void snd_pcm_set_sync(struct snd_pcm_substream *substream);
int snd_pcm_lib_ioctl(struct snd_pcm_substream *substream,
unsigned int cmd, void *arg);
void snd_pcm_period_elapsed(struct snd_pcm_substream *substream);
snd_pcm_sframes_t __snd_pcm_lib_xfer(struct snd_pcm_substream *substream,
void *buf, bool interleaved,
snd_pcm_uframes_t frames, bool in_kernel);
static inline snd_pcm_sframes_t
snd_pcm_lib_write(struct snd_pcm_substream *substream,
const void __user *buf, snd_pcm_uframes_t frames)
{
return __snd_pcm_lib_xfer(substream, (void __force *)buf, true, frames, false);
}
static inline snd_pcm_sframes_t
snd_pcm_lib_read(struct snd_pcm_substream *substream,
void __user *buf, snd_pcm_uframes_t frames)
{
return __snd_pcm_lib_xfer(substream, (void __force *)buf, true, frames, false);
}
static inline snd_pcm_sframes_t
snd_pcm_lib_writev(struct snd_pcm_substream *substream,
void __user **bufs, snd_pcm_uframes_t frames)
{
return __snd_pcm_lib_xfer(substream, (void *)bufs, false, frames, false);
}
static inline snd_pcm_sframes_t
snd_pcm_lib_readv(struct snd_pcm_substream *substream,
void __user **bufs, snd_pcm_uframes_t frames)
{
return __snd_pcm_lib_xfer(substream, (void *)bufs, false, frames, false);
}
static inline snd_pcm_sframes_t
snd_pcm_kernel_write(struct snd_pcm_substream *substream,
const void *buf, snd_pcm_uframes_t frames)
{
return __snd_pcm_lib_xfer(substream, (void *)buf, true, frames, true);
}
static inline snd_pcm_sframes_t
snd_pcm_kernel_read(struct snd_pcm_substream *substream,
void *buf, snd_pcm_uframes_t frames)
{
return __snd_pcm_lib_xfer(substream, buf, true, frames, true);
}
static inline snd_pcm_sframes_t
snd_pcm_kernel_writev(struct snd_pcm_substream *substream,
void **bufs, snd_pcm_uframes_t frames)
{
return __snd_pcm_lib_xfer(substream, bufs, false, frames, true);
}
static inline snd_pcm_sframes_t
snd_pcm_kernel_readv(struct snd_pcm_substream *substream,
void **bufs, snd_pcm_uframes_t frames)
{
return __snd_pcm_lib_xfer(substream, bufs, false, frames, true);
}
int snd_pcm_limit_hw_rates(struct snd_pcm_runtime *runtime);
unsigned int snd_pcm_rate_to_rate_bit(unsigned int rate);
unsigned int snd_pcm_rate_bit_to_rate(unsigned int rate_bit);
unsigned int snd_pcm_rate_mask_intersect(unsigned int rates_a,
unsigned int rates_b);
unsigned int snd_pcm_rate_range_to_bits(unsigned int rate_min,
unsigned int rate_max);
/**
* snd_pcm_set_runtime_buffer - Set the PCM runtime buffer
* @substream: PCM substream to set
* @bufp: the buffer information, NULL to clear
*
* Copy the buffer information to runtime->dma_buffer when @bufp is non-NULL.
* Otherwise it clears the current buffer information.
*/
static inline void snd_pcm_set_runtime_buffer(struct snd_pcm_substream *substream,
struct snd_dma_buffer *bufp)
{
struct snd_pcm_runtime *runtime = substream->runtime;
if (bufp) {
runtime->dma_buffer_p = bufp;
runtime->dma_area = bufp->area;
runtime->dma_addr = bufp->addr;
runtime->dma_bytes = bufp->bytes;
} else {
runtime->dma_buffer_p = NULL;
runtime->dma_area = NULL;
runtime->dma_addr = 0;
runtime->dma_bytes = 0;
}
}
/**
* snd_pcm_gettime - Fill the timespec depending on the timestamp mode
* @runtime: PCM runtime instance
* @tv: timespec to fill
*/
static inline void snd_pcm_gettime(struct snd_pcm_runtime *runtime,
struct timespec *tv)
{
switch (runtime->tstamp_type) {
case SNDRV_PCM_TSTAMP_TYPE_MONOTONIC:
ktime_get_ts(tv);
break;
case SNDRV_PCM_TSTAMP_TYPE_MONOTONIC_RAW:
getrawmonotonic(tv);
break;
default:
getnstimeofday(tv);
break;
}
}
/*
* Memory
*/
void snd_pcm_lib_preallocate_free(struct snd_pcm_substream *substream);
void snd_pcm_lib_preallocate_free_for_all(struct snd_pcm *pcm);
void snd_pcm_lib_preallocate_pages(struct snd_pcm_substream *substream,
int type, struct device *data,
size_t size, size_t max);
void snd_pcm_lib_preallocate_pages_for_all(struct snd_pcm *pcm,
int type, void *data,
size_t size, size_t max);
int snd_pcm_lib_malloc_pages(struct snd_pcm_substream *substream, size_t size);
int snd_pcm_lib_free_pages(struct snd_pcm_substream *substream);
int _snd_pcm_lib_alloc_vmalloc_buffer(struct snd_pcm_substream *substream,
size_t size, gfp_t gfp_flags);
int snd_pcm_lib_free_vmalloc_buffer(struct snd_pcm_substream *substream);
struct page *snd_pcm_lib_get_vmalloc_page(struct snd_pcm_substream *substream,
unsigned long offset);
/**
* snd_pcm_lib_alloc_vmalloc_buffer - allocate virtual DMA buffer
* @substream: the substream to allocate the buffer to
* @size: the requested buffer size, in bytes
*
* Allocates the PCM substream buffer using vmalloc(), i.e., the memory is
* contiguous in kernel virtual space, but not in physical memory. Use this
* if the buffer is accessed by kernel code but not by device DMA.
*
* Return: 1 if the buffer was changed, 0 if not changed, or a negative error
* code.
*/
static inline int snd_pcm_lib_alloc_vmalloc_buffer
(struct snd_pcm_substream *substream, size_t size)
{
return _snd_pcm_lib_alloc_vmalloc_buffer(substream, size,
GFP_KERNEL | __GFP_HIGHMEM | __GFP_ZERO);
}
/**
* snd_pcm_lib_alloc_vmalloc_32_buffer - allocate 32-bit-addressable buffer
* @substream: the substream to allocate the buffer to
* @size: the requested buffer size, in bytes
*
* This function works like snd_pcm_lib_alloc_vmalloc_buffer(), but uses
* vmalloc_32(), i.e., the pages are allocated from 32-bit-addressable memory.
*
* Return: 1 if the buffer was changed, 0 if not changed, or a negative error
* code.
*/
static inline int snd_pcm_lib_alloc_vmalloc_32_buffer
(struct snd_pcm_substream *substream, size_t size)
{
return _snd_pcm_lib_alloc_vmalloc_buffer(substream, size,
GFP_KERNEL | GFP_DMA32 | __GFP_ZERO);
}
#define snd_pcm_get_dma_buf(substream) ((substream)->runtime->dma_buffer_p)
#ifdef CONFIG_SND_DMA_SGBUF
/*
* SG-buffer handling
*/
#define snd_pcm_substream_sgbuf(substream) \
snd_pcm_get_dma_buf(substream)->private_data
struct page *snd_pcm_sgbuf_ops_page(struct snd_pcm_substream *substream,
unsigned long offset);
#else /* !SND_DMA_SGBUF */
/*
* fake using a continuous buffer
*/
#define snd_pcm_sgbuf_ops_page NULL
#endif /* SND_DMA_SGBUF */
/**
* snd_pcm_sgbuf_get_addr - Get the DMA address at the corresponding offset
* @substream: PCM substream
* @ofs: byte offset
*/
static inline dma_addr_t
snd_pcm_sgbuf_get_addr(struct snd_pcm_substream *substream, unsigned int ofs)
{
return snd_sgbuf_get_addr(snd_pcm_get_dma_buf(substream), ofs);
}
/**
* snd_pcm_sgbuf_get_ptr - Get the virtual address at the corresponding offset
* @substream: PCM substream
* @ofs: byte offset
*/
static inline void *
snd_pcm_sgbuf_get_ptr(struct snd_pcm_substream *substream, unsigned int ofs)
{
return snd_sgbuf_get_ptr(snd_pcm_get_dma_buf(substream), ofs);
}
/**
* snd_pcm_sgbuf_chunk_size - Compute the max size that fits within the contig.
* page from the given size
* @substream: PCM substream
* @ofs: byte offset
* @size: byte size to examine
*/
static inline unsigned int
snd_pcm_sgbuf_get_chunk_size(struct snd_pcm_substream *substream,
unsigned int ofs, unsigned int size)
{
return snd_sgbuf_get_chunk_size(snd_pcm_get_dma_buf(substream), ofs, size);
}
/**
* snd_pcm_mmap_data_open - increase the mmap counter
* @area: VMA
*
* PCM mmap callback should handle this counter properly
*/
static inline void snd_pcm_mmap_data_open(struct vm_area_struct *area)
{
struct snd_pcm_substream *substream = (struct snd_pcm_substream *)area->vm_private_data;
atomic_inc(&substream->mmap_count);
}
/**
* snd_pcm_mmap_data_close - decrease the mmap counter
* @area: VMA
*
* PCM mmap callback should handle this counter properly
*/
static inline void snd_pcm_mmap_data_close(struct vm_area_struct *area)
{
struct snd_pcm_substream *substream = (struct snd_pcm_substream *)area->vm_private_data;
atomic_dec(&substream->mmap_count);
}
int snd_pcm_lib_default_mmap(struct snd_pcm_substream *substream,
struct vm_area_struct *area);
/* mmap for io-memory area */
#if defined(CONFIG_X86) || defined(CONFIG_PPC) || defined(CONFIG_ALPHA)
#define SNDRV_PCM_INFO_MMAP_IOMEM SNDRV_PCM_INFO_MMAP
int snd_pcm_lib_mmap_iomem(struct snd_pcm_substream *substream, struct vm_area_struct *area);
#else
#define SNDRV_PCM_INFO_MMAP_IOMEM 0
#define snd_pcm_lib_mmap_iomem NULL
#endif
/**
* snd_pcm_limit_isa_dma_size - Get the max size fitting with ISA DMA transfer
* @dma: DMA number
* @max: pointer to store the max size
*/
static inline void snd_pcm_limit_isa_dma_size(int dma, size_t *max)
{
*max = dma < 4 ? 64 * 1024 : 128 * 1024;
}
/*
* Misc
*/
#define SNDRV_PCM_DEFAULT_CON_SPDIF (IEC958_AES0_CON_EMPHASIS_NONE|\
(IEC958_AES1_CON_ORIGINAL<<8)|\
(IEC958_AES1_CON_PCM_CODER<<8)|\
(IEC958_AES3_CON_FS_48000<<24))
#define PCM_RUNTIME_CHECK(sub) snd_BUG_ON(!(sub) || !(sub)->runtime)
const char *snd_pcm_format_name(snd_pcm_format_t format);
/**
* snd_pcm_stream_str - Get a string naming the direction of a stream
* @substream: the pcm substream instance
*
* Return: A string naming the direction of the stream.
*/
static inline const char *snd_pcm_stream_str(struct snd_pcm_substream *substream)
{
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
return "Playback";
else
return "Capture";
}
/*
* PCM channel-mapping control API
*/
/* array element of channel maps */
struct snd_pcm_chmap_elem {
unsigned char channels;
unsigned char map[15];
};
/* channel map information; retrieved via snd_kcontrol_chip() */
struct snd_pcm_chmap {
struct snd_pcm *pcm; /* assigned PCM instance */
int stream; /* PLAYBACK or CAPTURE */
struct snd_kcontrol *kctl;
const struct snd_pcm_chmap_elem *chmap;
unsigned int max_channels;
unsigned int channel_mask; /* optional: active channels bitmask */
void *private_data; /* optional: private data pointer */
};
/**
* snd_pcm_chmap_substream - get the PCM substream assigned to the given chmap info
* @info: chmap information
* @idx: the substream number index
*/
static inline struct snd_pcm_substream *
snd_pcm_chmap_substream(struct snd_pcm_chmap *info, unsigned int idx)
{
struct snd_pcm_substream *s;
for (s = info->pcm->streams[info->stream].substream; s; s = s->next)
if (s->number == idx)
return s;
return NULL;
}
/* ALSA-standard channel maps (RL/RR prior to C/LFE) */
extern const struct snd_pcm_chmap_elem snd_pcm_std_chmaps[];
/* Other world's standard channel maps (C/LFE prior to RL/RR) */
extern const struct snd_pcm_chmap_elem snd_pcm_alt_chmaps[];
/* bit masks to be passed to snd_pcm_chmap.channel_mask field */
#define SND_PCM_CHMAP_MASK_24 ((1U << 2) | (1U << 4))
#define SND_PCM_CHMAP_MASK_246 (SND_PCM_CHMAP_MASK_24 | (1U << 6))
#define SND_PCM_CHMAP_MASK_2468 (SND_PCM_CHMAP_MASK_246 | (1U << 8))
int snd_pcm_add_chmap_ctls(struct snd_pcm *pcm, int stream,
const struct snd_pcm_chmap_elem *chmap,
int max_channels,
unsigned long private_value,
struct snd_pcm_chmap **info_ret);
/**
* pcm_format_to_bits - Strong-typed conversion of pcm_format to bitwise
* @pcm_format: PCM format
*/
static inline u64 pcm_format_to_bits(snd_pcm_format_t pcm_format)
{
return 1ULL << (__force int) pcm_format;
}
/* printk helpers */
#define pcm_err(pcm, fmt, args...) \
dev_err((pcm)->card->dev, fmt, ##args)
#define pcm_warn(pcm, fmt, args...) \
dev_warn((pcm)->card->dev, fmt, ##args)
#define pcm_dbg(pcm, fmt, args...) \
dev_dbg((pcm)->card->dev, fmt, ##args)
#endif /* __SOUND_PCM_H */