Linux 4.4.80
ASoC: dpcm: Avoid putting stream state to STOP when FE stream is paused
scsi: snic: Return error code on memory allocation failure
scsi: fnic: Avoid sending reset to firmware when another reset is in progress
HID: ignore Petzl USB headlamp
ALSA: usb-audio: test EP_FLAG_RUNNING at urb completion
sh_eth: enable RX descriptor word 0 shift on SH7734
nvmem: imx-ocotp: Fix wrong register size
arm64: mm: fix show_pte KERN_CONT fallout
vfio-pci: Handle error from pci_iomap
video: fbdev: cobalt_lcdfb: Handle return NULL error from devm_ioremap
perf symbols: Robustify reading of build-id from sysfs
perf tools: Install tools/lib/traceevent plugins with install-bin
xfrm: Don't use sk_family for socket policy lookups
tools lib traceevent: Fix prev/next_prio for deadline tasks
Btrfs: adjust outstanding_extents counter properly when dio write is split
usb: gadget: Fix copy/pasted error message
ACPI / scan: Prefer devices without _HID/_CID for _ADR matching
ARM: s3c2410_defconfig: Fix invalid values for NF_CT_PROTO_*
ARM64: zynqmp: Fix i2c node's compatible string
ARM64: zynqmp: Fix W=1 dtc 1.4 warnings
dmaengine: ti-dma-crossbar: Add some 'of_node_put()' in error path.
dmaengine: ioatdma: workaround SKX ioatdma version
dmaengine: ioatdma: Add Skylake PCI Dev ID
openrisc: Add _text symbol to fix ksym build error
irqchip/mxs: Enable SKIP_SET_WAKE and MASK_ON_SUSPEND
ASoC: nau8825: fix invalid configuration in Pre-Scalar of FLL
spi: dw: Make debugfs name unique between instances
ASoC: tlv320aic3x: Mark the RESET register as volatile
irqchip/keystone: Fix "scheduling while atomic" on rt
vfio-pci: use 32-bit comparisons for register address for gcc-4.5
drm/msm: Verify that MSM_SUBMIT_BO_FLAGS are set
drm/msm: Ensure that the hardware write pointer is valid
net/mlx4: Remove BUG_ON from ICM allocation routine
ipv6: Should use consistent conditional judgement for ip6 fragment between __ip6_append_data and ip6_finish_output
ARM: dts: n900: Mark eMMC slot with no-sdio and no-sd flags
r8169: add support for RTL8168 series add-on card.
x86/mce/AMD: Make the init code more robust
tpm: Replace device number bitmap with IDR
tpm: fix a kernel memory leak in tpm-sysfs.c
xen/blkback: don't use xen_blkif_get() in xen-blkback kthread
xen/blkback: don't free be structure too early
sched/cputime: Fix prev steal time accouting during CPU hotplug
net: skb_needs_check() accepts CHECKSUM_NONE for tx
pstore: Use dynamic spinlock initializer
pstore: Correctly initialize spinlock and flags
pstore: Allow prz to control need for locking
vlan: Propagate MAC address to VLANs
/proc/iomem: only expose physical resource addresses to privileged users
Make file credentials available to the seqfile interfaces
v4l: s5c73m3: fix negation operator
dentry name snapshots
ipmi/watchdog: fix watchdog timeout set on reboot
libnvdimm, btt: fix btt_rw_page not returning errors
RDMA/uverbs: Fix the check for port number
PM / Domains: defer dev_pm_domain_set() until genpd->attach_dev succeeds if present
sched/cgroup: Move sched_online_group() back into css_online() to fix crash
kaweth: fix oops upon failed memory allocation
kaweth: fix firmware download
mpt3sas: Don't overreach ioc->reply_post[] during initialization
mailbox: handle empty message in tx_tick
mailbox: skip complete wait event if timer expired
mailbox: always wait in mbox_send_message for blocking Tx mode
wil6210: fix deadlock when using fw_no_recovery option
ath10k: fix null deref on wmi-tlv when trying spectral scan
isdn/i4l: fix buffer overflow
isdn: Fix a sleep-in-atomic bug
net: phy: Do not perform software reset for Generic PHY
nfc: fdp: fix NULL pointer dereference
xfs: don't BUG() on mixed direct and mapped I/O
perf intel-pt: Ensure never to set 'last_ip' when packet 'count' is zero
perf intel-pt: Use FUP always when scanning for an IP
perf intel-pt: Fix last_ip usage
perf intel-pt: Fix ip compression
drm: rcar-du: Simplify and fix probe error handling
drm: rcar-du: Perform initialization/cleanup at probe/remove time
drm/rcar: Nuke preclose hook
Staging: comedi: comedi_fops: Avoid orphaned proc entry
Revert "powerpc/numa: Fix percpu allocations to be NUMA aware"
KVM: PPC: Book3S HV: Save/restore host values of debug registers
KVM: PPC: Book3S HV: Reload HTM registers explicitly
KVM: PPC: Book3S HV: Restore critical SPRs to host values on guest exit
KVM: PPC: Book3S HV: Context-switch EBB registers properly
drm/nouveau/bar/gf100: fix access to upper half of BAR2
drm/vmwgfx: Fix gcc-7.1.1 warning
md/raid5: add thread_group worker async_tx_issue_pending_all
crypto: authencesn - Fix digest_null crash
powerpc/pseries: Fix of_node_put() underflow during reconfig remove
net: reduce skb_warn_bad_offload() noise
pstore: Make spinlock per zone instead of global
af_key: Add lock to key dump
Linux 4.4.79
alarmtimer: don't rate limit one-shot timers
tracing: Fix kmemleak in instance_rmdir
spmi: Include OF based modalias in device uevent
of: device: Export of_device_{get_modalias, uvent_modalias} to modules
drm/mst: Avoid processing partially received up/down message transactions
drm/mst: Avoid dereferencing a NULL mstb in drm_dp_mst_handle_up_req()
drm/mst: Fix error handling during MST sideband message reception
RDMA/core: Initialize port_num in qp_attr
ceph: fix race in concurrent readdir
staging: rtl8188eu: add TL-WN722N v2 support
Revert "perf/core: Drop kernel samples even though :u is specified"
perf annotate: Fix broken arrow at row 0 connecting jmp instruction to its target
target: Fix COMPARE_AND_WRITE caw_sem leak during se_cmd quiesce
udf: Fix deadlock between writeback and udf_setsize()
NFS: only invalidate dentrys that are clearly invalid.
Input: i8042 - fix crash at boot time
MIPS: Fix a typo: s/preset/present/ in r2-to-r6 emulation error message
MIPS: Send SIGILL for linked branches in `__compute_return_epc_for_insn'
MIPS: Rename `sigill_r6' to `sigill_r2r6' in `__compute_return_epc_for_insn'
MIPS: Send SIGILL for BPOSGE32 in `__compute_return_epc_for_insn'
MIPS: math-emu: Prevent wrong ISA mode instruction emulation
MIPS: Fix unaligned PC interpretation in `compute_return_epc'
MIPS: Actually decode JALX in `__compute_return_epc_for_insn'
MIPS: Save static registers before sysmips
MIPS: Fix MIPS I ISA /proc/cpuinfo reporting
x86/ioapic: Pass the correct data to unmask_ioapic_irq()
x86/acpi: Prevent out of bound access caused by broken ACPI tables
MIPS: Negate error syscall return in trace
MIPS: Fix mips_atomic_set() with EVA
MIPS: Fix mips_atomic_set() retry condition
ftrace: Fix uninitialized variable in match_records()
vfio: New external user group/file match
vfio: Fix group release deadlock
f2fs: Don't clear SGID when inheriting ACLs
ipmi:ssif: Add missing unlock in error branch
ipmi: use rcu lock around call to intf->handlers->sender()
drm/radeon: Fix eDP for single-display iMac10,1 (v2)
drm/radeon/ci: disable mclk switching for high refresh rates (v2)
drm/amd/amdgpu: Return error if initiating read out of range on vram
s390/syscalls: Fix out of bounds arguments access
Raid5 should update rdev->sectors after reshape
cx88: Fix regression in initial video standard setting
x86/xen: allow userspace access during hypercalls
md: don't use flush_signals in userspace processes
usb: renesas_usbhs: gadget: disable all eps when the driver stops
usb: renesas_usbhs: fix usbhsc_resume() for !USBHSF_RUNTIME_PWCTRL
USB: cdc-acm: add device-id for quirky printer
usb: storage: return on error to avoid a null pointer dereference
xhci: Fix NULL pointer dereference when cleaning up streams for removed host
xhci: fix 20000ms port resume timeout
ipvs: SNAT packet replies only for NATed connections
PCI/PM: Restore the status of PCI devices across hibernation
af_key: Fix sadb_x_ipsecrequest parsing
powerpc/asm: Mark cr0 as clobbered in mftb()
powerpc: Fix emulation of mfocrf in emulate_step()
powerpc: Fix emulation of mcrf in emulate_step()
powerpc/64: Fix atomic64_inc_not_zero() to return an int
iscsi-target: Add login_keys_workaround attribute for non RFC initiators
scsi: ses: do not add a device to an enclosure if enclosure_add_links() fails.
PM / Domains: Fix unsafe iteration over modified list of domain providers
PM / Domains: Fix unsafe iteration over modified list of device links
ASoC: compress: Derive substream from stream based on direction
wlcore: fix 64K page support
Bluetooth: use constant time memory comparison for secret values
perf intel-pt: Clear FUP flag on error
perf intel-pt: Ensure IP is zero when state is INTEL_PT_STATE_NO_IP
perf intel-pt: Fix missing stack clear
perf intel-pt: Improve sample timestamp
perf intel-pt: Move decoder error setting into one condition
NFC: Add sockaddr length checks before accessing sa_family in bind handlers
nfc: Fix the sockaddr length sanitization in llcp_sock_connect
nfc: Ensure presence of required attributes in the activate_target handler
NFC: nfcmrvl: fix firmware-management initialisation
NFC: nfcmrvl: use nfc-device for firmware download
NFC: nfcmrvl: do not use device-managed resources
NFC: nfcmrvl_uart: add missing tty-device sanity check
NFC: fix broken device allocation
ath9k: fix tx99 bus error
ath9k: fix tx99 use after free
thermal: cpu_cooling: Avoid accessing potentially freed structures
s5p-jpeg: don't return a random width/height
ir-core: fix gcc-7 warning on bool arithmetic
disable new gcc-7.1.1 warnings for now
Linux 4.4.78
kvm: vmx: allow host to access guest MSR_IA32_BNDCFGS
kvm: vmx: Check value written to IA32_BNDCFGS
kvm: x86: Guest BNDCFGS requires guest MPX support
kvm: vmx: Do not disable intercepts for BNDCFGS
KVM: x86: disable MPX if host did not enable MPX XSAVE features
tracing: Use SOFTIRQ_OFFSET for softirq dectection for more accurate results
PM / QoS: return -EINVAL for bogus strings
PM / wakeirq: Convert to SRCU
sched/topology: Optimize build_group_mask()
sched/topology: Fix overlapping sched_group_mask
crypto: caam - fix signals handling
crypto: sha1-ssse3 - Disable avx2
crypto: atmel - only treat EBUSY as transient if backlog
crypto: talitos - Extend max key length for SHA384/512-HMAC and AEAD
mm: fix overflow check in expand_upwards()
tpm: Issue a TPM2_Shutdown for TPM2 devices.
Add "shutdown" to "struct class".
tpm: Provide strong locking for device removal
tpm: Get rid of chip->pdev
selftests/capabilities: Fix the test_execve test
mnt: Make propagate_umount less slow for overlapping mount propagation trees
mnt: In propgate_umount handle visiting mounts in any order
mnt: In umount propagation reparent in a separate pass
vt: fix unchecked __put_user() in tioclinux ioctls
exec: Limit arg stack to at most 75% of _STK_LIM
s390: reduce ELF_ET_DYN_BASE
powerpc: move ELF_ET_DYN_BASE to 4GB / 4MB
arm64: move ELF_ET_DYN_BASE to 4GB / 4MB
arm: move ELF_ET_DYN_BASE to 4MB
binfmt_elf: use ELF_ET_DYN_BASE only for PIE
checkpatch: silence perl 5.26.0 unescaped left brace warnings
fs/dcache.c: fix spin lockup issue on nlru->lock
mm/list_lru.c: fix list_lru_count_node() to be race free
kernel/extable.c: mark core_kernel_text notrace
tools/lib/lockdep: Reduce MAX_LOCK_DEPTH to avoid overflowing lock_chain/: Depth
parisc/mm: Ensure IRQs are off in switch_mm()
parisc: DMA API: return error instead of BUG_ON for dma ops on non dma devs
parisc: use compat_sys_keyctl()
parisc: Report SIGSEGV instead of SIGBUS when running out of stack
irqchip/gic-v3: Fix out-of-bound access in gic_set_affinity
cfg80211: Check if PMKID attribute is of expected size
cfg80211: Validate frequencies nested in NL80211_ATTR_SCAN_FREQUENCIES
cfg80211: Define nla_policy for NL80211_ATTR_LOCAL_MESH_POWER_MODE
brcmfmac: fix possible buffer overflow in brcmf_cfg80211_mgmt_tx()
rds: tcp: use sock_create_lite() to create the accept socket
vrf: fix bug_on triggered by rx when destroying a vrf
net: ipv6: Compare lwstate in detecting duplicate nexthops
ipv6: dad: don't remove dynamic addresses if link is down
net: handle NAPI_GRO_FREE_STOLEN_HEAD case also in napi_frags_finish()
bpf: prevent leaking pointer via xadd on unpriviledged
net: prevent sign extension in dev_get_stats()
tcp: reset sk_rx_dst in tcp_disconnect()
net: dp83640: Avoid NULL pointer dereference.
ipv6: avoid unregistering inet6_dev for loopback
net/phy: micrel: configure intterupts after autoneg workaround
net: sched: Fix one possible panic when no destroy callback
net_sched: fix error recovery at qdisc creation
Linux 4.4.77
saa7134: fix warm Medion 7134 EEPROM read
x86/mm/pat: Don't report PAT on CPUs that don't support it
ext4: check return value of kstrtoull correctly in reserved_clusters_store
staging: comedi: fix clean-up of comedi_class in comedi_init()
staging: vt6556: vnt_start Fix missing call to vnt_key_init_table.
tcp: fix tcp_mark_head_lost to check skb len before fragmenting
md: fix super_offset endianness in super_1_rdev_size_change
md: fix incorrect use of lexx_to_cpu in does_sb_need_changing
perf tools: Use readdir() instead of deprecated readdir_r() again
perf tests: Remove wrong semicolon in while loop in CQM test
perf trace: Do not process PERF_RECORD_LOST twice
perf dwarf: Guard !x86_64 definitions under #ifdef else clause
perf pmu: Fix misleadingly indented assignment (whitespace)
perf annotate browser: Fix behaviour of Shift-Tab with nothing focussed
perf tools: Remove duplicate const qualifier
perf script: Use readdir() instead of deprecated readdir_r()
perf thread_map: Use readdir() instead of deprecated readdir_r()
perf tools: Use readdir() instead of deprecated readdir_r()
perf bench numa: Avoid possible truncation when using snprintf()
perf tests: Avoid possible truncation with dirent->d_name + snprintf
perf scripting perl: Fix compile error with some perl5 versions
perf thread_map: Correctly size buffer used with dirent->dt_name
perf intel-pt: Use __fallthrough
perf top: Use __fallthrough
tools strfilter: Use __fallthrough
tools string: Use __fallthrough in perf_atoll()
tools include: Add a __fallthrough statement
mqueue: fix a use-after-free in sys_mq_notify()
RDMA/uverbs: Check port number supplied by user verbs cmds
KEYS: Fix an error code in request_master_key()
ath10k: override CE5 config for QCA9377
x86/uaccess: Optimize copy_user_enhanced_fast_string() for short strings
x86/tools: Fix gcc-7 warning in relocs.c
gfs2: Fix glock rhashtable rcu bug
USB: serial: qcserial: new Sierra Wireless EM7305 device ID
USB: serial: option: add two Longcheer device ids
pinctrl: sh-pfc: Update info pointer after SoC-specific init
pinctrl: mxs: atomically switch mux and drive strength config
pinctrl: sunxi: Fix SPDIF function name for A83T
pinctrl: meson: meson8b: fix the NAND DQS pins
pinctrl: sh-pfc: r8a7791: Fix SCIF2 pinmux data
sysctl: report EINVAL if value is larger than UINT_MAX for proc_douintvec
sysctl: don't print negative flag for proc_douintvec
mac80211_hwsim: Replace bogus hrtimer clockid
usb: Fix typo in the definition of Endpoint[out]Request
usb: usbip: set buffer pointers to NULL after free
Add USB quirk for HVR-950q to avoid intermittent device resets
USB: serial: cp210x: add ID for CEL EM3588 USB ZigBee stick
usb: dwc3: replace %p with %pK
drm/virtio: don't leak bo on drm_gem_object_init failure
tracing/kprobes: Allow to create probe with a module name starting with a digit
mm: fix classzone_idx underflow in shrink_zones()
bgmac: reset & enable Ethernet core before using it
driver core: platform: fix race condition with driver_override
fs: completely ignore unknown open flags
fs: add a VALID_OPEN_FLAGS
Linux 4.4.76
KVM: nVMX: Fix exception injection
KVM: x86: zero base3 of unusable segments
KVM: x86/vPMU: fix undefined shift in intel_pmu_refresh()
KVM: x86: fix emulation of RSM and IRET instructions
cpufreq: s3c2416: double free on driver init error path
iommu/amd: Fix incorrect error handling in amd_iommu_bind_pasid()
iommu: Handle default domain attach failure
iommu/vt-d: Don't over-free page table directories
ocfs2: o2hb: revert hb threshold to keep compatible
x86/mm: Fix flush_tlb_page() on Xen
x86/mpx: Correctly report do_mpx_bt_fault() failures to user-space
ARM: 8685/1: ensure memblock-limit is pmd-aligned
ARM64/ACPI: Fix BAD_MADT_GICC_ENTRY() macro implementation
sched/loadavg: Avoid loadavg spikes caused by delayed NO_HZ accounting
watchdog: bcm281xx: Fix use of uninitialized spinlock.
xfrm: Oops on error in pfkey_msg2xfrm_state()
xfrm: NULL dereference on allocation failure
xfrm: fix stack access out of bounds with CONFIG_XFRM_SUB_POLICY
jump label: fix passing kbuild_cflags when checking for asm goto support
ravb: Fix use-after-free on `ifconfig eth0 down`
sctp: check af before verify address in sctp_addr_id2transport
net/mlx4_core: Eliminate warning messages for SRQ_LIMIT under SRIOV
perf probe: Fix to show correct locations for events on modules
be2net: fix status check in be_cmd_pmac_add()
s390/ctl_reg: make __ctl_load a full memory barrier
swiotlb: ensure that page-sized mappings are page-aligned
coredump: Ensure proper size of sparse core files
x86/mpx: Use compatible types in comparison to fix sparse error
mac80211: initialize SMPS field in HT capabilities
spi: davinci: use dma_mapping_error()
scsi: lpfc: avoid double free of resource identifiers
HID: i2c-hid: Add sleep between POWER ON and RESET
kernel/panic.c: add missing \n
ibmveth: Add a proper check for the availability of the checksum features
vxlan: do not age static remote mac entries
virtio_net: fix PAGE_SIZE > 64k
vfio/spapr: fail tce_iommu_attach_group() when iommu_data is null
drm/amdgpu: check ring being ready before using
net: dsa: Check return value of phy_connect_direct()
amd-xgbe: Check xgbe_init() return code
platform/x86: ideapad-laptop: handle ACPI event 1
scsi: virtio_scsi: Reject commands when virtqueue is broken
xen-netfront: Fix Rx stall during network stress and OOM
swiotlb-xen: update dev_addr after swapping pages
virtio_console: fix a crash in config_work_handler
Btrfs: fix truncate down when no_holes feature is enabled
gianfar: Do not reuse pages from emergency reserve
powerpc/eeh: Enable IO path on permanent error
net: bgmac: Remove superflous netif_carrier_on()
net: bgmac: Start transmit queue in bgmac_open
net: bgmac: Fix SOF bit checking
bgmac: Fix reversed test of build_skb() return value.
mtd: bcm47xxpart: don't fail because of bit-flips
bgmac: fix a missing check for build_skb
mtd: bcm47xxpart: limit scanned flash area on BCM47XX (MIPS) only
MIPS: ralink: fix MT7628 wled_an pinmux gpio
MIPS: ralink: fix MT7628 pinmux typos
MIPS: ralink: Fix invalid assignment of SoC type
MIPS: ralink: fix USB frequency scaling
MIPS: ralink: MT7688 pinmux fixes
net: korina: Fix NAPI versus resources freeing
MIPS: ath79: fix regression in PCI window initialization
net: mvneta: Fix for_each_present_cpu usage
ARM: dts: BCM5301X: Correct GIC_PPI interrupt flags
qla2xxx: Fix erroneous invalid handle message
scsi: lpfc: Set elsiocb contexts to NULL after freeing it
scsi: sd: Fix wrong DPOFUA disable in sd_read_cache_type
KVM: x86: fix fixing of hypercalls
mm: numa: avoid waiting on freed migrated pages
block: fix module reference leak on put_disk() call for cgroups throttle
sysctl: enable strict writes
usb: gadget: f_fs: Fix possibe deadlock
drm/vmwgfx: Free hash table allocated by cmdbuf managed res mgr
ALSA: hda - set input_path bitmap to zero after moving it to new place
ALSA: hda - Fix endless loop of codec configure
MIPS: Fix IRQ tracing & lockdep when rescheduling
MIPS: pm-cps: Drop manual cache-line alignment of ready_count
MIPS: Avoid accidental raw backtrace
mm, swap_cgroup: reschedule when neeed in swap_cgroup_swapoff()
drm/ast: Handle configuration without P2A bridge
NFSv4: fix a reference leak caused WARNING messages
netfilter: synproxy: fix conntrackd interaction
netfilter: xt_TCPMSS: add more sanity tests on tcph->doff
rtnetlink: add IFLA_GROUP to ifla_policy
ipv6: Do not leak throw route references
sfc: provide dummy definitions of vswitch functions
net: 8021q: Fix one possible panic caused by BUG_ON in free_netdev
decnet: always not take dst->__refcnt when inserting dst into hash table
net/mlx5: Wait for FW readiness before initializing command interface
ipv6: fix calling in6_ifa_hold incorrectly for dad work
igmp: add a missing spin_lock_init()
igmp: acquire pmc lock for ip_mc_clear_src()
net: caif: Fix a sleep-in-atomic bug in cfpkt_create_pfx
Fix an intermittent pr_emerg warning about lo becoming free.
af_unix: Add sockaddr length checks before accessing sa_family in bind and connect handlers
net: Zero ifla_vf_info in rtnl_fill_vfinfo()
decnet: dn_rtmsg: Improve input length sanitization in dnrmg_receive_user_skb
net: don't call strlen on non-terminated string in dev_set_alias()
ipv6: release dst on error in ip6_dst_lookup_tail
Linux 4.4.75
nvme: apply DELAY_BEFORE_CHK_RDY quirk at probe time too
nvme/quirk: Add a delay before checking for adapter readiness
net: phy: fix marvell phy status reading
net: phy: Initialize mdio clock at probe function
usb: gadget: f_fs: avoid out of bounds access on comp_desc
powerpc/slb: Force a full SLB flush when we insert for a bad EA
mtd: spi-nor: fix spansion quad enable
of: Add check to of_scan_flat_dt() before accessing initial_boot_params
rxrpc: Fix several cases where a padded len isn't checked in ticket decode
USB: usbip: fix nonconforming hub descriptor
drm/amdgpu: adjust default display clock
drm/amdgpu/atom: fix ps allocation size for EnableDispPowerGating
drm/radeon: add a quirk for Toshiba Satellite L20-183
drm/radeon: add a PX quirk for another K53TK variant
iscsi-target: Reject immediate data underflow larger than SCSI transfer length
target: Fix kref->refcount underflow in transport_cmd_finish_abort
time: Fix clock->read(clock) race around clocksource changes
Input: i8042 - add Fujitsu Lifebook AH544 to notimeout list
powerpc/kprobes: Pause function_graph tracing during jprobes handling
signal: Only reschedule timers on signals timers have sent
HID: Add quirk for Dell PIXART OEM mouse
CIFS: Improve readdir verbosity
KVM: PPC: Book3S HV: Preserve userspace HTM state properly
lib/cmdline.c: fix get_options() overflow while parsing ranges
autofs: sanity check status reported with AUTOFS_DEV_IOCTL_FAIL
fs/exec.c: account for argv/envp pointers
Linux 4.4.74
mm: fix new crash in unmapped_area_topdown()
Allow stack to grow up to address space limit
mm: larger stack guard gap, between vmas
alarmtimer: Rate limit periodic intervals
MIPS: Fix bnezc/jialc return address calculation
usb: dwc3: exynos fix axius clock error path to do cleanup
alarmtimer: Prevent overflow of relative timers
genirq: Release resources in __setup_irq() error path
swap: cond_resched in swap_cgroup_prepare()
mm/memory-failure.c: use compound_head() flags for huge pages
USB: gadgetfs, dummy-hcd, net2280: fix locking for callbacks
usb: xhci: ASMedia ASM1042A chipset need shorts TX quirk
drivers/misc/c2port/c2port-duramar2150.c: checking for NULL instead of IS_ERR()
usb: r8a66597-hcd: decrease timeout
usb: r8a66597-hcd: select a different endpoint on timeout
USB: gadget: dummy_hcd: fix hub-descriptor removable fields
pvrusb2: reduce stack usage pvr2_eeprom_analyze()
usb: core: fix potential memory leak in error path during hcd creation
USB: hub: fix SS max number of ports
iio: proximity: as3935: recalibrate RCO after resume
staging: rtl8188eu: prevent an underflow in rtw_check_beacon_data()
mfd: omap-usb-tll: Fix inverted bit use for USB TLL mode
x86/mm/32: Set the '__vmalloc_start_set' flag in initmem_init()
serial: efm32: Fix parity management in 'efm32_uart_console_get_options()'
mac80211: fix IBSS presp allocation size
mac80211: fix CSA in IBSS mode
mac80211/wpa: use constant time memory comparison for MACs
mac80211: don't look at the PM bit of BAR frames
vb2: Fix an off by one error in 'vb2_plane_vaddr'
cpufreq: conservative: Allow down_threshold to take values from 1 to 10
can: gs_usb: fix memory leak in gs_cmd_reset()
configfs: Fix race between create_link and configfs_rmdir
Linux 4.4.73
sparc64: make string buffers large enough
s390/kvm: do not rely on the ILC on kvm host protection fauls
xtensa: don't use linux IRQ #0
tipc: ignore requests when the connection state is not CONNECTED
proc: add a schedule point in proc_pid_readdir()
romfs: use different way to generate fsid for BLOCK or MTD
sctp: sctp_addr_id2transport should verify the addr before looking up assoc
r8152: avoid start_xmit to schedule napi when napi is disabled
r8152: fix rtl8152_post_reset function
r8152: re-schedule napi for tx
nfs: Fix "Don't increment lock sequence ID after NFS4ERR_MOVED"
ravb: unmap descriptors when freeing rings
drm/ast: Fixed system hanged if disable P2A
drm/nouveau: Don't enabling polling twice on runtime resume
parisc, parport_gsc: Fixes for printk continuation lines
net: adaptec: starfire: add checks for dma mapping errors
pinctrl: berlin-bg4ct: fix the value for "sd1a" of pin SCRD0_CRD_PRES
gianfar: synchronize DMA API usage by free_skb_rx_queue w/ gfar_new_page
net/mlx4_core: Avoid command timeouts during VF driver device shutdown
drm/nouveau/fence/g84-: protect against concurrent access to semaphore buffers
drm/nouveau: prevent userspace from deleting client object
ipv6: fix flow labels when the traffic class is non-0
FS-Cache: Initialise stores_lock in netfs cookie
fscache: Clear outstanding writes when disabling a cookie
fscache: Fix dead object requeue
ethtool: do not vzalloc(0) on registers dump
log2: make order_base_2() behave correctly on const input value zero
kasan: respect /proc/sys/kernel/traceoff_on_warning
jump label: pass kbuild_cflags when checking for asm goto support
PM / runtime: Avoid false-positive warnings from might_sleep_if()
ipv6: Fix IPv6 packet loss in scenarios involving roaming + snooping switches
i2c: piix4: Fix request_region size
sierra_net: Add support for IPv6 and Dual-Stack Link Sense Indications
sierra_net: Skip validating irrelevant fields for IDLE LSIs
net: hns: Fix the device being used for dma mapping during TX
NET: mkiss: Fix panic
NET: Fix /proc/net/arp for AX.25
ipv6: Inhibit IPv4-mapped src address on the wire.
ipv6: Handle IPv4-mapped src to in6addr_any dst.
net: xilinx_emaclite: fix receive buffer overflow
net: xilinx_emaclite: fix freezes due to unordered I/O
Call echo service immediately after socket reconnect
staging: rtl8192e: rtl92e_fill_tx_desc fix write to mapped out memory.
ARM: dts: imx6dl: Fix the VDD_ARM_CAP voltage for 396MHz operation
partitions/msdos: FreeBSD UFS2 file systems are not recognized
s390/vmem: fix identity mapping
Linux 4.4.72
arm64: ensure extension of smp_store_release value
arm64: armv8_deprecated: ensure extension of addr
usercopy: Adjust tests to deal with SMAP/PAN
RDMA/qib,hfi1: Fix MR reference count leak on write with immediate
arm64: entry: improve data abort handling of tagged pointers
arm64: hw_breakpoint: fix watchpoint matching for tagged pointers
Make __xfs_xattr_put_listen preperly report errors.
NFSv4: Don't perform cached access checks before we've OPENed the file
NFS: Ensure we revalidate attributes before using execute_ok()
mm: consider memblock reservations for deferred memory initialization sizing
net: better skb->sender_cpu and skb->napi_id cohabitation
serial: sh-sci: Fix panic when serial console and DMA are enabled
tty: Drop krefs for interrupted tty lock
drivers: char: mem: Fix wraparound check to allow mappings up to the end
ASoC: Fix use-after-free at card unregistration
ALSA: timer: Fix missing queue indices reset at SNDRV_TIMER_IOCTL_SELECT
ALSA: timer: Fix race between read and ioctl
drm/nouveau/tmr: fully separate alarm execution/pending lists
drm/vmwgfx: Make sure backup_handle is always valid
drm/vmwgfx: limit the number of mip levels in vmw_gb_surface_define_ioctl()
drm/vmwgfx: Handle vmalloc() failure in vmw_local_fifo_reserve()
perf/core: Drop kernel samples even though :u is specified
powerpc/hotplug-mem: Fix missing endian conversion of aa_index
powerpc/numa: Fix percpu allocations to be NUMA aware
powerpc/eeh: Avoid use after free in eeh_handle_special_event()
scsi: qla2xxx: don't disable a not previously enabled PCI device
KVM: arm/arm64: Handle possible NULL stage2 pud when ageing pages
btrfs: fix memory leak in update_space_info failure path
btrfs: use correct types for page indices in btrfs_page_exists_in_range
cxl: Fix error path on bad ioctl
ufs_getfrag_block(): we only grab ->truncate_mutex on block creation path
ufs_extend_tail(): fix the braino in calling conventions of ufs_new_fragments()
ufs: set correct ->s_maxsize
ufs: restore maintaining ->i_blocks
fix ufs_isblockset()
ufs: restore proper tail allocation
fs: add i_blocksize()
cpuset: consider dying css as offline
Input: elantech - add Fujitsu Lifebook E546/E557 to force crc_enabled
drm/msm: Expose our reservation object when exporting a dmabuf.
target: Re-add check to reject control WRITEs with overflow data
cpufreq: cpufreq_register_driver() should return -ENODEV if init fails
stackprotector: Increase the per-task stack canary's random range from 32 bits to 64 bits on 64-bit platforms
random: properly align get_random_int_hash
drivers: char: random: add get_random_long()
iio: proximity: as3935: fix AS3935_INT mask
iio: light: ltr501 Fix interchanged als/ps register field
staging/lustre/lov: remove set_fs() call from lov_getstripe()
usb: chipidea: debug: check before accessing ci_role
usb: chipidea: udc: fix NULL pointer dereference if udc_start failed
usb: gadget: f_mass_storage: Serialize wake and sleep execution
ext4: fix fdatasync(2) after extent manipulation operations
ext4: keep existing extra fields when inode expands
ext4: fix SEEK_HOLE
xen-netfront: cast grant table reference first to type int
xen-netfront: do not cast grant table reference to signed short
xen/privcmd: Support correctly 64KB page granularity when mapping memory
dmaengine: ep93xx: Always start from BASE0
dmaengine: usb-dmac: Fix DMAOR AE bit definition
KVM: async_pf: avoid async pf injection when in guest mode
arm: KVM: Allow unaligned accesses at HYP
KVM: cpuid: Fix read/write out-of-bounds vulnerability in cpuid emulation
kvm: async_pf: fix rcu_irq_enter() with irqs enabled
nfsd: Fix up the "supattr_exclcreat" attributes
nfsd4: fix null dereference on replay
drm/amdgpu/ci: disable mclk switching for high refresh rates (v2)
crypto: gcm - wait for crypto op not signal safe
KEYS: fix freeing uninitialized memory in key_update()
KEYS: fix dereferencing NULL payload with nonzero length
ptrace: Properly initialize ptracer_cred on fork
serial: ifx6x60: fix use-after-free on module unload
arch/sparc: support NR_CPUS = 4096
sparc64: delete old wrap code
sparc64: new context wrap
sparc64: add per-cpu mm of secondary contexts
sparc64: redefine first version
sparc64: combine activate_mm and switch_mm
sparc64: reset mm cpumask after wrap
sparc: Machine description indices can vary
sparc64: mm: fix copy_tsb to correctly copy huge page TSBs
net: bridge: start hello timer only if device is up
net: ethoc: enable NAPI before poll may be scheduled
net: ping: do not abuse udp_poll()
ipv6: Fix leak in ipv6_gso_segment().
vxlan: fix use-after-free on deletion
tcp: disallow cwnd undo when switching congestion control
cxgb4: avoid enabling napi twice to the same queue
ipv6: xfrm: Handle errors reported by xfrm6_find_1stfragopt()
bnx2x: Fix Multi-Cos
Linux 4.4.71
xfs: only return -errno or success from attr ->put_listent
xfs: in _attrlist_by_handle, copy the cursor back to userspace
xfs: fix unaligned access in xfs_btree_visit_blocks
xfs: bad assertion for delalloc an extent that start at i_size
xfs: fix indlen accounting error on partial delalloc conversion
xfs: wait on new inodes during quotaoff dquot release
xfs: update ag iterator to support wait on new inodes
xfs: support ability to wait on new inodes
xfs: fix up quotacheck buffer list error handling
xfs: prevent multi-fsb dir readahead from reading random blocks
xfs: handle array index overrun in xfs_dir2_leaf_readbuf()
xfs: fix over-copying of getbmap parameters from userspace
xfs: fix off-by-one on max nr_pages in xfs_find_get_desired_pgoff()
xfs: Fix missed holes in SEEK_HOLE implementation
mlock: fix mlock count can not decrease in race condition
mm/migrate: fix refcount handling when !hugepage_migration_supported()
drm/gma500/psb: Actually use VBT mode when it is found
slub/memcg: cure the brainless abuse of sysfs attributes
ALSA: hda - apply STAC_9200_DELL_M22 quirk for Dell Latitude D430
pcmcia: remove left-over %Z format
drm/radeon: Unbreak HPD handling for r600+
drm/radeon/ci: disable mclk switching for high refresh rates (v2)
scsi: mpt3sas: Force request partial completion alignment
HID: wacom: Have wacom_tpc_irq guard against possible NULL dereference
mmc: sdhci-iproc: suppress spurious interrupt with Multiblock read
i2c: i2c-tiny-usb: fix buffer not being DMA capable
vlan: Fix tcp checksum offloads in Q-in-Q vlans
net: phy: marvell: Limit errata to 88m1101
netem: fix skb_orphan_partial()
ipv4: add reference counting to metrics
sctp: fix ICMP processing if skb is non-linear
tcp: avoid fastopen API to be used on AF_UNSPEC
virtio-net: enable TSO/checksum offloads for Q-in-Q vlans
be2net: Fix offload features for Q-in-Q packets
ipv6: fix out of bound writes in __ip6_append_data()
bridge: start hello_timer when enabling KERNEL_STP in br_stp_start
qmi_wwan: add another Lenovo EM74xx device ID
bridge: netlink: check vlan_default_pvid range
ipv6: Check ip6_find_1stfragopt() return value properly.
ipv6: Prevent overrun when parsing v6 header options
net: Improve handling of failures on link and route dumps
tcp: eliminate negative reordering in tcp_clean_rtx_queue
sctp: do not inherit ipv6_{mc|ac|fl}_list from parent
sctp: fix src address selection if using secondary addresses for ipv6
tcp: avoid fragmenting peculiar skbs in SACK
s390/qeth: avoid null pointer dereference on OSN
s390/qeth: unbreak OSM and OSN support
s390/qeth: handle sysfs error during initialization
ipv6/dccp: do not inherit ipv6_mc_list from parent
dccp/tcp: do not inherit mc_list from parent
sparc: Fix -Wstringop-overflow warning
Bug: 62730977
Change-Id: Ifca755d82f9e4b11016f6660298c2c1b073bfb3a
Signed-off-by: Thierry Strudel <tstrudel@google.com>
1375 lines
47 KiB
C
1375 lines
47 KiB
C
/*
|
|
* 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.
|
|
*
|
|
* This file is released under the GPLv2
|
|
*
|
|
* See Documentation/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/pinctrl/devinfo.h>
|
|
#include <linux/pm.h>
|
|
#include <linux/atomic.h>
|
|
#include <linux/ratelimit.h>
|
|
#include <linux/uidgid.h>
|
|
#include <linux/gfp.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 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(_name, _mode, _show, _store) \
|
|
struct bus_attribute bus_attr_##_name = __ATTR(_name, _mode, _show, _store)
|
|
#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)
|
|
|
|
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.
|
|
* @dev_attrs: Default attributes of the devices on the bus.
|
|
* @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 nonzero value if the
|
|
* given device can be handled by the given driver.
|
|
* @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.
|
|
* @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.
|
|
* @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
|
|
*
|
|
* 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;
|
|
struct device_attribute *dev_attrs; /* use dev_groups instead */
|
|
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);
|
|
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);
|
|
|
|
const struct dev_pm_ops *pm;
|
|
|
|
const struct iommu_ops *iommu_ops;
|
|
|
|
struct subsys_private *p;
|
|
struct lock_class_key lock_key;
|
|
};
|
|
|
|
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 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,
|
|
void *data,
|
|
int (*match)(struct device *dev, void *data));
|
|
struct device *bus_find_device_by_name(struct bus_type *bus,
|
|
struct device *start,
|
|
const char *name);
|
|
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 */
|
|
|
|
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.
|
|
* @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.
|
|
* @pm: Power management operations of the device which matched
|
|
* this driver.
|
|
* @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);
|
|
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 dev_pm_ops *pm;
|
|
|
|
struct driver_private *p;
|
|
};
|
|
|
|
|
|
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(_name, _mode, _show, _store) \
|
|
struct driver_attribute driver_attr_##_name = __ATTR(_name, _mode, _show, _store)
|
|
#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);
|
|
|
|
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, void *data,
|
|
int (*match)(struct device *dev, void *data));
|
|
|
|
/**
|
|
* 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_attrs: 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.
|
|
* @suspend: Used to put the device to sleep mode, usually to a low power
|
|
* state.
|
|
* @resume: Used to bring the device from the sleep mode.
|
|
* @shutdown: Called at shut-down time to quiesce the device.
|
|
* @ns_type: Callbacks so sysfs can detemine namespaces.
|
|
* @namespace: Namespace of the device belongs to this class.
|
|
* @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;
|
|
|
|
struct class_attribute *class_attrs;
|
|
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 (*suspend)(struct device *dev, pm_message_t state);
|
|
int (*resume)(struct device *dev);
|
|
int (*shutdown)(struct device *dev);
|
|
|
|
const struct kobj_ns_type_operations *ns_type;
|
|
const void *(*namespace)(struct device *dev);
|
|
|
|
const struct dev_pm_ops *pm;
|
|
|
|
struct subsys_private *p;
|
|
};
|
|
|
|
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 *));
|
|
|
|
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(_name, _mode, _show, _store) \
|
|
struct class_attribute class_attr_##_name = __ATTR(_name, _mode, _show, _store)
|
|
#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)
|
|
|
|
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_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);
|
|
#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);
|
|
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);
|
|
extern __printf(3, 0)
|
|
char *devm_kvasprintf(struct device *dev, gfp_t gfp, const char *fmt,
|
|
va_list ap);
|
|
extern __printf(3, 4)
|
|
char *devm_kasprintf(struct device *dev, gfp_t gfp, const char *fmt, ...);
|
|
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)
|
|
{
|
|
if (size != 0 && n > SIZE_MAX / size)
|
|
return NULL;
|
|
return devm_kmalloc(dev, n * size, 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, void *p);
|
|
extern char *devm_kstrdup(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, struct resource *res);
|
|
|
|
/* 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);
|
|
|
|
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;
|
|
}
|
|
|
|
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 - 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.
|
|
* @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.
|
|
* @power: For device power management.
|
|
* See Documentation/power/devices.txt 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/pinctrl.txt 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_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.
|
|
* @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.
|
|
*
|
|
* @offline_disabled: If set, the device is permanently online.
|
|
* @offline: Set after successful invocation of bus type's .offline().
|
|
*
|
|
* 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 device *parent;
|
|
|
|
struct device_private *p;
|
|
|
|
struct kobject kobj;
|
|
const char *init_name; /* initial name of the device */
|
|
const struct device_type *type;
|
|
|
|
struct mutex mutex; /* mutex to synchronize calls to
|
|
* its driver.
|
|
*/
|
|
|
|
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/get_drvdata */
|
|
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
|
|
|
|
#ifdef CONFIG_NUMA
|
|
int numa_node; /* NUMA node this device is close to */
|
|
#endif
|
|
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. */
|
|
unsigned long dma_pfn_offset;
|
|
|
|
struct device_dma_parameters *dma_parms;
|
|
|
|
struct list_head dma_pools; /* dma pools (if dma'ble) */
|
|
|
|
struct dma_coherent_mem *dma_mem; /* internal for coherent mem
|
|
override */
|
|
#ifdef CONFIG_DMA_CMA
|
|
struct cma *cma_area; /* contiguous memory area for dma
|
|
allocations */
|
|
#endif
|
|
struct removed_region *removed_mem;
|
|
/* arch specific additions */
|
|
struct dev_archdata archdata;
|
|
|
|
struct device_node *of_node; /* associated device tree node */
|
|
struct fwnode_handle *fwnode; /* firmware device node */
|
|
|
|
dev_t devt; /* dev_t, creates the sysfs "dev" */
|
|
u32 id; /* device instance */
|
|
|
|
spinlock_t devres_lock;
|
|
struct list_head devres_head;
|
|
|
|
struct klist_node knode_class;
|
|
struct class *class;
|
|
const struct attribute_group **groups; /* optional groups */
|
|
|
|
void (*release)(struct device *dev);
|
|
struct iommu_group *iommu_group;
|
|
|
|
bool offline_disabled:1;
|
|
bool offline:1;
|
|
};
|
|
|
|
static inline struct device *kobj_to_dev(struct kobject *kobj)
|
|
{
|
|
return container_of(kobj, struct device, kobj);
|
|
}
|
|
|
|
/* 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 -1;
|
|
}
|
|
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 void pm_suspend_ignore_children(struct device *dev, bool enable)
|
|
{
|
|
dev->power.ignore_children = enable;
|
|
}
|
|
|
|
static inline void dev_pm_syscore_device(struct device *dev, bool val)
|
|
{
|
|
#ifdef CONFIG_PM_SLEEP
|
|
dev->power.syscore = val;
|
|
#endif
|
|
}
|
|
|
|
static inline void device_lock(struct device *dev)
|
|
{
|
|
mutex_lock(&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))
|
|
return NULL;
|
|
return dev->of_node;
|
|
}
|
|
|
|
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 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 void lock_device_hotplug_assert(void);
|
|
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);
|
|
|
|
/*
|
|
* 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);
|
|
|
|
/*
|
|
* 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);
|
|
|
|
/*
|
|
* 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);
|
|
|
|
#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);
|
|
|
|
|
|
#ifdef CONFIG_PRINTK
|
|
|
|
extern __printf(3, 0)
|
|
int dev_vprintk_emit(int level, const struct device *dev,
|
|
const char *fmt, va_list args);
|
|
extern __printf(3, 4)
|
|
int dev_printk_emit(int level, const struct device *dev, const char *fmt, ...);
|
|
|
|
extern __printf(3, 4)
|
|
void dev_printk(const char *level, const struct device *dev,
|
|
const char *fmt, ...);
|
|
extern __printf(2, 3)
|
|
void dev_emerg(const struct device *dev, const char *fmt, ...);
|
|
extern __printf(2, 3)
|
|
void dev_alert(const struct device *dev, const char *fmt, ...);
|
|
extern __printf(2, 3)
|
|
void dev_crit(const struct device *dev, const char *fmt, ...);
|
|
extern __printf(2, 3)
|
|
void dev_err(const struct device *dev, const char *fmt, ...);
|
|
extern __printf(2, 3)
|
|
void dev_warn(const struct device *dev, const char *fmt, ...);
|
|
extern __printf(2, 3)
|
|
void dev_notice(const struct device *dev, const char *fmt, ...);
|
|
extern __printf(2, 3)
|
|
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
|
|
|
|
/*
|
|
* Stupid hackaround for existing uses of non-printk uses dev_info
|
|
*
|
|
* Note that the definition of dev_info below is actually _dev_info
|
|
* and a macro is used to avoid redefining dev_info
|
|
*/
|
|
|
|
#define dev_info(dev, fmt, arg...) _dev_info(dev, fmt, ##arg)
|
|
|
|
#if defined(CONFIG_DYNAMIC_DEBUG)
|
|
#define dev_dbg(dev, format, ...) \
|
|
do { \
|
|
dynamic_dev_dbg(dev, format, ##__VA_ARGS__); \
|
|
} while (0)
|
|
#elif defined(DEBUG)
|
|
#define dev_dbg(dev, format, arg...) \
|
|
dev_printk(KERN_DEBUG, dev, format, ##arg)
|
|
#else
|
|
#define dev_dbg(dev, format, arg...) \
|
|
({ \
|
|
if (0) \
|
|
dev_printk(KERN_DEBUG, dev, format, ##arg); \
|
|
})
|
|
#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)
|
|
/* 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 (unlikely(descriptor.flags & _DPRINTK_FLAGS_PRINT) && \
|
|
__ratelimit(&_rs)) \
|
|
__dynamic_dev_dbg(&descriptor, dev, 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, fmt, ##__VA_ARGS__); \
|
|
} while (0)
|
|
#else
|
|
#define dev_dbg_ratelimited(dev, fmt, ...) \
|
|
no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
|
|
#endif
|
|
|
|
#ifdef VERBOSE_DEBUG
|
|
#define dev_vdbg dev_dbg
|
|
#else
|
|
#define dev_vdbg(dev, format, arg...) \
|
|
({ \
|
|
if (0) \
|
|
dev_printk(KERN_DEBUG, dev, format, ##arg); \
|
|
})
|
|
#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)
|
|
|
|
/* 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_ */
|