* origin/tmp-cc4a41f:
Linux 4.13-rc7
Avoid page waitqueue race leaving possible page locker waiting
Minor page waitqueue cleanups
Clarify (and fix) MAX_LFS_FILESIZE macros
PCI/MSI: Don't warn when irq_create_affinity_masks() returns NULL
mm/memblock.c: reversed logic in memblock_discard()
fork: fix incorrect fput of ->exe_file causing use-after-free
mm/madvise.c: fix freeing of locked page with MADV_FREE
dax: fix deadlock due to misaligned PMD faults
mm, shmem: fix handling /sys/kernel/mm/transparent_hugepage/shmem_enabled
PM/hibernate: touch NMI watchdog when creating snapshot
virtio_pci: fix cpu affinity support
virtio_blk: fix incorrect message when disk is resized
blk-mq-debugfs: Add names for recently added flags
KVM: PPC: Book3S: Fix race and leak in kvm_vm_ioctl_create_spapr_tce()
perf/core: Fix group {cpu,task} validation
x86/mm: Fix use-after-free of ldt_struct
KVM, pkeys: do not use PKRU value in vcpu->arch.guest_fpu.state
KVM: x86: simplify handling of PKRU
KVM: x86: block guest protection keys unless the host has them enabled
mtd: nand: atmel: Relax tADL_min constraint
mtd: nandsim: remove debugfs entries in error path
Input: ALPS - fix two-finger scroll breakage in right side on ALPS touchpad
net: sunrpc: svcsock: fix NULL-pointer exception
nfsd: Limit end of page list when decoding NFSv4 WRITE
pty: Repair TIOCGPTPEER
IB/mlx5: Always return success for RoCE modify port
IB/mlx5: Fix Raw Packet QP event handler assignment
IB/core: Avoid accessing non-allocated memory when inferring port type
ASoC: rt5677: Reintroduce I2C device IDs
Btrfs: fix blk_status_t/errno confusion
kbuild: update comments of Makefile.asm-generic
bsg-lib: fix kernel panic resulting from missing allocation of reply-buffer
tracing: Fix freeing of filter in create_filter() when set_str is false
tracing: Fix kmemleak in tracing_map_array_free()
ftrace: Check for null ret_stack on profile function graph entry function
KVM: PPC: Book3S HV: Add missing barriers to XIVE code and document them
KVM: PPC: Book3S HV: Workaround POWER9 DD1.0 bug causing IPB bit loss
KVM: PPC: Book3S HV: Use msgsync with hypervisor doorbells on POWER9
timers: Fix excessive granularity of new timers after a nohz idle
Revert "pty: fix the cached path of the pty slave file descriptor in the master"
Revert "loop: support 4k physical blocksize"
blk-throttle: cap discard request size
ARM: dts: exynos: add needs-hpd for Odroid-XU3/4
cifs: return ENAMETOOLONG for overlong names in cifs_open()/cifs_lookup()
cifs: Fix df output for users with quota limits
ARM: at91: don't select CONFIG_ARM_CPU_SUSPEND for old platforms
ALSA: hda - Add stereo mic quirk for Lenovo G50-70 (17aa:3978)
drm/i915/gvt: Fix the kernel null pointer error
ANDROID: binder: fix proc->tsk check.
ACPI: device property: Fix node lookup in acpi_graph_get_child_prop_value()
ACPICA: Fix acpi_evaluate_object_typed()
RDMA/uverbs: Initialize cq_context appropriately
arm64: kaslr: Adjust the offset to avoid Image across alignment boundary
arm64: kaslr: ignore modulo offset when validating virtual displacement
arm64: mm: abort uaccess retries upon fatal signal
arm64: fpsimd: Prevent registers leaking across exec
ALSA: core: Fix unexpected error at replacing user TLV
drm: Release driver tracking before making the object available again
ALSA: usb-audio: Add delay quirk for H650e/Jabra 550a USB headsets
Revert "mfd: da9061: Fix to remove BBAT_CONT register from chip model"
sparc: kernel/pcic: silence gcc 7.x warning in pcibios_fixup_bus()
pids: make task_tgid_nr_ns() safe
objtool: Fix '-mtune=atom' decoding support in objtool 2.0
KVM: s390: sthyi: fix specification exception detection
KVM: s390: sthyi: fix sthyi inline assembly
mmc: block: prevent propagating R1_OUT_OF_RANGE for open-ending mode
rtc: ds1307: fix regmap config
drm/i915: Clear lost context-switch interrupts across reset
drm/i915/bxt: use NULL for GPIO connection ID
soc: ti: knav: Add a NULL pointer check for kdev in knav_pool_create
ipv6: repair fib6 tree in failure case
net_sched: fix order of queue length updates in qdisc_replace()
tools lib bpf: improve warning
switchdev: documentation: minor typo fixes
bpf, doc: also add s390x as arch to sysctl description
kbuild: Do not use hyphen in exported variable name
Makefile: add kselftest-clean to PHONY target list
Kbuild: use -fshort-wchar globally
Linux 4.13-rc6
Sanitize 'move_pages()' permission checks
Input: soc_button_array - silence -ENOENT error on Dell XPS13 9365
iio: magnetometer: st_magn: remove ihl property for LSM303AGR
iio: magnetometer: st_magn: fix status register address for LSM303AGR
iio: hid-sensor-trigger: Fix the race with user space powering up sensors
iio: trigger: stm32-timer: fix get trigger mode
iio: imu: adis16480: Fix acceleration scale factor for adis16480
PATCH] iio: Fix some documentation warnings
genirq/ipi: Fixup checks against nr_cpu_ids
ALSA: firewire-motu: destroy stream data surely at failure of card initialization
ALSA: firewire: fix NULL pointer dereference when releasing uninitialized data of iso-resource
Input: trackpoint - add new trackpoint firmware ID
Input: elan_i2c - add ELAN0602 ACPI ID to support Lenovo Yoga310
net: sched: fix NULL pointer dereference when action calls some targets
rxrpc: Fix oops when discarding a preallocated service call
irda: do not leak initialized list.dev to userspace
net/mlx4_core: Enable 4K UAR if SRIOV module parameter is not enabled
PCI: Allow PCI express root ports to find themselves
tcp: when rearming RTO, if RTO time is in past then fire RTO ASAP
net: check and errout if res->fi is NULL when RTM_F_FIB_MATCH is set
ipv6: reset fn->rr_ptr when replacing route
staging: rtl8188eu: add RNX-N150NUB support
sctp: fully initialize the IPv6 address in sctp_v6_to_addr()
tipc: fix use-after-free
tun: handle register_netdevice() failures properly
mm: revert x86_64 and arm64 ELF_ET_DYN_BASE base changes
mm/vmalloc.c: don't unconditonally use __GFP_HIGHMEM
mm/mempolicy: fix use after free when calling get_mempolicy
mm/cma_debug.c: fix stack corruption due to sprintf usage
signal: don't remove SIGNAL_UNKILLABLE for traced tasks.
mm, oom: fix potential data corruption when oom_reaper races with writer
mm: fix double mmap_sem unlock on MMF_UNSTABLE enforced SIGBUS
slub: fix per memcg cache leak on css offline
mm: discard memblock data later
test_kmod: fix description for -s -and -c parameters
kmod: fix wait on recursive loop
wait: add wait_event_killable_timeout()
kernel/watchdog: fix Kconfig constraints for perf hardlockup watchdog
mm: memcontrol: fix NULL pointer crash in test_clear_page_writeback()
datagram: When peeking datagrams with offset < 0 don't skip empty skbs
bpf, doc: improve sysctl knob description
netxen: fix incorrect loop counter decrement
nfp: fix infinite loop on umapping cleanup
net: sched: fix p_filter_chain check in tcf_chain_flush
blk-mq-pci: add a fallback when pci_irq_get_affinity returns NULL
kernel/watchdog: Prevent false positives with turbo modes
genirq: Restore trigger settings in irq_modify_status()
soc: ti: ti_sci_pm_domains: Populate name for genpd
x86: Constify attribute_group structures
MAINTAINERS: Remove Jason Cooper's irqchip git tree
ALSA: emu10k1: Fix forgotten user-copy conversion in init code
ALSA: usb-audio: add DSD support for new Amanero PID
nvme-pci: set cqe_seen on polled completions
powerpc/mm: Ensure cpumask update is ordered
ARM: dts: imx6qdl-nitrogen6_som2: fix PCIe reset
xfs: don't leak quotacheck dquots when cow recovery
xfs: clear MS_ACTIVE after finishing log recovery
ACPI: EC: Fix regression related to wrong ECDT initialization order
bpf: Update sysctl documentation to list all supported architectures
nvme-fabrics: fix reporting of unrecognized options
pty: fix the cached path of the pty slave file descriptor in the master
i2c: designware: Fix runtime PM for I2C slave mode
i2c: designware: Remove needless pm_runtime_put_noidle() call
ALSA: usb-audio: Add mute TLV for playback volumes on C-Media devices
of: fix DMA mask generation
x86/boot/64/clang: Use fixup_pointer() to access 'next_early_pgt'
nvmet-fc: eliminate incorrect static markers on local variables
scsi: cxgb4i: call neigh_event_send() to update MAC address
Revert "scsi: default to scsi-mq"
scsi: sd_zbc: Write unlock zone from sd_uninit_cmnd()
scsi: aacraid: Fix out of bounds in aac_get_name_resp
scsi: csiostor: fail probe if fw does not support FCoE
scsi: megaraid_sas: fix error handle in megasas_probe_one
ipv4: better IP_MAX_MTU enforcement
ptr_ring: use kmalloc_array()
dccp: defer ccid_hc_tx_delete() at dismantle time
openvswitch: fix skb_panic due to the incorrect actions attrlen
printk-formats.txt: Better describe the difference between %pS and %pF
x86/elf: Remove the unnecessary ADDR_NO_RANDOMIZE checks
x86: Fix norandmaps/ADDR_NO_RANDOMIZE
sparc64: remove unnecessary log message
Revert "staging: fsl-mc: be consistent when checking strcmp() return"
net: igmp: Use ingress interface rather than vrf device
sparc64: Don't clibber fixed registers in __multi4.
IB/uverbs: Fix NULL pointer dereference during device removal
IB/core: Protect sysfs entry on ib_unregister_device
iw_cxgb4: fix misuse of integer variable
IB/hns: fix memory leak on ah on error return path
i40iw: Fix potential fcn_id_array out of bounds
i40iw: Use correct alignment for CQ0 memory
i40iw: Fix typecast of tcp_seq_num
i40iw: Correct variable names
i40iw: Fix parsing of query/commit FPM buffers
drm/i915/cnl: Fix LSPCON support.
drm/i915/vbt: ignore extraneous child devices for a port
drm/i915: Initialize 'data' in intel_dsi_dcs_backlight.c
RDMA/vmw_pvrdma: Report CQ missed events
powerpc: Fix VSX enabling/flushing to also test MSR_FP and MSR_VEC
nvmet-fc: correct use after free on list teardown
nvmet: don't overwrite identify sn/fr with 0-bytes
parisc: pci memory bar assignment fails with 64bit kernels on dino/cujo
bpf: fix bpf_trace_printk on 32 bit archs
PCI: fix oops when try to find Root Port for a PCI device
sfc: don't try and read ef10 data on non-ef10 NIC
net_sched: remove warning from qdisc_hash_add
net_sched/sfq: update hierarchical backlog when drop packet
net_sched: reset pointers to tcf blocks in classful qdiscs' destructors
ipv4: fix NULL dereference in free_fib_info_rcu()
net: Fix a typo in comment about sock flags.
ipv6: fix NULL dereference in ip6_route_dev_notify()
audit: Receive unmount event
audit: Fix use after free in audit_remove_watch_rule()
drm/amdgpu: save list length when fence is signaled
xen-blkfront: use a right index when checking requests
xen: fix bio vec merging
blk-mq: Fix queue usage on failed request allocation
iommu: Fix wrong freeing of iommu_device->dev
x86/mtrr: Prevent CPU hotplug lock recursion
drm/atomic: If the atomic check fails, return its value first
ALSA: usb-audio: Apply sample rate quirk to Sennheiser headset
ALSA: seq: 2nd attempt at fixing race creating a queue
tcp: fix possible deadlock in TCP stack vs BPF filter
dccp: purge write queue in dccp_destroy_sock()
udp: fix linear skb reception with PEEK_OFF
ipv6: release rt6->rt6i_idev properly during ifdown
af_key: do not use GFP_KERNEL in atomic contexts
tcp: ulp: avoid module refcnt leak in tcp_set_ulp
net/cxgb4vf: Use new PCI_DEV_FLAGS_NO_RELAXED_ORDERING flag
net/cxgb4: Use new PCI_DEV_FLAGS_NO_RELAXED_ORDERING flag
PCI: Disable Relaxed Ordering Attributes for AMD A1100
PCI: Disable Relaxed Ordering for some Intel processors
PCI: Disable PCIe Relaxed Ordering if unsupported
Input: elan_i2c - Add antoher Lenovo ACPI ID for upcoming Lenovo NB
Input: elan_i2c - add ELAN0608 to the ACPI table
i2c: aspeed: fixed potential null pointer dereference
i2c: simtec: use release_mem_region instead of release_resource
i2c: core: Make comment about I2C table requirement to reflect the code
i2c: designware: Fix standard mode speed when configuring the slave mode
i2c: designware: Fix oops from i2c_dw_irq_handler_slave
i2c: designware: Fix system suspend
tipc: avoid inheriting msg_non_seq flag when message is returned
tipc: accept PACKET_MULTICAST packets
ipv4: route: fix inet_rtm_getroute induced crash
drm/i915: Avoid the gpu reset vs. modeset deadlock
drm/i915: Suppress switch_mm emission between the same aliasing_ppgtt
drm/i915: Return correct EDP voltage swing table for 0.85V
drm/i915/cnl: Add slice and subslice information to debugfs.
drm/i915: Perform an invalidate prior to executing golden renderstate
drm/i915: remove unused function declaration
drm/atomic: Handle -EDEADLK with out-fences correctly
drm: Fix framebuffer leak
gpio: mvebu: Fix cause computation in irq handler
gpio: reject invalid gpio before getting gpio_desc
ext4: add missing xattr hash update
ext4: fix clang build regression
ALSA: hda/realtek - Fix pincfg for Dell XPS 13 9370
brcmfmac: feature check for multi-scheduled scan fails on bcm4343x devices
arm64: allwinner: h5: fix pinctrl IRQs
bonding: ratelimit failed speed/duplex update warning
Linux 4.13-rc5
mtd: blkdevs: Fix mtd block write failure
MD: not clear ->safemode for external metadata array
iomap: fix integer truncation issues in the zeroing and dirtying helpers
xfs: fix inobt inode allocation search optimization
udp: harden copy_linear_skb()
bpf: fix two missing target_size settings in bpf_convert_ctx_access
net: fix compilation when busy poll is not enabled
mISDN: Fix null pointer dereference at mISDN_FsmNew
nfp: do not update MTU from BH in flower app
net: stmmac: Use the right logging function in stmmac_mdio_register
net/sched/hfsc: allocate tcf block for hfsc root class
bonding: require speed/duplex only for 802.3ad, alb and tlb
net: dsa: ksz: fix skb freeing
pnfs/blocklayout: require 64-bit sector_t
selftests: timers: freq-step: fix compile error
iommu/arm-smmu: fix null-pointer dereference in arm_smmu_add_device
xen/events: Fix interrupt lost during irq_disable and irq_enable
xen: avoid deadlock in xenbus
clocksource/drivers/arm_arch_timer: Avoid infinite recursion when ftrace is enabled
xen: fix hvm guest with kaslr enabled
xen: split up xen_hvm_init_shared_info()
x86: provide an init_mem_mapping hypervisor hook
x86: Mark various structures and functions as 'static'
x86/cpufeature, kvm/svm: Rename (shorten) the new "virtualized VMSAVE/VMLOAD" CPUID flag
clocksource/drivers/Kconfig: Fix CLKSRC_PISTACHIO dependencies
clocksource/drivers/timer-of: Checking for IS_ERR() instead of NULL
fuse: set mapping error in writepage_locked when it fails
drm/imx: ipuv3-plane: fix YUV framebuffer scanout on the base plane
gpu: ipu-v3: add DRM dependency
ALSA: seq: Fix CONFIG_SND_SEQ_MIDI dependency
arc: Mask individual IRQ lines during core INTC init
cpufreq: x86: Disable interrupts during MSRs reading
cpufreq: intel_pstate: report correct CPU frequencies during trace
userfaultfd: replace ENOSPC with ESRCH in case mm has gone during copy/zeropage
zram: rework copy of compressor name in comp_algorithm_store()
rmap: do not call mmu_notifier_invalidate_page() under ptl
mm: fix list corruptions on shmem shrinklist
mm/balloon_compaction.c: don't zero ballooned pages
MAINTAINERS: copy virtio on balloon_compaction.c
mm: fix KSM data corruption
mm: fix MADV_[FREE|DONTNEED] TLB flush miss problem
mm: make tlb_flush_pending global
mm: refactor TLB gathering API
Revert "mm: numa: defer TLB flush for THP migration as long as possible"
mm: migrate: fix barriers around tlb_flush_pending
mm: migrate: prevent racy access to tlb_flush_pending
fault-inject: fix wrong should_fail() decision in task context
test_kmod: fix small memory leak on filesystem tests
test_kmod: fix the lock in register_test_dev_kmod()
test_kmod: fix bug which allows negative values on two config options
test_kmod: fix spelling mistake: "EMTPY" -> "EMPTY"
userfaultfd: hugetlbfs: remove superfluous page unlock in VM_SHARED case
mm: ratelimit PFNs busy info message
mm: fix global NR_SLAB_.*CLAIMABLE counter reads
mm: add pmd_t initializer __pmd() to work around a GCC bug.
thunderbolt: Do not enumerate more ports from DROM than the controller has
mei: exclude device from suspend direct complete optimization
firmware: avoid invalid fallback aborts by using killable wait
firmware: fix batched requests - send wake up on failure on direct lookups
firmware: fix batched requests - wake all waiters
USB: serial: pl2303: add new ATEN device id
usb: quirks: Add no-lpm quirk for Moshi USB to Ethernet Adapter
USB: Check for dropped connection before switching to full speed
usb:xhci:Add quirk for Certain failing HP keyboard on reset after resume
nvme: fix directive command numd calculation
nvme: fix nvme reset command timeout handling
packet: fix tp_reserve race in packet_set_ring
udp: consistently apply ufo or fragmentation
irqchip/gic-v3-its-platform-msi: Fix msi-parent parsing loop
irqchip/gic-v3-its: Allow GIC ITS number more than MAX_NUMNODES
x86/smpboot: Unbreak CPU0 hotplug
clocksource/drivers/em_sti: Fix error return codes in em_sti_probe()
clocksource/drivers/arm_arch_timer: Fix mem frame loop initialization
x86/asm/64: Clear AC on NMI entries
perf/core: Fix time on IOC_ENABLE
perf/x86: Fix RDPMC vs. mm_struct tracking
nvme-pci: fix CMB sysfs file removal in reset path
lpfc: support nvmet_fc defer_rcv callback
nvmet_fc: add defer_req callback for deferment of cmd buffer return
nvme: strip trailing 0-bytes in wwid_show
arm64: allwinner: a64: sopine: add missing ethernet0 alias
arm64: allwinner: a64: pine64: add missing ethernet0 alias
arm64: allwinner: a64: bananapi-m64: add missing ethernet0 alias
net: sched: set xt_tgchk_param par.nft_compat as 0 in ipt_init_target
igmp: Fix regression caused by igmp sysctl namespace code.
geneve: maximum value of VNI cannot be used
net: systemport: Fix software statistics for SYSTEMPORT Lite
tipc: remove premature ESTABLISH FSM event at link synchronization
sunvdc: prevent sunvdc panic when mpgroup disk added to guest domain
target: Fix node_acl demo-mode + uncached dynamic shutdown regression
block: Make blk_mq_delay_kick_requeue_list() rerun the queue at a quiet time
bio-integrity: only verify integrity on the lowest stacked driver
bio-integrity: Fix regression if profile verify_fn is NULL
drm/nouveau/disp/nv04: avoid creation of output paths
drm: make DRM_STM default n
futex: Remove unnecessary warning from get_futex_key
drm/rockchip: Fix suspend crash when drm is not bound
NFSv4: Ignore NFS4ERR_OLD_STATEID in nfs41_check_open_stateid()
selftests: futex: fix run_tests target
fixdep: trivial: typo fix and correction
kbuild: trivial cleanups on the comments
kbuild: linker script do not match C names unless LD_DEAD_CODE_DATA_ELIMINATION is configured
powerpc/watchdog: add locking around init/exit functions
powerpc/watchdog: Fix marking of stuck CPUs
powerpc/watchdog: Fix final-check recovered case
powerpc/watchdog: Moderate touch_nmi_watchdog overhead
powerpc/watchdog: Improve watchdog lock primitive
powerpc: NMI IPI improve lock primitive
powerpc/configs: Re-enable HARD/SOFT lockup detectors
crypto: x86/sha1 - Fix reads beyond the number of blocks passed
crypto: ixp4xx - Fix error handling path in 'aead_perform()'
mmc: block: fix lockdep splat when removing mmc_block module
iwlwifi: mvm: send delba upon rx ba session timeout
mac80211: add api to start ba session timer expired flow
dmaengine: tegra210-adma: fix of_irq_get() error check
iwlwifi: mvm: don't WARN when a legit race happens in A-MPDU
iwlwifi: mvm: start mac queues when deferred tx frames are purged
net: avoid skb_warn_bad_offload false positives on UFO
qmi_wwan: fix NULL deref on disconnect
ppp: fix xmit recursion detection on ppp channels
rds: Reintroduce statistics counting
tcp: fastopen: tcp_connect() must refresh the route
net: sched: set xt_tgchk_param par.net properly in ipt_init_target
net: dsa: mediatek: add adjust link support for user ports
net/mlx4_en: don't set CHECKSUM_COMPLETE on SCTP packets
drm/exynos: forbid creating framebuffers from too small GEM buffers
nfs/flexfiles: fix leak of nfs4_ff_ds_version arrays
parse-maintainers: Move matching sections from MAINTAINERS
parse-maintainers: Use perl hash references and specific filenames
parse-maintainers: Add section pattern sorting
get_maintainer: Prepare for separate MAINTAINERS files
MAINTAINERS: openbmc mailing list is moderated
MAINTAINERS: greybus: Fix typo s/LOOBACK/LOOPBACK
mmc: mmc: correct the logic for setting HS400ES signal voltage
random: fix warning message on ia64 and parisc
scsi: ses: Fix wrong page error
scsi: ipr: Fix scsi-mq lockdep issue
scsi: st: fix blk_get_queue usage
scsi: qla2xxx: Fix system crash while triggering FW dump
md/r5cache: fix io_unit handling in r5l_log_endio()
md/r5cache: call mddev_lock/unlock() in r5c_journal_mode_set
md: fix test in md_write_start()
md: always clear ->safemode when md_check_recovery gets the mddev lock.
drm/etnaviv: Fix off-by-one error in reloc checking
MIPS: Set ISA bit in entry-y for microMIPS kernels
MIPS: Prevent building MT support for microMIPS kernels
powerpc/powernv/idle: Disable LOSE_FULL_CONTEXT states when stop-api fails
mmc: host: omap_hsmmc: Add CMD23 capability to omap_hsmmc driver
MIPS: PCI: Fix smp_processor_id() in preemptible
MIPS: Introduce cpu_tcache_line_size
qed: Fix a memory allocation failure test in 'qed_mcp_cmd_init()'
test_sysctl: fix sysctl.sh by making it executable
test_kmod: fix kmod.sh by making it executable
hysdn: fix to a race condition in put_log_buffer
s390/qeth: fix L3 next-hop in xmit qeth hdr
asix: Fix small memory leak in ax88772_unbind()
asix: Ensure asix_rx_fixup_info members are all reset
asix: Add rx->ax_skb = NULL after usbnet_skb_return()
bpf: fix selftest/bpf/test_pkt_md_access on s390x
quota: correct space limit check
MIPS: DEC: Fix an int-handler.S CPU_DADDI_WORKAROUNDS regression
pinctrl: generic: update references to Documentation/pinctrl.txt
pinctrl: intel: merrifield: Correct UART pin lists
irqchip: brcmstb-l2: Define an irq_pm_shutdown function
pinctrl: armada-37xx: Fix number of pin in south bridge
pinctrl: armada-37xx: Fix the pin 23 on south bridge
MIPS: VDSO: Fix clobber lists in fallback code paths
Revert "powerpc/64: Avoid restore_math call if possible in syscall exit"
drm/i915: fix backlight invert for non-zero minimum brightness
drm/i915/shrinker: Wrap need_resched() inside preempt-disable
drm/i915/perf: fix flex eu registers programming
Revert "MIPS: Don't unnecessarily include kmalloc.h into <asm/cache.h>."
MIPS: OCTEON: Fix USB platform code breakage.
MIPS: Octeon: Fix broken EDAC driver.
MIPS: gitignore: ignore generated .c files
MIPS: Fix race on setting and getting cpu_online_mask
MIPS: mm: remove duplicate "const" qualifier on insn_table
drm/i915: Fix out-of-bounds array access in bdw_load_gamma_lut
drm/i915/gvt: Change the max length of mmio_reg_rw from 4 to 8
arm64: renesas: salvator-common: avoid audio_clkout naming conflict
netvsc: fix race on sub channel creation
Linux 4.13-rc4
iscsi-target: Fix iscsi_np reset hung task during parallel delete
Fix compat_sys_sigpending breakage
ext4: fix copy paste error in ext4_swap_extents()
ext4: fix overflow caused by missing cast in ext4_resize_fs()
ext4, project: expand inode extra size if possible
ext4: cleanup ext4_expand_extra_isize_ea()
ext4: restructure ext4_expand_extra_isize
ext4: fix forgetten xattr lock protection in ext4_expand_extra_isize
ext4: make xattr inode reads faster
ext4: inplace xattr block update fails to deduplicate blocks
ext4: remove unused mode parameter
ext4: fix warning about stack corruption
ext4: fix dir_nlink behaviour
ext4: silence array overflow warning
ext4: fix SEEK_HOLE/SEEK_DATA for blocksize < pagesize
platform/x86: intel-vbtn: match power button on press rather than release
iwlwifi: mvm: Fix a memory leak in an error handling path in 'iwl_mvm_sar_get_wgds_table()'
ext4: release discard bio after sending discard commands
ARM: dts: i.MX25: add ranges to tscadc
soc: imx: gpcv2: fix regulator deferred probe
bpf: fix byte order test in test_verifier
xfs: Fix per-inode DAX flag inheritance
xfs: Fix leak of discard bio
IB/hns: checking for IS_ERR() instead of NULL
xgene: Always get clk source, but ignore if it's missing for SGMII ports
RDMA/mlx5: Fix existence check for extended address vector
IB/uverbs: Fix device cleanup
RDMA/uverbs: Prevent leak of reserved field
IB/core: Fix race condition in resolving IP to MAC
MIPS: Add missing file for eBPF JIT.
bpf, s390: fix build for libbpf and selftest suite
bpf, s390: fix jit branch offset related to ldimm64
mlxsw: spectrum_switchdev: Release multicast groups during fini
mlxsw: spectrum_switchdev: Don't warn about valid situations
sparc64: Increase max_phys_bits to 51 and VA bits to 53 for M8.
sparc64: recognize and support sparc M8 cpu type
sparc64: properly name the cpu constants
sparc64: Fix exception handling in UltraSPARC-III memcpy.
arm64: avoid overflow in VA_START and PAGE_OFFSET
arm64: Fix potential race with hardware DBM in ptep_set_access_flags()
ARM: dts: tango4: Request RGMII RX and TX clock delays
bus: uniphier-system-bus: set up registers when resuming
drm/i915/gvt: Initialize MMIO Block with HW state
ARCv2: PAE40: set MSB even if !CONFIG_ARC_HAS_PAE40 but PAE exists in SoC
ARCv2: PAE40: Explicitly set MSB counterpart of SLC region ops addresses
ARC: dma: implement dma_unmap_page and sg variant
ARCv2: SLC: Make sure busy bit is set properly for region ops
ARC: [plat-sim] Include this platform unconditionally
ARC: [plat-axs10x]: prepare dts files for enabling PAE40 on axs103
drm/rockchip: vop: report error when check resource error
drm/rockchip: vop: round_up pitches to word align
drm/rockchip: vop: fix NV12 video display error
drm/rockchip: vop: fix iommu page fault when resume
powerpc/64: Fix __check_irq_replay missing decrementer interrupt
powerpc/perf: POWER9 PMU stops after idle workaround
tcp: fix xmit timer to only be reset if data ACKed/SACKed
tcp: enable xmit timer fix by having TLP use time when RTO should fire
tcp: introduce tcp_rto_delta_us() helper for xmit timer fix
ipv6: set rt6i_protocol properly in the route when it is installed
net: fix keepalive code vs TCP_FASTOPEN_CONNECT
fuse: Dont call set_page_dirty_lock() for ITER_BVEC pages for async_dio
KVM: arm/arm64: vgic: Use READ_ONCE fo cmpxchg
KVM: nVMX: Fix interrupt window request with "Acknowledge interrupt on exit"
usb: renesas_usbhs: gadget: fix unused-but-set-variable warning
usb: renesas_usbhs: Fix UGCTRL2 value for R-Car Gen3
usb: phy: phy-msm-usb: Fix usage of devm_regulator_bulk_get()
usb: gadget: udc: renesas_usb3: Fix usb_gadget_giveback_request() calling
usb: dwc3: gadget: Correct ISOC DATA PIDs for short packets
mmc: block: bypass the queue even if usage is present for hotplug
mmc: sdhci-of-at91: force card detect value for non removable devices
pinctrl: cherryview: Add Setzer models to the Chromebook DMI quirk
crypto: inside-secure - fix the sha state length in hmac_sha1_setkey
crypto: inside-secure - fix invalidation check in hmac_sha1_setkey
isdn/i4l: fix buffer overflow
clk: keystone: sci-clk: Fix sci_clk_get
ocfs2: don't clear SGID when inheriting ACLs
mm: allow page_cache_get_speculative in interrupt context
userfaultfd: non-cooperative: flush event_wqh at release time
ipc: add missing container_of()s for randstruct
cpuset: fix a deadlock due to incomplete patching of cpusets_enabled()
userfaultfd_zeropage: return -ENOSPC in case mm has gone
mm: take memory hotplug lock within numa_zonelist_order_handler()
mm/page_io.c: fix oops during block io poll in swapin path
zram: do not free pool->size_class
kthread: fix documentation build warning
kasan: avoid -Wmaybe-uninitialized warning
userfaultfd: non-cooperative: notify about unmap of destination during mremap
mm, mprotect: flush TLB if potentially racing with a parallel reclaim leaving stale TLB entries
pid: kill pidhash_size in pidhash_init()
mm/hugetlb.c: __get_user_pages ignores certain follow_hugetlb_page errors
KVM: nVMX: mark vmcs12 pages dirty on L2 exit
kvm: nVMX: don't flush VMCS12 during VMXOFF or VCPU teardown
KVM: nVMX: do not pin the VMCS12
KVM: avoid using rcu_dereference_protected
KVM: X86: init irq->level in kvm_pv_kick_cpu_op
KVM: X86: Fix loss of pending INIT due to race
drm/amdgpu: Use list_del_init in amdgpu_mn_unregister
drm/amdgpu: Fix undue fallthroughs in golden registers initialization
ring-buffer: Have ring_buffer_alloc_read_page() return error on offline CPU
tracing: Missing error code in tracer_alloc_buffers()
tracing: Call clear_boot_tracer() at lateinit_sync
tcp: avoid setting cwnd to invalid ssthresh after cwnd reduction states
ibmvnic: Initialize SCRQ's during login renegotiation
usb: qmi_wwan: add D-Link DWM-222 device ID
net/mlx4_core: Fixes missing capability bit in flags2 capability dump
net/mlx4_core: Fix namespace misalignment in QinQ VST support commit
net/mlx4_core: Fix sl_to_vl_change bit offset in flags2 dump
net/mlx4_en: Fix wrong indication of Wake-on-LAN (WoL) support
lan78xx: Fix to handle hard_header_len update
lan78xx: USB fast connect/disconnect crash fix
xhci: Reset Renesas uPD72020x USB controller for 32-bit DMA issue
irqchip/gic: Ensure we have an ISB between ack and ->handle_irq
irqchip/gic-v3-its: Remove ACPICA version check for ACPI NUMA
blk-mq: don't leak preempt counter/q_usage_counter when allocating rq failed
ARM64: dts: marvell: armada-37xx: Fix the number of GPIO on south bridge
NFSv4: Fix double frees in nfs4_test_session_trunk()
ALSA: hda - Fix speaker output from VAIO VPCL14M1R
powerpc/83xx/mpc832x_rdb: fix of_irq_to_resource() error check
gpio: tegra: fix unbalanced chained_irq_enter/exit
mtd: nand: atmel: Fix EDO mode check
mtd: nand: Declare tBERS, tR and tPROG as u64 to avoid integer overflow
mtd: nand: Fix timing setup for NANDs that do not support SET FEATURES
mtd: nand: Fix a docs build warning
mtd: nand: sunxi: fix potential divide-by-zero error
nand: fix wrong default oob layout for small pages using soft ecc
ipvlan: Fix 64-bit statistics seqcount initialization
netvsc: Initialize 64-bit stats seqcount
gtp: Initialize 64-bit per-cpu stats correctly
nfp: Initialize RX and TX ring 64-bit stats seqcounts
ixgbe: Initialize 64-bit stats seqcounts
i40e: Initialize 64-bit statistics TX ring seqcount
b44: Initialize 64-bit stats seqcount
drm/i915/gvt: clean workload queue if error happened
drm/i915/gvt: change resetting to resetting_eng
PCI: Add pci_reset_function_locked()
drm/msm: gpu: don't abuse dma_alloc for non-DMA allocations
drm/msm: gpu: call qcom_mdt interfaces only for ARCH_QCOM
drm/msm/adreno: Prevent unclocked access when retrieving timestamps
drm/msm: Remove __user from __u64 data types
drm/msm: args->fence should be args->flags
drm/msm: Turn off hardware clock gating before reading A5XX registers
drm/msm: Allow hardware clock gating to be toggled
drm/msm: Remove some potentially blocked register ranges
gue: fix remcsum when GRO on and CHECKSUM_PARTIAL boundary is outer UDP
vxlan: fix remcsum when GRO on and CHECKSUM_PARTIAL boundary is outer UDP
drm/msm/mdp5: Drop clock names with "_clk" suffix
drm/msm/mdp5: Fix typo in encoder_enable path
platform/x86: dell-wmi: Fix driver interface version query
drm/msm: NULL pointer dereference in drivers/gpu/drm/msm/msm_gem_vma.c
drm/msm: fix WARN_ON in add_vma() with no iommu
Cipso: cipso_v4_optptr enter infinite loop
net: ethernet: ti: cpts: fix fifo read in cpts_find_ts
net: ethernet: ti: cpts: fix tx timestamping timeout
net: ethernet: ti: cpts: convert to use ptp auxiliary worker
ptp: introduce ptp auxiliary worker
NFSv4: Fix EXCHANGE_ID corrupt verifier issue
drm/msm/dsi: Calculate link clock rates with updated dsi->lanes
drm/msm/mdp5: fix unclocked register access in _cursor_set()
drm/msm: unlock on error in msm_gem_get_iova()
KVM: async_pf: make rcu irq exit if not triggered from idle task
KVM: nVMX: fixes to nested virt interrupt injection
drm/msm: fix an integer overflow test
drm/msm/mdp5: Fix compilation warnings
KVM: nVMX: do not fill vm_exit_intr_error_code in prepare_vmcs12
USB: serial: option: add D-Link DWM-222 device ID
ntb: ntb_test: ensure the link is up before trying to configure the mws
xtensa: mm/cache: add missing EXPORT_SYMBOLs
xtensa: don't limit csum_partial export by CONFIG_NET
ntb: transport shouldn't disable link due to bogus values in SPADs
Revert "serial: Delete dead code for CIR serial ports"
libceph: make RECOVERY_DELETES feature create a new interval
libceph: upmap semantic changes
crush: assume weight_set != null imples weight_set_size > 0
libceph: fallback for when there isn't a pool-specific choose_arg
libceph: don't call ->reencode_message() more than once per message
libceph: make encode_request_*() work with r_mempool requests
device property: Fix usecount for of_graph_get_port_parent()
timers: Fix overflow in get_next_timer_interrupt
clk: meson: mpll: fix mpll0 fractional part ignored
gpiolib: skip unwanted events, don't convert them to opposite edge
gpio: exar: Use correct property prefix and document bindings
ASoC: rt5665: fix wrong register for bclk ratio control
arm64: Use arch_timer_get_rate when trapping CNTFRQ_EL0
x86/hpet: Cure interface abuse in the resume path
iwlwifi: add the new 9000 series PCI IDs
iwlwifi: mvm: set the RTS_MIMO_PROT bit in flag mask when sending sta to fw
iwlwifi: fix fw_pre_next_step to apply also for C step
iwlwifi: mvm: rs: fix TLC statistics collection
iwlwifi: mvm: set A-MPDU bit upon empty BA notification from FW
gpio: gpio-mxc: Fix: higher 16 GPIOs usable as wake source
iwlwifi: split the regulatory rules when the bandwidth flags require it
iwlwifi: add TLV for MLME offload firmware capability
gpio: xgene-sb: select IRQ_DOMAIN_HIERARCHY
pinctrl: stm32: select IRQ_DOMAIN_HIERARCHY instead of depends on
iwlwifi: mvm: fix TCP CSUM offload with WEP and A000 series
samples/bpf: fix bpf tunnel cleanup
udp6: fix jumbogram reception
ppp: Fix a scheduling-while-atomic bug in del_chan
Revert "net: bcmgenet: Remove init parameter from bcmgenet_mii_config"
virtio_net: fix truesize for mergeable buffers
mv643xx_eth: fix of_irq_to_resource() error check
MAINTAINERS: Add more files to the PHY LIBRARY section
ipv4: fib: Fix NULL pointer deref during fib_sync_down_dev()
net: phy: Correctly process PHY_HALTED in phy_stop_machine()
sunhme: fix up GREG_STAT and GREG_IMASK register offsets
clk: samsung: exynos5420: The EPLL rate table corrections
efifb: allow user to disable write combined mapping.
fbdev: omapfb: remove unused variable
video: fbdev: imxfb: use after free in imxfb_remove()
parisc: Define CONFIG_CPU_BIG_ENDIAN
i2c: rephrase explanation of I2C_CLASS_DEPRECATED
i2c: allow i2c-versatile for ARM MPS platforms
libata: fix a couple of doc build warnings
parisc: pdc_stable: Fix locking when creating sysfs links
i2c: designware: Some broken DSTDs use 1MiHz instead of 1MHz
i2c: designware: Print clock freq on invalid clock freq error
dma-buf/sync_file: Allow multiple sync_files to wrap a single dma-fence
pinctrl: sunxi: add a missing function of A10/A20 pinctrl driver
i2c: core: Allow empty id_table in ACPI case as well
pinctrl: uniphier: fix USB3 pin assignment for Pro4
gpio: lp87565: Set proper output level and direction for direction_output
pinctrl: zte: fix dereference of 'data' in zx_set_mux()
thunderbolt: icm: Ignore mailbox errors in icm_suspend()
powerpc/64s: Fix stack setup in watchdog soft_nmi_common()
batman-adv: fix TT sync flag inconsistencies
MAINTAINERS: Add entry for Whiskey Cove PMIC GPIO driver
parisc: Increase thread and stack size to 32kb
parisc: Handle vma's whose context is not current in flush_cache_range
ext4: convert swap_inode_data() over to use swap() on most of the fields
ext4: error should be cleared if ea_inode isn't added to the cache
ext4: Don't clear SGID when inheriting ACLs
ext4: preserve i_mode if __ext4_set_acl() fails
ext4: remove unused metadata accounting variables
ext4: correct comment references to ext4_ext_direct_IO()
qla2xxx: Fix incorrect tcm_qla2xxx_free_cmd use during TMR ABORT (v2)
cxgbit: fix sg_nents calculation
iscsi-target: fix invalid flags in text response
iscsi-target: fix memory leak in iscsit_setup_text_cmd()
cxgbit: add missing __kfree_skb()
tcmu: free old string on reconfig
tcmu: Fix possible to/from address overflow when doing the memcpy
iio: adc: stm32: fix common clock rate
staging: comedi: comedi_fops: do not call blocking ops when !TASK_RUNNING
tty: pl011: fix initialization order of QDF2400 E44
usb: musb: fix tx fifo flush handling again
usb: core: unlink urbs from the tail of the endpoint's urb_list
usb-storage: fix deadlock involving host lock and scsi_done
uas: Add US_FL_IGNORE_RESIDUE for Initio Corporation INIC-3069
USB: hcd: Mark secondary HCD as dead if the primary one died
iio: adc: ina219: Avoid underflow for sleeping time
iio: trigger: stm32-timer: add enable attribute
iio: trigger: stm32-timer: fix get/set down count direction
iio: trigger: stm32-timer: fix write_raw return value
iio: trigger: stm32-timer: fix quadrature mode get routine
iio: bmp280: properly initialize device for humidity reading
ACPI: APD: Fix HID for Hisilicon Hip07/08
cpufreq: x86: Make scaling_cur_freq behave more as expected
bpf: fix bpf_prog_get_info_by_fd to dump correct xlated_prog_len
tcp: avoid bogus gcc-7 array-bounds warning
net: tc35815: fix spelling mistake: "Intterrupt" -> "Interrupt"
block, bfq: consider also in_service_entity to state whether an entity is active
block, bfq: reset in_service_entity if it becomes idle
bpf: don't indicate success when copy_from_user fails
udp6: fix socket leak on early demux
net: thunderx: Fix BGX transmit stall due to underflow
Revert "vhost: cache used event for better performance"
team: use a larger struct for mac address
net: check dev->addr_len for dev_set_mac_address()
ARM: shmobile: rcar-gen2: Fix deadlock in regulator quirk
xtensa: fix cache aliasing handling code for WT cache
workqueue: Work around edge cases for calc of pool's cpumask
powerpc/powernv/pci: Return failure for some uses of dma_set_mask()
ASoC: Intel: Use MCLK instead of BLCK as the sysclock for RT5514 codec on kabylake platform
ASoC: Intel: Enabling ASRC for RT5663 codec on kabylake platform
powerpc/boot: Fix 64-bit boot wrapper build with non-biarch compiler
powerpc/smp: Call smp_ops->setup_cpu() directly on the boot CPU
powerpc/tm: Fix saving of TM SPRs in core dump
powerpc/mm: Fix pmd/pte_devmap() on non-leaf entries
arm64: defconfig: enable missing HWSPINLOCK
drm/bridge: tc358767: fix probe without attached output node
phy: bcm-ns-usb3: fix MDIO_BUS dependency
net: phy: rework Kconfig settings for MDIO_BUS
PM / runtime: Document new pm_runtime_set_suspended() constraint
cpufreq: docs: Add missing cpuinfo_cur_freq description
cpufreq: intel_pstate: Drop ->get from intel_pstate structure
ARM: pxa: select both FB and FB_W100 for eseries
ARM: ixp4xx: fix ioport_unmap definition
ARM: ep93xx: use ARM_PATCH_PHYS_VIRT correctly
ARM: mmp: mark usb_dma_mask as __maybe_unused
ARM: omap2: mark unused functions as __maybe_unused
ARM: omap1: avoid unused variable warning
ARM: sirf: mark sirfsoc_init_late as __maybe_unused
ARM: ixp4xx: use normal prototype for {read,write}s{b,w,l}
ARM: omap1/ams-delta: warn about failed regulator enable
ARM: rpc: rename RAM_SIZE macro
ARM: w90x900: normalize clk API
ARM: ep93xx: normalize clk API
vfio/pci: Fix handling of RC integrated endpoint PCIe capability size
drm/amdgpu: fix header on gfx9 clear state
net/mlx5: Fix mlx5_add_flow_rules call with correct num of dests
net/mlx5e: Schedule overflow check work to mlx5e workqueue
net/mlx5e: Fix wrong delay calculation for overflow check scheduling
net/mlx5e: Add missing support for PTP_CLK_REQ_PPS request
net/mlx5e: Change 1PPS out scheme
net/mlx5e: Fix broken disable 1PPS flow
net/mlx5e: Add field select to MTPPS register
net/mlx5: Fix mlx5_ifc_mtpps_reg_bits structure size
net/mlx5e: Fix outer_header_zero() check size
net/mlx5e: IPoIB, Modify add/remove underlay QPN flows
net/mlx5: Fix command bad flow on command entry allocation failure
net/mlx5: Fix command completion after timeout access invalid structure
net/mlx5: Consider tx_enabled in all modes on remap
net/mlx5: Clean SRIOV eswitch resources upon VF creation failure
ARM: dts: sun8i: a83t: Switch to CCU device tree binding macros
arm64: allwinner: sun50i-a64: Correct emac register size
ARM: dts: sunxi: h3/h5: Correct emac register size
scsi: sg: only check for dxfer_len greater than 256M
ARM: sa1100: normalize clk API
ARM: davinci: normalize clk API
ARM: sa1100/pxa: fix MTD_XIP build
ARM: davinci: don't mark vpif_input structures as 'const'
soc: zte: Restrict SOC_ZTE to ARCH_ZX or COMPILE_TEST
brcmfmac: fix memleak due to calling brcmf_sdiod_sgtable_alloc() twice
brcmfmac: Don't grow SKB by negative size
ARM: dts: da850-lcdk: drop unused VPIF endpoints
ARM: dts: da850-evm: drop unused VPIF endpoints
ARM: dts: exynos: Add clocks to audss block to fix silent hang on Exynos4412
sctp: fix the check for _sctp_walk_params and _sctp_walk_errors
dccp: fix a memleak for dccp_feat_init err process
dccp: fix a memleak that dccp_ipv4 doesn't put reqsk properly
dccp: fix a memleak that dccp_ipv6 doesn't put reqsk properly
scsi: aacraid: reading out of bounds
scsi: qedf: Limit number of CQs
scsi: bnx2i: Simplify cpu hotplug code
scsi: bnx2fc: Simplify CPU hotplug code
scsi: bnx2i: Prevent recursive cpuhotplug locking
scsi: bnx2fc: Prevent recursive cpuhotplug locking
scsi: bnx2fc: Plug CPU hotplug race
bpf: don't zero out the info struct in bpf_obj_get_info_by_fd()
netpoll: Fix device name check in netpoll_setup()
bonding: commit link status change after propose
memory: atmel-ebi: Fix smc cycle xlate converter
memory: atmel-ebi: Allow t_DF timings of zero ns
memory: atmel-ebi: Fix smc timing return value evaluation
vfio/pci: Use pci_try_reset_function() on initial open
include/linux/vfio.h: Guard powerpc-specific functions with CONFIG_VFIO_SPAPR_EEH
udp: unbreak build lacking CONFIG_XFRM
ASoC: codecs: msm8916-analog: fix DIG_CLK_CTL_RXD3_CLK_EN define
iommu/amd: Fix schedule-while-atomic BUG in initialization code
media: atomisp2: array underflow in imx_enum_frame_size()
media: atomisp2: array underflow in ap1302_enum_frame_size()
media: atomisp2: Array underflow in atomisp_enum_input()
ASoC: Intel: Skylake: Fix missing sentinels in sst_acpi_mach
media: platform: davinci: drop VPFE_CMD_S_CCDC_RAW_PARAMS
media: platform: davinci: return -EINVAL for VPFE_CMD_S_CCDC_RAW_PARAMS ioctl
media: venus: don't abuse dma_alloc for non-DMA allocations
media: venus: hfi: fix error handling in hfi_sys_init_done()
media: venus: fix compile-test build on non-qcom ARM platform
media: venus: mark PM functions as __maybe_unused
media: cec-notifier: small improvements
media: pulse8-cec: persistent_config should be off by default
media: cec: cec_transmit_attempt_done: ignore CEC_TX_STATUS_MAX_RETRIES
media: staging: atomisp: array underflow in ioctl
media: lirc: LIRC_GET_REC_RESOLUTION should return microseconds
media: svg: avoid too long lines
media: svg files: simplify files
media: selection.svg: simplify the SVG file
media: vimc: set id_table for platform drivers
net: ethernet: nb8800: Handle all 4 RGMII modes identically
Revert "netvsc: optimize calculation of number of slots"
ftgmac100: return error in ftgmac100_alloc_rx_buf
ipv6: Don't increase IPSTATS_MIB_FRAGFAILS twice in ip6_fragment()
mailbox: pcc: Fix crash when request PCC channel 0
ACPI / watchdog: Fix init failure with overlapping register regions
lib: test_rhashtable: Fix KASAN warning
net: phy: Remove trailing semicolon in macro definition
workqueue: implicit ordered attribute should be overridable
udp: preserve head state for IP_CMSG_PASSSEC
KVM: arm/arm64: Handle hva aging while destroying the vm
KVM: arm/arm64: PMU: Fix overflow interrupt injection
KVM: arm/arm64: Fix bug in advertising KVM_CAP_MSI_DEVID capability
iommu/amd: Enable ga_log_intr when enabling guest_mode
scsi: qedi: Fix return code in qedi_ep_connect()
scsi: lpfc: fix linking against modular NVMe support
scsi: scsi_transport_fc: return -EBUSY for deleted vport
scsi: libcxgbi: add check for valid cxgbi_task_data
scsi: aic7xxx: fix firmware build with O=path
scsi: megaraid_sas: fix memleak in megasas_alloc_cmdlist_fusion
scsi: qedi: Add ISCSI_BOOT_SYSFS to Kconfig
net: dsa: Initialize ds->cpu_port_mask earlier
packet: fix use-after-free in prb_retire_rx_blk_timer_expired()
ftgmac100: Make the MDIO bus a child of the ethernet device
ftgmac100: Increase reset timeout
openvswitch: fix potential out of bound access in parse_ct
mcs7780: Fix initialization when CONFIG_VMAP_STACK is enabled
net: stmmac: Adjust dump offset of DMA registers for ethtool
net/socket: fix type in assignment and trim long line
mlxsw: spectrum_router: Don't offload routes next in list
lib: test_rhashtable: fix for large entry counts
bpf/verifier: fix min/max handling in BPF_SUB
selftests/bpf: subtraction bounds test
net: ethernet: mediatek: Explicitly include linux/interrupt.h
tun/tap: Add the missed return value check of register_netdevice_notifier
net: ethernet: mediatek: avoid potential invalid memory access
ASoC: sh: hac: add missing "int ret"
clk: sunxi-ng: sun5i: Add clk_set_rate_parent to the CPU clock
cgroup: fix error return value from cgroup_subtree_control()
iio: aspeed-adc: wait for initial sequence.
IB/ipoib: Notify on modify QP failure only when relevant
Revert "IB/core: Allow QP state transition from reset to error"
IB/ipoib: Remove double pointer assigning
IB/ipoib: Clean error paths in add port
IB/ipoib: Add get statistics support to SRIOV VF
IB/ipoib: Add multicast packets statistics
IB/ipoib: Set IPOIB_NEIGH_TBL_FLUSH after flushed completion initialization
IB/ipoib: Prevent setting negative values to max_nonsrq_conn_qp
IB/ipoib: Make sure no in-flight joins while leaving that mcast
IB/ipoib: Use cancel_delayed_work_sync when needed
IB/ipoib: Fix race between light events and interface restart
platform/x86: wmi: Fix error handling in acpi_wmi_init()
ASoC: samsung: odroid: Fix EPLL frequency values
ASoC: sgtl5000: Use snd_soc_kcontrol_codec()
xtensa: remove wrapper header for asm/param.h
xtensa: remove wrapper header for asm/device.h
iwlwifi: mvm: defer setting IWL_MVM_STATUS_IN_HW_RESTART
iwlwifi: mvm: handle IBSS probe_queue in a few missing places
iwlwifi: fix tracing when tx only is enabled
iwlwifi: missing error code in iwl_trans_pcie_alloc()
iwlwifi: mvm: fix a NULL pointer dereference of error in recovery
iwlwifi: pcie: fix unused txq NULL pointer dereference
iwlwifi: dvm: prevent an out of bounds access
Revert "rtlwifi: btcoex: rtl8723be: fix ant_sel not work"
brcmfmac: fix regression in brcmf_sdio_txpkt_hdalign()
ARM64: dts: meson-gxl-s905x-libretech-cc: fixup board definition
ARM64: dts: meson-gx: use specific compatible for the AO pwms
platform/x86: peaq-wmi: select INPUT_POLLDEV
sbus: Convert to using %pOF instead of full_name
sparc: defconfig: Cleanup from old Kconfig options
sparc64: Register hugepages during arch init
ASoC: rt5665: fix GPIO6 pin function define
iommu/io-pgtable: Sanitise map/unmap addresses
iommu/arm-smmu: Fix the error path in arm_smmu_add_device
Revert "iommu/io-pgtable: Avoid redundant TLB syncs"
iommu/mtk: Avoid redundant TLB syncs locally
iommu/arm-smmu: Reintroduce locking around TLB sync operations
mtd: nand: atmel: Fix DT backward compatibility in pmecc.c
workqueue: restore WQ_UNBOUND/max_active==1 to be ordered
libata: array underflow in ata_find_dev()
arm64: dts: marvell: mark the cp110 crypto engine as dma coherent
Input: trackpoint - assume 3 buttons when buttons detection fails
clk: x86: Do not gate clocks enabled by the firmware
cgroup: create dfl_root files on subsys registration
MIPS: ralink: mt7620: Add missing header
MIPS: ralink: Fix build error due to missing header
sparc64: Prevent perf from running during super critical sections
arm64: dts: marvell: use ICU for the CP110 slave RTC
ARM: dts: armada-38x: Fix irq type for pca955
ARM: mvebu: use __pa_symbol in the mv98dx3236 platform SMP code
ARC: defconfig: Cleanup from old Kconfig options
iio: accel: bmc150: Always restore device to normal mode after suspend-resume
clk: gemini: Fix reset regression
ntb: use correct mw_count function in ntb_tool and ntb_transport
ASoC: ux500: Restore platform DAI assignments
ASoC: fix pcm-creation regression
ASoC: do not close shared backend dailink
media: staging: atomisp: disable warnings with cc-disable-warning
media: davinci: variable 'common' set but not used
USB: serial: cp210x: add support for Qivicon USB ZigBee dongle
ARM: dts: at91: sama5d2: fix EBI/NAND controllers declaration
ARM: dts: at91: sama5d2: use sama5d2 compatible string for SMC
drm/sun4i: Implement drm_driver lastclose to restore fbdev console
i2c: mux: pinctrl: mention correct module name in Kconfig help text
ARM: dts: rockchip: fix mali gpu node on rk3288
dt-bindings: gpu: drop wrong compatible from midgard binding example
ARM: dts: imx7d-sdb: Put pinctrl_spi4 in the correct location
staging:iio:resolver:ad2s1210 fix negative IIO_ANGL_VEL read
ata: sata_rcar: add gen[23] fallback compatibility strings
libata: remove unused rc in ata_eh_handle_port_resume
ASoC: pxa: SND_PXA2XX_SOC should depend on HAS_DMA
ASoC: Intel: Skylake: Fix default dma_buffer_size
libata: Cleanup ata_read_log_page()
ata: fix gemini Kconfig dependencies
ASoC: rt5663: Update the HW default values based on the shipping version
arm64: dts: renesas: ulcb: sound clock-frequency needs descending order
iio: adc: axp288: Fix the GPADC pin reading often wrongly returning 0
cgroup: don't call migration methods if there are no tasks to migrate
ASoC: imx-ssi: add check on platform_get_irq return value
ACPI / LPSS: Only call pwm_add_table() for the first PWM controller
iio: adc: vf610_adc: Fix VALT selection value for REFSEL bits
iio: accel: st_accel: add SPI-3wire support
ARM: dts: dra71-evm: mdio: Fix impedance values
ARM: dts: dm816x: Correct the state of the write protect pin
ARM: dts: dm816x: Correct NAND support nodes
iio: adc: Revert "axp288: Drop bogus AXP288_ADC_TS_PIN_CTRL register modifications"
iio: adc: sun4i-gpadc-iio: fix unbalanced irq enable/disable
irqchip/gic-v3: Honor forced affinity setting
irqchip/gic-v3: Report failures in gic_irq_domain_alloc
irqchip/gic-v2: Report failures in gic_irq_domain_alloc
irqchip/atmel-aic: Remove root argument from ->fixup() prototype
irqchip/atmel-aic: Fix unbalanced refcount in aic_common_rtc_irq_fixup()
irqchip/atmel-aic: Fix unbalanced of_node_put() in aic_common_irq_fixup()
ARM: OMAP4: Fix legacy code clean-up regression
ARM: OMAP2+: Fix omap3 prm shared irq
media: staging: cxd2099: Activate cxd2099 buffer mode
media: staging: cxd2099: Removed printing in write_block
media: staging: cxd2099: Removed useless printing in cxd2099 driver
media: staging: cxd2099: Fixed buffer mode
media: dvb_ca_en50221: Add block read/write functions
media: dvb_ca_en50221: Increase timeout for link init
media: dvb_ca_en50221: State UNINITIALISED instead of INVALID
media: docs-rst: Document EBUSY for VIDIOC_S_FMT
media: dtv-core.rst: complete description of a demod driver
media: dtv-core.rst: add an introduction to FE kAPI
media: dvb-frontends/stv0367: Improve DVB-C/T frontend status
media: dvb-frontends/stv0367: DVB-C signal strength statistics
media: dvb-frontends/stv0367: update UCB readout condition logic
media: stv0367: prevent division by zero
media: dvb-frontends/stv0367: SNR DVBv5 statistics for DVB-C and T
media: dvb-frontends/cxd2841er: require STATE_ACTIVE_* for agc readout
media: ddbridge: dev_* logging fixup
media: i2c: tvp5150: remove useless variable assignment in tvp5150_set_vbi()
media: dvb-usb-v2: lmedm04: remove unnecessary variable in lme2510_stream_restart()
media: dvb-frontends/stv0367: split SNR determination into functions
media: dvb-frontends/stv0367: initial DDB DVBv5 stats, implement ucblocks
media: dvb-frontends/lnbh25: improve kernellog output
iio: pressure: st_pressure_core: disable multiread by default for LPS22HB
iio: light: tsl2563: use correct event code
media: ngene: Replace semaphore i2c_switch_mutex with mutex
media: ngene: Replace semaphore stream_mutex with mutex
media: ngene: Replace semaphore cmd_mutex with mutex
media: tw5864, fc0011: better handle WARN_ON()
media: dvb-frontends: drx39xyj: remove obsolete sign extend macros
media: v4l: omap_vout: vrfb: Convert to dmaengine
media: Replace initalized ->initialized
media: em28xx: add support for new of Terratec H6
media: em28xx: Ignore errors while reading from eeprom
media: dib0700: fix error handling in dib0700_i2c_xfer_legacy()
media: dib0700: fix locking in dib0700_i2c_xfer_new()
media: tuners: mxl5005s: remove useless variable assignments
media: imx.rst: add it to v4l-drivers book
media: dtv-core.rst: explain how to get DVBv5 statistics
media: dvb-frontends/stv0367: deduplicate DDB dvb_frontend_ops caps
media: ddbridge: use dev_* macros in favor of printk
media: ddbridge: make (ddb)readl in while-loops fail-safe
media: coda: rename the picture run timeout error handler
media: venus: fix loop wrap in cleanup of clks
media: radio: wl1273: add check on core->write() return value
media: rainshadow-cec: avoid -Wmaybe-uninitialized warning again
media: tuner-core: Remove unused #define PREFIX
media: stkwebcam: Use more common logging styles
media: coda: ctx->codec is not NULL in coda_alloc_framebuffers
media: Revert "[media] et8ek8: Export OF device ID as module aliases"
media: bdisp-debug: Replace a seq_puts() call by seq_putc() in seven functions
arm64: renesas: salvator-common: sound clock-frequency needs descending order
fuse: initialize the flock flag in fuse_file on allocation
Change-Id: Iab1fe9ac11d8736eda11867cd11b27b9e263326e
Signed-off-by: Kyle Yan <kyan@codeaurora.org>
Signed-off-by: Prasad Sodagudi <psodagud@codeaurora.org>
1506 lines
52 KiB
C
1506 lines
52 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 iommu_fwspec;
|
|
|
|
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.
|
|
* @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.
|
|
* @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.
|
|
* @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;
|
|
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);
|
|
|
|
int (*num_vf)(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 */
|
|
#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.
|
|
* @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_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.
|
|
* @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;
|
|
|
|
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 (*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_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_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)
|
|
{
|
|
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) __malloc;
|
|
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;
|
|
}
|
|
|
|
/**
|
|
* 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;
|
|
};
|
|
|
|
/**
|
|
* 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 won't track the presence of supplier/consumer drivers.
|
|
* AUTOREMOVE: Remove this 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.
|
|
*/
|
|
#define DL_FLAG_STATELESS BIT(0)
|
|
#define DL_FLAG_AUTOREMOVE BIT(1)
|
|
#define DL_FLAG_PM_RUNTIME BIT(2)
|
|
#define DL_FLAG_RPM_ACTIVE BIT(3)
|
|
|
|
/**
|
|
* 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.
|
|
* @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.
|
|
* @rcu_head: An RCU head to use for deferred execution of SRCU callbacks.
|
|
*/
|
|
struct device_link {
|
|
struct device *supplier;
|
|
struct list_head s_node;
|
|
struct device *consumer;
|
|
struct list_head c_node;
|
|
enum device_link_state status;
|
|
u32 flags;
|
|
bool rpm_active;
|
|
#ifdef CONFIG_SRCU
|
|
struct rcu_head rcu_head;
|
|
#endif
|
|
};
|
|
|
|
/**
|
|
* 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.
|
|
* @status: Driver status information.
|
|
*/
|
|
struct dev_links_info {
|
|
struct list_head suppliers;
|
|
struct list_head consumers;
|
|
enum dl_dev_state status;
|
|
};
|
|
|
|
/**
|
|
* 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.
|
|
* @links: Links to suppliers and consumers of this device.
|
|
* @power: For device power management.
|
|
* See Documentation/power/admin-guide/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_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.
|
|
* @iommu_fwspec: IOMMU-specific properties supplied by firmware.
|
|
*
|
|
* @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.
|
|
*
|
|
* 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_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
|
|
|
|
#ifdef CONFIG_NUMA
|
|
int numa_node; /* NUMA node this device is close to */
|
|
#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. */
|
|
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;
|
|
struct iommu_fwspec *iommu_fwspec;
|
|
|
|
bool offline_disabled:1;
|
|
bool offline:1;
|
|
bool of_node_reused: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 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_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))
|
|
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 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);
|
|
|
|
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);
|
|
|
|
/*
|
|
* 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);
|
|
|
|
/* 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);
|
|
|
|
#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, ...) \
|
|
do { \
|
|
if (0) \
|
|
dev_printk(KERN_DEBUG, dev, fmt, ##__VA_ARGS__); \
|
|
} while (0)
|
|
#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_ */
|