Files
Lucas Wei 4b93cc8b15 Merge android-4.9-q (4.9.254) into android-msm-pixel-4.9-lts
Merge 4.9.254 into android-4.9-q
Linux 4.9.254
    x86/boot/compressed: Disable relocation relaxation
  * tracing: Fix race in trace_open and buffer resize call
      kernel/trace/ring_buffer.c
  * Revert "mm/slub: fix a memory leak in sysfs_slab_add()"
      mm/slub.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
  * 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
  * bpf: Fix buggy rsh min/max bounds tracking
      kernel/bpf/verifier.c
    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
    ehci: fix EHCI host controller initialization sequence
    stm class: Fix module init return on allocation failure
    iio: ad5504: Fix setting power-down state
    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/bios: fix issue shadowing expansion ROMs
  * scsi: ufs: Correct the LUN used in eh_device_reset_handler() callback
      drivers/scsi/ufs/ufshcd.c
    ASoC: Intel: haswell: Add missing pm_ops
  * dm: avoid filesystem lookup in dm_get_dev_t()
      drivers/md/dm-table.c
    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()
    Merge 4.9.253 into android-4.9-q
Linux 4.9.253
    spi: cadence: cache reference clock rate during probe
    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: dcb: Accept RTM_GETDCB messages carrying set-like DCB commands
    net: dcb: Validate netlink message in DCB handler
    rndis_host: set proper input size for OID_GEN_PHYSICAL_MEDIUM request
    netxen_nic: fix MSI/MSI-x interrupts
  * net: cdc_ncm: correct overhead in delayed_ndp_size
      drivers/net/usb/cdc_ncm.c
    nfsd4: readdirplus shouldn't return parent of export
    usb: ohci: Make distrust_firmware param default to false
  * netfilter: conntrack: fix reading nf_conntrack_buckets
      net/netfilter/nf_conntrack_standalone.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
  * dump_common_audit_data(): fix racy accesses to ->d_name
      security/lsm_audit.c
  * Input: uinput - avoid FF flush when destroying device
      drivers/input/ff-core.c
      drivers/input/misc/uinput.c
      include/linux/input.h
    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
    ethernet: ucc_geth: fix definition and size of ucc_geth_tx_global_pram
    ARC: build: add boot_targets to PHONY
  * ext4: fix bug for rename with RENAME_WHITEOUT
      fs/ext4/namei.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.9.252 into android-4.9-q
Linux 4.9.252
  * 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 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
    cpufreq: powernow-k8: pass policy rather than use cpufreq_cpu_get()
    ARM: OMAP2+: omap_device: fix idling of devices during probe
    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
  * net: fix pmtu check in nopmtudisc mode
      net/ipv4/ip_tunnel.c
  * net: ip: always refragment ip defragmented packets
      net/ipv4/ip_output.c
    powerpc: Fix incorrect stw{, ux, u, x} instructions in __set_pte_at
    target: add XCOPY target/segment desc sense codes
    scsi: target: Fix XCOPY NAA identifier lookup
    xcopy: loop over devices using idr helper
    target: use XCOPY segment descriptor CSCD IDs
    target: simplify XCOPY wwn->se_dev lookup helper
    target: bounds check XCOPY segment descriptor list
    ANDROID: cuttlefish_defconfig: add missing CONFIG_BLK_CGROUP
    Merge 4.9.251 into android-4.9-q
Linux 4.9.251
    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/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 LongSung M5710 module support
    USB: serial: iuu_phoenix: fix DMA from stack
    usb: uas: Add PNY USB Portable SSD to unusual_uas
  * 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: cdc-acm: blacklist another IR Droid device
  * usb: gadget: enable super speed plus
      drivers/usb/gadget/configfs.c
    video: hyperv_fb: Fix the mmap() regression for v5.4.y and older
    scripts/gdb: fix lx-version string output
    scripts/gdb: lx-dmesg: use explicit encoding=utf8 errors=replace
    scripts/gdb: lx-dmesg: cast log_buf to void* for addr fetch
    scripts/gdb: make lx-dmesg command work (reliably)
    virtio_net: Fix recursive call to cpus_read_lock()
    net: sched: prevent invalid Scell_log shift count
    vhost_net: fix ubuf refcount incorrectly when sendmsg fails
  * 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: Fix memleak in ethoc_probe
    net/ncsi: Use real net-device for response handler
    atm: idt77252: call pci_disable_device() on error path
    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
  * workqueue: Kick a worker based on the actual activation of delayed works
      kernel/workqueue.c
  * kbuild: don't hardcode depmod path
      Makefile
    Merge 4.9.250 into android-4.9-q
Linux 4.9.250
    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
    iio:imu:bmi160: Fix too large a buffer.
    iio: bmi160_core: Fix sparse warning due to incorrect type in assignment
    xenbus/xenbus_backend: Disallow pending watch messages
    xen/xenbus: Count pending messages for each watch
    xen/xenbus/xen_bus_type: Support will_handle watch callback
    xen/xenbus: Add 'will_handle' callback support in xenbus_watch_path()
    xen/xenbus: Allow watches discard events before queueing
  * kdev_t: always inline major/minor helper functions
      include/linux/kdev_t.h
  * 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
    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/mroute6.h
      include/uapi/linux/netfilter/x_tables.h
      include/uapi/linux/netlink.h
      include/uapi/linux/sysctl.h
  * l2tp: fix races with ipv4-mapped ipv6 addresses
      net/l2tp/l2tp_core.c
      net/l2tp/l2tp_core.h
  * net: ipv6: keep sk status consistent after datagram connect failure
      net/ipv6/datagram.c
    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()
    ALSA: hda/realtek - Dell headphone has noise on unmute for ALC236
    ALSA: hda - Fix a wrong FIXUP for alc289 on Dell machines
    ALSA: hda/realtek - Support Dell headset mode for ALC3271
  * 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
    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
  * UPSTREAM: locking/atomic, kref: Add KREF_INIT()
      fs/fuse/fuse_i.h
      include/linux/kref.h
      init/version.c
      kernel/pid.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.9.249 into android-4.9-q
Linux 4.9.249
  * PCI: Fix pci_slot_release() NULL pointer dereference
      drivers/pci/slot.c
    xen-blkback: set ring->xenblkd to NULL after kthread_stop()
    clk: mvebu: a3700: fix the XTAL MODE pin to MPP1_9
    iio:pressure:mpl3115: Force alignment of buffer
    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
    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
    powerpc/xmon: Change printk() to pr_cont()
  * KVM: arm64: Introduce handling of AArch32 TTBCR2 traps
      arch/arm64/include/asm/kvm_host.h
  * 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
    btrfs: scrub: Don't use inode page cache in scrub_handle_errored_block()
    btrfs: quota: Set rescan progress to (u64)-1 if we hit last leaf
    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
    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
  * 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
    ACPI: PNP: compare the string length in the matching_id()
    Revert "ACPI / resources: Use AE_CTRL_TERMINATE to terminate resources walks"
    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
    Input: goodix - add upside-down quirk for Teclast X98 Pro tablet
    Input: cros_ec_keyb - send 'scancodes' in addition to key events
  * cfg80211: initialize rekey_data
      net/wireless/nl80211.c
    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
    clk: ti: Fix memleak in ti_fapll_synth_setup
    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
    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()
    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: 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()
    cpufreq: scpi: Add missing MODULE_ALIAS
    cpufreq: loongson1: Add missing MODULE_ALIAS
    cpufreq: st: 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()
    memstick: r592: Fix error return in r592_probe()
    pinctrl: falcon: add missing put_device() call in pinctrl_falcon_probe()
    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
    ARM: dts: at91: at91sam9rl: fix ADC triggers
    HSI: omap_ssi: Don't jump to free ID in ssi_add_controller()
    mips: cdmm: fix use-after-free in mips_cdmm_bus_discover
    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
    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
    Input: ads7846 - fix unaligned access on 7845
    Input: ads7846 - fix integer overflow on Rt calculation
    drm/omap: dmm_tiler: fix return error code in omap_dmm_probe()
    media: solo6x10: fix missing snd_card_free in error handling case
    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
    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
  * 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()
    ARM: p2v: fix handling of LPAE translation in BE mode
    RDMA/rxe: Compute PSN windows correctly
    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
    media: msi2500: assign SPI bus number dynamically
  * 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_fs: Re-use SS descriptors for SuperSpeedPlus
      drivers/usb/gadget/function/f_fs.c
    USB: gadget: f_rndis: fix bitrate for SuperSpeed and above
  * 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
    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
    pinctrl: baytrail: Avoid clearing debounce value when turning it off
    pinctrl: merrifield: Set default bias in case no particular value given
    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
  * 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
  * tcp: fix cwnd-limited bug for TSO deferral where we send nothing
      net/ipv4/tcp_output.c
    net/mlx4_en: Avoid scheduling restart task if it is already running
  * spi: Prevent adding devices below an unregistering controller
      drivers/spi/Kconfig
      drivers/spi/spi.c
    scsi: be2iscsi: Revert "Fix a theoretical leak in beiscsi_create_eqs()"
    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
    ARC: stack unwinding: don't assume non-current task is sleeping
    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: Icded594ca907f1cf0a53f7a506c1cb9e58cbc213
Signed-off-by: Lucas Wei <lucaswei@google.com>
2021-03-01 15:00:57 +00:00

1311 lines
38 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;
struct bin_attribute attr;
};
#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;
struct kobject kobj;
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;
static inline void of_node_init(struct device_node *node)
{
kobject_init(&node->kobj, &of_node_ktype);
node->fwnode.type = FWNODE_OF;
}
#define of_node_kobj(n) (&(n)->kobj)
/* true when node is initialized */
static inline int of_node_is_initialized(struct device_node *node)
{
return node && node->kobj.state_initialized;
}
/* true when node is attached (i.e. present on sysfs) */
static inline int of_node_is_attached(struct device_node *node)
{
return node && node->kobj.state_in_sysfs;
}
#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->type == FWNODE_OF;
}
#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; \
})
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 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_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);
#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;
}
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 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_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)
{
}
#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
*/
#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);
#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;
}
#endif
#endif /* _LINUX_OF_H */