Files
Lucas Wei 14ed7c48f3 Merge android-4.14-q (4.14.218) into android-msm-pixel-4.14-lts
Merge 4.14.218 into android-4.14-q
Linux 4.14.218
  * fs: fix lazytime expiration handling in __writeback_single_inode()
      fs/fs-writeback.c
  * writeback: Drop I_DIRTY_TIME_EXPIRE
      fs/ext4/inode.c
      fs/fs-writeback.c
      include/linux/fs.h
      include/trace/events/writeback.h
  * fs: move I_DIRTY_INODE to fs.h
      fs/ext4/inode.c
      fs/fs-writeback.c
      include/linux/fs.h
    x86/boot/compressed: Disable relocation relaxation
  * tracing: Fix race in trace_open and buffer resize call
      kernel/trace/ring_buffer.c
  * futex: Handle faults correctly for PI futexes
      kernel/futex.c
  * futex: Simplify fixup_pi_state_owner()
      kernel/futex.c
  * futex: Use pi_state_update_owner() in put_pi_state()
      kernel/futex.c
  * rtmutex: Remove unused argument from rt_mutex_proxy_unlock()
      kernel/futex.c
      kernel/locking/rtmutex.c
      kernel/locking/rtmutex_common.h
  * futex: Provide and use pi_state_update_owner()
      kernel/futex.c
  * futex: Replace pointless printk in fixup_owner()
      kernel/futex.c
  * futex: Ensure the correct return value from futex_lock_pi()
      kernel/futex.c
  * Revert "mm/slub: fix a memory leak in sysfs_slab_add()"
      mm/slub.c
    gpio: mvebu: fix pwm .get_state period calculation
  * futex: futex_wake_op, fix sign_extend32 sign bits
      kernel/futex.c
    net: dsa: b53: fix an off by one in checking "vlan->vid"
    net_sched: avoid shift-out-of-bounds in tcindex_set_parms()
  * ipv6: create multicast route with RTPROT_KERNEL
      net/ipv6/addrconf.c
  * udp: mask TOS bits in udp_v4_early_demux()
      net/ipv4/udp.c
  * skbuff: back tiny skbs with kmalloc() in __netdev_alloc_skb() too
      net/core/skbuff.c
    sh_eth: Fix power down vs. is_opened flag ordering
    sh: dma: fix kconfig dependency for G2_DMA
  * netfilter: rpfilter: mask ecn bits before fib lookup
      net/ipv4/netfilter/ipt_rpfilter.c
  * compiler.h: Raise minimum version of GCC to 5.1 for arm64
      include/linux/compiler-gcc.h
    xhci: tegra: Delay for disabling LFPS detector
  * xhci: make sure TRB is fully written before giving it to the controller
      drivers/usb/host/xhci-ring.c
  * usb: bdc: Make bdc pci driver depend on BROKEN
      drivers/usb/gadget/udc/bdc/Kconfig
  * usb: udc: core: Use lock when write to soft_connect
      drivers/usb/gadget/udc/core.c
  * USB: ehci: fix an interrupt calltrace error
      drivers/usb/host/ehci-hub.c
  * ehci: fix EHCI host controller initialization sequence
      drivers/usb/host/ehci-hcd.c
    stm class: Fix module init return on allocation failure
    intel_th: pci: Add Alder Lake-P support
    irqchip/mips-cpu: Set IPI domain parent chip
    iio: ad5504: Fix setting power-down state
    can: vxcan: vxcan_xmit: fix use after free bug
    can: dev: can_restart: fix use after free bug
    i2c: octeon: check correct size of maximum RECV_LEN packet
    drm/nouveau/i2c/gm200: increase width of aux semaphore owner fields
    drm/nouveau/privring: ack interrupts the same way as RM
    drm/nouveau/bios: fix issue shadowing expansion ROMs
  * xen: Fix event channel callback via INTX/GSI
      include/xen/xenbus.h
  * scsi: ufs: Correct the LUN used in eh_device_reset_handler() callback
      drivers/scsi/ufs/ufshcd.c
    ASoC: Intel: haswell: Add missing pm_ops
  * drm/atomic: put state on error path
      drivers/gpu/drm/drm_atomic_helper.c
  * dm: avoid filesystem lookup in dm_get_dev_t()
      drivers/md/dm-table.c
    mmc: sdhci-xenon: fix 1.8v regulator stabilization
    ACPI: scan: Make acpi_bus_get_device() clear return pointer on error
    ALSA: hda/via: Add minimum mute flag
    ALSA: seq: oss: Fix missing error check in snd_seq_oss_synth_make_info()
    i2c: bpmp-tegra: Ignore unknown I2C_M flags
    Merge 4.14.217 into android-4.14-q
Linux 4.14.217
    spi: cadence: cache reference clock rate during probe
  * net: ipv6: Validate GSO SKB before finish IPv6 processing
      net/ipv6/ip6_output.c
  * net: skbuff: disambiguate argument and member for skb_list_walk_safe helper
      include/linux/skbuff.h
  * net: introduce skb_list_walk_safe for skb segment walking
      include/linux/skbuff.h
  * net: use skb_list_del_init() to remove from RX sublists
      include/linux/skbuff.h
    tipc: fix NULL deref in tipc_link_xmit()
    rxrpc: Fix handling of an unsupported token type in rxrpc_read()
  * net: avoid 32 x truesize under-estimation for tiny skbs
      net/core/skbuff.c
  * net: sit: unregister_netdevice on newlink's error path
      net/ipv6/sit.c
    net: stmmac: Fixed mtu channged by cache aligned
    net: dcb: Accept RTM_GETDCB messages carrying set-like DCB commands
    net: dcb: Validate netlink message in DCB handler
  * esp: avoid unneeded kmap_atomic call
      net/ipv4/esp4.c
      net/ipv6/esp6.c
    rndis_host: set proper input size for OID_GEN_PHYSICAL_MEDIUM request
    netxen_nic: fix MSI/MSI-x interrupts
    nfsd4: readdirplus shouldn't return parent of export
  * usb: ohci: Make distrust_firmware param default to false
      drivers/usb/host/ohci-hcd.c
  * netfilter: conntrack: fix reading nf_conntrack_buckets
      net/netfilter/nf_conntrack_standalone.c
    ALSA: fireface: Fix integer overflow in transmit_midi_msg()
    ALSA: firewire-tascam: Fix integer overflow in midi_port_work()
  * dm: eliminate potential source of excessive kernel log noise
      drivers/md/dm.c
    net: sunrpc: interpret the return value of kstrtou32 correctly
  * mm, slub: consider rest of partial list if acquire_slab() fails
      mm/slub.c
    RDMA/usnic: Fix memleak in find_free_vf_and_create_qp_grp
  * ext4: fix superblock checksum failure when setting password salt
      fs/ext4/ioctl.c
    NFS: nfs_igrab_and_active must first reference the superblock
    pNFS: Mark layout for return if return-on-close was not sent
    NFS4: Fix use-after-free in trace_event_raw_event_nfs4_set_lock
    ASoC: Intel: fix error code cnl_set_dsp_D0()
  * dump_common_audit_data(): fix racy accesses to ->d_name
      security/lsm_audit.c
    ARM: picoxcell: fix missing interrupt-parent properties
  * ACPI: scan: add stub acpi_create_platform_device() for !CONFIG_ACPI
      include/linux/acpi.h
    net: ethernet: fs_enet: Add missing MODULE_LICENSE
  * misdn: dsp: select CONFIG_BITREVERSE
      drivers/isdn/mISDN/Kconfig
  * arch/arc: add copy_user_page() to <asm/page.h> to fix build error on ARC
      arch/arc/include/asm/page.h
    ethernet: ucc_geth: fix definition and size of ucc_geth_tx_global_pram
    btrfs: fix transaction leak and crash after RO remount caused by qgroup rescan
    ARC: build: add boot_targets to PHONY
    ARC: build: add uImage.lzma to the top-level target
    ARC: build: remove non-existing bootpImage from KBUILD_IMAGE
  * ext4: fix bug for rename with RENAME_WHITEOUT
      fs/ext4/namei.c
  * r8152: Add Lenovo Powered USB-C Travel Hub
      drivers/net/usb/cdc_ether.c
      drivers/net/usb/r8152.c
  * dm snapshot: flush merged data before committing metadata
      drivers/md/dm-snap.c
    mm/hugetlb: fix potential missing huge page size info
    ACPI: scan: Harden acpi_device_add() against device ID overflows
    MIPS: relocatable: fix possible boot hangup with KASLR enabled
    MIPS: boot: Fix unaligned access with CONFIG_MIPS_RAW_APPENDED_DTB
  * ASoC: dapm: remove widget from dirty list on free
      sound/soc/soc-dapm.c
    Merge 4.14.216 into android-4.14-q
Linux 4.14.216
  * net: drop bogus skb with CHECKSUM_PARTIAL and offset beyond end of trimmed packet
      net/core/skbuff.c
  * block: fix use-after-free in disk_part_iter_next
      block/genhd.c
    KVM: arm64: Don't access PMCR_EL0 when no PMU is available
  * wan: ds26522: select CONFIG_BITREVERSE
      drivers/net/wan/Kconfig
    net/mlx5e: Fix two double free cases
    net/mlx5e: Fix memleak in mlx5e_create_l2_table_groups
    iommu/intel: Fix memleak in intel_irq_remapping_alloc
  * block: rsxx: select CONFIG_CRC32
      drivers/block/Kconfig
  * wil6210: select CONFIG_CRC32
      drivers/net/wireless/ath/wil6210/Kconfig
    dmaengine: xilinx_dma: fix mixed_enum_type coverity warning
    dmaengine: xilinx_dma: check dma_async_device_register return value
    spi: stm32: FIFO threshold level - fix align packet size
    cpufreq: powernow-k8: pass policy rather than use cpufreq_cpu_get()
    i2c: sprd: use a specific timeout to avoid system hang up issue
    ARM: OMAP2+: omap_device: fix idling of devices during probe
    iio: imu: st_lsm6dsx: fix edge-trigger interrupts
    iio: imu: st_lsm6dsx: flip irq return logic
    spi: pxa2xx: Fix use-after-free on unbind
    ubifs: wbuf: Don't leak kernel memory to flash
    drm/i915: Fix mismatch between misplaced vma check and vma insert
  * vmlinux.lds.h: Add PGO and AutoFDO input sections
      include/asm-generic/vmlinux.lds.h
    x86/resctrl: Don't move a task to the same resource group
    x86/resctrl: Use an IPI instead of task_work_add() to update PQR_ASSOC MSR
  * net: fix pmtu check in nopmtudisc mode
      net/ipv4/ip_tunnel.c
  * net: ip: always refragment ip defragmented packets
      net/ipv4/ip_output.c
    net: vlan: avoid leaks on register_vlan_dev() failures
  * net: cdc_ncm: correct overhead in delayed_ndp_size
      drivers/net/usb/cdc_ncm.c
  * powerpc: Fix incorrect stw{, ux, u, x} instructions in __set_pte_at
      arch/powerpc/include/asm/book3s/32/pgtable.h
      arch/powerpc/include/asm/nohash/pgtable.h
    ANDROID: cuttlefish_defconfig: add missing CONFIG_BLK_CGROUP
    Merge 4.14.215 into android-4.14-q
Linux 4.14.215
    scsi: target: Fix XCOPY NAA identifier lookup
  * KVM: x86: fix shift out of bounds reported by UBSAN
      arch/x86/kvm/mmu.h
    x86/mtrr: Correct the range check before performing MTRR type lookups
    netfilter: xt_RATEEST: reject non-null terminated string from userspace
    netfilter: ipset: fix shift-out-of-bounds in htable_bits()
  * Revert "device property: Keep secondary firmware node secondary by type"
      drivers/base/core.c
    ALSA: hda/realtek - Fix speaker volume control on Lenovo C940
    ALSA: hda/conexant: add a new hda codec CX11970
    x86/mm: Fix leak of pmd ptlock
    USB: serial: keyspan_pda: remove unused variable
  * usb: gadget: configfs: Fix use-after-free issue with udc_name
      drivers/usb/gadget/configfs.c
  * usb: gadget: configfs: Preserve function ordering after bind failure
      drivers/usb/gadget/configfs.c
  * usb: gadget: Fix spinlock lockup on usb_function_deactivate
      drivers/usb/gadget/composite.c
    USB: gadget: legacy: fix return error code in acm_ms_bind()
    usb: gadget: function: printer: Fix a memory leak for interface descriptor
    usb: gadget: f_uac2: reset wMaxPacketSize
  * usb: gadget: select CONFIG_CRC32
      drivers/usb/gadget/Kconfig
  * ALSA: usb-audio: Fix UBSAN warnings for MIDI jacks
      sound/usb/midi.c
    USB: usblp: fix DMA to stack
    USB: yurex: fix control-URB timeout handling
    USB: serial: option: add Quectel EM160R-GL
    USB: serial: option: add LongSung M5710 module support
    USB: serial: iuu_phoenix: fix DMA from stack
    usb: uas: Add PNY USB Portable SSD to unusual_uas
    usb: usbip: vhci_hcd: protect shift size
  * USB: xhci: fix U1/U2 handling for hardware with XHCI_INTEL_HOST quirk set
      drivers/usb/host/xhci.c
    usb: chipidea: ci_hdrc_imx: add missing put_device() call in usbmisc_get_init_data()
  * usb: dwc3: ulpi: Use VStsDone to detect PHY regs access completion
      drivers/usb/dwc3/core.h
    USB: cdc-acm: blacklist another IR Droid device
  * usb: gadget: enable super speed plus
      drivers/usb/gadget/configfs.c
  * crypto: ecdh - avoid buffer overflow in ecdh_set_secret()
      crypto/ecdh.c
    video: hyperv_fb: Fix the mmap() regression for v5.4.y and older
    net: systemport: set dev->max_mtu to UMAC_MAX_MTU_SIZE
    net: mvpp2: Fix GoP port 3 Networking Complex Control configurations
  * net-sysfs: take the rtnl lock when accessing xps_cpus_map and num_tc
      net/core/net-sysfs.c
  * net: sched: prevent invalid Scell_log shift count
      include/net/red.h
    vhost_net: fix ubuf refcount incorrectly when sendmsg fails
    net: usb: qmi_wwan: add Quectel EM160R-GL
  * CDC-NCM: remove "connected" log message
      drivers/net/usb/cdc_ncm.c
    net: hdlc_ppp: Fix issues when mod_timer is called while timer is running
    net: hns: fix return value check in __lb_other_process()
  * ipv4: Ignore ECN bits for fib lookups in fib_compute_spec_dst()
      net/ipv4/fib_frontend.c
    net: ethernet: ti: cpts: fix ethtool output when no ptp_clock registered
  * net-sysfs: take the rtnl lock when storing xps_cpus
      net/core/net-sysfs.c
    net: ethernet: Fix memleak in ethoc_probe
    net/ncsi: Use real net-device for response handler
    virtio_net: Fix recursive call to cpus_read_lock()
    qede: fix offload for IPIP tunnel packets
    atm: idt77252: call pci_disable_device() on error path
    ethernet: ucc_geth: set dev->max_mtu to 1518
    ethernet: ucc_geth: fix use-after-free in ucc_geth_remove()
  * depmod: handle the case of /sbin/depmod without /sbin in PATH
      scripts/depmod.sh
  * lib/genalloc: fix the overflow when size is too big
      lib/genalloc.c
    scsi: ide: Do not set the RQF_PREEMPT flag for sense requests
    scsi: ufs-pci: Ensure UFS device is in PowerDown mode for suspend-to-disk ->poweroff()
  * workqueue: Kick a worker based on the actual activation of delayed works
      kernel/workqueue.c
  * kbuild: don't hardcode depmod path
      Makefile
    Merge 4.14.214 into android-4.14-q
Linux 4.14.214
    mwifiex: Fix possible buffer overflows in mwifiex_cmd_802_11_ad_hoc_start
    iio:magnetometer:mag3110: Fix alignment and data leak issues.
    iio:imu:bmi160: Fix alignment and data leak issues
  * kdev_t: always inline major/minor helper functions
      include/linux/kdev_t.h
  * dm verity: skip verity work if I/O error when system is shutting down
      drivers/md/dm-verity-target.c
  * ALSA: pcm: Clear the full allocated memory at hw_params
      sound/core/pcm_native.c
  * module: delay kobject uevent until after module init call
      kernel/module.c
    powerpc: sysdev: add missing iounmap() on error in mpic_msgr_probe()
  * quota: Don't overflow quota file offsets
      fs/quota/quota_tree.c
  * module: set MODULE_STATE_GOING state when a module fails to load
      kernel/module.c
    rtc: sun6i: Fix memleak in sun6i_rtc_clk_init
    ALSA: seq: Use bool for snd_seq_queue internal flags
    media: gp8psk: initialize stats at power control logic
    misc: vmw_vmci: fix kernel info-leak by initializing dbells in vmci_ctx_get_chkpt_doorbells()
    reiserfs: add check for an invalid ih_entry_count
  * of: fix linker-section match-table corruption
      include/linux/of.h
  * uapi: move constants from <linux/kernel.h> to <linux/const.h>
      include/uapi/linux/const.h
      include/uapi/linux/ethtool.h
      include/uapi/linux/kernel.h
      include/uapi/linux/lightnvm.h
      include/uapi/linux/mroute6.h
      include/uapi/linux/netfilter/x_tables.h
      include/uapi/linux/netlink.h
      include/uapi/linux/sysctl.h
  * powerpc/bitops: Fix possible undefined behaviour with fls() and fls64()
      arch/powerpc/include/asm/bitops.h
    USB: serial: digi_acceleport: fix write-wakeup deadlocks
    s390/dasd: fix hanging device offline processing
    vfio/pci: Move dummy_resources_list init in vfio_pci_probe()
  * mm: memcontrol: fix excessive complexity in memory.stat reporting
      include/linux/memcontrol.h
  * mm: memcontrol: implement lruvec stat functions on top of each other
      include/linux/memcontrol.h
  * mm: memcontrol: eliminate raw access to stat and event counters
      include/linux/memcontrol.h
  * ALSA: usb-audio: fix sync-ep altsetting sanity check
      sound/usb/pcm.c
  * ALSA: usb-audio: simplify set_sync_ep_implicit_fb_quirk
      sound/usb/pcm.c
    ALSA: hda/ca0132 - Fix work handling in delayed HP detection
    md/raid10: initialize r10_bio->read_slot before use.
    x86/entry/64: Add instruction suffix
  * ANDROID: usb: f_accessory: Don't drop NULL reference in acc_disconnect()
      drivers/usb/gadget/function/f_accessory.c
  * ANDROID: usb: f_accessory: Avoid bitfields for shared variables
      drivers/usb/gadget/function/f_accessory.c
  * ANDROID: usb: f_accessory: Cancel any pending work before teardown
      drivers/usb/gadget/function/f_accessory.c
  * ANDROID: usb: f_accessory: Don't corrupt global state on double registration
      drivers/usb/gadget/function/f_accessory.c
  * ANDROID: usb: f_accessory: Fix teardown ordering in acc_release()
      drivers/usb/gadget/function/f_accessory.c
  * ANDROID: usb: f_accessory: Add refcounting to global 'acc_dev'
      drivers/usb/gadget/function/f_accessory.c
  * ANDROID: usb: f_accessory: Wrap '_acc_dev' in get()/put() accessors
      drivers/usb/gadget/function/f_accessory.c
  * ANDROID: usb: f_accessory: Remove useless assignment
      drivers/usb/gadget/function/f_accessory.c
  * ANDROID: usb: f_accessory: Remove useless non-debug prints
      drivers/usb/gadget/function/f_accessory.c
  * ANDROID: usb: f_accessory: Remove stale comments
      drivers/usb/gadget/function/f_accessory.c
  * ANDROID: USB: f_accessory: Check dev pointer before decoding ctrl request
      drivers/usb/gadget/function/f_accessory.c
  * ANDROID: usb: gadget: f_accessory: fix CTS test stuck
      drivers/usb/gadget/function/f_accessory.c
    Merge 4.14.213 into android-4.14-q
Linux 4.14.213
  * PCI: Fix pci_slot_release() NULL pointer dereference
      drivers/pci/slot.c
    libnvdimm/namespace: Fix reaping of invalidated block-window-namespace labels
    xenbus/xenbus_backend: Disallow pending watch messages
  * xen/xenbus: Count pending messages for each watch
      include/xen/xenbus.h
    xen/xenbus/xen_bus_type: Support will_handle watch callback
  * xen/xenbus: Add 'will_handle' callback support in xenbus_watch_path()
      include/xen/xenbus.h
  * xen/xenbus: Allow watches discard events before queueing
      include/xen/xenbus.h
    xen-blkback: set ring->xenblkd to NULL after kthread_stop()
    clk: mvebu: a3700: fix the XTAL MODE pin to MPP1_9
    md/cluster: fix deadlock when node is doing resync job
    iio:imu:bmi160: Fix too large a buffer.
    iio:pressure:mpl3115: Force alignment of buffer
    iio:light:rpr0521: Fix timestamp alignment and prevent data leak.
    iio: adc: rockchip_saradc: fix missing clk_disable_unprepare() on error in rockchip_saradc_resume
    iio: buffer: Fix demux update
    mtd: parser: cmdline: Fix parsing of part-names with colons
  * soc: qcom: smp2p: Safely acquire spinlock without IRQs
      drivers/soc/qcom/smp2p.c
    spi: st-ssc4: Fix unbalanced pm_runtime_disable() in probe error path
    spi: sc18is602: Don't leak SPI master in probe error path
    spi: rb4xx: Don't leak SPI master in probe error path
    spi: pic32: Don't leak DMA channels in probe error path
    spi: davinci: Fix use-after-free on unbind
    spi: spi-sh: Fix use-after-free on unbind
    drm/dp_aux_dev: check aux_dev before use in drm_dp_aux_dev_get_by_minor()
    jfs: Fix array index bounds check in dbAdjTree
    jffs2: Fix GC exit abnormally
    ceph: fix race in concurrent __ceph_remove_cap invocations
    ima: Don't modify file descriptor mode on the fly
    powerpc/powernv/memtrace: Don't leak kernel memory to user space
    powerpc/xmon: Change printk() to pr_cont()
    powerpc/rtas: Fix typo of ibm,open-errinjct in RTAS filter
    ARM: dts: at91: sama5d2: fix CAN message ram offset and size
  * KVM: arm64: Introduce handling of AArch32 TTBCR2 traps
      arch/arm64/include/asm/kvm_host.h
  * ext4: fix deadlock with fs freezing and EA inodes
      fs/ext4/inode.c
  * ext4: fix a memory leak of ext4_free_data
      fs/ext4/mballoc.c
    btrfs: fix return value mixup in btrfs_get_extent
    Btrfs: fix selftests failure due to uninitialized i_mode in test inodes
    USB: serial: keyspan_pda: fix write unthrottling
    USB: serial: keyspan_pda: fix tx-unthrottle use-after-free
    USB: serial: keyspan_pda: fix write-wakeup use-after-free
    USB: serial: keyspan_pda: fix stalled writes
    USB: serial: keyspan_pda: fix write deadlock
    USB: serial: keyspan_pda: fix dropped unthrottle interrupts
    USB: serial: mos7720: fix parallel-port state restore
    EDAC/amd64: Fix PCI component registration
  * crypto: ecdh - avoid unaligned accesses in ecdh_set_secret()
      crypto/ecdh.c
    powerpc/perf: Exclude kernel samples while counting events in user space.
    staging: comedi: mf6x4: Fix AI end-of-conversion detection
    s390/dasd: fix list corruption of lcu list
    s390/dasd: fix list corruption of pavgroup group list
    s390/dasd: prevent inconsistent LCU device data
    s390/smp: perform initial CPU reset also for SMT siblings
  * ALSA: usb-audio: Disable sample read check if firmware doesn't give back
      sound/usb/clock.c
    ALSA: pcm: oss: Fix a few more UBSAN fixes
    ALSA: hda/realtek - Enable headset mic of ASUS Q524UQK with ALC255
    ACPI: PNP: compare the string length in the matching_id()
    Revert "ACPI / resources: Use AE_CTRL_TERMINATE to terminate resources walks"
  * PM: ACPI: PCI: Drop acpi_pm_set_bridge_wakeup()
      include/acpi/acpi_bus.h
    Input: cyapa_gen6 - fix out-of-bounds stack access
    media: netup_unidvb: Don't leak SPI master in probe error path
    media: sunxi-cir: ensure IR is handled when it is continuous
  * media: gspca: Fix memory leak in probe
      drivers/media/usb/gspca/gspca.c
    Input: goodix - add upside-down quirk for Teclast X98 Pro tablet
    Input: cros_ec_keyb - send 'scancodes' in addition to key events
  * fix namespaced fscaps when !CONFIG_SECURITY
      include/linux/security.h
  * cfg80211: initialize rekey_data
      net/wireless/nl80211.c
    clk: sunxi-ng: Make sure divider tables have sentinel
    clk: s2mps11: Fix a resource leak in error handling paths in the probe function
    qlcnic: Fix error code in probe
    perf record: Fix memory leak when using '--user-regs=?' to list registers
    pwm: lp3943: Dynamically allocate PWM chip base
    pwm: zx: Add missing cleanup in error path
    clk: ti: Fix memleak in ti_fapll_synth_setup
  * watchdog: coh901327: add COMMON_CLK dependency
      drivers/watchdog/Kconfig
    watchdog: qcom: Avoid context switch in restart handler
    net: korina: fix return value
    net: allwinner: Fix some resources leak in the error handling path of the probe and in the remove function
    net: bcmgenet: Fix a resource leak in an error handling path in the probe functin
    checkpatch: fix unescaped left brace
    powerpc/ps3: use dma_mapping_error()
    nfc: s3fwrn5: Release the nfc firmware
    um: chan_xterm: Fix fd leak
  * watchdog: sirfsoc: Add missing dependency on HAS_IOMEM
      drivers/watchdog/Kconfig
    irqchip/alpine-msi: Fix freeing of interrupts on allocation error path
  * ASoC: wm_adsp: remove "ctl" from list on error in wm_adsp_create_control()
      sound/soc/codecs/wm_adsp.c
    extcon: max77693: Fix modalias string
    clk: tegra: Fix duplicated SE clock entry
    x86/kprobes: Restore BTF if the single-stepping is cancelled
    nfs_common: need lock during iterate through the list
    nfsd: Fix message level for normal termination
    speakup: fix uninitialized flush_lock
    usb: oxu210hp-hcd: Fix memory leak in oxu_create
    usb: ehci-omap: Fix PM disable depth umbalance in ehci_hcd_omap_probe
    powerpc/pseries/hibernation: remove redundant cacheinfo update
    powerpc/pseries/hibernation: drop pseries_suspend_begin() from suspend ops
    scsi: fnic: Fix error return code in fnic_probe()
  * seq_buf: Avoid type mismatch for seq_buf_init
      include/linux/seq_buf.h
      include/linux/trace_seq.h
    scsi: pm80xx: Fix error return in pm8001_pci_probe()
    scsi: qedi: Fix missing destroy_workqueue() on error in __qedi_probe
    cpufreq: scpi: Add missing MODULE_ALIAS
    cpufreq: loongson1: Add missing MODULE_ALIAS
    cpufreq: st: Add missing MODULE_DEVICE_TABLE
    cpufreq: mediatek: Add missing MODULE_DEVICE_TABLE
    cpufreq: highbank: Add missing MODULE_DEVICE_TABLE
  * clocksource/drivers/arm_arch_timer: Correct fault programming of CNTKCTL_EL1.EVNTI
      drivers/clocksource/arm_arch_timer.c
  * dm ioctl: fix error return code in target_message
      drivers/md/dm-ioctl.c
    ASoC: jz4740-i2s: add missed checks for clk_get()
    net/mlx5: Properly convey driver version to firmware
    memstick: r592: Fix error return in r592_probe()
    arm64: dts: rockchip: Fix UART pull-ups on rk3328
    pinctrl: falcon: add missing put_device() call in pinctrl_falcon_probe()
    ARM: dts: at91: sama5d2: map securam as device
    clocksource/drivers/cadence_ttc: Fix memory leak in ttc_setup_clockevent()
    media: saa7146: fix array overflow in vidioc_s_audio()
    vfio-pci: Use io_remap_pfn_range() for PCI IO memory
    NFS: switch nfsiod to be an UNBOUND workqueue.
    lockd: don't use interval-based rebinding over TCP
  * SUNRPC: xprt_load_transport() needs to support the netid "rdma6"
      include/linux/sunrpc/xprt.h
    NFSv4.2: condition READDIR's mask for security label based on LSM state
    ath10k: Release some resources in an error handling path
    ath10k: Fix an error handling path
    ARM: dts: at91: at91sam9rl: fix ADC triggers
    PCI: iproc: Fix out-of-bound array accesses
  * genirq/irqdomain: Don't try to free an interrupt that has no mapping
      kernel/irq/irqdomain.c
    power: supply: bq24190_charger: fix reference leak
    ARM: dts: Remove non-existent i2c1 from 98dx3236
    HSI: omap_ssi: Don't jump to free ID in ssi_add_controller()
    media: max2175: fix max2175_set_csm_mode() error code
    mips: cdmm: fix use-after-free in mips_cdmm_bus_discover
    samples: bpf: Fix lwt_len_hist reusing previous BPF map
    media: siano: fix memory leak of debugfs members in smsdvb_hotplug
    cw1200: fix missing destroy_workqueue() on error in cw1200_init_common
    orinoco: Move context allocation after processing the skb
    ARM: dts: at91: sama5d3_xplained: add pincontrol for USB Host
    ARM: dts: at91: sama5d4_xplained: add pincontrol for USB Host
    memstick: fix a double-free bug in memstick_check
    RDMA/cxgb4: Validate the number of CQEs
    Input: omap4-keypad - fix runtime PM error handling
    drivers: soc: ti: knav_qmss_queue: Fix error return code in knav_queue_probe
    soc: ti: Fix reference imbalance in knav_dma_probe
    soc: ti: knav_qmss: fix reference leak in knav_queue_probe
    crypto: omap-aes - Fix PM disable depth imbalance in omap_aes_probe
  * powerpc/feature: Fix CPU_FTRS_ALWAYS by removing CPU_FTRS_GENERIC_32
      arch/powerpc/include/asm/cputable.h
    Input: ads7846 - fix unaligned access on 7845
    Input: ads7846 - fix integer overflow on Rt calculation
    Input: ads7846 - fix race that causes missing releases
    drm/omap: dmm_tiler: fix return error code in omap_dmm_probe()
    media: solo6x10: fix missing snd_card_free in error handling case
  * scsi: core: Fix VPD LUN ID designator priorities
      drivers/scsi/scsi_lib.c
    media: mtk-vcodec: add missing put_device() call in mtk_vcodec_release_dec_pm()
    staging: greybus: codecs: Fix reference counter leak in error handling
    MIPS: BCM47XX: fix kconfig dependency bug for BCM47XX_BCMA
    RDMa/mthca: Work around -Wenum-conversion warning
    ASoC: arizona: Fix a wrong free in wm8997_probe
    ASoC: wm8998: Fix PM disable depth imbalance on error
    mwifiex: fix mwifiex_shutdown_sw() causing sw reset failure
    spi: tegra114: fix reference leak in tegra spi ops
    spi: tegra20-sflash: fix reference leak in tegra_sflash_resume
    spi: tegra20-slink: fix reference leak in slink ops of tegra20
    spi: spi-ti-qspi: fix reference leak in ti_qspi_setup
  * Bluetooth: Fix null pointer dereference in hci_event_packet()
      net/bluetooth/hci_event.c
    arm64: dts: exynos: Correct psci compatible used on Exynos7
  * selinux: fix inode_doinit_with_dentry() LABEL_INVALID error handling
      security/selinux/hooks.c
  * ASoC: pcm: DRAIN support reactivation
      sound/soc/soc-pcm.c
    spi: img-spfi: fix reference leak in img_spfi_resume
    crypto: talitos - Fix return type of current_desc_hdr()
  * sched: Reenable interrupts in do_sched_yield()
      kernel/sched/core.c
  * sched/deadline: Fix sched_dl_global_validate()
      kernel/sched/deadline.c
      kernel/sched/sched.h
    ARM: p2v: fix handling of LPAE translation in BE mode
    x86/mm/ident_map: Check for errors from ident_pud_init()
    RDMA/rxe: Compute PSN windows correctly
  * selinux: fix error initialization in inode_doinit_with_dentry()
      security/selinux/hooks.c
    RDMA/bnxt_re: Set queue pair state when being queried
    soc: mediatek: Check if power domains can be powered on at boot time
    soc: renesas: rmobile-sysc: Fix some leaks in rmobile_init_pm_domains()
    drm/gma500: fix double free of gma_connector
  * Bluetooth: Fix slab-out-of-bounds read in hci_le_direct_adv_report_evt()
      net/bluetooth/hci_event.c
    md: fix a warning caused by a race between concurrent md_ioctl()s
  * crypto: af_alg - avoid undefined behavior accessing salg_name
      include/uapi/linux/if_alg.h
    media: msi2500: assign SPI bus number dynamically
  * quota: Sanity-check quota file headers on load
      fs/quota/quota_v2.c
  * serial_core: Check for port state when tty is in error state
      drivers/tty/serial/serial_core.c
    HID: i2c-hid: add Vero K147 to descriptor override
    ARM: dts: exynos: fix USB 3.0 pins supply being turned off on Odroid XU
    ARM: dts: exynos: fix USB 3.0 VBUS control and over-current pins on Exynos5410
    ARM: dts: exynos: fix roles of USB 3.0 ports on Odroid XU
    usb: chipidea: ci_hdrc_imx: Pass DISABLE_DEVICE_STREAMING flag to imx6ul
    USB: gadget: f_rndis: fix bitrate for SuperSpeed and above
  * usb: gadget: f_fs: Re-use SS descriptors for SuperSpeedPlus
      drivers/usb/gadget/function/f_fs.c
  * USB: gadget: f_midi: setup SuperSpeed Plus descriptors
      drivers/usb/gadget/function/f_midi.c
    USB: gadget: f_acm: add support for SuperSpeed Plus
    USB: serial: option: add interface-number sanity check to flag handling
    soc/tegra: fuse: Fix index bug in get_process_id
  * dm table: Remove BUG_ON(in_interrupt())
      drivers/md/dm-table.c
    scsi: mpt3sas: Increase IOCInit request timeout to 30s
    vxlan: Copy needed_tailroom from lowerdev
    vxlan: Add needed_headroom for lower device
    drm/tegra: sor: Disable clocks on error in tegra_sor_init()
  * kernel/cpu: add arch override for clear_tasks_mm_cpumask() mm handling
      kernel/cpu.c
    RDMA/cm: Fix an attempt to use non-valid pointer when cleaning timewait
    can: softing: softing_netdev_open(): fix error handling
  * scsi: bnx2i: Requires MMU
      drivers/scsi/bnx2i/Kconfig
    gpio: mvebu: fix potential user-after-free on probe
    ARM: dts: sun8i: v3s: fix GIC node memory range
    pinctrl: baytrail: Avoid clearing debounce value when turning it off
    pinctrl: merrifield: Set default bias in case no particular value given
  * drm: fix drm_dp_mst_port refcount leaks in drm_dp_mst_allocate_vcpi
      drivers/gpu/drm/drm_dp_mst_topology.c
    serial: 8250_omap: Avoid FIFO corruption caused by MDR1 access
    ALSA: pcm: oss: Fix potential out-of-bounds shift
  * USB: sisusbvga: Make console support depend on BROKEN
      drivers/usb/misc/sisusbvga/Kconfig
  * USB: UAS: introduce a quirk to set no_write_same
      drivers/usb/storage/usb.c
      include/linux/usb_usual.h
  * xhci: Give USB2 ports time to enter U3 in bus suspend
      drivers/usb/host/xhci-hub.c
  * ALSA: usb-audio: Fix control 'access overflow' errors from chmap
      sound/usb/stream.c
  * ALSA: usb-audio: Fix potential out-of-bounds shift
      sound/usb/format.c
  * USB: add RESET_RESUME quirk for Snapscan 1212
      drivers/usb/core/quirks.c
    USB: dummy-hcd: Fix uninitialized array use in init()
    mac80211: mesh: fix mesh_pathtbl_init() error path
    net: bridge: vlan: fix error return code in __vlan_add()
    net: stmmac: dwmac-meson8b: fix mask definition of the m250_sel mux
    net: stmmac: delete the eee_ctrl_timer after napi disabled
    net/mlx4_en: Handle TX error CQE
    net/mlx4_en: Avoid scheduling restart task if it is already running
  * tcp: fix cwnd-limited bug for TSO deferral where we send nothing
      net/ipv4/tcp_output.c
    net: stmmac: free tx skb buffer in stmmac_resume()
    PCI: qcom: Add missing reset for ipq806x
  * x86/mm/mem_encrypt: Fix definition of PMD_FLAGS_DEC_WP
      arch/x86/include/asm/pgtable_types.h
    scsi: be2iscsi: Revert "Fix a theoretical leak in beiscsi_create_eqs()"
  * kbuild: avoid static_assert for genksyms
      include/linux/build_bug.h
    pinctrl: amd: remove debounce filter setting in IRQ type setting
    Input: i8042 - add Acer laptops to the i8042 reset list
    Input: cm109 - do not stomp on control URB
    platform/x86: acer-wmi: add automatic keyboard background light toggle key as KEY_LIGHTS_TOGGLE
    soc: fsl: dpio: Get the cpumask through cpumask_of(cpu)
  * scsi: ufs: Make sure clk scaling happens only when HBA is runtime ACTIVE
      drivers/scsi/ufs/ufshcd.c
    ARC: stack unwinding: don't assume non-current task is sleeping
    iwlwifi: mvm: fix kernel panic in case of assert during CSA
    arm64: dts: rockchip: Assign a fixed index to mmc devices on rk3399 boards.
    iwlwifi: pcie: limit memory read spin time
    spi: bcm2835aux: Restore err assignment in bcm2835aux_spi_probe
    spi: bcm2835aux: Fix use-after-free on unbind

Bug: 180663378
Change-Id: Idee3af71ad1ba834e9d8ee29090386017d40028e
Signed-off-by: Lucas Wei <lucaswei@google.com>
2021-02-26 11:17:11 +08:00

1372 lines
39 KiB
C

#ifndef _LINUX_OF_H
#define _LINUX_OF_H
/*
* Definitions for talking to the Open Firmware PROM on
* Power Macintosh and other computers.
*
* Copyright (C) 1996-2005 Paul Mackerras.
*
* Updates for PPC64 by Peter Bergner & David Engebretsen, IBM Corp.
* Updates for SPARC64 by David S. Miller
* Derived from PowerPC and Sparc prom.h files by Stephen Rothwell, IBM Corp.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*/
#include <linux/types.h>
#include <linux/bitops.h>
#include <linux/errno.h>
#include <linux/kobject.h>
#include <linux/mod_devicetable.h>
#include <linux/spinlock.h>
#include <linux/topology.h>
#include <linux/notifier.h>
#include <linux/property.h>
#include <linux/list.h>
#include <asm/byteorder.h>
#include <asm/errno.h>
typedef u32 phandle;
typedef u32 ihandle;
struct property {
char *name;
int length;
void *value;
struct property *next;
unsigned long _flags;
unsigned int unique_id;
#if defined(CONFIG_OF_KOBJ)
struct bin_attribute attr;
#endif
};
#if defined(CONFIG_SPARC)
struct of_irq_controller;
#endif
struct device_node {
const char *name;
const char *type;
phandle phandle;
const char *full_name;
struct fwnode_handle fwnode;
struct property *properties;
struct property *deadprops; /* removed properties */
struct device_node *parent;
struct device_node *child;
struct device_node *sibling;
#if defined(CONFIG_OF_KOBJ)
struct kobject kobj;
#endif
unsigned long _flags;
void *data;
#if defined(CONFIG_SPARC)
const char *path_component_name;
unsigned int unique_id;
struct of_irq_controller *irq_trans;
#endif
};
#define MAX_PHANDLE_ARGS 16
struct of_phandle_args {
struct device_node *np;
int args_count;
uint32_t args[MAX_PHANDLE_ARGS];
};
struct of_phandle_iterator {
/* Common iterator information */
const char *cells_name;
int cell_count;
const struct device_node *parent;
/* List size information */
const __be32 *list_end;
const __be32 *phandle_end;
/* Current position state */
const __be32 *cur;
uint32_t cur_count;
phandle phandle;
struct device_node *node;
};
struct of_reconfig_data {
struct device_node *dn;
struct property *prop;
struct property *old_prop;
};
/* initialize a node */
extern struct kobj_type of_node_ktype;
extern const struct fwnode_operations of_fwnode_ops;
static inline void of_node_init(struct device_node *node)
{
#if defined(CONFIG_OF_KOBJ)
kobject_init(&node->kobj, &of_node_ktype);
#endif
node->fwnode.ops = &of_fwnode_ops;
}
#if defined(CONFIG_OF_KOBJ)
#define of_node_kobj(n) (&(n)->kobj)
#else
#define of_node_kobj(n) NULL
#endif
#ifdef CONFIG_OF_DYNAMIC
extern struct device_node *of_node_get(struct device_node *node);
extern void of_node_put(struct device_node *node);
#else /* CONFIG_OF_DYNAMIC */
/* Dummy ref counting routines - to be implemented later */
static inline struct device_node *of_node_get(struct device_node *node)
{
return node;
}
static inline void of_node_put(struct device_node *node) { }
#endif /* !CONFIG_OF_DYNAMIC */
/* Pointer for first entry in chain of all nodes. */
extern struct device_node *of_root;
extern struct device_node *of_chosen;
extern struct device_node *of_aliases;
extern struct device_node *of_stdout;
extern raw_spinlock_t devtree_lock;
/* flag descriptions (need to be visible even when !CONFIG_OF) */
#define OF_DYNAMIC 1 /* node and properties were allocated via kmalloc */
#define OF_DETACHED 2 /* node has been detached from the device tree */
#define OF_POPULATED 3 /* device already created for the node */
#define OF_POPULATED_BUS 4 /* of_platform_populate recursed to children of this node */
#define OF_BAD_ADDR ((u64)-1)
#ifdef CONFIG_OF
void of_core_init(void);
static inline bool is_of_node(const struct fwnode_handle *fwnode)
{
return !IS_ERR_OR_NULL(fwnode) && fwnode->ops == &of_fwnode_ops;
}
#define to_of_node(__fwnode) \
({ \
typeof(__fwnode) __to_of_node_fwnode = (__fwnode); \
\
is_of_node(__to_of_node_fwnode) ? \
container_of(__to_of_node_fwnode, \
struct device_node, fwnode) : \
NULL; \
})
#define of_fwnode_handle(node) \
({ \
typeof(node) __of_fwnode_handle_node = (node); \
\
__of_fwnode_handle_node ? \
&__of_fwnode_handle_node->fwnode : NULL; \
})
static inline bool of_have_populated_dt(void)
{
return of_root != NULL;
}
static inline bool of_node_is_root(const struct device_node *node)
{
return node && (node->parent == NULL);
}
static inline int of_node_check_flag(struct device_node *n, unsigned long flag)
{
return test_bit(flag, &n->_flags);
}
static inline int of_node_test_and_set_flag(struct device_node *n,
unsigned long flag)
{
return test_and_set_bit(flag, &n->_flags);
}
static inline void of_node_set_flag(struct device_node *n, unsigned long flag)
{
set_bit(flag, &n->_flags);
}
static inline void of_node_clear_flag(struct device_node *n, unsigned long flag)
{
clear_bit(flag, &n->_flags);
}
static inline int of_property_check_flag(struct property *p, unsigned long flag)
{
return test_bit(flag, &p->_flags);
}
static inline void of_property_set_flag(struct property *p, unsigned long flag)
{
set_bit(flag, &p->_flags);
}
static inline void of_property_clear_flag(struct property *p, unsigned long flag)
{
clear_bit(flag, &p->_flags);
}
extern struct device_node *__of_find_all_nodes(struct device_node *prev);
extern struct device_node *of_find_all_nodes(struct device_node *prev);
/*
* OF address retrieval & translation
*/
/* Helper to read a big number; size is in cells (not bytes) */
static inline u64 of_read_number(const __be32 *cell, int size)
{
u64 r = 0;
for (; size--; cell++)
r = (r << 32) | be32_to_cpu(*cell);
return r;
}
/* Like of_read_number, but we want an unsigned long result */
static inline unsigned long of_read_ulong(const __be32 *cell, int size)
{
/* toss away upper bits if unsigned long is smaller than u64 */
return of_read_number(cell, size);
}
#if defined(CONFIG_SPARC)
#include <asm/prom.h>
#endif
/* Default #address and #size cells. Allow arch asm/prom.h to override */
#if !defined(OF_ROOT_NODE_ADDR_CELLS_DEFAULT)
#define OF_ROOT_NODE_ADDR_CELLS_DEFAULT 1
#define OF_ROOT_NODE_SIZE_CELLS_DEFAULT 1
#endif
#define OF_IS_DYNAMIC(x) test_bit(OF_DYNAMIC, &x->_flags)
#define OF_MARK_DYNAMIC(x) set_bit(OF_DYNAMIC, &x->_flags)
static inline const char *of_node_full_name(const struct device_node *np)
{
return np ? np->full_name : "<no-node>";
}
#define for_each_of_allnodes_from(from, dn) \
for (dn = __of_find_all_nodes(from); dn; dn = __of_find_all_nodes(dn))
#define for_each_of_allnodes(dn) for_each_of_allnodes_from(NULL, dn)
extern struct device_node *of_find_node_by_name(struct device_node *from,
const char *name);
extern struct device_node *of_find_node_by_type(struct device_node *from,
const char *type);
extern struct device_node *of_find_compatible_node(struct device_node *from,
const char *type, const char *compat);
extern struct device_node *of_find_matching_node_and_match(
struct device_node *from,
const struct of_device_id *matches,
const struct of_device_id **match);
extern struct device_node *of_find_node_opts_by_path(const char *path,
const char **opts);
static inline struct device_node *of_find_node_by_path(const char *path)
{
return of_find_node_opts_by_path(path, NULL);
}
extern struct device_node *of_find_node_by_phandle(phandle handle);
extern struct device_node *of_get_parent(const struct device_node *node);
extern struct device_node *of_get_next_parent(struct device_node *node);
extern struct device_node *of_get_next_child(const struct device_node *node,
struct device_node *prev);
extern struct device_node *of_get_next_available_child(
const struct device_node *node, struct device_node *prev);
extern struct device_node *of_get_compatible_child(const struct device_node *parent,
const char *compatible);
extern struct device_node *of_get_child_by_name(const struct device_node *node,
const char *name);
/* cache lookup */
extern struct device_node *of_find_next_cache_node(const struct device_node *);
extern int of_find_last_cache_level(unsigned int cpu);
extern struct device_node *of_find_node_with_property(
struct device_node *from, const char *prop_name);
extern struct property *of_find_property(const struct device_node *np,
const char *name,
int *lenp);
extern int of_property_count_elems_of_size(const struct device_node *np,
const char *propname, int elem_size);
extern int of_property_read_u32_index(const struct device_node *np,
const char *propname,
u32 index, u32 *out_value);
extern int of_property_read_u64_index(const struct device_node *np,
const char *propname,
u32 index, u64 *out_value);
extern int of_property_read_variable_u8_array(const struct device_node *np,
const char *propname, u8 *out_values,
size_t sz_min, size_t sz_max);
extern int of_property_read_variable_u16_array(const struct device_node *np,
const char *propname, u16 *out_values,
size_t sz_min, size_t sz_max);
extern int of_property_read_variable_u32_array(const struct device_node *np,
const char *propname,
u32 *out_values,
size_t sz_min,
size_t sz_max);
extern int of_property_read_u64(const struct device_node *np,
const char *propname, u64 *out_value);
extern int of_property_read_variable_u64_array(const struct device_node *np,
const char *propname,
u64 *out_values,
size_t sz_min,
size_t sz_max);
extern int of_property_read_string(const struct device_node *np,
const char *propname,
const char **out_string);
extern int of_property_match_string(const struct device_node *np,
const char *propname,
const char *string);
extern int of_property_read_string_helper(const struct device_node *np,
const char *propname,
const char **out_strs, size_t sz, int index);
extern int of_device_is_compatible(const struct device_node *device,
const char *);
extern int of_device_compatible_match(struct device_node *device,
const char *const *compat);
extern bool of_device_is_available(const struct device_node *device);
extern bool of_device_is_big_endian(const struct device_node *device);
extern const void *of_get_property(const struct device_node *node,
const char *name,
int *lenp);
extern struct device_node *of_get_cpu_node(int cpu, unsigned int *thread);
#define for_each_property_of_node(dn, pp) \
for (pp = dn->properties; pp != NULL; pp = pp->next)
extern int of_n_addr_cells(struct device_node *np);
extern int of_n_size_cells(struct device_node *np);
extern const struct of_device_id *of_match_node(
const struct of_device_id *matches, const struct device_node *node);
extern int of_modalias_node(struct device_node *node, char *modalias, int len);
extern void of_print_phandle_args(const char *msg, const struct of_phandle_args *args);
extern struct device_node *of_parse_phandle(const struct device_node *np,
const char *phandle_name,
int index);
extern int of_parse_phandle_with_args(const struct device_node *np,
const char *list_name, const char *cells_name, int index,
struct of_phandle_args *out_args);
extern int of_parse_phandle_with_fixed_args(const struct device_node *np,
const char *list_name, int cells_count, int index,
struct of_phandle_args *out_args);
extern int of_count_phandle_with_args(const struct device_node *np,
const char *list_name, const char *cells_name);
/* phandle iterator functions */
extern int of_phandle_iterator_init(struct of_phandle_iterator *it,
const struct device_node *np,
const char *list_name,
const char *cells_name,
int cell_count);
extern int of_phandle_iterator_next(struct of_phandle_iterator *it);
extern int of_phandle_iterator_args(struct of_phandle_iterator *it,
uint32_t *args,
int size);
extern void of_alias_scan(void * (*dt_alloc)(u64 size, u64 align));
extern int of_alias_get_id(struct device_node *np, const char *stem);
extern int of_alias_get_highest_id(const char *stem);
extern int of_machine_is_compatible(const char *compat);
extern int of_add_property(struct device_node *np, struct property *prop);
extern int of_remove_property(struct device_node *np, struct property *prop);
extern int of_update_property(struct device_node *np, struct property *newprop);
/* For updating the device tree at runtime */
#define OF_RECONFIG_ATTACH_NODE 0x0001
#define OF_RECONFIG_DETACH_NODE 0x0002
#define OF_RECONFIG_ADD_PROPERTY 0x0003
#define OF_RECONFIG_REMOVE_PROPERTY 0x0004
#define OF_RECONFIG_UPDATE_PROPERTY 0x0005
extern int of_attach_node(struct device_node *);
extern int of_detach_node(struct device_node *);
#define of_match_ptr(_ptr) (_ptr)
/**
* of_property_read_u8_array - Find and read an array of u8 from a property.
*
* @np: device node from which the property value is to be read.
* @propname: name of the property to be searched.
* @out_values: pointer to return value, modified only if return value is 0.
* @sz: number of array elements to read
*
* Search for a property in a device node and read 8-bit value(s) from
* it. Returns 0 on success, -EINVAL if the property does not exist,
* -ENODATA if property does not have a value, and -EOVERFLOW if the
* property data isn't large enough.
*
* dts entry of array should be like:
* property = /bits/ 8 <0x50 0x60 0x70>;
*
* The out_values is modified only if a valid u8 value can be decoded.
*/
static inline int of_property_read_u8_array(const struct device_node *np,
const char *propname,
u8 *out_values, size_t sz)
{
int ret = of_property_read_variable_u8_array(np, propname, out_values,
sz, 0);
if (ret >= 0)
return 0;
else
return ret;
}
/**
* of_property_read_u16_array - Find and read an array of u16 from a property.
*
* @np: device node from which the property value is to be read.
* @propname: name of the property to be searched.
* @out_values: pointer to return value, modified only if return value is 0.
* @sz: number of array elements to read
*
* Search for a property in a device node and read 16-bit value(s) from
* it. Returns 0 on success, -EINVAL if the property does not exist,
* -ENODATA if property does not have a value, and -EOVERFLOW if the
* property data isn't large enough.
*
* dts entry of array should be like:
* property = /bits/ 16 <0x5000 0x6000 0x7000>;
*
* The out_values is modified only if a valid u16 value can be decoded.
*/
static inline int of_property_read_u16_array(const struct device_node *np,
const char *propname,
u16 *out_values, size_t sz)
{
int ret = of_property_read_variable_u16_array(np, propname, out_values,
sz, 0);
if (ret >= 0)
return 0;
else
return ret;
}
/**
* of_property_read_u32_array - Find and read an array of 32 bit integers
* from a property.
*
* @np: device node from which the property value is to be read.
* @propname: name of the property to be searched.
* @out_values: pointer to return value, modified only if return value is 0.
* @sz: number of array elements to read
*
* Search for a property in a device node and read 32-bit value(s) from
* it. Returns 0 on success, -EINVAL if the property does not exist,
* -ENODATA if property does not have a value, and -EOVERFLOW if the
* property data isn't large enough.
*
* The out_values is modified only if a valid u32 value can be decoded.
*/
static inline int of_property_read_u32_array(const struct device_node *np,
const char *propname,
u32 *out_values, size_t sz)
{
int ret = of_property_read_variable_u32_array(np, propname, out_values,
sz, 0);
if (ret >= 0)
return 0;
else
return ret;
}
/**
* of_property_read_u64_array - Find and read an array of 64 bit integers
* from a property.
*
* @np: device node from which the property value is to be read.
* @propname: name of the property to be searched.
* @out_values: pointer to return value, modified only if return value is 0.
* @sz: number of array elements to read
*
* Search for a property in a device node and read 64-bit value(s) from
* it. Returns 0 on success, -EINVAL if the property does not exist,
* -ENODATA if property does not have a value, and -EOVERFLOW if the
* property data isn't large enough.
*
* The out_values is modified only if a valid u64 value can be decoded.
*/
static inline int of_property_read_u64_array(const struct device_node *np,
const char *propname,
u64 *out_values, size_t sz)
{
int ret = of_property_read_variable_u64_array(np, propname, out_values,
sz, 0);
if (ret >= 0)
return 0;
else
return ret;
}
/*
* struct property *prop;
* const __be32 *p;
* u32 u;
*
* of_property_for_each_u32(np, "propname", prop, p, u)
* printk("U32 value: %x\n", u);
*/
const __be32 *of_prop_next_u32(struct property *prop, const __be32 *cur,
u32 *pu);
/*
* struct property *prop;
* const char *s;
*
* of_property_for_each_string(np, "propname", prop, s)
* printk("String value: %s\n", s);
*/
const char *of_prop_next_string(struct property *prop, const char *cur);
bool of_console_check(struct device_node *dn, char *name, int index);
extern int of_cpu_node_to_id(struct device_node *np);
#else /* CONFIG_OF */
static inline void of_core_init(void)
{
}
static inline bool is_of_node(const struct fwnode_handle *fwnode)
{
return false;
}
static inline struct device_node *to_of_node(const struct fwnode_handle *fwnode)
{
return NULL;
}
static inline const char* of_node_full_name(const struct device_node *np)
{
return "<no-node>";
}
static inline struct device_node *of_find_node_by_name(struct device_node *from,
const char *name)
{
return NULL;
}
static inline struct device_node *of_find_node_by_type(struct device_node *from,
const char *type)
{
return NULL;
}
static inline struct device_node *of_find_matching_node_and_match(
struct device_node *from,
const struct of_device_id *matches,
const struct of_device_id **match)
{
return NULL;
}
static inline struct device_node *of_find_node_by_path(const char *path)
{
return NULL;
}
static inline struct device_node *of_find_node_opts_by_path(const char *path,
const char **opts)
{
return NULL;
}
static inline struct device_node *of_find_node_by_phandle(phandle handle)
{
return NULL;
}
static inline struct device_node *of_get_parent(const struct device_node *node)
{
return NULL;
}
static inline struct device_node *of_get_next_child(
const struct device_node *node, struct device_node *prev)
{
return NULL;
}
static inline struct device_node *of_get_next_available_child(
const struct device_node *node, struct device_node *prev)
{
return NULL;
}
static inline struct device_node *of_find_node_with_property(
struct device_node *from, const char *prop_name)
{
return NULL;
}
#define of_fwnode_handle(node) NULL
static inline bool of_have_populated_dt(void)
{
return false;
}
static inline struct device_node *of_get_compatible_child(const struct device_node *parent,
const char *compatible)
{
return NULL;
}
static inline struct device_node *of_get_child_by_name(
const struct device_node *node,
const char *name)
{
return NULL;
}
static inline int of_device_is_compatible(const struct device_node *device,
const char *name)
{
return 0;
}
static inline int of_device_compatible_match(struct device_node *device,
const char *const *compat)
{
return 0;
}
static inline bool of_device_is_available(const struct device_node *device)
{
return false;
}
static inline bool of_device_is_big_endian(const struct device_node *device)
{
return false;
}
static inline struct property *of_find_property(const struct device_node *np,
const char *name,
int *lenp)
{
return NULL;
}
static inline struct device_node *of_find_compatible_node(
struct device_node *from,
const char *type,
const char *compat)
{
return NULL;
}
static inline int of_property_count_elems_of_size(const struct device_node *np,
const char *propname, int elem_size)
{
return -ENOSYS;
}
static inline int of_property_read_u32_index(const struct device_node *np,
const char *propname, u32 index, u32 *out_value)
{
return -ENOSYS;
}
static inline int of_property_read_u8_array(const struct device_node *np,
const char *propname, u8 *out_values, size_t sz)
{
return -ENOSYS;
}
static inline int of_property_read_u16_array(const struct device_node *np,
const char *propname, u16 *out_values, size_t sz)
{
return -ENOSYS;
}
static inline int of_property_read_u32_array(const struct device_node *np,
const char *propname,
u32 *out_values, size_t sz)
{
return -ENOSYS;
}
static inline int of_property_read_u64_array(const struct device_node *np,
const char *propname,
u64 *out_values, size_t sz)
{
return -ENOSYS;
}
static inline int of_property_read_string(const struct device_node *np,
const char *propname,
const char **out_string)
{
return -ENOSYS;
}
static inline int of_property_read_string_helper(const struct device_node *np,
const char *propname,
const char **out_strs, size_t sz, int index)
{
return -ENOSYS;
}
static inline const void *of_get_property(const struct device_node *node,
const char *name,
int *lenp)
{
return NULL;
}
static inline struct device_node *of_get_cpu_node(int cpu,
unsigned int *thread)
{
return NULL;
}
static inline int of_n_addr_cells(struct device_node *np)
{
return 0;
}
static inline int of_n_size_cells(struct device_node *np)
{
return 0;
}
static inline int of_property_read_u64(const struct device_node *np,
const char *propname, u64 *out_value)
{
return -ENOSYS;
}
static inline int of_property_match_string(const struct device_node *np,
const char *propname,
const char *string)
{
return -ENOSYS;
}
static inline struct device_node *of_parse_phandle(const struct device_node *np,
const char *phandle_name,
int index)
{
return NULL;
}
static inline int of_parse_phandle_with_args(const struct device_node *np,
const char *list_name,
const char *cells_name,
int index,
struct of_phandle_args *out_args)
{
return -ENOSYS;
}
static inline int of_parse_phandle_with_fixed_args(const struct device_node *np,
const char *list_name, int cells_count, int index,
struct of_phandle_args *out_args)
{
return -ENOSYS;
}
static inline int of_count_phandle_with_args(struct device_node *np,
const char *list_name,
const char *cells_name)
{
return -ENOSYS;
}
static inline int of_phandle_iterator_init(struct of_phandle_iterator *it,
const struct device_node *np,
const char *list_name,
const char *cells_name,
int cell_count)
{
return -ENOSYS;
}
static inline int of_phandle_iterator_next(struct of_phandle_iterator *it)
{
return -ENOSYS;
}
static inline int of_phandle_iterator_args(struct of_phandle_iterator *it,
uint32_t *args,
int size)
{
return 0;
}
static inline int of_alias_get_id(struct device_node *np, const char *stem)
{
return -ENOSYS;
}
static inline int of_alias_get_highest_id(const char *stem)
{
return -ENOSYS;
}
static inline int of_machine_is_compatible(const char *compat)
{
return 0;
}
static inline bool of_console_check(const struct device_node *dn, const char *name, int index)
{
return false;
}
static inline const __be32 *of_prop_next_u32(struct property *prop,
const __be32 *cur, u32 *pu)
{
return NULL;
}
static inline const char *of_prop_next_string(struct property *prop,
const char *cur)
{
return NULL;
}
static inline int of_node_check_flag(struct device_node *n, unsigned long flag)
{
return 0;
}
static inline int of_node_test_and_set_flag(struct device_node *n,
unsigned long flag)
{
return 0;
}
static inline void of_node_set_flag(struct device_node *n, unsigned long flag)
{
}
static inline void of_node_clear_flag(struct device_node *n, unsigned long flag)
{
}
static inline int of_property_check_flag(struct property *p, unsigned long flag)
{
return 0;
}
static inline void of_property_set_flag(struct property *p, unsigned long flag)
{
}
static inline void of_property_clear_flag(struct property *p, unsigned long flag)
{
}
static inline int of_cpu_node_to_id(struct device_node *np)
{
return -ENODEV;
}
#define of_match_ptr(_ptr) NULL
#define of_match_node(_matches, _node) NULL
#endif /* CONFIG_OF */
/* Default string compare functions, Allow arch asm/prom.h to override */
#if !defined(of_compat_cmp)
#define of_compat_cmp(s1, s2, l) strcasecmp((s1), (s2))
#define of_prop_cmp(s1, s2) strcmp((s1), (s2))
#define of_node_cmp(s1, s2) strcasecmp((s1), (s2))
#endif
#if defined(CONFIG_OF) && defined(CONFIG_NUMA)
extern int of_node_to_nid(struct device_node *np);
#else
static inline int of_node_to_nid(struct device_node *device)
{
return NUMA_NO_NODE;
}
#endif
#ifdef CONFIG_OF_NUMA
extern int of_numa_init(void);
#else
static inline int of_numa_init(void)
{
return -ENOSYS;
}
#endif
static inline struct device_node *of_find_matching_node(
struct device_node *from,
const struct of_device_id *matches)
{
return of_find_matching_node_and_match(from, matches, NULL);
}
/**
* of_property_count_u8_elems - Count the number of u8 elements in a property
*
* @np: device node from which the property value is to be read.
* @propname: name of the property to be searched.
*
* Search for a property in a device node and count the number of u8 elements
* in it. Returns number of elements on sucess, -EINVAL if the property does
* not exist or its length does not match a multiple of u8 and -ENODATA if the
* property does not have a value.
*/
static inline int of_property_count_u8_elems(const struct device_node *np,
const char *propname)
{
return of_property_count_elems_of_size(np, propname, sizeof(u8));
}
/**
* of_property_count_u16_elems - Count the number of u16 elements in a property
*
* @np: device node from which the property value is to be read.
* @propname: name of the property to be searched.
*
* Search for a property in a device node and count the number of u16 elements
* in it. Returns number of elements on sucess, -EINVAL if the property does
* not exist or its length does not match a multiple of u16 and -ENODATA if the
* property does not have a value.
*/
static inline int of_property_count_u16_elems(const struct device_node *np,
const char *propname)
{
return of_property_count_elems_of_size(np, propname, sizeof(u16));
}
/**
* of_property_count_u32_elems - Count the number of u32 elements in a property
*
* @np: device node from which the property value is to be read.
* @propname: name of the property to be searched.
*
* Search for a property in a device node and count the number of u32 elements
* in it. Returns number of elements on sucess, -EINVAL if the property does
* not exist or its length does not match a multiple of u32 and -ENODATA if the
* property does not have a value.
*/
static inline int of_property_count_u32_elems(const struct device_node *np,
const char *propname)
{
return of_property_count_elems_of_size(np, propname, sizeof(u32));
}
/**
* of_property_count_u64_elems - Count the number of u64 elements in a property
*
* @np: device node from which the property value is to be read.
* @propname: name of the property to be searched.
*
* Search for a property in a device node and count the number of u64 elements
* in it. Returns number of elements on sucess, -EINVAL if the property does
* not exist or its length does not match a multiple of u64 and -ENODATA if the
* property does not have a value.
*/
static inline int of_property_count_u64_elems(const struct device_node *np,
const char *propname)
{
return of_property_count_elems_of_size(np, propname, sizeof(u64));
}
/**
* of_property_read_string_array() - Read an array of strings from a multiple
* strings property.
* @np: device node from which the property value is to be read.
* @propname: name of the property to be searched.
* @out_strs: output array of string pointers.
* @sz: number of array elements to read.
*
* Search for a property in a device tree node and retrieve a list of
* terminated string values (pointer to data, not a copy) in that property.
*
* If @out_strs is NULL, the number of strings in the property is returned.
*/
static inline int of_property_read_string_array(const struct device_node *np,
const char *propname, const char **out_strs,
size_t sz)
{
return of_property_read_string_helper(np, propname, out_strs, sz, 0);
}
/**
* of_property_count_strings() - Find and return the number of strings from a
* multiple strings property.
* @np: device node from which the property value is to be read.
* @propname: name of the property to be searched.
*
* Search for a property in a device tree node and retrieve the number of null
* terminated string contain in it. Returns the number of strings on
* success, -EINVAL if the property does not exist, -ENODATA if property
* does not have a value, and -EILSEQ if the string is not null-terminated
* within the length of the property data.
*/
static inline int of_property_count_strings(const struct device_node *np,
const char *propname)
{
return of_property_read_string_helper(np, propname, NULL, 0, 0);
}
/**
* of_property_read_string_index() - Find and read a string from a multiple
* strings property.
* @np: device node from which the property value is to be read.
* @propname: name of the property to be searched.
* @index: index of the string in the list of strings
* @out_string: pointer to null terminated return string, modified only if
* return value is 0.
*
* Search for a property in a device tree node and retrieve a null
* terminated string value (pointer to data, not a copy) in the list of strings
* contained in that property.
* Returns 0 on success, -EINVAL if the property does not exist, -ENODATA if
* property does not have a value, and -EILSEQ if the string is not
* null-terminated within the length of the property data.
*
* The out_string pointer is modified only if a valid string can be decoded.
*/
static inline int of_property_read_string_index(const struct device_node *np,
const char *propname,
int index, const char **output)
{
int rc = of_property_read_string_helper(np, propname, output, 1, index);
return rc < 0 ? rc : 0;
}
/**
* of_property_read_bool - Findfrom a property
* @np: device node from which the property value is to be read.
* @propname: name of the property to be searched.
*
* Search for a property in a device node.
* Returns true if the property exists false otherwise.
*/
static inline bool of_property_read_bool(const struct device_node *np,
const char *propname)
{
struct property *prop = of_find_property(np, propname, NULL);
return prop ? true : false;
}
static inline int of_property_read_u8(const struct device_node *np,
const char *propname,
u8 *out_value)
{
return of_property_read_u8_array(np, propname, out_value, 1);
}
static inline int of_property_read_u16(const struct device_node *np,
const char *propname,
u16 *out_value)
{
return of_property_read_u16_array(np, propname, out_value, 1);
}
static inline int of_property_read_u32(const struct device_node *np,
const char *propname,
u32 *out_value)
{
return of_property_read_u32_array(np, propname, out_value, 1);
}
static inline int of_property_read_s32(const struct device_node *np,
const char *propname,
s32 *out_value)
{
return of_property_read_u32(np, propname, (u32*) out_value);
}
#define of_for_each_phandle(it, err, np, ln, cn, cc) \
for (of_phandle_iterator_init((it), (np), (ln), (cn), (cc)), \
err = of_phandle_iterator_next(it); \
err == 0; \
err = of_phandle_iterator_next(it))
#define of_property_for_each_u32(np, propname, prop, p, u) \
for (prop = of_find_property(np, propname, NULL), \
p = of_prop_next_u32(prop, NULL, &u); \
p; \
p = of_prop_next_u32(prop, p, &u))
#define of_property_for_each_string(np, propname, prop, s) \
for (prop = of_find_property(np, propname, NULL), \
s = of_prop_next_string(prop, NULL); \
s; \
s = of_prop_next_string(prop, s))
#define for_each_node_by_name(dn, name) \
for (dn = of_find_node_by_name(NULL, name); dn; \
dn = of_find_node_by_name(dn, name))
#define for_each_node_by_type(dn, type) \
for (dn = of_find_node_by_type(NULL, type); dn; \
dn = of_find_node_by_type(dn, type))
#define for_each_compatible_node(dn, type, compatible) \
for (dn = of_find_compatible_node(NULL, type, compatible); dn; \
dn = of_find_compatible_node(dn, type, compatible))
#define for_each_matching_node(dn, matches) \
for (dn = of_find_matching_node(NULL, matches); dn; \
dn = of_find_matching_node(dn, matches))
#define for_each_matching_node_and_match(dn, matches, match) \
for (dn = of_find_matching_node_and_match(NULL, matches, match); \
dn; dn = of_find_matching_node_and_match(dn, matches, match))
#define for_each_child_of_node(parent, child) \
for (child = of_get_next_child(parent, NULL); child != NULL; \
child = of_get_next_child(parent, child))
#define for_each_available_child_of_node(parent, child) \
for (child = of_get_next_available_child(parent, NULL); child != NULL; \
child = of_get_next_available_child(parent, child))
#define for_each_node_with_property(dn, prop_name) \
for (dn = of_find_node_with_property(NULL, prop_name); dn; \
dn = of_find_node_with_property(dn, prop_name))
static inline int of_get_child_count(const struct device_node *np)
{
struct device_node *child;
int num = 0;
for_each_child_of_node(np, child)
num++;
return num;
}
static inline int of_get_available_child_count(const struct device_node *np)
{
struct device_node *child;
int num = 0;
for_each_available_child_of_node(np, child)
num++;
return num;
}
#if defined(CONFIG_OF) && !defined(MODULE)
#define _OF_DECLARE(table, name, compat, fn, fn_type) \
static const struct of_device_id __of_table_##name \
__used __section(__##table##_of_table) \
__aligned(__alignof__(struct of_device_id)) \
= { .compatible = compat, \
.data = (fn == (fn_type)NULL) ? fn : fn }
#else
#define _OF_DECLARE(table, name, compat, fn, fn_type) \
static const struct of_device_id __of_table_##name \
__attribute__((unused)) \
= { .compatible = compat, \
.data = (fn == (fn_type)NULL) ? fn : fn }
#endif
typedef int (*of_init_fn_2)(struct device_node *, struct device_node *);
typedef int (*of_init_fn_1_ret)(struct device_node *);
typedef void (*of_init_fn_1)(struct device_node *);
#define OF_DECLARE_1(table, name, compat, fn) \
_OF_DECLARE(table, name, compat, fn, of_init_fn_1)
#define OF_DECLARE_1_RET(table, name, compat, fn) \
_OF_DECLARE(table, name, compat, fn, of_init_fn_1_ret)
#define OF_DECLARE_2(table, name, compat, fn) \
_OF_DECLARE(table, name, compat, fn, of_init_fn_2)
/**
* struct of_changeset_entry - Holds a changeset entry
*
* @node: list_head for the log list
* @action: notifier action
* @np: pointer to the device node affected
* @prop: pointer to the property affected
* @old_prop: hold a pointer to the original property
*
* Every modification of the device tree during a changeset
* is held in a list of of_changeset_entry structures.
* That way we can recover from a partial application, or we can
* revert the changeset
*/
struct of_changeset_entry {
struct list_head node;
unsigned long action;
struct device_node *np;
struct property *prop;
struct property *old_prop;
};
/**
* struct of_changeset - changeset tracker structure
*
* @entries: list_head for the changeset entries
*
* changesets are a convenient way to apply bulk changes to the
* live tree. In case of an error, changes are rolled-back.
* changesets live on after initial application, and if not
* destroyed after use, they can be reverted in one single call.
*/
struct of_changeset {
struct list_head entries;
};
enum of_reconfig_change {
OF_RECONFIG_NO_CHANGE = 0,
OF_RECONFIG_CHANGE_ADD,
OF_RECONFIG_CHANGE_REMOVE,
};
#ifdef CONFIG_OF_DYNAMIC
extern int of_reconfig_notifier_register(struct notifier_block *);
extern int of_reconfig_notifier_unregister(struct notifier_block *);
extern int of_reconfig_notify(unsigned long, struct of_reconfig_data *rd);
extern int of_reconfig_get_state_change(unsigned long action,
struct of_reconfig_data *arg);
extern void of_changeset_init(struct of_changeset *ocs);
extern void of_changeset_destroy(struct of_changeset *ocs);
extern int of_changeset_apply(struct of_changeset *ocs);
extern int of_changeset_revert(struct of_changeset *ocs);
extern int of_changeset_action(struct of_changeset *ocs,
unsigned long action, struct device_node *np,
struct property *prop);
static inline int of_changeset_attach_node(struct of_changeset *ocs,
struct device_node *np)
{
return of_changeset_action(ocs, OF_RECONFIG_ATTACH_NODE, np, NULL);
}
static inline int of_changeset_detach_node(struct of_changeset *ocs,
struct device_node *np)
{
return of_changeset_action(ocs, OF_RECONFIG_DETACH_NODE, np, NULL);
}
static inline int of_changeset_add_property(struct of_changeset *ocs,
struct device_node *np, struct property *prop)
{
return of_changeset_action(ocs, OF_RECONFIG_ADD_PROPERTY, np, prop);
}
static inline int of_changeset_remove_property(struct of_changeset *ocs,
struct device_node *np, struct property *prop)
{
return of_changeset_action(ocs, OF_RECONFIG_REMOVE_PROPERTY, np, prop);
}
static inline int of_changeset_update_property(struct of_changeset *ocs,
struct device_node *np, struct property *prop)
{
return of_changeset_action(ocs, OF_RECONFIG_UPDATE_PROPERTY, np, prop);
}
#else /* CONFIG_OF_DYNAMIC */
static inline int of_reconfig_notifier_register(struct notifier_block *nb)
{
return -EINVAL;
}
static inline int of_reconfig_notifier_unregister(struct notifier_block *nb)
{
return -EINVAL;
}
static inline int of_reconfig_notify(unsigned long action,
struct of_reconfig_data *arg)
{
return -EINVAL;
}
static inline int of_reconfig_get_state_change(unsigned long action,
struct of_reconfig_data *arg)
{
return -EINVAL;
}
#endif /* CONFIG_OF_DYNAMIC */
/* CONFIG_OF_RESOLVE api */
extern int of_resolve_phandles(struct device_node *tree);
/**
* of_device_is_system_power_controller - Tells if system-power-controller is found for device_node
* @np: Pointer to the given device_node
*
* return true if present false otherwise
*/
static inline bool of_device_is_system_power_controller(const struct device_node *np)
{
return of_property_read_bool(np, "system-power-controller");
}
/**
* Overlay support
*/
enum of_overlay_notify_action {
OF_OVERLAY_PRE_APPLY,
OF_OVERLAY_POST_APPLY,
OF_OVERLAY_PRE_REMOVE,
OF_OVERLAY_POST_REMOVE,
};
struct of_overlay_notify_data {
struct device_node *overlay;
struct device_node *target;
};
#ifdef CONFIG_OF_OVERLAY
/* ID based overlays; the API for external users */
int of_overlay_create(struct device_node *tree);
int of_overlay_destroy(int id);
int of_overlay_destroy_all(void);
int of_overlay_notifier_register(struct notifier_block *nb);
int of_overlay_notifier_unregister(struct notifier_block *nb);
#else
static inline int of_overlay_create(struct device_node *tree)
{
return -ENOTSUPP;
}
static inline int of_overlay_destroy(int id)
{
return -ENOTSUPP;
}
static inline int of_overlay_destroy_all(void)
{
return -ENOTSUPP;
}
static inline int of_overlay_notifier_register(struct notifier_block *nb)
{
return 0;
}
static inline int of_overlay_notifier_unregister(struct notifier_block *nb)
{
return 0;
}
#endif
#endif /* _LINUX_OF_H */