android_kernel_xiaomi_sm8350/include/linux/device.h
kamasali Satyanarayan 9110d2473d Merge android11-5.4.259+ (81334f2) into msm-5.4
* remotes/origin/tmp-81334f2:
  UPSTREAM: netfilter: nf_tables: remove busy mark and gc batch API
  UPSTREAM: netfilter: nft_set_hash: mark set element as dead when deleting from packet path
  UPSTREAM: netfilter: nf_tables: adapt set backend to use GC transaction API
  UPSTREAM: netfilter: nf_tables: GC transaction API to avoid race with control plane
  UPSTREAM: netfilter: nft_set_rbtree: fix overlap expiration walk
  UPSTREAM: netfilter: nft_set_rbtree: fix null deref on element insertion
  UPSTREAM: netfilter: nft_set_rbtree: Switch to node list walk for overlap detection
  UPSTREAM: netfilter: nf_tables: drop map element references from preparation phase
  UPSTREAM: netfilter: nftables: rename set element data activation/deactivation functions
  ANDROID: ABI: Update allowed list for QCOM
  BACKPORT: ALSA: compress: Allow pause and resume during draining
  UPSTREAM: netfilter: nf_tables: pass context to nft_set_destroy()
  UPSTREAM: netfilter: nf_tables: don't skip expired elements during walk
  ANDROID: GKI: db845c: Update symbols list and ABI on rpmsg_register_device_override
  ANDROID: Use GKI Dr. No OWNERS file
  ANDROID: Remove android/OWNERs file
  FROMGIT: Input: uinput - allow injecting event times
  ANDROID: fix up rpmsg_device ABI break
  ANDROID: fix up platform_device ABI break
  UPSTREAM: rpmsg: Fix possible refcount leak in rpmsg_register_device_override()
  UPSTREAM: rpmsg: glink: Release driver_override
  BACKPORT: rpmsg: Fix calling device_lock() on non-initialized device
  BACKPORT: rpmsg: Fix kfree() of static memory on setting driver_override
  UPSTREAM: rpmsg: Constify local variable in field store macro
  UPSTREAM: driver: platform: Add helper for safer setting of driver_override
  Revert "perf: Disallow mis-matched inherited group reads"
  Revert "xfrm: fix a data-race in xfrm_gen_index()"
  Revert "Bluetooth: hci_core: Fix build warnings"
  Revert "xfrm: interface: use DEV_STATS_INC()"
  Revert "netfilter: conntrack: allow sctp hearbeat after connection re-use"
  Revert "netfilter: conntrack: don't refresh sctp entries in closed state"
  Revert "netfilter: handle the connecting collision properly in nf_conntrack_proto_sctp"
  Reapply "netfilter: conntrack: don't refresh sctp entries in closed state"
  Reapply "netfilter: conntrack: allow sctp hearbeat after connection re-use"
  Linux 5.4.259
  xfrm6: fix inet6_dev refcount underflow problem
  Bluetooth: hci_sock: Correctly bounds check and pad HCI_MON_NEW_INDEX name
  Bluetooth: hci_sock: fix slab oob read in create_monitor_event
  phy: mapphone-mdm6600: Fix pinctrl_pm handling for sleep pins
  phy: mapphone-mdm6600: Fix runtime PM for remove
  phy: mapphone-mdm6600: Fix runtime disable on probe
  ASoC: pxa: fix a memory leak in probe()
  gpio: vf610: set value before the direction to avoid a glitch
  s390/pci: fix iommu bitmap allocation
  perf: Disallow mis-matched inherited group reads
  USB: serial: option: add Fibocom to DELL custom modem FM101R-GL
  USB: serial: option: add entry for Sierra EM9191 with new firmware
  USB: serial: option: add Telit LE910C4-WWX 0x1035 composition
  ACPI: irq: Fix incorrect return value in acpi_register_gsi()
  Revert "pinctrl: avoid unsafe code pattern in find_pinctrl()"
  mmc: core: Capture correct oemid-bits for eMMC cards
  mmc: core: sdio: hold retuning if sdio in 1-bit mode
  mtd: physmap-core: Restore map_rom fallback
  mtd: spinand: micron: correct bitmask for ecc status
  mtd: rawnand: qcom: Unmap the right resource upon probe failure
  Bluetooth: hci_event: Fix using memcmp when comparing keys
  HID: multitouch: Add required quirk for Synaptics 0xcd7e device
  btrfs: fix some -Wmaybe-uninitialized warnings in ioctl.c
  drm: panel-orientation-quirks: Add quirk for One Mix 2S
  sky2: Make sure there is at least one frag_addr available
  regulator/core: Revert "fix kobject release warning and memory leak in regulator_register()"
  wifi: cfg80211: avoid leaking stack data into trace
  wifi: mac80211: allow transmitting EAPOL frames with tainted key
  Bluetooth: hci_core: Fix build warnings
  Bluetooth: Avoid redundant authentication
  HID: holtek: fix slab-out-of-bounds Write in holtek_kbd_input_event
  tracing: relax trace_event_eval_update() execution with cond_resched()
  ata: libata-eh: Fix compilation warning in ata_eh_link_report()
  gpio: timberdale: Fix potential deadlock on &tgpio->lock
  overlayfs: set ctime when setting mtime and atime
  i2c: mux: Avoid potential false error message in i2c_mux_add_adapter
  btrfs: initialize start_slot in btrfs_log_prealloc_extents
  btrfs: return -EUCLEAN for delayed tree ref with a ref count not equals to 1
  ARM: dts: ti: omap: Fix noisy serial with overrun-throttle-ms for mapphone
  ACPI: resource: Skip IRQ override on ASUS ExpertBook B1402CBA
  ACPI: resource: Skip IRQ override on ASUS ExpertBook B1502CBA
  ACPI: resource: Skip IRQ override on Asus Expertbook B2402CBA
  ACPI: resource: Add Asus ExpertBook B2502 to Asus quirks
  ACPI: resource: Skip IRQ override on Asus Vivobook S5602ZA
  ACPI: resource: Add ASUS model S5402ZA to quirks
  ACPI: resource: Skip IRQ override on Asus Vivobook K3402ZA/K3502ZA
  ACPI: resources: Add DMI-based legacy IRQ override quirk
  ACPI: Drop acpi_dev_irqresource_disabled()
  resource: Add irqresource_disabled()
  net: pktgen: Fix interface flags printing
  netfilter: nft_set_rbtree: .deactivate fails if element has expired
  neighbor: tracing: Move pin6 inside CONFIG_IPV6=y section
  net/sched: sch_hfsc: upgrade 'rt' to 'sc' when it becomes a inner curve
  i40e: prevent crash on probe if hw registers have invalid values
  net: usb: smsc95xx: Fix an error code in smsc95xx_reset()
  ipv4: fib: annotate races around nh->nh_saddr_genid and nh->nh_saddr
  tun: prevent negative ifindex
  tcp: tsq: relax tcp_small_queue_check() when rtx queue contains a single skb
  tcp: fix excessive TLP and RACK timeouts from HZ rounding
  net: rfkill: gpio: prevent value glitch during probe
  net: ipv6: fix return value check in esp_remove_trailer
  net: ipv4: fix return value check in esp_remove_trailer
  xfrm: interface: use DEV_STATS_INC()
  xfrm: fix a data-race in xfrm_gen_index()
  qed: fix LL2 RX buffer allocation
  netfilter: nft_payload: fix wrong mac header matching
  KVM: x86: Mask LVTPC when handling a PMI
  regmap: fix NULL deref on lookup
  nfc: nci: fix possible NULL pointer dereference in send_acknowledge()
  ice: fix over-shifted variable
  Bluetooth: avoid memcmp() out of bounds warning
  Bluetooth: hci_event: Fix coding style
  Bluetooth: vhci: Fix race when opening vhci device
  Bluetooth: Fix a refcnt underflow problem for hci_conn
  Bluetooth: Reject connection with the device which has same BD_ADDR
  Bluetooth: hci_event: Ignore NULL link key
  usb: hub: Guard against accesses to uninitialized BOS descriptors
  Documentation: sysctl: align cells in second content column
  dev_forward_skb: do not scrub skb mark within the same name space
  ravb: Fix use-after-free issue in ravb_tx_timeout_work()
  powerpc/64e: Fix wrong test in __ptep_test_and_clear_young()
  powerpc/8xx: Fix pte_access_permitted() for PAGE_NONE
  dmaengine: mediatek: Fix deadlock caused by synchronize_irq()
  x86/cpu: Fix AMD erratum #1485 on Zen4-based CPUs
  usb: gadget: ncm: Handle decoding of multiple NTB's in unwrap call
  usb: gadget: udc-xilinx: replace memcpy with memcpy_toio
  pinctrl: avoid unsafe code pattern in find_pinctrl()
  cgroup: Remove duplicates in cgroup v1 tasks file
  Input: xpad - add PXN V900 support
  Input: psmouse - fix fast_reconnect function for PS/2 mode
  Input: powermate - fix use-after-free in powermate_config_complete
  ceph: fix incorrect revoked caps assert in ceph_fill_file_size()
  libceph: use kernel_connect()
  mcb: remove is_added flag from mcb_device struct
  iio: pressure: ms5611: ms5611_prom_is_valid false negative bug
  iio: pressure: dps310: Adjust Timeout Settings
  iio: pressure: bmp280: Fix NULL pointer exception
  usb: musb: Modify the "HWVers" register address
  usb: musb: Get the musb_qh poniter after musb_giveback
  usb: dwc3: Soft reset phy on probe for host
  net: usb: dm9601: fix uninitialized variable use in dm9601_mdio_read
  usb: xhci: xhci-ring: Use sysdev for mapping bounce buffer
  dmaengine: stm32-mdma: abort resume if no ongoing transfer
  workqueue: Override implicit ordered attribute in workqueue_apply_unbound_cpumask()
  nfc: nci: assert requested protocol is valid
  net: nfc: fix races in nfc_llcp_sock_get() and nfc_llcp_sock_get_sn()
  ixgbe: fix crash with empty VF macvlan list
  drm/vmwgfx: fix typo of sizeof argument
  xen-netback: use default TX queue size for vifs
  mlxsw: fix mlxsw_sp2_nve_vxlan_learning_set() return type
  ieee802154: ca8210: Fix a potential UAF in ca8210_probe
  ravb: Fix up dma_free_coherent() call in ravb_remove()
  drm/msm/dsi: skip the wait for video mode done if not applicable
  drm: etvnaviv: fix bad backport leading to warning
  net: prevent address rewrite in kernel_bind()
  quota: Fix slow quotaoff
  HID: logitech-hidpp: Fix kernel crash on receiver USB disconnect
  pwm: hibvt: Explicitly set .polarity in .get_state()
  lib/test_meminit: fix off-by-one error in test_pages()
  RDMA/cxgb4: Check skb value for failure to allocate
  Reapply "ANDROID: Revert "tracing/ring-buffer: Have polling block on watermark""
  Revert "ring-buffer: Update "shortest_full" in polling"
  Revert "ANDROID: Revert "tracing/ring-buffer: Have polling block on watermark""
  Revert "net: bridge: use DEV_STATS_INC()"
  FROMLIST: lib/test_meminit: fix off-by-one error in test_pages()
  Linux 5.4.258
  xen/events: replace evtchn_rwlock with RCU
  ima: rework CONFIG_IMA dependency block
  NFS: Fix a race in __nfs_list_for_each_server()
  parisc: Restore __ldcw_align for PA-RISC 2.0 processors
  RDMA/mlx5: Fix NULL string error
  RDMA/siw: Fix connection failure handling
  RDMA/uverbs: Fix typo of sizeof argument
  RDMA/cma: Fix truncation compilation warning in make_cma_ports
  gpio: pxa: disable pinctrl calls for MMP_GPIO
  gpio: aspeed: fix the GPIO number passed to pinctrl_gpio_set_config()
  IB/mlx4: Fix the size of a buffer in add_port_entries()
  RDMA/core: Require admin capabilities to set system parameters
  cpupower: add Makefile dependencies for install targets
  sctp: update hb timer immediately after users change hb_interval
  sctp: update transport state when processing a dupcook packet
  tcp: fix delayed ACKs for MSS boundary condition
  tcp: fix quick-ack counting to count actual ACKs of new data
  net: stmmac: dwmac-stm32: fix resume on STM32 MCU
  netfilter: handle the connecting collision properly in nf_conntrack_proto_sctp
  net: nfc: llcp: Add lock when modifying device list
  net: usb: smsc75xx: Fix uninit-value access in __smsc75xx_read_reg
  net: dsa: mv88e6xxx: Avoid EEPROM timeout when EEPROM is absent
  ipv4, ipv6: Fix handling of transhdrlen in __ip{,6}_append_data()
  net: fix possible store tearing in neigh_periodic_work()
  modpost: add missing else to the "of" check
  NFSv4: Fix a nfs4_state_manager() race
  NFS: Add a helper nfs_client_for_each_server()
  NFS4: Trace state recovery operation
  wifi: mt76: mt76x02: fix MT76x0 external LNA gain handling
  wifi: mwifiex: Fix tlv_buf_left calculation
  scsi: target: core: Fix deadlock due to recursive locking
  drivers/net: process the result of hdlc_open() and add call of hdlc_close() in uhdlc_close()
  qed/red_ll2: Fix undefined behavior bug in struct qed_ll2_info
  ima: Finish deprecation of IMA_TRUSTED_KEYRING Kconfig
  wifi: mwifiex: Fix oob check condition in mwifiex_process_rx_packet
  regmap: rbtree: Fix wrong register marked as in-cache when creating new node
  wifi: iwlwifi: dbg_ini: fix structure packing
  ubi: Refuse attaching if mtd's erasesize is 0
  net: prevent rewrite of msg_name in sock_sendmsg()
  net: replace calls to sock->ops->connect() with kernel_connect()
  fs: binfmt_elf_efpic: fix personality for ELF-FDPIC
  scsi: zfcp: Fix a double put in zfcp_port_enqueue()
  ata: libata-sata: increase PMP SRST timeout to 10s
  Revert "PCI: qcom: Disable write access to read only registers for IP v2.3.3"
  ata: libata-core: Do not register PM operations for SAS ports
  rbd: take header_rwsem in rbd_dev_refresh() only when updating
  ata: libata-core: Fix port and device removal
  rbd: decouple parent info read-in from updating rbd_dev
  ata: libata-core: Fix ata_port_request_pm() locking
  rbd: decouple header read-in from updating rbd_dev->header
  rbd: move rbd_dev_refresh() definition
  ring-buffer: Update "shortest_full" in polling
  i2c: i801: unregister tco_pdev in i801_probe() error path
  net: thunderbolt: Fix TCPv6 GSO checksum calculation
  ata: libata-scsi: ignore reserved bits for REPORT SUPPORTED OPERATION CODES
  btrfs: properly report 0 avail for very full file systems
  ALSA: hda: Disable power save for solving pop issue on Lenovo ThinkCentre M70q
  nilfs2: fix potential use after free in nilfs_gccache_submit_read_data()
  serial: 8250_port: Check IRQ data before use
  Smack:- Use overlay inode label in smack_inode_copy_up()
  smack: Retrieve transmuting information in smack_inode_getsecurity()
  smack: Record transmuting in smk_transmuted
  i40e: fix return of uninitialized aq_ret in i40e_set_vsi_promisc
  i40e: always propagate error value in i40e_set_vsi_promisc()
  ring-buffer: Avoid softlockup in ring_buffer_resize()
  selftests/ftrace: Correctly enable event in instance-event.tc
  i40e: improve locking of mac_filter_hash
  watchdog: iTCO_wdt: Set NO_REBOOT if the watchdog is not already running
  watchdog: iTCO_wdt: No need to stop the timer in probe
  nvme-pci: do not set the NUMA node of device if it has none
  fbdev/sh7760fb: Depend on FB=y
  ncsi: Propagate carrier gain/loss events to the NCSI controller
  powerpc/watchpoints: Annotate atomic context in more places
  bpf: Clarify error expectations from bpf_clone_redirect
  spi: nxp-fspi: reset the FLSHxCR1 registers
  ata: libata-eh: do not clear ATA_PFLAG_EH_PENDING in ata_eh_reset()
  parisc: irq: Make irq_stack_union static to avoid sparse warning
  parisc: drivers: Fix sparse warning
  parisc: iosapic.c: Fix sparse warnings
  parisc: sba: Fix compile warning wrt list of SBA devices
  gpio: pmic-eic-sprd: Add can_sleep flag for PMIC EIC chip
  xtensa: boot/lib: fix function prototypes
  xtensa: boot: don't add include-dirs
  xtensa: iss/network: make functions static
  xtensa: add default definition for XCHAL_HAVE_DIV32
  bus: ti-sysc: Fix SYSC_QUIRK_SWSUP_SIDLE_ACT handling for uart wake-up
  ARM: dts: ti: omap: motorola-mapphone: Fix abe_clkctrl warning on boot
  clk: tegra: fix error return case for recalc_rate
  scsi: qla2xxx: Fix deletion race condition
  MIPS: Alchemy: only build mmc support helpers if au1xmmc is enabled
  scsi: qla2xxx: Fix update_fcport for current_topology
  ata: libata: disallow dev-initiated LPM transitions to unsupported states
  Input: i8042 - add quirk for TUXEDO Gemini 17 Gen1/Clevo PD70PN
  drm/amd/display: prevent potential division by zero errors
  i2c: mux: demux-pinctrl: check the return value of devm_kstrdup()
  drm/amd/display: Fix LFC multiplier changing erratically
  gpio: tb10x: Fix an error handling path in tb10x_gpio_probe()
  drm/amd/display: Reinstate LFC optimization
  netfilter: ipset: Fix race between IPSET_CMD_CREATE and IPSET_CMD_SWAP
  net: rds: Fix possible NULL-pointer dereference
  team: fix null-ptr-deref when team device type is changed
  net: bridge: use DEV_STATS_INC()
  net: hns3: add 5ms delay before clear firmware reset irq source
  dccp: fix dccp_v4_err()/dccp_v6_err() again
  powerpc/perf/hv-24x7: Update domain value check
  ipv4: fix null-deref in ipv4_link_failure
  i40e: Fix VF VLAN offloading when port VLAN is configured
  i40e: Fix warning message and call stack during rmmod i40e driver
  i40e: Remove scheduling while atomic possibility
  i40e: Fix for persistent lldp support
  ASoC: imx-audmix: Fix return error with devm_clk_get()
  selftests: tls: swap the TX and RX sockets in some tests
  ASoC: meson: spdifin: start hw on dai probe
  selftests/tls: Add {} to avoid static checker warning
  ext4: do not let fstrim block system suspend
  bpf: Avoid deadlock when using queue and stack maps from NMI
  ext4: move setting of trimmed bit into ext4_try_to_trim_range()
  netfilter: nf_tables: disallow element removal on anonymous sets
  ext4: replace the traditional ternary conditional operator with with max()/min()
  ext4: mark group as trimmed only if it was fully scanned
  ext4: change s_last_trim_minblks type to unsigned long
  ext4: scope ret locally in ext4_try_to_trim_range()
  ext4: add new helper interface ext4_try_to_trim_range()
  ext4: remove the 'group' parameter of ext4_trim_extent
  ata: libahci: clear pending interrupt status
  tracing: Increase trace array ref count on enable and filter files
  SUNRPC: Mark the cred for revalidation if the server rejects it
  NFS/pNFS: Report EINVAL errors from connect() to the server
  Revert "drm/panel: simple: Add missing connector type and pixel format for AUO T215HVN01"
  Revert "usb: typec: bus: verify partner exists in typec_altmode_attention"
  Revert "fs/nls: make load_nls() take a const parameter"
  Revert "ip_tunnels: use DEV_STATS_INC()"
  Linux 5.4.257
  net/sched: Retire rsvp classifier
  drm/amdgpu: fix amdgpu_cs_p1_user_fence
  mtd: rawnand: brcmnand: Fix ECC level field setting for v7.2 controller
  ext4: fix rec_len verify error
  scsi: megaraid_sas: Fix deadlock on firmware crashdump
  i2c: aspeed: Reset the i2c controller when timeout occurs
  tracefs: Add missing lockdown check to tracefs_create_dir()
  nfsd: fix change_info in NFSv4 RENAME replies
  tracing: Have option files inc the trace array ref count
  tracing: Have current_trace inc the trace array ref count
  btrfs: fix lockdep splat and potential deadlock after failure running delayed items
  attr: block mode changes of symlinks
  md/raid1: fix error: ISO C90 forbids mixed declarations
  selftests: tracing: Fix to unmount tracefs for recovering environment
  btrfs: compare the correct fsid/metadata_uuid in btrfs_validate_super
  btrfs: add a helper to read the superblock metadata_uuid
  btrfs: move btrfs_pinned_by_swapfile prototype into volumes.h
  perf tools: Add an option to build without libbfd
  perf jevents: Make build dependency on test JSONs
  tools features: Add feature test to check if libbfd has buildid support
  kobject: Add sanity check for kset->kobj.ktype in kset_register()
  media: pci: ipu3-cio2: Initialise timing struct to avoid a compiler warning
  serial: cpm_uart: Avoid suspicious locking
  scsi: target: iscsi: Fix buffer overflow in lio_target_nacl_info_show()
  usb: gadget: fsl_qe_udc: validate endpoint index for ch9 udc
  media: pci: cx23885: replace BUG with error return
  media: tuners: qt1010: replace BUG_ON with a regular error
  media: az6007: Fix null-ptr-deref in az6007_i2c_xfer()
  media: anysee: fix null-ptr-deref in anysee_master_xfer
  media: af9005: Fix null-ptr-deref in af9005_i2c_xfer
  media: dw2102: Fix null-ptr-deref in dw2102_i2c_transfer()
  media: dvb-usb-v2: af9035: Fix null-ptr-deref in af9035_i2c_master_xfer
  powerpc/pseries: fix possible memory leak in ibmebus_bus_init()
  jfs: fix invalid free of JFS_IP(ipimap)->i_imap in diUnmount
  fs/jfs: prevent double-free in dbUnmount() after failed jfs_remount()
  ext2: fix datatype of block number in ext2_xattr_set2()
  md: raid1: fix potential OOB in raid1_remove_disk()
  bus: ti-sysc: Configure uart quirks for k3 SoC
  drm/exynos: fix a possible null-pointer dereference due to data race in exynos_drm_crtc_atomic_disable()
  wifi: mac80211_hwsim: drop short frames
  alx: fix OOB-read compiler warning
  mmc: sdhci-esdhc-imx: improve ESDHC_FLAG_ERR010450
  tpm_tis: Resend command to recover from data transfer errors
  crypto: lib/mpi - avoid null pointer deref in mpi_cmp_ui()
  wifi: mwifiex: fix fortify warning
  wifi: ath9k: fix printk specifier
  devlink: remove reload failed checks in params get/set callbacks
  hw_breakpoint: fix single-stepping when using bpf_overflow_handler
  perf/smmuv3: Enable HiSilicon Erratum 162001900 quirk for HIP08/09
  ACPI: video: Add backlight=native DMI quirk for Lenovo Ideapad Z470
  kernel/fork: beware of __put_task_struct() calling context
  ACPICA: Add AML_NO_OPERAND_RESOLVE flag to Timer
  locks: fix KASAN: use-after-free in trace_event_raw_event_filelock_lock
  btrfs: output extra debug info if we failed to find an inline backref
  autofs: fix memory leak of waitqueues in autofs_catatonic_mode
  parisc: Drop loops_per_jiffy from per_cpu struct
  drm/amd/display: Fix a bug when searching for insert_above_mpcc
  kcm: Fix error handling for SOCK_DGRAM in kcm_sendmsg().
  ixgbe: fix timestamp configuration code
  net/tls: do not free tls_rec on async operation in bpf_exec_tx_verdict()
  platform/mellanox: mlxbf-tmfifo: Drop jumbo frames
  mlxbf-tmfifo: sparse tags for config access
  platform/mellanox: mlxbf-tmfifo: Drop the Rx packet if no more descriptors
  kcm: Fix memory leak in error path of kcm_sendmsg()
  r8152: check budget for r8152_poll()
  net: ethernet: mtk_eth_soc: fix possible NULL pointer dereference in mtk_hwlro_get_fdir_all()
  net: ethernet: mvpp2_main: fix possible OOB write in mvpp2_ethtool_get_rxnfc()
  net: ipv4: fix one memleak in __inet_del_ifa()
  clk: imx8mm: Move 1443X/1416X PLL clock structure to common place
  ARM: dts: BCM5301X: Extend RAM to full 256MB for Linksys EA6500 V2
  usb: typec: bus: verify partner exists in typec_altmode_attention
  usb: typec: tcpm: Refactor tcpm_handle_vdm_request
  usb: typec: tcpm: Refactor tcpm_handle_vdm_request payload handling
  perf tools: Handle old data in PERF_RECORD_ATTR
  perf hists browser: Fix hierarchy mode header
  mtd: rawnand: brcmnand: Fix potential false time out warning
  mtd: rawnand: brcmnand: Fix potential out-of-bounds access in oob write
  mtd: rawnand: brcmnand: Fix crash during the panic_write
  btrfs: use the correct superblock to compare fsid in btrfs_validate_super
  btrfs: don't start transaction when joining with TRANS_JOIN_NOSTART
  fuse: nlookup missing decrement in fuse_direntplus_link
  ata: pata_ftide010: Add missing MODULE_DESCRIPTION
  ata: sata_gemini: Add missing MODULE_DESCRIPTION
  sh: boards: Fix CEU buffer size passed to dma_declare_coherent_memory()
  net: hns3: fix the port information display when sfp is absent
  netfilter: nfnetlink_osf: avoid OOB read
  ip_tunnels: use DEV_STATS_INC()
  idr: fix param name in idr_alloc_cyclic() doc
  s390/zcrypt: don't leak memory if dev_set_name() fails
  igb: Change IGB_MIN to allow set rx/tx value between 64 and 80
  igbvf: Change IGBVF_MIN to allow set rx/tx value between 64 and 80
  igc: Change IGC_MIN to allow set rx/tx value between 64 and 80
  kcm: Destroy mutex in kcm_exit_net()
  net: sched: sch_qfq: Fix UAF in qfq_dequeue()
  af_unix: Fix data race around sk->sk_err.
  af_unix: Fix data-races around sk->sk_shutdown.
  af_unix: Fix data-race around unix_tot_inflight.
  af_unix: Fix data-races around user->unix_inflight.
  net: ipv6/addrconf: avoid integer underflow in ipv6_create_tempaddr
  veth: Fixing transmit return status for dropped packets
  igb: disable virtualization features on 82580
  net: read sk->sk_family once in sk_mc_loop()
  ipv4: annotate data-races around fi->fib_dead
  sctp: annotate data-races around sk->sk_wmem_queued
  pwm: lpc32xx: Remove handling of PWM channels
  watchdog: intel-mid_wdt: add MODULE_ALIAS() to allow auto-load
  perf top: Don't pass an ERR_PTR() directly to perf_session__delete()
  x86/virt: Drop unnecessary check on extended CPUID level in cpu_has_svm()
  perf annotate bpf: Don't enclose non-debug code with an assert()
  kconfig: fix possible buffer overflow
  NFSv4/pnfs: minor fix for cleanup path in nfs4_get_device_info
  soc: qcom: qmi_encdec: Restrict string length in decode
  clk: qcom: gcc-mdm9615: use proper parent for pll0_vote clock
  parisc: led: Reduce CPU overhead for disk & lan LED computation
  parisc: led: Fix LAN receive and transmit LEDs
  lib/test_meminit: allocate pages up to order MAX_ORDER
  drm/ast: Fix DRAM init on AST2200
  fbdev/ep93xx-fb: Do not assign to struct fb_info.dev
  scsi: qla2xxx: Remove unsupported ql2xenabledif option
  scsi: qla2xxx: Turn off noisy message log
  scsi: qla2xxx: Fix erroneous link up failure
  scsi: qla2xxx: fix inconsistent TMF timeout
  net/ipv6: SKB symmetric hash should incorporate transport ports
  drm: fix double free for gbo in drm_gem_vram_init and drm_gem_vram_create
  udf: initialize newblock to 0
  usb: typec: tcpci: clear the fault status bit
  serial: sc16is7xx: fix broken port 0 uart init
  sc16is7xx: Set iobase to device index
  cpufreq: brcmstb-avs-cpufreq: Fix -Warray-bounds bug
  crypto: stm32 - fix loop iterating through scatterlist for DMA
  s390/ipl: add missing secure/has_secure file to ipl type 'unknown'
  pstore/ram: Check start of empty przs during init
  fsverity: skip PKCS#7 parser when keyring is empty
  net: handle ARPHRD_PPP in dev_is_mac_header_xmit()
  X.509: if signature is unsupported skip validation
  dccp: Fix out of bounds access in DCCP error handler
  dlm: fix plock lookup when using multiple lockspaces
  parisc: Fix /proc/cpuinfo output for lscpu
  procfs: block chmod on /proc/thread-self/comm
  Revert "PCI: Mark NVIDIA T4 GPUs to avoid bus reset"
  ntb: Fix calculation ntb_transport_tx_free_entry()
  ntb: Clean up tx tail index on link down
  ntb: Drop packets when qp link is down
  media: dvb: symbol fixup for dvb_attach()
  xtensa: PMU: fix base address for the newer hardware
  backlight/lv5207lp: Compare against struct fb_info.device
  backlight/bd6107: Compare against struct fb_info.device
  backlight/gpio_backlight: Compare against struct fb_info.device
  ARM: OMAP2+: Fix -Warray-bounds warning in _pwrdm_state_switch()
  ipmi_si: fix a memleak in try_smi_init()
  ALSA: pcm: Fix missing fixup call in compat hw_refine ioctl
  PM / devfreq: Fix leak in devfreq_dev_release()
  igb: set max size RX buffer when store bad packet is enabled
  skbuff: skb_segment, Call zero copy functions before using skbuff frags
  netfilter: xt_sctp: validate the flag_info count
  netfilter: xt_u32: validate user space input
  netfilter: ipset: add the missing IP_SET_HASH_WITH_NET0 macro for ip_set_hash_netportnet.c
  igmp: limit igmpv3_newpack() packet size to IP_MAX_MTU
  virtio_ring: fix avail_wrap_counter in virtqueue_add_packed
  cpufreq: Fix the race condition while updating the transition_task of policy
  dmaengine: ste_dma40: Add missing IRQ check in d40_probe
  um: Fix hostaudio build errors
  mtd: rawnand: fsmc: handle clk prepare error in fsmc_nand_resume()
  rpmsg: glink: Add check for kstrdup
  phy/rockchip: inno-hdmi: do not power on rk3328 post pll on reg write
  phy/rockchip: inno-hdmi: round fractal pixclock in rk3328 recalc_rate
  phy/rockchip: inno-hdmi: use correct vco_div_5 macro on rk3328
  tracing: Fix race issue between cpu buffer write and swap
  x86/speculation: Mark all Skylake CPUs as vulnerable to GDS
  HID: multitouch: Correct devm device reference for hidinput input_dev name
  HID: logitech-dj: Fix error handling in logi_dj_recv_switch_to_dj_mode()
  RDMA/siw: Correct wrong debug message
  RDMA/siw: Balance the reference of cep->kref in the error path
  Revert "IB/isert: Fix incorrect release of isert connection"
  amba: bus: fix refcount leak
  serial: tegra: handle clk prepare error in tegra_uart_hw_init()
  scsi: fcoe: Fix potential deadlock on &fip->ctlr_lock
  scsi: core: Use 32-bit hostnum in scsi_host_lookup()
  media: ov2680: Fix regulators being left enabled on ov2680_power_on() errors
  media: ov2680: Fix vflip / hflip set functions
  media: ov2680: Fix ov2680_bayer_order()
  media: ov2680: Remove auto-gain and auto-exposure controls
  media: i2c: ov2680: Set V4L2_CTRL_FLAG_MODIFY_LAYOUT on flips
  media: ov5640: Enable MIPI interface in ov5640_set_power_mipi()
  media: i2c: ov5640: Configure HVP lines in s_power callback
  USB: gadget: f_mass_storage: Fix unused variable warning
  media: go7007: Remove redundant if statement
  iommu/vt-d: Fix to flush cache of PASID directory table
  IB/uverbs: Fix an potential error pointer dereference
  driver core: test_async: fix an error code
  dma-buf/sync_file: Fix docs syntax
  coresight: tmc: Explicit type conversions to prevent integer overflow
  scsi: qedf: Do not touch __user pointer in qedf_dbg_fp_int_cmd_read() directly
  scsi: qedf: Do not touch __user pointer in qedf_dbg_debug_cmd_read() directly
  scsi: qedf: Do not touch __user pointer in qedf_dbg_stop_io_on_error_cmd_read() directly
  x86/APM: drop the duplicate APM_MINOR_DEV macro
  serial: sprd: Fix DMA buffer leak issue
  serial: sprd: Assign sprd_port after initialized to avoid wrong access
  serial: sprd: remove redundant sprd_port cleanup
  serial: sprd: getting port index via serial aliases only
  scsi: qla4xxx: Add length check when parsing nlattrs
  scsi: be2iscsi: Add length check when parsing nlattrs
  scsi: iscsi: Add strlen() check in iscsi_if_set{_host}_param()
  usb: phy: mxs: fix getting wrong state with mxs_phy_is_otg_host()
  media: mediatek: vcodec: Return NULL if no vdec_fb is found
  media: cx24120: Add retval check for cx24120_message_send()
  media: dvb-usb: m920x: Fix a potential memory leak in m920x_i2c_xfer()
  media: dib7000p: Fix potential division by zero
  drivers: usb: smsusb: fix error handling code in smsusb_init_device
  media: v4l2-core: Fix a potential resource leak in v4l2_fwnode_parse_link()
  media: v4l2-fwnode: simplify v4l2_fwnode_parse_link
  media: v4l2-fwnode: fix v4l2_fwnode_parse_link handling
  NFS: Guard against READDIR loop when entry names exceed MAXNAMELEN
  NFSD: da_addr_body field missing in some GETDEVICEINFO replies
  fs: lockd: avoid possible wrong NULL parameter
  jfs: validate max amount of blocks before allocation.
  powerpc/iommu: Fix notifiers being shared by PCI and VIO buses
  nfs/blocklayout: Use the passed in gfp flags
  wifi: ath10k: Use RMW accessors for changing LNKCTL
  drm/radeon: Use RMW accessors for changing LNKCTL
  drm/radeon: Prefer pcie_capability_read_word()
  drm/radeon: Replace numbers with PCI_EXP_LNKCTL2 definitions
  drm/radeon: Correct Transmit Margin masks
  drm/amdgpu: Use RMW accessors for changing LNKCTL
  drm/amdgpu: Prefer pcie_capability_read_word()
  drm/amdgpu: Replace numbers with PCI_EXP_LNKCTL2 definitions
  drm/amdgpu: Correct Transmit Margin masks
  PCI: Add #defines for Enter Compliance, Transmit Margin
  powerpc/fadump: reset dump area size if fadump memory reserve fails
  clk: imx: composite-8m: fix clock pauses when set_rate would be a no-op
  PCI/ASPM: Use RMW accessors for changing LNKCTL
  PCI: pciehp: Use RMW accessors for changing LNKCTL
  PCI: Mark NVIDIA T4 GPUs to avoid bus reset
  clk: sunxi-ng: Modify mismatched function name
  drivers: clk: keystone: Fix parameter judgment in _of_pll_clk_init()
  ipmi:ssif: Fix a memory leak when scanning for an adapter
  ipmi:ssif: Add check for kstrdup
  ALSA: ac97: Fix possible error value of *rac97
  of: unittest: Fix overlay type in apply/revert check
  drm/mediatek: Fix potential memory leak if vmap() fail
  audit: fix possible soft lockup in __audit_inode_child()
  smackfs: Prevent underflow in smk_set_cipso()
  drm/msm/mdp5: Don't leak some plane state
  ima: Remove deprecated IMA_TRUSTED_KEYRING Kconfig
  drm/panel: simple: Add missing connector type and pixel format for AUO T215HVN01
  drm/armada: Fix off-by-one error in armada_overlay_get_property()
  of: unittest: fix null pointer dereferencing in of_unittest_find_node_by_name()
  drm/tegra: dpaux: Fix incorrect return value of platform_get_irq
  drm/tegra: Remove superfluous error messages around platform_get_irq()
  md/md-bitmap: hold 'reconfig_mutex' in backlog_store()
  md/bitmap: don't set max_write_behind if there is no write mostly device
  drm/amdgpu: Update min() to min_t() in 'amdgpu_info_ioctl'
  arm64: dts: qcom: sdm845: Add missing RPMh power domain to GCC
  ARM: dts: BCM53573: Fix Ethernet info for Luxul devices
  drm: adv7511: Fix low refresh rate register for ADV7533/5
  ARM: dts: samsung: s5pv210-smdkv210: correct ethernet reg addresses (split)
  ARM: dts: s5pv210: add dummy 5V regulator for backlight on SMDKv210
  ARM: dts: s5pv210: correct ethernet unit address in SMDKV210
  ARM: dts: s5pv210: use defines for IRQ flags in SMDKV210
  ARM: dts: s5pv210: add RTC 32 KHz clock in SMDKV210
  ARM: dts: samsung: s3c6410-mini6410: correct ethernet reg addresses (split)
  ARM: dts: s3c64xx: align pinctrl with dtschema
  ARM: dts: s3c6410: align node SROM bus node name with dtschema in Mini6410
  ARM: dts: s3c6410: move fixed clocks under root node in Mini6410
  drm/etnaviv: fix dumping of active MMU context
  ARM: dts: BCM53573: Use updated "spi-gpio" binding properties
  ARM: dts: BCM53573: Add cells sizes to PCIe node
  ARM: dts: BCM53573: Drop nonexistent "default-off" LED trigger
  drm/amdgpu: avoid integer overflow warning in amdgpu_device_resize_fb_bar()
  quota: fix dqput() to follow the guarantees dquot_srcu should provide
  quota: add new helper dquot_active()
  quota: rename dquot_active() to inode_quota_active()
  quota: factor out dquot_write_dquot()
  quota: avoid increasing DQST_LOOKUPS when iterating over dirty/inuse list
  drm/bridge: tc358764: Fix debug print parameter order
  netrom: Deny concurrent connect().
  net/sched: sch_hfsc: Ensure inner classes have fsc curve
  mlxsw: i2c: Limit single transaction buffer size
  mlxsw: i2c: Fix chunk size setting in output mailbox buffer
  net: arcnet: Do not call kfree_skb() under local_irq_disable()
  wifi: ath9k: use IS_ERR() with debugfs_create_dir()
  wifi: mwifiex: avoid possible NULL skb pointer dereference
  wifi: ath9k: protect WMI command response buffer replacement with a lock
  wifi: ath9k: fix races between ath9k_wmi_cmd and ath9k_wmi_ctrl_rx
  wifi: mwifiex: Fix missed return in oob checks failed path
  wifi: mwifiex: fix memory leak in mwifiex_histogram_read()
  fs: ocfs2: namei: check return value of ocfs2_add_entry()
  lwt: Check LWTUNNEL_XMIT_CONTINUE strictly
  lwt: Fix return values of BPF xmit ops
  hwrng: iproc-rng200 - Implement suspend and resume calls
  hwrng: iproc-rng200 - use semicolons rather than commas to separate statements
  crypto: caam - fix unchecked return value error
  Bluetooth: nokia: fix value check in nokia_bluetooth_serdev_probe()
  crypto: stm32 - Properly handle pm_runtime_get failing
  wifi: mwifiex: fix error recovery in PCIE buffer descriptor management
  mwifiex: switch from 'pci_' to 'dma_' API
  wifi: mwifiex: Fix OOB and integer underflow when rx packets
  can: gs_usb: gs_usb_receive_bulk_callback(): count RX overflow errors also in case of OOM
  spi: tegra20-sflash: fix to check return value of platform_get_irq() in tegra_sflash_probe()
  regmap: rbtree: Use alloc_flags for memory allocations
  tcp: tcp_enter_quickack_mode() should be static
  bpf: Clear the probe_addr for uprobe
  cpufreq: powernow-k8: Use related_cpus instead of cpus in driver.exit()
  perf/imx_ddr: don't enable counter0 if none of 4 counters are used
  x86/decompressor: Don't rely on upper 32 bits of GPRs being preserved
  x86/boot: Annotate local functions
  x86/asm: Make more symbols local
  OPP: Fix passing 0 to PTR_ERR in _opp_attach_genpd()
  tmpfs: verify {g,u}id mount options correctly
  fs: Fix error checking for d_hash_and_lookup()
  new helper: lookup_positive_unlocked()
  eventfd: prevent underflow for eventfd semaphores
  eventfd: Export eventfd_ctx_do_read()
  reiserfs: Check the return value from __getblk()
  Revert "net: macsec: preserve ingress frame ordering"
  udf: Handle error when adding extent to a file
  udf: Check consistency of Space Bitmap Descriptor
  powerpc/32s: Fix assembler warning about r0
  net: Avoid address overwrite in kernel_connect
  platform/mellanox: Fix mlxbf-tmfifo not handling all virtio CONSOLE notifications
  ALSA: seq: oss: Fix racy open/close of MIDI devices
  scsi: storvsc: Always set no_report_opcodes
  cifs: add a warning when the in-flight count goes negative
  sctp: handle invalid error codes without calling BUG()
  bnx2x: fix page fault following EEH recovery
  netlabel: fix shift wrapping bug in netlbl_catmap_setlong()
  scsi: qedi: Fix potential deadlock on &qedi_percpu->p_work_lock
  idmaengine: make FSL_EDMA and INTEL_IDMA64 depends on HAS_IOMEM
  net: usb: qmi_wwan: add Quectel EM05GV2
  clk: fixed-mmio: make COMMON_CLK_FIXED_MMIO depend on HAS_IOMEM
  security: keys: perform capable check only on privileged operations
  platform/x86: huawei-wmi: Silence ambient light sensor
  platform/x86: intel: hid: Always call BTNL ACPI method
  ASoC: atmel: Fix the 8K sample parameter in I2SC master
  ASoc: codecs: ES8316: Fix DMIC config
  fs/nls: make load_nls() take a const parameter
  s390/dasd: fix hanging device after request requeue
  s390/dasd: use correct number of retries for ERP requests
  m68k: Fix invalid .section syntax
  vxlan: generalize vxlan_parse_gpe_hdr and remove unused args
  ethernet: atheros: fix return value check in atl1c_tso_csum()
  ASoC: da7219: Check for failure reading AAD IRQ events
  ASoC: da7219: Flush pending AAD IRQ when suspending
  9p: virtio: make sure 'offs' is initialized in zc_request
  pinctrl: amd: Don't show `Invalid config param` errors
  nilfs2: fix WARNING in mark_buffer_dirty due to discarded buffer reuse
  nilfs2: fix general protection fault in nilfs_lookup_dirty_data_buffers()
  fsi: master-ast-cf: Add MODULE_FIRMWARE macro
  firmware: stratix10-svc: Fix an NULL vs IS_ERR() bug in probe
  serial: sc16is7xx: fix bug when first setting GPIO direction
  Bluetooth: btsdio: fix use after free bug in btsdio_remove due to race condition
  staging: rtl8712: fix race condition
  HID: wacom: remove the battery when the EKR is off
  USB: serial: option: add FOXCONN T99W368/T99W373 product
  USB: serial: option: add Quectel EM05G variant (0x030e)
  modules: only allow symbol_get of EXPORT_SYMBOL_GPL modules
  rtc: ds1685: use EXPORT_SYMBOL_GPL for ds1685_rtc_poweroff
  net: enetc: use EXPORT_SYMBOL_GPL for enetc_phc_index
  mmc: au1xmmc: force non-modular build and remove symbol_get usage
  ARM: pxa: remove use of symbol_get()
  erofs: ensure that the post-EOF tails are all zeroed
  Linux 5.4.256
  Revert "MIPS: Alchemy: fix dbdma2"
  powerpc/pmac/smp: Drop unnecessary volatile qualifier
  powerpc/pmac/smp: Avoid unused-variable warnings
  Revert "drm/display/dp: Fix the DP DSC Receiver cap size"
  Revert "macsec: Fix traffic counters/statistics"
  Revert "macsec: use DEV_STATS_INC()"
  ANDROID: GKI: add back pm_runtime_get_if_in_use()
  Revert "interconnect: Add helpers for enabling/disabling a path"
  Revert "interconnect: Do not skip aggregation for disabled paths"
  Revert "ALSA: pcm: Set per-card upper limit of PCM buffer allocations"
  Revert "ALSA: pcm: Use SG-buffer only when direct DMA is available"
  Revert "ALSA: pcm: Fix potential data race at PCM memory allocation helpers"
  Revert "ALSA: pcm: Fix build error on m68k and others"
  Revert "Revert "ALSA: pcm: Use SG-buffer only when direct DMA is available""
  Revert "ALSA: pcm: Check for null pointer of pointer substream before dereferencing it"
  Linux 5.4.255
  dma-buf/sw_sync: Avoid recursive lock during fence signal
  pinctrl: renesas: rza2: Add lock around pinctrl_generic{{add,remove}_group,{add,remove}_function}
  clk: Fix undefined reference to `clk_rate_exclusive_{get,put}'
  scsi: core: raid_class: Remove raid_component_add()
  scsi: snic: Fix double free in snic_tgt_create()
  irqchip/mips-gic: Don't touch vl_map if a local interrupt is not routable
  Documentation/sysctl: document page_lock_unfairness
  ALSA: pcm: Check for null pointer of pointer substream before dereferencing it
  interconnect: Do not skip aggregation for disabled paths
  Revert "ALSA: pcm: Use SG-buffer only when direct DMA is available"
  ALSA: pcm: Fix build error on m68k and others
  rtnetlink: Reject negative ifindexes in RTM_NEWLINK
  mm: allow a controlled amount of unfairness in the page lock
  x86/fpu: Set X86_FEATURE_OSXSAVE feature after enabling OSXSAVE in CR4
  drm/display/dp: Fix the DP DSC Receiver cap size
  PCI: acpiphp: Use pci_assign_unassigned_bridge_resources() only for non-root bus
  media: vcodec: Fix potential array out-of-bounds in encoder queue_setup
  radix tree: remove unused variable
  lib/clz_ctz.c: Fix __clzdi2() and __ctzdi2() for 32-bit kernels
  batman-adv: Hold rtnl lock during MTU update via netlink
  batman-adv: Fix batadv_v_ogm_aggr_send memory leak
  batman-adv: Fix TT global entry leak when client roamed back
  batman-adv: Do not get eth header before batadv_check_management_packet
  batman-adv: Don't increase MTU when set by user
  batman-adv: Trigger events for auto adjusted MTU
  nfsd: Fix race to FREE_STATEID and cl_revoked
  clk: Fix slab-out-of-bounds error in devm_clk_release()
  NFSv4: Fix dropped lock for racing OPEN and delegation return
  ibmveth: Use dcbf rather than dcbfl
  bonding: fix macvlan over alb bond support
  net: remove bond_slave_has_mac_rcu()
  net/sched: fix a qdisc modification with ambiguous command request
  igb: Avoid starting unnecessary workqueues
  net: validate veth and vxcan peer ifindexes
  net: bcmgenet: Fix return value check for fixed_phy_register()
  net: bgmac: Fix return value check for fixed_phy_register()
  ipvlan: Fix a reference count leak warning in ipvlan_ns_exit()
  dccp: annotate data-races in dccp_poll()
  sock: annotate data-races around prot->memory_pressure
  octeontx2-af: SDP: fix receive link config
  tracing: Fix memleak due to race between current_tracer and trace
  drm/amd/display: check TG is non-null before checking if enabled
  drm/amd/display: do not wait for mpc idle if tg is disabled
  ASoC: fsl_sai: Disable bit clock with transmitter
  ASoC: fsl_sai: Add new added registers and new bit definition
  ASoC: fsl_sai: Refine enable/disable TE/RE sequence in trigger()
  regmap: Account for register length in SMBus I/O limits
  ALSA: pcm: Fix potential data race at PCM memory allocation helpers
  ALSA: pcm: Use SG-buffer only when direct DMA is available
  ALSA: pcm: Set per-card upper limit of PCM buffer allocations
  dm integrity: reduce vmalloc space footprint on 32-bit architectures
  dm integrity: increase RECALC_SECTORS to improve recalculate speed
  fbdev: fix potential OOB read in fast_imageblit()
  fbdev: Fix sys_imageblit() for arbitrary image widths
  fbdev: Improve performance of sys_imageblit()
  MIPS: cpu-features: Use boot_cpu_type for CPU type based features
  MIPS: cpu-features: Enable octeon_cache by cpu_type
  fs: dlm: fix mismatch of plock results from userspace
  fs: dlm: use dlm_plock_info for do_unlock_close
  fs: dlm: change plock interrupted message to debug again
  fs: dlm: add pid to debug log
  dlm: replace usage of found with dedicated list iterator variable
  dlm: improve plock logging if interrupted
  PCI: acpiphp: Reassign resources on bridge if necessary
  net: phy: broadcom: stub c45 read/write for 54810
  mmc: f-sdh30: fix order of function calls in sdhci_f_sdh30_remove
  net: xfrm: Amend XFRMA_SEC_CTX nla_policy structure
  net: fix the RTO timer retransmitting skb every 1ms if linear option is enabled
  virtio-net: set queues after driver_ok
  af_unix: Fix null-ptr-deref in unix_stream_sendpage().
  netfilter: set default timeout to 3 secs for sctp shutdown send and recv state
  mmc: block: Fix in_flight[issue_type] value error
  mmc: wbsd: fix double mmc_free_host() in wbsd_init()
  cifs: Release folio lock on fscache read hit.
  ALSA: usb-audio: Add support for Mythware XA001AU capture and playback interfaces.
  serial: 8250: Fix oops for port->pm on uart_change_pm()
  ASoC: meson: axg-tdm-formatter: fix channel slot allocation
  ASoC: rt5665: add missed regulator_bulk_disable
  ARM: dts: imx: Set default tuning step for imx6sx usdhc
  ARM: dts: imx: Set default tuning step for imx7d usdhc
  ARM: dts: imx: Adjust dma-apbh node name
  ARM: dts: imx7s: Drop dma-apb interrupt-names
  bus: ti-sysc: Flush posted write on enable before reset
  bus: ti-sysc: Improve reset to work with modules with no sysconfig
  net: do not allow gso_size to be set to GSO_BY_FRAGS
  sock: Fix misuse of sk_under_memory_pressure()
  net: dsa: mv88e6xxx: Wait for EEPROM done before HW reset
  i40e: fix misleading debug logs
  team: Fix incorrect deletion of ETH_P_8021AD protocol vid from slaves
  netfilter: nft_dynset: disallow object maps
  ipvs: fix racy memcpy in proc_do_sync_threshold
  selftests: mirror_gre_changes: Tighten up the TTL test match
  xfrm: add NULL check in xfrm_update_ae_params
  ip_vti: fix potential slab-use-after-free in decode_session6
  ip6_vti: fix slab-use-after-free in decode_session6
  xfrm: fix slab-use-after-free in decode_session6
  xfrm: interface: rename xfrm_interface.c to xfrm_interface_core.c
  net: af_key: fix sadb_x_filter validation
  net: xfrm: Fix xfrm_address_filter OOB read
  btrfs: fix BUG_ON condition in btrfs_cancel_balance
  tty: serial: fsl_lpuart: Clear the error flags by writing 1 for lpuart32 platforms
  powerpc/rtas_flash: allow user copy to flash block cache objects
  fbdev: mmp: fix value check in mmphw_probe()
  i2c: bcm-iproc: Fix bcm_iproc_i2c_isr deadlock issue
  virtio-mmio: don't break lifecycle of vm_dev
  virtio-mmio: Use to_virtio_mmio_device() to simply code
  virtio-mmio: convert to devm_platform_ioremap_resource
  nfsd: Remove incorrect check in nfsd4_validate_stateid
  nfsd4: kill warnings on testing stateids with mismatched clientids
  net/ncsi: Fix gma flag setting after response
  tracing/probes: Fix to update dynamic data counter if fetcharg uses it
  tracing/probes: Have process_fetch_insn() take a void * instead of pt_regs
  leds: trigger: netdev: Recheck NETDEV_LED_MODE_LINKUP on dev rename
  mmc: sunxi: fix deferred probing
  mmc: bcm2835: fix deferred probing
  USB: dwc3: qcom: fix NULL-deref on suspend
  usb: dwc3: qcom: Add helper functions to enable,disable wake irqs
  interconnect: Add helpers for enabling/disabling a path
  interconnect: Move internal structs into a separate file
  irqchip/mips-gic: Use raw spinlock for gic_lock
  irqchip/mips-gic: Get rid of the reliance on irq_cpu_online()
  ALSA: hda: Fix unhandled register update during auto-suspend period
  PM: runtime: Add pm_runtime_get_if_active()
  PM-runtime: add tracepoints for usage_count changes
  iommu/amd: Fix "Guest Virtual APIC Table Root Pointer" configuration in IRTE
  iio: addac: stx104: Fix race condition when converting analog-to-digital
  iio: addac: stx104: Fix race condition for stx104_write_raw()
  iio: stx104: Move to addac subdirectory
  iio: adc: stx104: Implement and utilize register structures
  iio: adc: stx104: Utilize iomap interface
  iio: add addac subdirectory
  IMA: allow/fix UML builds
  powerpc/kasan: Disable KCOV in KASAN code
  ALSA: hda: fix a possible null-pointer dereference due to data race in snd_hdac_regmap_sync()
  ALSA: hda/realtek: Add quirks for Unis H3C Desktop B760 & Q760
  drm/amdgpu: Fix potential fence use-after-free v2
  Bluetooth: L2CAP: Fix use-after-free
  pcmcia: rsrc_nonstatic: Fix memory leak in nonstatic_release_resource_db()
  gfs2: Fix possible data races in gfs2_show_options()
  usb: chipidea: imx: don't request QoS for imx8ulp
  media: platform: mediatek: vpu: fix NULL ptr dereference
  media: v4l2-mem2mem: add lock to protect parameter num_rdy
  FS: JFS: Check for read-only mounted filesystem in txBegin
  FS: JFS: Fix null-ptr-deref Read in txBegin
  MIPS: dec: prom: Address -Warray-bounds warning
  fs: jfs: Fix UBSAN: array-index-out-of-bounds in dbAllocDmapLev
  udf: Fix uninitialized array access for some pathnames
  ovl: check type and offset of struct vfsmount in ovl_entry
  HID: add quirk for 03f0:464a HP Elite Presenter Mouse
  quota: fix warning in dqgrab()
  quota: Properly disable quotas when add_dquot_ref() fails
  ALSA: emu10k1: roll up loops in DSP setup code for Audigy
  drm/radeon: Fix integer overflow in radeon_cs_parser_init
  macsec: use DEV_STATS_INC()
  macsec: Fix traffic counters/statistics
  selftests: forwarding: tc_flower: Relax success criterion
  mmc: sdhci-f-sdh30: Replace with sdhci_pltfm
  mmc: sdhci_f_sdh30: convert to devm_platform_ioremap_resource

Conflict:
	drivers/devfreq/devfreq.c
	drivers/mmc/core/block.c
	drivers/rpmsg/qcom_glink_native.c
	include/net/tcp.h
	net/ipv4/tcp_input.c

Change-Id: I9381be24d8fd353e56226698d20732fee74a03c3
Signed-off-by: kamasali Satyanarayan <quic_kamasali@quicinc.com>
2023-12-18 15:40:18 +05:30

2030 lines
68 KiB
C

// SPDX-License-Identifier: GPL-2.0
/*
* device.h - generic, centralized driver model
*
* Copyright (c) 2001-2003 Patrick Mochel <mochel@osdl.org>
* Copyright (c) 2004-2009 Greg Kroah-Hartman <gregkh@suse.de>
* Copyright (c) 2008-2009 Novell Inc.
*
* See Documentation/driver-api/driver-model/ for more information.
*/
#ifndef _DEVICE_H_
#define _DEVICE_H_
#include <linux/ioport.h>
#include <linux/kobject.h>
#include <linux/klist.h>
#include <linux/list.h>
#include <linux/lockdep.h>
#include <linux/compiler.h>
#include <linux/types.h>
#include <linux/mutex.h>
#include <linux/pm.h>
#include <linux/atomic.h>
#include <linux/ratelimit.h>
#include <linux/uidgid.h>
#include <linux/gfp.h>
#include <linux/overflow.h>
#include <linux/android_kabi.h>
#include <asm/device.h>
struct device;
struct device_private;
struct device_driver;
struct driver_private;
struct module;
struct class;
struct subsys_private;
struct bus_type;
struct device_node;
struct fwnode_handle;
struct iommu_ops;
struct iommu_group;
struct iommu_fwspec;
struct dev_pin_info;
struct iommu_param;
struct bus_attribute {
struct attribute attr;
ssize_t (*show)(struct bus_type *bus, char *buf);
ssize_t (*store)(struct bus_type *bus, const char *buf, size_t count);
};
#define BUS_ATTR_RW(_name) \
struct bus_attribute bus_attr_##_name = __ATTR_RW(_name)
#define BUS_ATTR_RO(_name) \
struct bus_attribute bus_attr_##_name = __ATTR_RO(_name)
#define BUS_ATTR_WO(_name) \
struct bus_attribute bus_attr_##_name = __ATTR_WO(_name)
extern int __must_check bus_create_file(struct bus_type *,
struct bus_attribute *);
extern void bus_remove_file(struct bus_type *, struct bus_attribute *);
/**
* struct bus_type - The bus type of the device
*
* @name: The name of the bus.
* @dev_name: Used for subsystems to enumerate devices like ("foo%u", dev->id).
* @dev_root: Default device to use as the parent.
* @bus_groups: Default attributes of the bus.
* @dev_groups: Default attributes of the devices on the bus.
* @drv_groups: Default attributes of the device drivers on the bus.
* @match: Called, perhaps multiple times, whenever a new device or driver
* is added for this bus. It should return a positive value if the
* given device can be handled by the given driver and zero
* otherwise. It may also return error code if determining that
* the driver supports the device is not possible. In case of
* -EPROBE_DEFER it will queue the device for deferred probing.
* @uevent: Called when a device is added, removed, or a few other things
* that generate uevents to add the environment variables.
* @probe: Called when a new device or driver add to this bus, and callback
* the specific driver's probe to initial the matched device.
* @sync_state: Called to sync device state to software state after all the
* state tracking consumers linked to this device (present at
* the time of late_initcall) have successfully bound to a
* driver. If the device has no consumers, this function will
* be called at late_initcall_sync level. If the device has
* consumers that are never bound to a driver, this function
* will never get called until they do.
* @remove: Called when a device removed from this bus.
* @shutdown: Called at shut-down time to quiesce the device.
*
* @online: Called to put the device back online (after offlining it).
* @offline: Called to put the device offline for hot-removal. May fail.
*
* @suspend: Called when a device on this bus wants to go to sleep mode.
* @resume: Called to bring a device on this bus out of sleep mode.
* @num_vf: Called to find out how many virtual functions a device on this
* bus supports.
* @dma_configure: Called to setup DMA configuration on a device on
* this bus.
* @pm: Power management operations of this bus, callback the specific
* device driver's pm-ops.
* @iommu_ops: IOMMU specific operations for this bus, used to attach IOMMU
* driver implementations to a bus and allow the driver to do
* bus-specific setup
* @p: The private data of the driver core, only the driver core can
* touch this.
* @lock_key: Lock class key for use by the lock validator
* @need_parent_lock: When probing or removing a device on this bus, the
* device core should lock the device's parent.
*
* A bus is a channel between the processor and one or more devices. For the
* purposes of the device model, all devices are connected via a bus, even if
* it is an internal, virtual, "platform" bus. Buses can plug into each other.
* A USB controller is usually a PCI device, for example. The device model
* represents the actual connections between buses and the devices they control.
* A bus is represented by the bus_type structure. It contains the name, the
* default attributes, the bus' methods, PM operations, and the driver core's
* private data.
*/
struct bus_type {
const char *name;
const char *dev_name;
struct device *dev_root;
const struct attribute_group **bus_groups;
const struct attribute_group **dev_groups;
const struct attribute_group **drv_groups;
int (*match)(struct device *dev, struct device_driver *drv);
int (*uevent)(struct device *dev, struct kobj_uevent_env *env);
int (*probe)(struct device *dev);
void (*sync_state)(struct device *dev);
int (*remove)(struct device *dev);
void (*shutdown)(struct device *dev);
int (*online)(struct device *dev);
int (*offline)(struct device *dev);
int (*suspend)(struct device *dev, pm_message_t state);
int (*resume)(struct device *dev);
int (*num_vf)(struct device *dev);
int (*dma_configure)(struct device *dev);
const struct dev_pm_ops *pm;
const struct iommu_ops *iommu_ops;
struct subsys_private *p;
struct lock_class_key lock_key;
bool need_parent_lock;
ANDROID_KABI_RESERVE(1);
ANDROID_KABI_RESERVE(2);
ANDROID_KABI_RESERVE(3);
ANDROID_KABI_RESERVE(4);
};
extern int __must_check bus_register(struct bus_type *bus);
extern void bus_unregister(struct bus_type *bus);
extern int __must_check bus_rescan_devices(struct bus_type *bus);
/* iterator helpers for buses */
struct subsys_dev_iter {
struct klist_iter ki;
const struct device_type *type;
};
void subsys_dev_iter_init(struct subsys_dev_iter *iter,
struct bus_type *subsys,
struct device *start,
const struct device_type *type);
struct device *subsys_dev_iter_next(struct subsys_dev_iter *iter);
void subsys_dev_iter_exit(struct subsys_dev_iter *iter);
int device_match_name(struct device *dev, const void *name);
int device_match_of_node(struct device *dev, const void *np);
int device_match_fwnode(struct device *dev, const void *fwnode);
int device_match_devt(struct device *dev, const void *pdevt);
int device_match_acpi_dev(struct device *dev, const void *adev);
int device_match_any(struct device *dev, const void *unused);
int bus_for_each_dev(struct bus_type *bus, struct device *start, void *data,
int (*fn)(struct device *dev, void *data));
struct device *bus_find_device(struct bus_type *bus, struct device *start,
const void *data,
int (*match)(struct device *dev, const void *data));
/**
* bus_find_device_by_name - device iterator for locating a particular device
* of a specific name.
* @bus: bus type
* @start: Device to begin with
* @name: name of the device to match
*/
static inline struct device *bus_find_device_by_name(struct bus_type *bus,
struct device *start,
const char *name)
{
return bus_find_device(bus, start, name, device_match_name);
}
/**
* bus_find_device_by_of_node : device iterator for locating a particular device
* matching the of_node.
* @bus: bus type
* @np: of_node of the device to match.
*/
static inline struct device *
bus_find_device_by_of_node(struct bus_type *bus, const struct device_node *np)
{
return bus_find_device(bus, NULL, np, device_match_of_node);
}
/**
* bus_find_device_by_fwnode : device iterator for locating a particular device
* matching the fwnode.
* @bus: bus type
* @fwnode: fwnode of the device to match.
*/
static inline struct device *
bus_find_device_by_fwnode(struct bus_type *bus, const struct fwnode_handle *fwnode)
{
return bus_find_device(bus, NULL, fwnode, device_match_fwnode);
}
/**
* bus_find_device_by_devt : device iterator for locating a particular device
* matching the device type.
* @bus: bus type
* @devt: device type of the device to match.
*/
static inline struct device *bus_find_device_by_devt(struct bus_type *bus,
dev_t devt)
{
return bus_find_device(bus, NULL, &devt, device_match_devt);
}
/**
* bus_find_next_device - Find the next device after a given device in a
* given bus.
* @bus: bus type
* @cur: device to begin the search with.
*/
static inline struct device *
bus_find_next_device(struct bus_type *bus,struct device *cur)
{
return bus_find_device(bus, cur, NULL, device_match_any);
}
#ifdef CONFIG_ACPI
struct acpi_device;
/**
* bus_find_device_by_acpi_dev : device iterator for locating a particular device
* matching the ACPI COMPANION device.
* @bus: bus type
* @adev: ACPI COMPANION device to match.
*/
static inline struct device *
bus_find_device_by_acpi_dev(struct bus_type *bus, const struct acpi_device *adev)
{
return bus_find_device(bus, NULL, adev, device_match_acpi_dev);
}
#else
static inline struct device *
bus_find_device_by_acpi_dev(struct bus_type *bus, const void *adev)
{
return NULL;
}
#endif
struct device *subsys_find_device_by_id(struct bus_type *bus, unsigned int id,
struct device *hint);
int bus_for_each_drv(struct bus_type *bus, struct device_driver *start,
void *data, int (*fn)(struct device_driver *, void *));
void bus_sort_breadthfirst(struct bus_type *bus,
int (*compare)(const struct device *a,
const struct device *b));
/*
* Bus notifiers: Get notified of addition/removal of devices
* and binding/unbinding of drivers to devices.
* In the long run, it should be a replacement for the platform
* notify hooks.
*/
struct notifier_block;
extern int bus_register_notifier(struct bus_type *bus,
struct notifier_block *nb);
extern int bus_unregister_notifier(struct bus_type *bus,
struct notifier_block *nb);
/* All 4 notifers below get called with the target struct device *
* as an argument. Note that those functions are likely to be called
* with the device lock held in the core, so be careful.
*/
#define BUS_NOTIFY_ADD_DEVICE 0x00000001 /* device added */
#define BUS_NOTIFY_DEL_DEVICE 0x00000002 /* device to be removed */
#define BUS_NOTIFY_REMOVED_DEVICE 0x00000003 /* device removed */
#define BUS_NOTIFY_BIND_DRIVER 0x00000004 /* driver about to be
bound */
#define BUS_NOTIFY_BOUND_DRIVER 0x00000005 /* driver bound to device */
#define BUS_NOTIFY_UNBIND_DRIVER 0x00000006 /* driver about to be
unbound */
#define BUS_NOTIFY_UNBOUND_DRIVER 0x00000007 /* driver is unbound
from the device */
#define BUS_NOTIFY_DRIVER_NOT_BOUND 0x00000008 /* driver fails to be bound */
extern struct kset *bus_get_kset(struct bus_type *bus);
extern struct klist *bus_get_device_klist(struct bus_type *bus);
/**
* enum probe_type - device driver probe type to try
* Device drivers may opt in for special handling of their
* respective probe routines. This tells the core what to
* expect and prefer.
*
* @PROBE_DEFAULT_STRATEGY: Used by drivers that work equally well
* whether probed synchronously or asynchronously.
* @PROBE_PREFER_ASYNCHRONOUS: Drivers for "slow" devices which
* probing order is not essential for booting the system may
* opt into executing their probes asynchronously.
* @PROBE_FORCE_SYNCHRONOUS: Use this to annotate drivers that need
* their probe routines to run synchronously with driver and
* device registration (with the exception of -EPROBE_DEFER
* handling - re-probing always ends up being done asynchronously).
*
* Note that the end goal is to switch the kernel to use asynchronous
* probing by default, so annotating drivers with
* %PROBE_PREFER_ASYNCHRONOUS is a temporary measure that allows us
* to speed up boot process while we are validating the rest of the
* drivers.
*/
enum probe_type {
PROBE_DEFAULT_STRATEGY,
PROBE_PREFER_ASYNCHRONOUS,
PROBE_FORCE_SYNCHRONOUS,
};
/**
* struct device_driver - The basic device driver structure
* @name: Name of the device driver.
* @bus: The bus which the device of this driver belongs to.
* @owner: The module owner.
* @mod_name: Used for built-in modules.
* @suppress_bind_attrs: Disables bind/unbind via sysfs.
* @probe_type: Type of the probe (synchronous or asynchronous) to use.
* @of_match_table: The open firmware table.
* @acpi_match_table: The ACPI match table.
* @probe: Called to query the existence of a specific device,
* whether this driver can work with it, and bind the driver
* to a specific device.
* @sync_state: Called to sync device state to software state after all the
* state tracking consumers linked to this device (present at
* the time of late_initcall) have successfully bound to a
* driver. If the device has no consumers, this function will
* be called at late_initcall_sync level. If the device has
* consumers that are never bound to a driver, this function
* will never get called until they do.
* @remove: Called when the device is removed from the system to
* unbind a device from this driver.
* @shutdown: Called at shut-down time to quiesce the device.
* @suspend: Called to put the device to sleep mode. Usually to a
* low power state.
* @resume: Called to bring a device from sleep mode.
* @groups: Default attributes that get created by the driver core
* automatically.
* @dev_groups: Additional attributes attached to device instance once the
* it is bound to the driver.
* @pm: Power management operations of the device which matched
* this driver.
* @coredump: Called when sysfs entry is written to. The device driver
* is expected to call the dev_coredump API resulting in a
* uevent.
* @p: Driver core's private data, no one other than the driver
* core can touch this.
*
* The device driver-model tracks all of the drivers known to the system.
* The main reason for this tracking is to enable the driver core to match
* up drivers with new devices. Once drivers are known objects within the
* system, however, a number of other things become possible. Device drivers
* can export information and configuration variables that are independent
* of any specific device.
*/
struct device_driver {
const char *name;
struct bus_type *bus;
struct module *owner;
const char *mod_name; /* used for built-in modules */
bool suppress_bind_attrs; /* disables bind/unbind via sysfs */
enum probe_type probe_type;
const struct of_device_id *of_match_table;
const struct acpi_device_id *acpi_match_table;
int (*probe) (struct device *dev);
void (*sync_state)(struct device *dev);
int (*remove) (struct device *dev);
void (*shutdown) (struct device *dev);
int (*suspend) (struct device *dev, pm_message_t state);
int (*resume) (struct device *dev);
const struct attribute_group **groups;
const struct attribute_group **dev_groups;
const struct dev_pm_ops *pm;
void (*coredump) (struct device *dev);
struct driver_private *p;
ANDROID_KABI_RESERVE(1);
ANDROID_KABI_RESERVE(2);
ANDROID_KABI_RESERVE(3);
ANDROID_KABI_RESERVE(4);
};
extern int __must_check driver_register(struct device_driver *drv);
extern void driver_unregister(struct device_driver *drv);
extern struct device_driver *driver_find(const char *name,
struct bus_type *bus);
extern int driver_probe_done(void);
extern void wait_for_device_probe(void);
/* sysfs interface for exporting driver attributes */
struct driver_attribute {
struct attribute attr;
ssize_t (*show)(struct device_driver *driver, char *buf);
ssize_t (*store)(struct device_driver *driver, const char *buf,
size_t count);
};
#define DRIVER_ATTR_RW(_name) \
struct driver_attribute driver_attr_##_name = __ATTR_RW(_name)
#define DRIVER_ATTR_RO(_name) \
struct driver_attribute driver_attr_##_name = __ATTR_RO(_name)
#define DRIVER_ATTR_WO(_name) \
struct driver_attribute driver_attr_##_name = __ATTR_WO(_name)
extern int __must_check driver_create_file(struct device_driver *driver,
const struct driver_attribute *attr);
extern void driver_remove_file(struct device_driver *driver,
const struct driver_attribute *attr);
int driver_set_override(struct device *dev, const char **override,
const char *s, size_t len);
extern int __must_check driver_for_each_device(struct device_driver *drv,
struct device *start,
void *data,
int (*fn)(struct device *dev,
void *));
struct device *driver_find_device(struct device_driver *drv,
struct device *start, const void *data,
int (*match)(struct device *dev, const void *data));
/**
* driver_find_device_by_name - device iterator for locating a particular device
* of a specific name.
* @drv: the driver we're iterating
* @name: name of the device to match
*/
static inline struct device *driver_find_device_by_name(struct device_driver *drv,
const char *name)
{
return driver_find_device(drv, NULL, name, device_match_name);
}
/**
* driver_find_device_by_of_node- device iterator for locating a particular device
* by of_node pointer.
* @drv: the driver we're iterating
* @np: of_node pointer to match.
*/
static inline struct device *
driver_find_device_by_of_node(struct device_driver *drv,
const struct device_node *np)
{
return driver_find_device(drv, NULL, np, device_match_of_node);
}
/**
* driver_find_device_by_fwnode- device iterator for locating a particular device
* by fwnode pointer.
* @drv: the driver we're iterating
* @fwnode: fwnode pointer to match.
*/
static inline struct device *
driver_find_device_by_fwnode(struct device_driver *drv,
const struct fwnode_handle *fwnode)
{
return driver_find_device(drv, NULL, fwnode, device_match_fwnode);
}
/**
* driver_find_device_by_devt- device iterator for locating a particular device
* by devt.
* @drv: the driver we're iterating
* @devt: devt pointer to match.
*/
static inline struct device *driver_find_device_by_devt(struct device_driver *drv,
dev_t devt)
{
return driver_find_device(drv, NULL, &devt, device_match_devt);
}
static inline struct device *driver_find_next_device(struct device_driver *drv,
struct device *start)
{
return driver_find_device(drv, start, NULL, device_match_any);
}
#ifdef CONFIG_ACPI
/**
* driver_find_device_by_acpi_dev : device iterator for locating a particular
* device matching the ACPI_COMPANION device.
* @drv: the driver we're iterating
* @adev: ACPI_COMPANION device to match.
*/
static inline struct device *
driver_find_device_by_acpi_dev(struct device_driver *drv,
const struct acpi_device *adev)
{
return driver_find_device(drv, NULL, adev, device_match_acpi_dev);
}
#else
static inline struct device *
driver_find_device_by_acpi_dev(struct device_driver *drv, const void *adev)
{
return NULL;
}
#endif
void driver_deferred_probe_add(struct device *dev);
int driver_deferred_probe_check_state(struct device *dev);
int driver_deferred_probe_check_state_continue(struct device *dev);
/**
* struct subsys_interface - interfaces to device functions
* @name: name of the device function
* @subsys: subsytem of the devices to attach to
* @node: the list of functions registered at the subsystem
* @add_dev: device hookup to device function handler
* @remove_dev: device hookup to device function handler
*
* Simple interfaces attached to a subsystem. Multiple interfaces can
* attach to a subsystem and its devices. Unlike drivers, they do not
* exclusively claim or control devices. Interfaces usually represent
* a specific functionality of a subsystem/class of devices.
*/
struct subsys_interface {
const char *name;
struct bus_type *subsys;
struct list_head node;
int (*add_dev)(struct device *dev, struct subsys_interface *sif);
void (*remove_dev)(struct device *dev, struct subsys_interface *sif);
};
int subsys_interface_register(struct subsys_interface *sif);
void subsys_interface_unregister(struct subsys_interface *sif);
int subsys_system_register(struct bus_type *subsys,
const struct attribute_group **groups);
int subsys_virtual_register(struct bus_type *subsys,
const struct attribute_group **groups);
/**
* struct class - device classes
* @name: Name of the class.
* @owner: The module owner.
* @class_groups: Default attributes of this class.
* @dev_groups: Default attributes of the devices that belong to the class.
* @dev_kobj: The kobject that represents this class and links it into the hierarchy.
* @dev_uevent: Called when a device is added, removed from this class, or a
* few other things that generate uevents to add the environment
* variables.
* @devnode: Callback to provide the devtmpfs.
* @class_release: Called to release this class.
* @dev_release: Called to release the device.
* @shutdown_pre: Called at shut-down time before driver shutdown.
* @ns_type: Callbacks so sysfs can detemine namespaces.
* @namespace: Namespace of the device belongs to this class.
* @get_ownership: Allows class to specify uid/gid of the sysfs directories
* for the devices belonging to the class. Usually tied to
* device's namespace.
* @pm: The default device power management operations of this class.
* @p: The private data of the driver core, no one other than the
* driver core can touch this.
*
* A class is a higher-level view of a device that abstracts out low-level
* implementation details. Drivers may see a SCSI disk or an ATA disk, but,
* at the class level, they are all simply disks. Classes allow user space
* to work with devices based on what they do, rather than how they are
* connected or how they work.
*/
struct class {
const char *name;
struct module *owner;
const struct attribute_group **class_groups;
const struct attribute_group **dev_groups;
struct kobject *dev_kobj;
int (*dev_uevent)(struct device *dev, struct kobj_uevent_env *env);
char *(*devnode)(struct device *dev, umode_t *mode);
void (*class_release)(struct class *class);
void (*dev_release)(struct device *dev);
int (*shutdown_pre)(struct device *dev);
const struct kobj_ns_type_operations *ns_type;
const void *(*namespace)(struct device *dev);
void (*get_ownership)(struct device *dev, kuid_t *uid, kgid_t *gid);
const struct dev_pm_ops *pm;
struct subsys_private *p;
ANDROID_KABI_RESERVE(1);
ANDROID_KABI_RESERVE(2);
ANDROID_KABI_RESERVE(3);
ANDROID_KABI_RESERVE(4);
};
struct class_dev_iter {
struct klist_iter ki;
const struct device_type *type;
};
extern struct kobject *sysfs_dev_block_kobj;
extern struct kobject *sysfs_dev_char_kobj;
extern int __must_check __class_register(struct class *class,
struct lock_class_key *key);
extern void class_unregister(struct class *class);
/* This is a #define to keep the compiler from merging different
* instances of the __key variable */
#define class_register(class) \
({ \
static struct lock_class_key __key; \
__class_register(class, &__key); \
})
struct class_compat;
struct class_compat *class_compat_register(const char *name);
void class_compat_unregister(struct class_compat *cls);
int class_compat_create_link(struct class_compat *cls, struct device *dev,
struct device *device_link);
void class_compat_remove_link(struct class_compat *cls, struct device *dev,
struct device *device_link);
extern void class_dev_iter_init(struct class_dev_iter *iter,
struct class *class,
struct device *start,
const struct device_type *type);
extern struct device *class_dev_iter_next(struct class_dev_iter *iter);
extern void class_dev_iter_exit(struct class_dev_iter *iter);
extern int class_for_each_device(struct class *class, struct device *start,
void *data,
int (*fn)(struct device *dev, void *data));
extern struct device *class_find_device(struct class *class,
struct device *start, const void *data,
int (*match)(struct device *, const void *));
/**
* class_find_device_by_name - device iterator for locating a particular device
* of a specific name.
* @class: class type
* @name: name of the device to match
*/
static inline struct device *class_find_device_by_name(struct class *class,
const char *name)
{
return class_find_device(class, NULL, name, device_match_name);
}
/**
* class_find_device_by_of_node : device iterator for locating a particular device
* matching the of_node.
* @class: class type
* @np: of_node of the device to match.
*/
static inline struct device *
class_find_device_by_of_node(struct class *class, const struct device_node *np)
{
return class_find_device(class, NULL, np, device_match_of_node);
}
/**
* class_find_device_by_fwnode : device iterator for locating a particular device
* matching the fwnode.
* @class: class type
* @fwnode: fwnode of the device to match.
*/
static inline struct device *
class_find_device_by_fwnode(struct class *class,
const struct fwnode_handle *fwnode)
{
return class_find_device(class, NULL, fwnode, device_match_fwnode);
}
/**
* class_find_device_by_devt : device iterator for locating a particular device
* matching the device type.
* @class: class type
* @devt: device type of the device to match.
*/
static inline struct device *class_find_device_by_devt(struct class *class,
dev_t devt)
{
return class_find_device(class, NULL, &devt, device_match_devt);
}
#ifdef CONFIG_ACPI
struct acpi_device;
/**
* class_find_device_by_acpi_dev : device iterator for locating a particular
* device matching the ACPI_COMPANION device.
* @class: class type
* @adev: ACPI_COMPANION device to match.
*/
static inline struct device *
class_find_device_by_acpi_dev(struct class *class, const struct acpi_device *adev)
{
return class_find_device(class, NULL, adev, device_match_acpi_dev);
}
#else
static inline struct device *
class_find_device_by_acpi_dev(struct class *class, const void *adev)
{
return NULL;
}
#endif
struct class_attribute {
struct attribute attr;
ssize_t (*show)(struct class *class, struct class_attribute *attr,
char *buf);
ssize_t (*store)(struct class *class, struct class_attribute *attr,
const char *buf, size_t count);
};
#define CLASS_ATTR_RW(_name) \
struct class_attribute class_attr_##_name = __ATTR_RW(_name)
#define CLASS_ATTR_RO(_name) \
struct class_attribute class_attr_##_name = __ATTR_RO(_name)
#define CLASS_ATTR_WO(_name) \
struct class_attribute class_attr_##_name = __ATTR_WO(_name)
extern int __must_check class_create_file_ns(struct class *class,
const struct class_attribute *attr,
const void *ns);
extern void class_remove_file_ns(struct class *class,
const struct class_attribute *attr,
const void *ns);
static inline int __must_check class_create_file(struct class *class,
const struct class_attribute *attr)
{
return class_create_file_ns(class, attr, NULL);
}
static inline void class_remove_file(struct class *class,
const struct class_attribute *attr)
{
return class_remove_file_ns(class, attr, NULL);
}
/* Simple class attribute that is just a static string */
struct class_attribute_string {
struct class_attribute attr;
char *str;
};
/* Currently read-only only */
#define _CLASS_ATTR_STRING(_name, _mode, _str) \
{ __ATTR(_name, _mode, show_class_attr_string, NULL), _str }
#define CLASS_ATTR_STRING(_name, _mode, _str) \
struct class_attribute_string class_attr_##_name = \
_CLASS_ATTR_STRING(_name, _mode, _str)
extern ssize_t show_class_attr_string(struct class *class, struct class_attribute *attr,
char *buf);
struct class_interface {
struct list_head node;
struct class *class;
int (*add_dev) (struct device *, struct class_interface *);
void (*remove_dev) (struct device *, struct class_interface *);
};
extern int __must_check class_interface_register(struct class_interface *);
extern void class_interface_unregister(struct class_interface *);
extern struct class * __must_check __class_create(struct module *owner,
const char *name,
struct lock_class_key *key);
extern void class_destroy(struct class *cls);
/* This is a #define to keep the compiler from merging different
* instances of the __key variable */
#define class_create(owner, name) \
({ \
static struct lock_class_key __key; \
__class_create(owner, name, &__key); \
})
/*
* The type of device, "struct device" is embedded in. A class
* or bus can contain devices of different types
* like "partitions" and "disks", "mouse" and "event".
* This identifies the device type and carries type-specific
* information, equivalent to the kobj_type of a kobject.
* If "name" is specified, the uevent will contain it in
* the DEVTYPE variable.
*/
struct device_type {
const char *name;
const struct attribute_group **groups;
int (*uevent)(struct device *dev, struct kobj_uevent_env *env);
char *(*devnode)(struct device *dev, umode_t *mode,
kuid_t *uid, kgid_t *gid);
void (*release)(struct device *dev);
const struct dev_pm_ops *pm;
};
/* interface for exporting device attributes */
struct device_attribute {
struct attribute attr;
ssize_t (*show)(struct device *dev, struct device_attribute *attr,
char *buf);
ssize_t (*store)(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count);
};
struct dev_ext_attribute {
struct device_attribute attr;
void *var;
};
ssize_t device_show_ulong(struct device *dev, struct device_attribute *attr,
char *buf);
ssize_t device_store_ulong(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count);
ssize_t device_show_int(struct device *dev, struct device_attribute *attr,
char *buf);
ssize_t device_store_int(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count);
ssize_t device_show_bool(struct device *dev, struct device_attribute *attr,
char *buf);
ssize_t device_store_bool(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count);
#define DEVICE_ATTR(_name, _mode, _show, _store) \
struct device_attribute dev_attr_##_name = __ATTR(_name, _mode, _show, _store)
#define DEVICE_ATTR_PREALLOC(_name, _mode, _show, _store) \
struct device_attribute dev_attr_##_name = \
__ATTR_PREALLOC(_name, _mode, _show, _store)
#define DEVICE_ATTR_RW(_name) \
struct device_attribute dev_attr_##_name = __ATTR_RW(_name)
#define DEVICE_ATTR_RO(_name) \
struct device_attribute dev_attr_##_name = __ATTR_RO(_name)
#define DEVICE_ATTR_WO(_name) \
struct device_attribute dev_attr_##_name = __ATTR_WO(_name)
#define DEVICE_ULONG_ATTR(_name, _mode, _var) \
struct dev_ext_attribute dev_attr_##_name = \
{ __ATTR(_name, _mode, device_show_ulong, device_store_ulong), &(_var) }
#define DEVICE_INT_ATTR(_name, _mode, _var) \
struct dev_ext_attribute dev_attr_##_name = \
{ __ATTR(_name, _mode, device_show_int, device_store_int), &(_var) }
#define DEVICE_BOOL_ATTR(_name, _mode, _var) \
struct dev_ext_attribute dev_attr_##_name = \
{ __ATTR(_name, _mode, device_show_bool, device_store_bool), &(_var) }
#define DEVICE_ATTR_IGNORE_LOCKDEP(_name, _mode, _show, _store) \
struct device_attribute dev_attr_##_name = \
__ATTR_IGNORE_LOCKDEP(_name, _mode, _show, _store)
extern int device_create_file(struct device *device,
const struct device_attribute *entry);
extern void device_remove_file(struct device *dev,
const struct device_attribute *attr);
extern bool device_remove_file_self(struct device *dev,
const struct device_attribute *attr);
extern int __must_check device_create_bin_file(struct device *dev,
const struct bin_attribute *attr);
extern void device_remove_bin_file(struct device *dev,
const struct bin_attribute *attr);
/* device resource management */
typedef void (*dr_release_t)(struct device *dev, void *res);
typedef int (*dr_match_t)(struct device *dev, void *res, void *match_data);
#ifdef CONFIG_DEBUG_DEVRES
extern void *__devres_alloc_node(dr_release_t release, size_t size, gfp_t gfp,
int nid, const char *name) __malloc;
#define devres_alloc(release, size, gfp) \
__devres_alloc_node(release, size, gfp, NUMA_NO_NODE, #release)
#define devres_alloc_node(release, size, gfp, nid) \
__devres_alloc_node(release, size, gfp, nid, #release)
#else
extern void *devres_alloc_node(dr_release_t release, size_t size, gfp_t gfp,
int nid) __malloc;
static inline void *devres_alloc(dr_release_t release, size_t size, gfp_t gfp)
{
return devres_alloc_node(release, size, gfp, NUMA_NO_NODE);
}
#endif
extern void devres_for_each_res(struct device *dev, dr_release_t release,
dr_match_t match, void *match_data,
void (*fn)(struct device *, void *, void *),
void *data);
extern void devres_free(void *res);
extern void devres_add(struct device *dev, void *res);
extern void *devres_find(struct device *dev, dr_release_t release,
dr_match_t match, void *match_data);
extern void *devres_get(struct device *dev, void *new_res,
dr_match_t match, void *match_data);
extern void *devres_remove(struct device *dev, dr_release_t release,
dr_match_t match, void *match_data);
extern int devres_destroy(struct device *dev, dr_release_t release,
dr_match_t match, void *match_data);
extern int devres_release(struct device *dev, dr_release_t release,
dr_match_t match, void *match_data);
/* devres group */
extern void * __must_check devres_open_group(struct device *dev, void *id,
gfp_t gfp);
extern void devres_close_group(struct device *dev, void *id);
extern void devres_remove_group(struct device *dev, void *id);
extern int devres_release_group(struct device *dev, void *id);
/* managed devm_k.alloc/kfree for device drivers */
extern void *devm_kmalloc(struct device *dev, size_t size, gfp_t gfp) __malloc;
extern __printf(3, 0)
char *devm_kvasprintf(struct device *dev, gfp_t gfp, const char *fmt,
va_list ap) __malloc;
extern __printf(3, 4)
char *devm_kasprintf(struct device *dev, gfp_t gfp, const char *fmt, ...) __malloc;
static inline void *devm_kzalloc(struct device *dev, size_t size, gfp_t gfp)
{
return devm_kmalloc(dev, size, gfp | __GFP_ZERO);
}
static inline void *devm_kmalloc_array(struct device *dev,
size_t n, size_t size, gfp_t flags)
{
size_t bytes;
if (unlikely(check_mul_overflow(n, size, &bytes)))
return NULL;
return devm_kmalloc(dev, bytes, flags);
}
static inline void *devm_kcalloc(struct device *dev,
size_t n, size_t size, gfp_t flags)
{
return devm_kmalloc_array(dev, n, size, flags | __GFP_ZERO);
}
extern void devm_kfree(struct device *dev, const void *p);
extern char *devm_kstrdup(struct device *dev, const char *s, gfp_t gfp) __malloc;
extern const char *devm_kstrdup_const(struct device *dev,
const char *s, gfp_t gfp);
extern void *devm_kmemdup(struct device *dev, const void *src, size_t len,
gfp_t gfp);
extern unsigned long devm_get_free_pages(struct device *dev,
gfp_t gfp_mask, unsigned int order);
extern void devm_free_pages(struct device *dev, unsigned long addr);
void __iomem *devm_ioremap_resource(struct device *dev,
const struct resource *res);
void __iomem *devm_of_iomap(struct device *dev,
struct device_node *node, int index,
resource_size_t *size);
/* allows to add/remove a custom action to devres stack */
int devm_add_action(struct device *dev, void (*action)(void *), void *data);
void devm_remove_action(struct device *dev, void (*action)(void *), void *data);
void devm_release_action(struct device *dev, void (*action)(void *), void *data);
static inline int devm_add_action_or_reset(struct device *dev,
void (*action)(void *), void *data)
{
int ret;
ret = devm_add_action(dev, action, data);
if (ret)
action(data);
return ret;
}
/**
* devm_alloc_percpu - Resource-managed alloc_percpu
* @dev: Device to allocate per-cpu memory for
* @type: Type to allocate per-cpu memory for
*
* Managed alloc_percpu. Per-cpu memory allocated with this function is
* automatically freed on driver detach.
*
* RETURNS:
* Pointer to allocated memory on success, NULL on failure.
*/
#define devm_alloc_percpu(dev, type) \
((typeof(type) __percpu *)__devm_alloc_percpu((dev), sizeof(type), \
__alignof__(type)))
void __percpu *__devm_alloc_percpu(struct device *dev, size_t size,
size_t align);
void devm_free_percpu(struct device *dev, void __percpu *pdata);
struct device_dma_parameters {
/*
* a low level driver may set these to teach IOMMU code about
* sg limitations.
*/
unsigned int max_segment_size;
unsigned long segment_boundary_mask;
};
/**
* struct device_connection - Device Connection Descriptor
* @fwnode: The device node of the connected device
* @endpoint: The names of the two devices connected together
* @id: Unique identifier for the connection
* @list: List head, private, for internal use only
*
* NOTE: @fwnode is not used together with @endpoint. @fwnode is used when
* platform firmware defines the connection. When the connection is registered
* with device_connection_add() @endpoint is used instead.
*/
struct device_connection {
struct fwnode_handle *fwnode;
const char *endpoint[2];
const char *id;
struct list_head list;
};
typedef void *(*devcon_match_fn_t)(struct device_connection *con, int ep,
void *data);
void *fwnode_connection_find_match(struct fwnode_handle *fwnode,
const char *con_id, void *data,
devcon_match_fn_t match);
void *device_connection_find_match(struct device *dev, const char *con_id,
void *data, devcon_match_fn_t match);
struct device *device_connection_find(struct device *dev, const char *con_id);
void device_connection_add(struct device_connection *con);
void device_connection_remove(struct device_connection *con);
/**
* device_connections_add - Add multiple device connections at once
* @cons: Zero terminated array of device connection descriptors
*/
static inline void device_connections_add(struct device_connection *cons)
{
struct device_connection *c;
for (c = cons; c->endpoint[0]; c++)
device_connection_add(c);
}
/**
* device_connections_remove - Remove multiple device connections at once
* @cons: Zero terminated array of device connection descriptors
*/
static inline void device_connections_remove(struct device_connection *cons)
{
struct device_connection *c;
for (c = cons; c->endpoint[0]; c++)
device_connection_remove(c);
}
/**
* enum device_link_state - Device link states.
* @DL_STATE_NONE: The presence of the drivers is not being tracked.
* @DL_STATE_DORMANT: None of the supplier/consumer drivers is present.
* @DL_STATE_AVAILABLE: The supplier driver is present, but the consumer is not.
* @DL_STATE_CONSUMER_PROBE: The consumer is probing (supplier driver present).
* @DL_STATE_ACTIVE: Both the supplier and consumer drivers are present.
* @DL_STATE_SUPPLIER_UNBIND: The supplier driver is unbinding.
*/
enum device_link_state {
DL_STATE_NONE = -1,
DL_STATE_DORMANT = 0,
DL_STATE_AVAILABLE,
DL_STATE_CONSUMER_PROBE,
DL_STATE_ACTIVE,
DL_STATE_SUPPLIER_UNBIND,
};
/*
* Device link flags.
*
* STATELESS: The core will not remove this link automatically.
* AUTOREMOVE_CONSUMER: Remove the link automatically on consumer driver unbind.
* PM_RUNTIME: If set, the runtime PM framework will use this link.
* RPM_ACTIVE: Run pm_runtime_get_sync() on the supplier during link creation.
* AUTOREMOVE_SUPPLIER: Remove the link automatically on supplier driver unbind.
* AUTOPROBE_CONSUMER: Probe consumer driver automatically after supplier binds.
* MANAGED: The core tracks presence of supplier/consumer drivers (internal).
* SYNC_STATE_ONLY: Link only affects sync_state() behavior.
*/
#define DL_FLAG_STATELESS BIT(0)
#define DL_FLAG_AUTOREMOVE_CONSUMER BIT(1)
#define DL_FLAG_PM_RUNTIME BIT(2)
#define DL_FLAG_RPM_ACTIVE BIT(3)
#define DL_FLAG_AUTOREMOVE_SUPPLIER BIT(4)
#define DL_FLAG_AUTOPROBE_CONSUMER BIT(5)
#define DL_FLAG_MANAGED BIT(6)
#define DL_FLAG_SYNC_STATE_ONLY BIT(7)
/**
* enum dl_dev_state - Device driver presence tracking information.
* @DL_DEV_NO_DRIVER: There is no driver attached to the device.
* @DL_DEV_PROBING: A driver is probing.
* @DL_DEV_DRIVER_BOUND: The driver has been bound to the device.
* @DL_DEV_UNBINDING: The driver is unbinding from the device.
*/
enum dl_dev_state {
DL_DEV_NO_DRIVER = 0,
DL_DEV_PROBING,
DL_DEV_DRIVER_BOUND,
DL_DEV_UNBINDING,
};
/**
* struct dev_links_info - Device data related to device links.
* @suppliers: List of links to supplier devices.
* @consumers: List of links to consumer devices.
* @needs_suppliers: Hook to global list of devices waiting for suppliers.
* @defer_hook: Hook to global list of devices that have deferred sync_state or
* deferred fw_devlink.
* @need_for_probe: If needs_suppliers is on a list, this indicates if the
* suppliers are needed for probe or not.
* @status: Driver status information.
*/
struct dev_links_info {
struct list_head suppliers;
struct list_head consumers;
struct list_head needs_suppliers;
struct list_head defer_hook;
bool need_for_probe;
enum dl_dev_state status;
ANDROID_KABI_RESERVE(1);
ANDROID_KABI_RESERVE(2);
ANDROID_KABI_RESERVE(3);
ANDROID_KABI_RESERVE(4);
};
/**
* struct device - The basic device structure
* @parent: The device's "parent" device, the device to which it is attached.
* In most cases, a parent device is some sort of bus or host
* controller. If parent is NULL, the device, is a top-level device,
* which is not usually what you want.
* @p: Holds the private data of the driver core portions of the device.
* See the comment of the struct device_private for detail.
* @kobj: A top-level, abstract class from which other classes are derived.
* @init_name: Initial name of the device.
* @type: The type of device.
* This identifies the device type and carries type-specific
* information.
* @mutex: Mutex to synchronize calls to its driver.
* @lockdep_mutex: An optional debug lock that a subsystem can use as a
* peer lock to gain localized lockdep coverage of the device_lock.
* @bus: Type of bus device is on.
* @driver: Which driver has allocated this
* @platform_data: Platform data specific to the device.
* Example: For devices on custom boards, as typical of embedded
* and SOC based hardware, Linux often uses platform_data to point
* to board-specific structures describing devices and how they
* are wired. That can include what ports are available, chip
* variants, which GPIO pins act in what additional roles, and so
* on. This shrinks the "Board Support Packages" (BSPs) and
* minimizes board-specific #ifdefs in drivers.
* @driver_data: Private pointer for driver specific info.
* @links: Links to suppliers and consumers of this device.
* @power: For device power management.
* See Documentation/driver-api/pm/devices.rst for details.
* @pm_domain: Provide callbacks that are executed during system suspend,
* hibernation, system resume and during runtime PM transitions
* along with subsystem-level and driver-level callbacks.
* @pins: For device pin management.
* See Documentation/driver-api/pinctl.rst for details.
* @msi_list: Hosts MSI descriptors
* @msi_domain: The generic MSI domain this device is using.
* @numa_node: NUMA node this device is close to.
* @dma_ops: DMA mapping operations for this device.
* @dma_mask: Dma mask (if dma'ble device).
* @coherent_dma_mask: Like dma_mask, but for alloc_coherent mapping as not all
* hardware supports 64-bit addresses for consistent allocations
* such descriptors.
* @bus_dma_mask: Mask of an upstream bridge or bus which imposes a smaller DMA
* limit than the device itself supports.
* @dma_pfn_offset: offset of DMA memory range relatively of RAM
* @dma_parms: A low level driver may set these to teach IOMMU code about
* segment limitations.
* @dma_pools: Dma pools (if dma'ble device).
* @dma_mem: Internal for coherent mem override.
* @cma_area: Contiguous memory area for dma allocations
* @archdata: For arch-specific additions.
* @of_node: Associated device tree node.
* @fwnode: Associated device node supplied by platform firmware.
* @devt: For creating the sysfs "dev".
* @id: device instance
* @devres_lock: Spinlock to protect the resource of the device.
* @devres_head: The resources list of the device.
* @knode_class: The node used to add the device to the class list.
* @class: The class of the device.
* @groups: Optional attribute groups.
* @release: Callback to free the device after all references have
* gone away. This should be set by the allocator of the
* device (i.e. the bus driver that discovered the device).
* @iommu_group: IOMMU group the device belongs to.
* @iommu_fwspec: IOMMU-specific properties supplied by firmware.
* @iommu_param: Per device generic IOMMU runtime data
*
* @offline_disabled: If set, the device is permanently online.
* @offline: Set after successful invocation of bus type's .offline().
* @of_node_reused: Set if the device-tree node is shared with an ancestor
* device.
* @state_synced: The hardware state of this device has been synced to match
* the software state of this device by calling the driver/bus
* sync_state() callback.
* @dma_coherent: this particular device is dma coherent, even if the
* architecture supports non-coherent devices.
* @dma_coherent_hint_cached: Tell the framework to try and treat the device
* as DMA coherent when working with CPU cached
* buffers.
* At the lowest level, every device in a Linux system is represented by an
* instance of struct device. The device structure contains the information
* that the device model core needs to model the system. Most subsystems,
* however, track additional information about the devices they host. As a
* result, it is rare for devices to be represented by bare device structures;
* instead, that structure, like kobject structures, is usually embedded within
* a higher-level representation of the device.
*/
struct device {
struct kobject kobj;
struct device *parent;
struct device_private *p;
const char *init_name; /* initial name of the device */
const struct device_type *type;
struct bus_type *bus; /* type of bus device is on */
struct device_driver *driver; /* which driver has allocated this
device */
void *platform_data; /* Platform specific data, device
core doesn't touch it */
void *driver_data; /* Driver data, set and get with
dev_set_drvdata/dev_get_drvdata */
#ifdef CONFIG_PROVE_LOCKING
struct mutex lockdep_mutex;
#endif
struct mutex mutex; /* mutex to synchronize calls to
* its driver.
*/
struct dev_links_info links;
struct dev_pm_info power;
struct dev_pm_domain *pm_domain;
#ifdef CONFIG_GENERIC_MSI_IRQ_DOMAIN
struct irq_domain *msi_domain;
#endif
#ifdef CONFIG_PINCTRL
struct dev_pin_info *pins;
#endif
#ifdef CONFIG_GENERIC_MSI_IRQ
struct list_head msi_list;
#endif
const struct dma_map_ops *dma_ops;
u64 *dma_mask; /* dma mask (if dma'able device) */
u64 coherent_dma_mask;/* Like dma_mask, but for
alloc_coherent mappings as
not all hardware supports
64 bit addresses for consistent
allocations such descriptors. */
u64 bus_dma_mask; /* upstream dma_mask constraint */
unsigned long dma_pfn_offset;
struct device_dma_parameters *dma_parms;
struct list_head dma_pools; /* dma pools (if dma'ble) */
#ifdef CONFIG_DMA_DECLARE_COHERENT
struct dma_coherent_mem *dma_mem; /* internal for coherent mem
override */
#endif
#ifdef CONFIG_DMA_CMA
struct cma *cma_area; /* contiguous memory area for dma
allocations */
#endif
/* arch specific additions */
struct dev_archdata archdata;
struct device_node *of_node; /* associated device tree node */
struct fwnode_handle *fwnode; /* firmware device node */
#ifdef CONFIG_NUMA
int numa_node; /* NUMA node this device is close to */
#endif
dev_t devt; /* dev_t, creates the sysfs "dev" */
u32 id; /* device instance */
spinlock_t devres_lock;
struct list_head devres_head;
struct class *class;
const struct attribute_group **groups; /* optional groups */
void (*release)(struct device *dev);
struct iommu_group *iommu_group;
struct iommu_fwspec *iommu_fwspec;
struct iommu_param *iommu_param;
bool offline_disabled:1;
bool offline:1;
bool of_node_reused:1;
bool state_synced:1;
#if defined(CONFIG_ARCH_HAS_SYNC_DMA_FOR_DEVICE) || \
defined(CONFIG_ARCH_HAS_SYNC_DMA_FOR_CPU) || \
defined(CONFIG_ARCH_HAS_SYNC_DMA_FOR_CPU_ALL)
bool dma_coherent:1;
#endif
#if defined(CONFIG_DMA_COHERENT_HINT_CACHED)
bool dma_coherent_hint_cached:1;
#endif
ANDROID_KABI_RESERVE(1);
ANDROID_KABI_RESERVE(2);
ANDROID_KABI_RESERVE(3);
ANDROID_KABI_RESERVE(4);
ANDROID_KABI_RESERVE(5);
ANDROID_KABI_RESERVE(6);
ANDROID_KABI_RESERVE(7);
ANDROID_KABI_RESERVE(8);
};
/**
* struct device_link - Device link representation.
* @supplier: The device on the supplier end of the link.
* @s_node: Hook to the supplier device's list of links to consumers.
* @consumer: The device on the consumer end of the link.
* @c_node: Hook to the consumer device's list of links to suppliers.
* @link_dev: device used to expose link details in sysfs
* @status: The state of the link (with respect to the presence of drivers).
* @flags: Link flags.
* @rpm_active: Whether or not the consumer device is runtime-PM-active.
* @kref: Count repeated addition of the same link.
* @rcu_head: An RCU head to use for deferred execution of SRCU callbacks.
* @supplier_preactivated: Supplier has been made active before consumer probe.
*/
struct device_link {
struct device *supplier;
struct list_head s_node;
struct device *consumer;
struct list_head c_node;
struct device link_dev;
enum device_link_state status;
u32 flags;
refcount_t rpm_active;
struct kref kref;
#ifdef CONFIG_SRCU
struct rcu_head rcu_head;
#endif
bool supplier_preactivated; /* Owned by consumer probe. */
ANDROID_KABI_RESERVE(1);
ANDROID_KABI_RESERVE(2);
ANDROID_KABI_RESERVE(3);
ANDROID_KABI_RESERVE(4);
};
static inline struct device *kobj_to_dev(struct kobject *kobj)
{
return container_of(kobj, struct device, kobj);
}
/**
* device_iommu_mapped - Returns true when the device DMA is translated
* by an IOMMU
* @dev: Device to perform the check on
*/
static inline bool device_iommu_mapped(struct device *dev)
{
return (dev->iommu_group != NULL);
}
/* Get the wakeup routines, which depend on struct device */
#include <linux/pm_wakeup.h>
static inline const char *dev_name(const struct device *dev)
{
/* Use the init name until the kobject becomes available */
if (dev->init_name)
return dev->init_name;
return kobject_name(&dev->kobj);
}
extern __printf(2, 3)
int dev_set_name(struct device *dev, const char *name, ...);
#ifdef CONFIG_NUMA
static inline int dev_to_node(struct device *dev)
{
return dev->numa_node;
}
static inline void set_dev_node(struct device *dev, int node)
{
dev->numa_node = node;
}
#else
static inline int dev_to_node(struct device *dev)
{
return NUMA_NO_NODE;
}
static inline void set_dev_node(struct device *dev, int node)
{
}
#endif
static inline struct irq_domain *dev_get_msi_domain(const struct device *dev)
{
#ifdef CONFIG_GENERIC_MSI_IRQ_DOMAIN
return dev->msi_domain;
#else
return NULL;
#endif
}
static inline void dev_set_msi_domain(struct device *dev, struct irq_domain *d)
{
#ifdef CONFIG_GENERIC_MSI_IRQ_DOMAIN
dev->msi_domain = d;
#endif
}
static inline void *dev_get_drvdata(const struct device *dev)
{
return dev->driver_data;
}
static inline void dev_set_drvdata(struct device *dev, void *data)
{
dev->driver_data = data;
}
static inline struct pm_subsys_data *dev_to_psd(struct device *dev)
{
return dev ? dev->power.subsys_data : NULL;
}
static inline unsigned int dev_get_uevent_suppress(const struct device *dev)
{
return dev->kobj.uevent_suppress;
}
static inline void dev_set_uevent_suppress(struct device *dev, int val)
{
dev->kobj.uevent_suppress = val;
}
static inline int device_is_registered(struct device *dev)
{
return dev->kobj.state_in_sysfs;
}
static inline void device_enable_async_suspend(struct device *dev)
{
if (!dev->power.is_prepared)
dev->power.async_suspend = true;
}
static inline void device_disable_async_suspend(struct device *dev)
{
if (!dev->power.is_prepared)
dev->power.async_suspend = false;
}
static inline bool device_async_suspend_enabled(struct device *dev)
{
return !!dev->power.async_suspend;
}
static inline bool device_pm_not_required(struct device *dev)
{
return dev->power.no_pm;
}
static inline void device_set_pm_not_required(struct device *dev)
{
dev->power.no_pm = true;
}
static inline void dev_pm_syscore_device(struct device *dev, bool val)
{
#ifdef CONFIG_PM_SLEEP
dev->power.syscore = val;
#endif
}
static inline void dev_pm_set_driver_flags(struct device *dev, u32 flags)
{
dev->power.driver_flags = flags;
}
static inline bool dev_pm_test_driver_flags(struct device *dev, u32 flags)
{
return !!(dev->power.driver_flags & flags);
}
static inline void device_lock(struct device *dev)
{
mutex_lock(&dev->mutex);
}
static inline int device_lock_interruptible(struct device *dev)
{
return mutex_lock_interruptible(&dev->mutex);
}
static inline int device_trylock(struct device *dev)
{
return mutex_trylock(&dev->mutex);
}
static inline void device_unlock(struct device *dev)
{
mutex_unlock(&dev->mutex);
}
static inline void device_lock_assert(struct device *dev)
{
lockdep_assert_held(&dev->mutex);
}
static inline struct device_node *dev_of_node(struct device *dev)
{
if (!IS_ENABLED(CONFIG_OF) || !dev)
return NULL;
return dev->of_node;
}
static inline bool dev_has_sync_state(struct device *dev)
{
if (!dev)
return false;
if (dev->driver && dev->driver->sync_state)
return true;
if (dev->bus && dev->bus->sync_state)
return true;
return false;
}
void driver_init(void);
/*
* High level routines for use by the bus drivers
*/
extern int __must_check device_register(struct device *dev);
extern void device_unregister(struct device *dev);
extern void device_initialize(struct device *dev);
extern int __must_check device_add(struct device *dev);
extern void device_del(struct device *dev);
extern int device_for_each_child(struct device *dev, void *data,
int (*fn)(struct device *dev, void *data));
extern int device_for_each_child_reverse(struct device *dev, void *data,
int (*fn)(struct device *dev, void *data));
extern struct device *device_find_child(struct device *dev, void *data,
int (*match)(struct device *dev, void *data));
extern struct device *device_find_child_by_name(struct device *parent,
const char *name);
extern int device_rename(struct device *dev, const char *new_name);
extern int device_move(struct device *dev, struct device *new_parent,
enum dpm_order dpm_order);
extern const char *device_get_devnode(struct device *dev,
umode_t *mode, kuid_t *uid, kgid_t *gid,
const char **tmp);
static inline bool device_supports_offline(struct device *dev)
{
return dev->bus && dev->bus->offline && dev->bus->online;
}
extern void lock_device_hotplug(void);
extern void unlock_device_hotplug(void);
extern int lock_device_hotplug_sysfs(void);
extern int trylock_device_hotplug(void);
#ifdef CONFIG_SCHED_WALT
extern void lock_device_hotplug_assert(void);
#endif
extern int device_offline(struct device *dev);
extern int device_online(struct device *dev);
extern void set_primary_fwnode(struct device *dev, struct fwnode_handle *fwnode);
extern void set_secondary_fwnode(struct device *dev, struct fwnode_handle *fwnode);
void device_set_of_node_from_dev(struct device *dev, const struct device *dev2);
void device_set_node(struct device *dev, struct fwnode_handle *fwnode);
static inline int dev_num_vf(struct device *dev)
{
if (dev->bus && dev->bus->num_vf)
return dev->bus->num_vf(dev);
return 0;
}
/*
* Root device objects for grouping under /sys/devices
*/
extern struct device *__root_device_register(const char *name,
struct module *owner);
/* This is a macro to avoid include problems with THIS_MODULE */
#define root_device_register(name) \
__root_device_register(name, THIS_MODULE)
extern void root_device_unregister(struct device *root);
static inline void *dev_get_platdata(const struct device *dev)
{
return dev->platform_data;
}
/*
* Manual binding of a device to driver. See drivers/base/bus.c
* for information on use.
*/
extern int __must_check device_bind_driver(struct device *dev);
extern void device_release_driver(struct device *dev);
extern int __must_check device_attach(struct device *dev);
extern int __must_check driver_attach(struct device_driver *drv);
extern void device_initial_probe(struct device *dev);
extern int __must_check device_reprobe(struct device *dev);
extern bool device_is_bound(struct device *dev);
/*
* Easy functions for dynamically creating devices on the fly
*/
extern __printf(5, 0)
struct device *device_create_vargs(struct class *cls, struct device *parent,
dev_t devt, void *drvdata,
const char *fmt, va_list vargs);
extern __printf(5, 6)
struct device *device_create(struct class *cls, struct device *parent,
dev_t devt, void *drvdata,
const char *fmt, ...);
extern __printf(6, 7)
struct device *device_create_with_groups(struct class *cls,
struct device *parent, dev_t devt, void *drvdata,
const struct attribute_group **groups,
const char *fmt, ...);
extern void device_destroy(struct class *cls, dev_t devt);
extern int __must_check device_add_groups(struct device *dev,
const struct attribute_group **groups);
extern void device_remove_groups(struct device *dev,
const struct attribute_group **groups);
static inline int __must_check device_add_group(struct device *dev,
const struct attribute_group *grp)
{
const struct attribute_group *groups[] = { grp, NULL };
return device_add_groups(dev, groups);
}
static inline void device_remove_group(struct device *dev,
const struct attribute_group *grp)
{
const struct attribute_group *groups[] = { grp, NULL };
return device_remove_groups(dev, groups);
}
extern int __must_check devm_device_add_groups(struct device *dev,
const struct attribute_group **groups);
extern void devm_device_remove_groups(struct device *dev,
const struct attribute_group **groups);
extern int __must_check devm_device_add_group(struct device *dev,
const struct attribute_group *grp);
extern void devm_device_remove_group(struct device *dev,
const struct attribute_group *grp);
/*
* Platform "fixup" functions - allow the platform to have their say
* about devices and actions that the general device layer doesn't
* know about.
*/
/* Notify platform of device discovery */
extern int (*platform_notify)(struct device *dev);
extern int (*platform_notify_remove)(struct device *dev);
/*
* get_device - atomically increment the reference count for the device.
*
*/
extern struct device *get_device(struct device *dev);
extern void put_device(struct device *dev);
extern bool kill_device(struct device *dev);
#ifdef CONFIG_DEVTMPFS
extern int devtmpfs_create_node(struct device *dev);
extern int devtmpfs_delete_node(struct device *dev);
extern int devtmpfs_mount(const char *mntdir);
#else
static inline int devtmpfs_create_node(struct device *dev) { return 0; }
static inline int devtmpfs_delete_node(struct device *dev) { return 0; }
static inline int devtmpfs_mount(const char *mountpoint) { return 0; }
#endif
/* drivers/base/power/shutdown.c */
extern void device_shutdown(void);
/* debugging and troubleshooting/diagnostic helpers. */
extern const char *dev_driver_string(const struct device *dev);
/* Device links interface. */
struct device_link *device_link_add(struct device *consumer,
struct device *supplier, u32 flags);
void device_link_del(struct device_link *link);
void device_link_remove(void *consumer, struct device *supplier);
void device_links_supplier_sync_state_pause(void);
void device_links_supplier_sync_state_resume(void);
#ifndef dev_fmt
#define dev_fmt(fmt) fmt
#endif
#ifdef CONFIG_PRINTK
__printf(3, 0) __cold
int dev_vprintk_emit(int level, const struct device *dev,
const char *fmt, va_list args);
__printf(3, 4) __cold
int dev_printk_emit(int level, const struct device *dev, const char *fmt, ...);
__printf(3, 4) __cold
void dev_printk(const char *level, const struct device *dev,
const char *fmt, ...);
__printf(2, 3) __cold
void _dev_emerg(const struct device *dev, const char *fmt, ...);
__printf(2, 3) __cold
void _dev_alert(const struct device *dev, const char *fmt, ...);
__printf(2, 3) __cold
void _dev_crit(const struct device *dev, const char *fmt, ...);
__printf(2, 3) __cold
void _dev_err(const struct device *dev, const char *fmt, ...);
__printf(2, 3) __cold
void _dev_warn(const struct device *dev, const char *fmt, ...);
__printf(2, 3) __cold
void _dev_notice(const struct device *dev, const char *fmt, ...);
__printf(2, 3) __cold
void _dev_info(const struct device *dev, const char *fmt, ...);
#else
static inline __printf(3, 0)
int dev_vprintk_emit(int level, const struct device *dev,
const char *fmt, va_list args)
{ return 0; }
static inline __printf(3, 4)
int dev_printk_emit(int level, const struct device *dev, const char *fmt, ...)
{ return 0; }
static inline void __dev_printk(const char *level, const struct device *dev,
struct va_format *vaf)
{}
static inline __printf(3, 4)
void dev_printk(const char *level, const struct device *dev,
const char *fmt, ...)
{}
static inline __printf(2, 3)
void _dev_emerg(const struct device *dev, const char *fmt, ...)
{}
static inline __printf(2, 3)
void _dev_crit(const struct device *dev, const char *fmt, ...)
{}
static inline __printf(2, 3)
void _dev_alert(const struct device *dev, const char *fmt, ...)
{}
static inline __printf(2, 3)
void _dev_err(const struct device *dev, const char *fmt, ...)
{}
static inline __printf(2, 3)
void _dev_warn(const struct device *dev, const char *fmt, ...)
{}
static inline __printf(2, 3)
void _dev_notice(const struct device *dev, const char *fmt, ...)
{}
static inline __printf(2, 3)
void _dev_info(const struct device *dev, const char *fmt, ...)
{}
#endif
/*
* #defines for all the dev_<level> macros to prefix with whatever
* possible use of #define dev_fmt(fmt) ...
*/
#define dev_emerg(dev, fmt, ...) \
_dev_emerg(dev, dev_fmt(fmt), ##__VA_ARGS__)
#define dev_crit(dev, fmt, ...) \
_dev_crit(dev, dev_fmt(fmt), ##__VA_ARGS__)
#define dev_alert(dev, fmt, ...) \
_dev_alert(dev, dev_fmt(fmt), ##__VA_ARGS__)
#define dev_err(dev, fmt, ...) \
_dev_err(dev, dev_fmt(fmt), ##__VA_ARGS__)
#define dev_warn(dev, fmt, ...) \
_dev_warn(dev, dev_fmt(fmt), ##__VA_ARGS__)
#define dev_notice(dev, fmt, ...) \
_dev_notice(dev, dev_fmt(fmt), ##__VA_ARGS__)
#define dev_info(dev, fmt, ...) \
_dev_info(dev, dev_fmt(fmt), ##__VA_ARGS__)
#if defined(CONFIG_DYNAMIC_DEBUG) || \
(defined(CONFIG_DYNAMIC_DEBUG_CORE) && defined(DYNAMIC_DEBUG_MODULE))
#define dev_dbg(dev, fmt, ...) \
dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)
#elif defined(DEBUG)
#define dev_dbg(dev, fmt, ...) \
dev_printk(KERN_DEBUG, dev, dev_fmt(fmt), ##__VA_ARGS__)
#else
#define dev_dbg(dev, fmt, ...) \
({ \
if (0) \
dev_printk(KERN_DEBUG, dev, dev_fmt(fmt), ##__VA_ARGS__); \
})
#endif
#ifdef CONFIG_PRINTK
#define dev_level_once(dev_level, dev, fmt, ...) \
do { \
static bool __print_once __read_mostly; \
\
if (!__print_once) { \
__print_once = true; \
dev_level(dev, fmt, ##__VA_ARGS__); \
} \
} while (0)
#else
#define dev_level_once(dev_level, dev, fmt, ...) \
do { \
if (0) \
dev_level(dev, fmt, ##__VA_ARGS__); \
} while (0)
#endif
#define dev_emerg_once(dev, fmt, ...) \
dev_level_once(dev_emerg, dev, fmt, ##__VA_ARGS__)
#define dev_alert_once(dev, fmt, ...) \
dev_level_once(dev_alert, dev, fmt, ##__VA_ARGS__)
#define dev_crit_once(dev, fmt, ...) \
dev_level_once(dev_crit, dev, fmt, ##__VA_ARGS__)
#define dev_err_once(dev, fmt, ...) \
dev_level_once(dev_err, dev, fmt, ##__VA_ARGS__)
#define dev_warn_once(dev, fmt, ...) \
dev_level_once(dev_warn, dev, fmt, ##__VA_ARGS__)
#define dev_notice_once(dev, fmt, ...) \
dev_level_once(dev_notice, dev, fmt, ##__VA_ARGS__)
#define dev_info_once(dev, fmt, ...) \
dev_level_once(dev_info, dev, fmt, ##__VA_ARGS__)
#define dev_dbg_once(dev, fmt, ...) \
dev_level_once(dev_dbg, dev, fmt, ##__VA_ARGS__)
#define dev_level_ratelimited(dev_level, dev, fmt, ...) \
do { \
static DEFINE_RATELIMIT_STATE(_rs, \
DEFAULT_RATELIMIT_INTERVAL, \
DEFAULT_RATELIMIT_BURST); \
if (__ratelimit(&_rs)) \
dev_level(dev, fmt, ##__VA_ARGS__); \
} while (0)
#define dev_emerg_ratelimited(dev, fmt, ...) \
dev_level_ratelimited(dev_emerg, dev, fmt, ##__VA_ARGS__)
#define dev_alert_ratelimited(dev, fmt, ...) \
dev_level_ratelimited(dev_alert, dev, fmt, ##__VA_ARGS__)
#define dev_crit_ratelimited(dev, fmt, ...) \
dev_level_ratelimited(dev_crit, dev, fmt, ##__VA_ARGS__)
#define dev_err_ratelimited(dev, fmt, ...) \
dev_level_ratelimited(dev_err, dev, fmt, ##__VA_ARGS__)
#define dev_warn_ratelimited(dev, fmt, ...) \
dev_level_ratelimited(dev_warn, dev, fmt, ##__VA_ARGS__)
#define dev_notice_ratelimited(dev, fmt, ...) \
dev_level_ratelimited(dev_notice, dev, fmt, ##__VA_ARGS__)
#define dev_info_ratelimited(dev, fmt, ...) \
dev_level_ratelimited(dev_info, dev, fmt, ##__VA_ARGS__)
#if defined(CONFIG_DYNAMIC_DEBUG) || \
(defined(CONFIG_DYNAMIC_DEBUG_CORE) && defined(DYNAMIC_DEBUG_MODULE))
/* descriptor check is first to prevent flooding with "callbacks suppressed" */
#define dev_dbg_ratelimited(dev, fmt, ...) \
do { \
static DEFINE_RATELIMIT_STATE(_rs, \
DEFAULT_RATELIMIT_INTERVAL, \
DEFAULT_RATELIMIT_BURST); \
DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt); \
if (DYNAMIC_DEBUG_BRANCH(descriptor) && \
__ratelimit(&_rs)) \
__dynamic_dev_dbg(&descriptor, dev, dev_fmt(fmt), \
##__VA_ARGS__); \
} while (0)
#elif defined(DEBUG)
#define dev_dbg_ratelimited(dev, fmt, ...) \
do { \
static DEFINE_RATELIMIT_STATE(_rs, \
DEFAULT_RATELIMIT_INTERVAL, \
DEFAULT_RATELIMIT_BURST); \
if (__ratelimit(&_rs)) \
dev_printk(KERN_DEBUG, dev, dev_fmt(fmt), ##__VA_ARGS__); \
} while (0)
#else
#define dev_dbg_ratelimited(dev, fmt, ...) \
do { \
if (0) \
dev_printk(KERN_DEBUG, dev, dev_fmt(fmt), ##__VA_ARGS__); \
} while (0)
#endif
#ifdef VERBOSE_DEBUG
#define dev_vdbg dev_dbg
#else
#define dev_vdbg(dev, fmt, ...) \
({ \
if (0) \
dev_printk(KERN_DEBUG, dev, dev_fmt(fmt), ##__VA_ARGS__); \
})
#endif
/*
* dev_WARN*() acts like dev_printk(), but with the key difference of
* using WARN/WARN_ONCE to include file/line information and a backtrace.
*/
#define dev_WARN(dev, format, arg...) \
WARN(1, "%s %s: " format, dev_driver_string(dev), dev_name(dev), ## arg);
#define dev_WARN_ONCE(dev, condition, format, arg...) \
WARN_ONCE(condition, "%s %s: " format, \
dev_driver_string(dev), dev_name(dev), ## arg)
extern __printf(3, 4)
int dev_err_probe(const struct device *dev, int err, const char *fmt, ...);
/* Create alias, so I can be autoloaded. */
#define MODULE_ALIAS_CHARDEV(major,minor) \
MODULE_ALIAS("char-major-" __stringify(major) "-" __stringify(minor))
#define MODULE_ALIAS_CHARDEV_MAJOR(major) \
MODULE_ALIAS("char-major-" __stringify(major) "-*")
#ifdef CONFIG_SYSFS_DEPRECATED
extern long sysfs_deprecated;
#else
#define sysfs_deprecated 0
#endif
/**
* module_driver() - Helper macro for drivers that don't do anything
* special in module init/exit. This eliminates a lot of boilerplate.
* Each module may only use this macro once, and calling it replaces
* module_init() and module_exit().
*
* @__driver: driver name
* @__register: register function for this driver type
* @__unregister: unregister function for this driver type
* @...: Additional arguments to be passed to __register and __unregister.
*
* Use this macro to construct bus specific macros for registering
* drivers, and do not use it on its own.
*/
#define module_driver(__driver, __register, __unregister, ...) \
static int __init __driver##_init(void) \
{ \
return __register(&(__driver) , ##__VA_ARGS__); \
} \
module_init(__driver##_init); \
static void __exit __driver##_exit(void) \
{ \
__unregister(&(__driver) , ##__VA_ARGS__); \
} \
module_exit(__driver##_exit);
/**
* builtin_driver() - Helper macro for drivers that don't do anything
* special in init and have no exit. This eliminates some boilerplate.
* Each driver may only use this macro once, and calling it replaces
* device_initcall (or in some cases, the legacy __initcall). This is
* meant to be a direct parallel of module_driver() above but without
* the __exit stuff that is not used for builtin cases.
*
* @__driver: driver name
* @__register: register function for this driver type
* @...: Additional arguments to be passed to __register
*
* Use this macro to construct bus specific macros for registering
* drivers, and do not use it on its own.
*/
#define builtin_driver(__driver, __register, ...) \
static int __init __driver##_init(void) \
{ \
return __register(&(__driver) , ##__VA_ARGS__); \
} \
device_initcall(__driver##_init);
#endif /* _DEVICE_H_ */