06fa962add
* refs/heads/tmp-:9759829 ANDROID: GKI: Update symbols to symbol list FROMLIST: binder: check offset alignment in binder_get_object() ANDROID: GKI: Update symbols to symbol list UPSTREAM: netfilter: nf_tables: release mutex after nft_gc_seq_end from abort path UPSTREAM: netfilter: nf_tables: release batch on table validation from abort path UPSTREAM: netfilter: nf_tables: mark set as dead when unbinding anonymous set with timeout UPSTREAM: netfilter: nft_chain_filter: handle NETDEV_UNREGISTER for inet/ingress basechain BACKPORT: mm: update mark_victim tracepoints fields Revert "FROMGIT: BACKPORT: mm: update mark_victim tracepoints fields" UPSTREAM: usb: gadget: uvc: decrease the interrupt load to a quarter UPSTREAM: netfilter: nft_set_pipapo: release elements in clone only from destroy path FROMLIST: binder: check offset alignment in binder_get_object() ANDROID: enable CONFIG_USB_XHCI_PCI_RENESAS in gki_defconfig UPSTREAM: usb: dwc3: core: set force_gen1 bit in USB31 devices if max speed is SS ANDROID: userfaultfd: abort uffdio ops if mmap_lock is contended ANDROID: userfaultfd: add MMAP_TRYLOCK mode for COPY/ZEROPAGE UPSTREAM: coresight: etm4x: Remove bogous __exit annotation for some functions UPSTREAM: ASoC: hdmi-codec: register hpd callback on component probe UPSTREAM: usb: typec: tcpm: Fix NULL pointer dereference in tcpm_pd_svdm() UPSTREAM: mm/damon/vaddr-test: fix memory leak in damon_do_test_apply_three_regions() UPSTREAM: task_work: add kerneldoc annotation for 'data' argument UPSTREAM: x86/purgatory: Remove LTO flags UPSTREAM: tcpm: Avoid soft reset when partner does not support get_status UPSTREAM: block/mq-deadline: use correct way to throttling write requests UPSTREAM: usb: typec: tcpm: Fix response to vsafe0V event UPSTREAM: clk: Fix memory leak in devm_clk_notifier_register() UPSTREAM: selftests: damon: add config file ANDROID: abi_gki_aarch64_qcom: Export trace_android_vh_try_fixup_sea ANDROID: arm64: Call fixup_exception() within do_sea() ANDROID: userfaultfd: allow SPF for UFFD_FEATURE_SIGBUS on private+anon ANDROID: GKI: db845c: Update symbols list and ABI UPSTREAM: drm/msm/dsi: Enable runtime PM UPSTREAM: PM: runtime: Have devm_pm_runtime_enable() handle pm_runtime_dont_use_autosuspend() UPSTREAM: PM: runtime: add devm_pm_runtime_enable helper Revert "clk: fixed-rate: add devm_clk_hw_register_fixed_rate" Revert "clk: fixed-rate: fix clk_hw_register_fixed_rate_with_accuracy_parent_hw" Linux 5.10.209 arm64: dts: armada-3720-turris-mox: set irq type for RTC i2c: s3c24xx: fix transferring more than one message in polling mode i2c: s3c24xx: fix read transfers in polling mode selftests: mlxsw: qos_pfc: Adjust the test to support 8 lanes selftests: mlxsw: qos_pfc: Convert to iproute2 dcb mlxsw: spectrum_acl_tcam: Fix stack corruption mlxsw: spectrum_acl_tcam: Reorder functions to avoid forward declarations mlxsw: spectrum_acl_tcam: Make fini symmetric to init mlxsw: spectrum_acl_tcam: Add missing mutex_destroy() mlxsw: spectrum: Use 'bitmap_zalloc()' when applicable mlxsw: spectrum_acl_erp: Fix error flow of pool allocation failure ethtool: netlink: Add missing ethnl_ops_begin/complete kdb: Fix a potential buffer overflow in kdb_local() ipvs: avoid stat macros calls from preemptible context netfilter: nf_tables: reject NFT_SET_CONCAT with not field length description netfilter: nf_tables: skip dead set elements in netlink dump netfilter: nf_tables: do not allow mismatch field size and set key length net: dsa: vsc73xx: Add null pointer check to vsc73xx_gpio_probe net: ravb: Fix dma_addr_t truncation in error case net: phy: micrel: populate .soft_reset for KSZ9131 net: ethernet: ti: am65-cpsw: Fix max mtu to fit ethernet frames net: qualcomm: rmnet: fix global oob in rmnet_policy s390/pci: fix max size calculation in zpci_memcpy_toio() PCI: keystone: Fix race condition when initializing PHYs nvmet-tcp: Fix the H2C expected PDU len calculation serial: imx: Correct clock error message in function probe() apparmor: avoid crash when parsed profile name is empty perf env: Avoid recursively taking env->bpf_progs.lock nvmet-tcp: fix a crash in nvmet_req_complete() nvmet-tcp: Fix a kernel panic when host sends an invalid H2C PDU length usb: cdc-acm: return correct error code on unsupported break tty: use 'if' in send_break() instead of 'goto' tty: don't check for signal_pending() in send_break() tty: early return from send_break() on TTY_DRIVER_HARDWARE_BREAK tty: change tty_write_lock()'s ndelay parameter to bool perf genelf: Set ELF program header addresses properly iio: adc: ad9467: fix scale setting iio: adc: ad9467: don't ignore error codes iio: adc: ad9467: fix reset gpio handling iio: adc: ad9467: Benefit from devm_clk_get_enabled() to simplify serial: imx: fix tx statemachine deadlock software node: Let args be NULL in software_node_get_reference_args acpi: property: Let args be NULL in __acpi_node_get_property_reference libapi: Add missing linux/types.h header to get the __u64 type on io.h serial: 8250: omap: Don't skip resource freeing if pm_runtime_resume_and_get() failed power: supply: cw2015: correct time_to_empty units in sysfs MIPS: Alchemy: Fix an out-of-bound access in db1550_dev_setup() MIPS: Alchemy: Fix an out-of-bound access in db1200_dev_setup() mips: Fix incorrect max_low_pfn adjustment mips: dmi: Fix early remap on MIPS32 leds: aw2013: Select missing dependency REGMAP_I2C mfd: syscon: Fix null pointer dereference in of_syscon_register() HID: wacom: Correct behavior when processing some confidence == false touches iio: adc: ad7091r: Pass iio_dev to event handler KVM: arm64: vgic-its: Avoid potential UAF in LPI translation cache KVM: arm64: vgic-v4: Restore pending state on host userspace write x86/kvm: Do not try to disable kvmclock if it was not enabled wifi: mwifiex: configure BSSID consistently when starting AP wifi: rtlwifi: Convert LNKCTL change to PCIe cap RMW accessors wifi: rtlwifi: Remove bogus and dangerous ASPM disable/enable code iommu/arm-smmu-qcom: Add missing GMU entry to match table Bluetooth: Fix atomicity violation in {min,max}_key_size_set rootfs: Fix support for rootfstype= when root= is given io_uring/rw: ensure io->bytes_done is always initialized pwm: jz4740: Don't use dev_err_probe() in .request() fbdev: flush deferred work in fb_deferred_io_fsync() ALSA: hda/relatek: Enable Mute LED on HP Laptop 15s-fq2xxx ALSA: oxygen: Fix right channel of capture volume mixer serial: imx: Ensure that imx_uart_rs485_config() is called with enabled clock usb: mon: Fix atomicity violation in mon_bin_vma_fault usb: typec: class: fix typec_altmode_put_partner to put plugs Revert "usb: typec: class: fix typec_altmode_put_partner to put plugs" usb: chipidea: wait controller resume finished for wakeup irq Revert "usb: dwc3: don't reset device side if dwc3 was configured as host-only" Revert "usb: dwc3: Soft reset phy on probe for host" usb: dwc: ep0: Update request status in dwc3_ep0_stall_restart usb: phy: mxs: remove CONFIG_USB_OTG condition for mxs_phy_is_otg_host() tick-sched: Fix idle and iowait sleeptime accounting vs CPU hotplug binder: fix race between mmput() and do_exit() xen-netback: don't produce zero-size SKB frags net: ethernet: mtk_eth_soc: remove duplicate if statements kprobes: Fix to handle forcibly unoptimized kprobes on freeing_list Revert "ASoC: atmel: Remove system clock tree configuration for at91sam9g20ek" virtio-crypto: fix memory leak in virtio_crypto_alg_skcipher_close_session() virtio-crypto: fix memory-leak dma-mapping: Fix build error unused-value Input: atkbd - use ab83 as id when skipping the getid command binder: fix use-after-free in shinker's callback binder: fix unused alloc->free_async_space binder: fix async space check for 0-sized buffers keys, dns: Fix size check of V1 server-list header of: unittest: Fix of_count_phandle_with_args() expected value message of: Fix double free in of_parse_phandle_with_args_map IB/iser: Prevent invalidating wrong MR mmc: sdhci_omap: Fix TI SoC dependencies mmc: sdhci_am654: Fix TI SoC dependencies pwm: stm32: Fix enable count for clk in .probe() pwm: stm32: Use hweight32 in stm32_pwm_detect_channels pwm: stm32: Use regmap_clear_bits and regmap_set_bits where applicable clk: fixed-rate: fix clk_hw_register_fixed_rate_with_accuracy_parent_hw clk: fixed-rate: add devm_clk_hw_register_fixed_rate clk: si5341: fix an error code problem in si5341_output_clk_set_rate watchdog: rti_wdt: Drop runtime pm reference count when watchdog is unused watchdog: bcm2835_wdt: Fix WDIOC_SETTIMEOUT handling watchdog/hpwdt: Only claim UNKNOWN NMI if from iLO watchdog: set cdev owner before adding drivers: clk: zynqmp: update divider round rate logic clk: zynqmp: Add a check for NULL pointer clk: zynqmp: make bestdiv unsigned drivers: clk: zynqmp: calculate closest mux rate clk: qcom: videocc-sm8150: Add missing PLL config property clk: qcom: videocc-sm8150: Update the videocc resets dt-bindings: clock: Update the videocc resets for sm8150 gpu/drm/radeon: fix two memleaks in radeon_vm_init drivers/amd/pm: fix a use-after-free in kv_parse_power_table drm/amd/pm: fix a double-free in si_dpm_init drm/amdgpu/debugfs: fix error code when smc register accessors are NULL media: dvb-frontends: m88ds3103: Fix a memory leak in an error handling path of m88ds3103_probe() media: dvbdev: drop refcount on error path in dvb_device_open() f2fs: fix to update iostat correctly in f2fs_filemap_fault() f2fs: fix to check compress file in f2fs_move_file_range() media: rkisp1: Disable runtime PM in probe error path clk: qcom: gpucc-sm8150: Update the gpu_cc_pll1 config media: cx231xx: fix a memleak in cx231xx_init_isoc drm/bridge: tc358767: Fix return value on error case drm/radeon/trinity_dpm: fix a memleak in trinity_parse_power_table drm/radeon/dpm: fix a memleak in sumo_parse_power_table drm/radeon: check the alloc_workqueue return value in radeon_crtc_init() drm/drv: propagate errors from drm_modeset_register_all() drm/msm/dsi: Use pm_runtime_resume_and_get to prevent refcnt leaks drm/msm/mdp4: flush vblank event on disable ASoC: cs35l34: Fix GPIO name and drop legacy include ASoC: cs35l33: Fix GPIO name and drop legacy include drm/radeon: check return value of radeon_ring_lock() drm/radeon/r100: Fix integer overflow issues in r100_cs_track_check() drm/radeon/r600_cs: Fix possible int overflows in r600_cs_check_reg() f2fs: fix to avoid dirent corruption drm/bridge: Fix typo in post_disable() description media: pvrusb2: fix use after free on context disconnection drm/bridge: tpd12s015: Drop buggy __exit annotation for remove function drm/nouveau/fence:: fix warning directly dereferencing a rcu pointer rcu: Create an unrcu_pointer() to remove __rcu from a pointer drm/panel-elida-kd35t133: hold panel in reset for unprepare RDMA/usnic: Silence uninitialized symbol smatch warnings ARM: davinci: always select CONFIG_CPU_ARM926T ip6_tunnel: fix NEXTHDR_FRAGMENT handling in ip6_tnl_parse_tlv_enc_lim() Bluetooth: btmtkuart: fix recv_buf() return value Bluetooth: Fix bogus check for re-auth no supported with non-ssp netfilter: nf_tables: mark newset as dead on transaction abort wifi: rtlwifi: rtl8192se: using calculate_bit_shift() wifi: rtlwifi: rtl8192ee: using calculate_bit_shift() wifi: rtlwifi: rtl8192de: using calculate_bit_shift() rtlwifi: rtl8192de: make arrays static const, makes object smaller wifi: rtlwifi: rtl8192ce: using calculate_bit_shift() wifi: rtlwifi: rtl8192cu: using calculate_bit_shift() wifi: rtlwifi: rtl8192c: using calculate_bit_shift() wifi: rtlwifi: rtl8188ee: phy: using calculate_bit_shift() wifi: rtlwifi: add calculate_bit_shift() dma-mapping: clear dev->dma_mem to NULL after freeing it dma-mapping: Add dma_release_coherent_memory to DMA API virtio/vsock: fix logic which reduces credit update messages selftests/net: fix grep checking for fib_nexthop_multiprefix scsi: hisi_sas: Replace with standard error code return value bpf: Fix verification of indirect var-off stack access arm64: dts: qcom: sdm845-db845c: correct LED panic indicator arm64: dts: qcom: qrb5165-rb5: correct LED panic indicator scsi: fnic: Return error if vmalloc() failed bpf: fix check for attempt to corrupt spilled pointer arm64: dts: ti: k3-am65-main: Fix DSS irq trigger type wifi: rtlwifi: rtl8821ae: phy: fix an undefined bitwise shift behavior firmware: meson_sm: populate platform devices from sm device tree data firmware: ti_sci: Fix an off-by-one in ti_sci_debugfs_create() net/ncsi: Fix netlink major/minor version numbers ncsi: internal.h: Fix a spello ARM: dts: qcom: apq8064: correct XOADC register address wifi: libertas: stop selecting wext wifi: ath11k: Defer on rproc_get failure bpf: Add crosstask check to __bpf_get_stack bpf, lpm: Fix check prefixlen before walking trie wifi: rtw88: fix RX filter in FIF_ALLMULTI flag NFSv4.1/pnfs: Ensure we handle the error NFS4ERR_RETURNCONFLICT blocklayoutdriver: Fix reference leak of pnfs_device_node crypto: scomp - fix req->dst buffer overflow crypto: sahara - do not resize req->src when doing hash operations crypto: sahara - fix processing hash requests with req->nbytes < sg->length crypto: sahara - improve error handling in sahara_sha_process() crypto: sahara - fix wait_for_completion_timeout() error handling crypto: sahara - fix ahash reqsize crypto: sahara - handle zero-length aes requests crypto: sahara - avoid skcipher fallback code duplication crypto: virtio - Wait for tasklet to complete on device remove gfs2: Fix kernel NULL pointer dereference in gfs2_rgrp_dump gfs2: Also reflect single-block allocations in rgd->rd_extfail_pt Revert "gfs2: Don't reject a supposedly full bitmap if we have blocks reserved" fs: indicate request originates from old mount API pstore: ram_core: fix possible overflow in persistent_ram_init_ecc() crypto: sahara - fix error handling in sahara_hw_descriptor_create() crypto: sahara - fix processing requests with cryptlen < sg->length crypto: sahara - fix ahash selftest failure crypto: sahara - fix cbc selftest failure crypto: sahara - remove FLAGS_NEW_KEY logic crypto: af_alg - Disallow multiple in-flight AIO requests crypto: ccp - fix memleak in ccp_init_dm_workarea crypto: sa2ul - Return crypto_aead_setkey to transfer the error crypto: virtio - Handle dataq logic with tasklet virtio-crypto: wait ctrl queue instead of busy polling virtio-crypto: use private buffer for control request virtio-crypto: change code style virtio-crypto: implement RSA algorithm virtio-crypto: introduce akcipher service virtio_crypto: Introduce VIRTIO_CRYPTO_NOSPC selinux: Fix error priority for bind with AF_UNSPEC on PF_INET6 socket mtd: Fix gluebi NULL pointer dereference caused by ftl notifier ACPI: extlog: Clear Extended Error Log status when RAS_CEC handled the error spi: sh-msiof: Enforce fixed DTDL for R-Car H3 efivarfs: force RO when remounting if SetVariable is not supported calipso: fix memory leak in netlbl_calipso_add_pass() netlabel: remove unused parameter in netlbl_netlink_auditinfo() net: netlabel: Fix kerneldoc warnings cpufreq: scmi: process the result of devm_of_clk_add_hw_provider() cpufreq: Use of_property_present() for testing DT property presence of: Add of_property_present() helper of: property: define of_property_read_u{8,16,32,64}_array() unconditionally ACPI: LPIT: Avoid u32 multiplication overflow ACPI: video: check for error while searching for backlight device parent mtd: rawnand: Increment IFC_TIMEOUT_MSECS for nand controller response spi: spi-zynqmp-gqspi: fix driver kconfig dependencies powerpc/imc-pmu: Add a null pointer check in update_events_in_group() powerpc/powernv: Add a null pointer check in opal_powercap_init() powerpc/powernv: Add a null pointer check in opal_event_init() powerpc/powernv: Add a null pointer check to scom_debug_init_one() selftests/powerpc: Fix error handling in FPU/VMX preemption tests powerpc/pseries/memhp: Fix access beyond end of drmem array powerpc/pseries/memhotplug: Quieten some DLPAR operations powerpc/44x: select I2C for CURRITUCK powerpc: Remove in_kernel_text() powerpc: add crtsavres.o to always-y instead of extra-y EDAC/thunderx: Fix possible out-of-bounds string access x86/lib: Fix overflow when counting digits coresight: etm4x: Fix width of CCITMIN field PCI: Add ACS quirk for more Zhaoxin Root Ports parport: parport_serial: Add Brainboxes device IDs and geometry parport: parport_serial: Add Brainboxes BAR details uio: Fix use-after-free in uio_open binder: fix comment on binder_alloc_new_buf() return value binder: fix trivial typo of binder_free_buf_locked() binder: use EPOLLERR from eventpoll.h ACPI: resource: Add another DMI match for the TongFang GMxXGxx drm/crtc: fix uninitialized variable use ARM: sun9i: smp: fix return code check of of_property_match_string net: qrtr: ns: Return 0 if server port is not present ida: Fix crash in ida_free when the bitmap is empty i2c: rk3x: fix potential spinlock recursion on poll Input: xpad - add Razer Wolverine V2 support ARC: fix spare error s390/scm: fix virtual vs physical address confusion Input: i8042 - add nomux quirk for Acer P459-G2-M Input: atkbd - skip ATKBD_CMD_GETID in translated mode reset: hisilicon: hi6220: fix Wvoid-pointer-to-enum-cast warning ring-buffer: Do not record in NMI if the arch does not support cmpxchg in NMI tracing: Add size check when printing trace_marker output tracing: Have large events show up as '[LINE TOO BIG]' instead of nothing jbd2: fix soft lockup in journal_finish_inode_data_buffers() neighbour: Don't let neigh_forced_gc() disable preemption for long drm/crtc: Fix uninit-value bug in drm_mode_setcrtc jbd2: correct the printing of write_flags in jbd2_write_superblock() clk: rockchip: rk3128: Fix HCLK_OTG gate register drm/exynos: fix a wrong error checking drm/exynos: fix a potential error pointer dereference nvme: introduce helper function to get ctrl state ASoC: da7219: Support low DC impedance headset net/tg3: fix race condition in tg3_reset_task() nouveau/tu102: flush all pdbs on vmm flush ASoC: rt5650: add mutex to avoid the jack detection failure ASoC: cs43130: Fix incorrect frame delay configuration ASoC: cs43130: Fix the position of const qualifier ASoC: Intel: Skylake: mem leak in skl register function ASoC: nau8822: Fix incorrect type in assignment and cast to restricted __be16 ASoC: Intel: Skylake: Fix mem leak in few functions ASoC: wm8974: Correct boost mixer inputs nvme-core: check for too small lba shift drm/amdgpu: Fix cat debugfs amdgpu_regs_didt causes kernel null pointer debugfs: fix automount d_fsdata usage mptcp: fix uninit-value in mptcp_incoming_options ALSA: hda - Fix speaker and headset mic pin config for CHUWI CoreBook XPro pinctrl: lochnagar: Don't build on MIPS f2fs: explicitly null-terminate the xattr list Revert "ipv6: remove max_size check inline with ipv4" ANDROID: db845c: Enable device tree overlay support Linux 5.10.208 Revert "nvme: use command_id instead of req->tag in trace_nvme_complete_rq()" PCI: Disable ATS for specific Intel IPU E2000 devices PCI: Extract ATS disabling to a helper function netfilter: nf_tables: Reject tables of unsupported family drm/qxl: fix UAF on handle creation ipv6: remove max_size check inline with ipv4 net: tls, update curr on splice as well powerpc: update ppc_save_regs to save current r1 in pt_regs mmc: sdhci-sprd: Fix eMMC init failure after hw reset mmc: core: Cancel delayed work before releasing host mmc: rpmb: fixes pause retune on all RPMB partitions. mmc: meson-mx-sdhc: Fix initialization frozen issue mm: fix unmap_mapping_range high bits shift bug i2c: core: Fix atomic xfer check for non-preempt config x86/kprobes: fix incorrect return address calculation in kprobe_emulate_call_indirect firewire: ohci: suppress unexpected system reboot in AMD Ryzen machines and ASM108x/VT630x PCIe cards mm/memory-failure: check the mapcount of the precise page net: Implement missing SO_TIMESTAMPING_NEW cmsg support bnxt_en: Remove mis-applied code from bnxt_cfg_ntp_filters() asix: Add check for usbnet_get_endpoints net/qla3xxx: fix potential memleak in ql_alloc_buffer_queues net/qla3xxx: switch from 'pci_' to 'dma_' API i40e: Restore VF MSI-X state during PCI reset ASoC: meson: g12a-tohdmitx: Fix event generation for S/PDIF mux ASoC: meson: g12a-toacodec: Fix event generation ASoC: meson: g12a-tohdmitx: Validate written enum values ASoC: meson: g12a-toacodec: Validate written enum values i40e: fix use-after-free in i40e_aqc_add_filters() net: Save and restore msg_namelen in sock_sendmsg netfilter: nft_immediate: drop chain reference counter on error netfilter: nftables: add loop check helper function net: bcmgenet: Fix FCS generation for fragmented skbuffs sfc: fix a double-free bug in efx_probe_filters ARM: sun9i: smp: Fix array-index-out-of-bounds read in sunxi_mc_smp_init net: sched: em_text: fix possible memory leak in em_text_destroy() i40e: Fix filter input checks to prevent config with invalid values drm/i915/dp: Fix passing the correct DPCD_REV for drm_dp_set_phy_test_pattern octeontx2-af: Fix marking couple of structure as __packed nfc: llcp_core: Hold a ref to llcp_local->dev when holding a ref to llcp_local ALSA: hda/realtek: Fix mute and mic-mute LEDs for HP ProBook 440 G6 block: Don't invalidate pagecache for invalid falloc modes keys, dns: Fix missing size check of V1 server-list header Revert "ANDROID: GKI: Fix abi break in struct scsi_cmd" Linux 5.10.207 scsi: core: Always send batch on reset or error handling command Revert "scsi: core: Add scsi_prot_ref_tag() helper" Revert "scsi: core: Introduce scsi_get_sector()" Revert "scsi: core: Make scsi_get_lba() return the LBA" Revert "scsi: core: Use scsi_cmd_to_rq() instead of scsi_cmnd.request" Revert "scsi: core: Use a structure member to track the SCSI command submitter" Revert "scsi: core: Always send batch on reset or error handling command" ANDROID: GKI: Fix abi break in struct scsi_cmd Linux 5.10.206 spi: atmel: Fix PDC transfer setup bug Bluetooth: SMP: Fix crash when receiving new connection when debug is enabled Revert "MIPS: Loongson64: Enable DMA noncoherent support" dm-integrity: don't modify bio's immutable bio_vec in integrity_metadata() netfilter: nf_tables: skip set commit for deleted/destroyed sets tracing: Fix blocked reader of snapshot buffer ring-buffer: Fix wake ups when buffer_percent is set to 100 scsi: core: Always send batch on reset or error handling command scsi: core: Use a structure member to track the SCSI command submitter scsi: core: Use scsi_cmd_to_rq() instead of scsi_cmnd.request scsi: core: Make scsi_get_lba() return the LBA scsi: core: Introduce scsi_get_sector() scsi: core: Add scsi_prot_ref_tag() helper spi: atmel: Fix CS and initialization bug spi: atmel: Switch to transfer_one transfer method Bluetooth: af_bluetooth: Fix Use-After-Free in bt_sock_recvmsg smb: client: fix OOB in smbCalcSize() smb: client: fix OOB in SMB2_query_info_init() usb: fotg210-hcd: delete an incorrect bounds test Bluetooth: MGMT/SMP: Fix address type when using SMP over BREDR/LE Bluetooth: use inclusive language in SMP Bluetooth: SMP: Convert BT_ERR/BT_DBG to bt_dev_err/bt_dev_dbg ARM: dts: Fix occasional boot hang for am3 usb 9p/net: fix possible memory leak in p9_check_errors() x86/alternatives: Sync core before enabling interrupts lib/vsprintf: Fix %pfwf when current node refcount == 0 bus: ti-sysc: Flush posted write only after srst_udelay tracing / synthetic: Disable events after testing in synth_event_gen_test_init() dt-bindings: nvmem: mxs-ocotp: Document fsl,ocotp net: ks8851: Fix TX stall caused by TX buffer overrun net: rfkill: gpio: set GPIO direction net: 9p: avoid freeing uninit memory in p9pdu_vreadf Input: soc_button_array - add mapping for airplane mode button Bluetooth: L2CAP: Send reject on command corrupted request Bluetooth: hci_event: Fix not checking if HCI_OP_INQUIRY has been sent USB: serial: option: add Quectel RM500Q R13 firmware support USB: serial: option: add Foxconn T99W265 with new baseline USB: serial: option: add Quectel EG912Y module support USB: serial: ftdi_sio: update Actisense PIDs constant names wifi: cfg80211: fix certs build to not depend on file order wifi: cfg80211: Add my certificate iio: adc: ti_am335x_adc: Fix return value check of tiadc_request_dma() iio: common: ms_sensors: ms_sensors_i2c: fix humidity conversion time table scsi: bnx2fc: Fix skb double free in bnx2fc_rcv() Input: ipaq-micro-keys - add error handling for devm_kmemdup iio: imu: inv_mpu6050: fix an error code problem in inv_mpu6050_read_raw interconnect: Treat xlate() returning NULL node as an error btrfs: do not allow non subvolume root targets for snapshot smb: client: fix NULL deref in asn1_ber_decoder() ALSA: hda/hdmi: add force-connect quirk for NUC5CPYB ALSA: hda/hdmi: Add quirk to force pin connectivity on NUC10 pinctrl: at91-pio4: use dedicated lock class for IRQ i2c: aspeed: Handle the coalesced stop conditions with the start conditions. afs: Fix overwriting of result of DNS query keys, dns: Allow key types (eg. DNS) to be reclaimed immediately on expiry net: check dev->gso_max_size in gso_features_check() net: warn if gso_type isn't set for a GSO SKB afs: Fix dynamic root lookup DNS check afs: Fix the dynamic root's d_delete to always delete unused dentries net: check vlan filter feature in vlan_vids_add_by_dev() and vlan_vids_del_by_dev() net/rose: fix races in rose_kill_by_device() ethernet: atheros: fix a memleak in atl1e_setup_ring_resources net: sched: ife: fix potential use-after-free net/mlx5e: Correct snprintf truncation handling for fw_version buffer used by representors net/mlx5: Fix fw tracer first block check net/mlx5e: Fix slab-out-of-bounds in mlx5_query_nic_vport_mac_list() Revert "net/mlx5e: fix double free of encap_header" wifi: mac80211: mesh_plink: fix matches_local logic s390/vx: fix save/restore of fpu kernel context reset: Fix crash when freeing non-existent optional resets ARM: OMAP2+: Fix null pointer dereference and memory leak in omap_soc_device_init smb: client: fix OOB in smb2_query_reparse_point() ksmbd: fix wrong name of SMB2_CREATE_ALLOCATION_SIZE Conflicts: Documentation/devicetree/bindings Documentation/devicetree/bindings/nvmem/mxs-ocotp.yaml Change-Id: I510554c8e4a97b8aad3b6e8a7b0abdfe742bb405 Signed-off-by: aseshu <quic_aseshu@quicinc.com>
1522 lines
43 KiB
C
1522 lines
43 KiB
C
/* SPDX-License-Identifier: GPL-2.0+ */
|
|
#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.
|
|
*/
|
|
#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;
|
|
#if defined(CONFIG_OF_DYNAMIC) || defined(CONFIG_SPARC)
|
|
unsigned long _flags;
|
|
#endif
|
|
#if defined(CONFIG_OF_PROMTREE)
|
|
unsigned int unique_id;
|
|
#endif
|
|
#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;
|
|
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)
|
|
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
|
|
fwnode_init(&node->fwnode, &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;
|
|
|
|
/*
|
|
* struct device_node flag descriptions
|
|
* (need to be visible even when !CONFIG_OF)
|
|
*/
|
|
#define OF_DYNAMIC 1 /* (and properties) allocated via kmalloc */
|
|
#define OF_DETACHED 2 /* detached from the device tree */
|
|
#define OF_POPULATED 3 /* device already created */
|
|
#define OF_POPULATED_BUS 4 /* platform bus created for children */
|
|
#define OF_OVERLAY 5 /* allocated for an overlay */
|
|
#define OF_OVERLAY_FREE_CSET 6 /* in overlay cset being freed */
|
|
|
|
#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);
|
|
}
|
|
|
|
#if defined(CONFIG_OF_DYNAMIC) || defined(CONFIG_SPARC)
|
|
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);
|
|
}
|
|
#endif
|
|
|
|
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
|
|
|
|
#define OF_IS_DYNAMIC(x) test_bit(OF_DYNAMIC, &x->_flags)
|
|
#define OF_MARK_DYNAMIC(x) set_bit(OF_DYNAMIC, &x->_flags)
|
|
|
|
extern bool of_node_name_eq(const struct device_node *np, const char *name);
|
|
extern bool of_node_name_prefix(const struct device_node *np, const char *prefix);
|
|
|
|
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);
|
|
extern struct device_node *of_get_next_cpu_node(struct device_node *prev);
|
|
extern struct device_node *of_get_cpu_state_node(struct device_node *cpu_node,
|
|
int index);
|
|
|
|
#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_args_map(const struct device_node *np,
|
|
const char *list_name, const char *stem_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_alias_get_alias_list(const struct of_device_id *matches,
|
|
const char *stem, unsigned long *bitmap,
|
|
unsigned int nbits);
|
|
|
|
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)
|
|
|
|
/*
|
|
* 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);
|
|
|
|
int of_map_id(struct device_node *np, u32 id,
|
|
const char *map_name, const char *map_mask_name,
|
|
struct device_node **target, u32 *id_out);
|
|
|
|
phys_addr_t of_dma_get_max_cpu_address(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 bool of_node_name_eq(const struct device_node *np, const char *name)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
static inline bool of_node_name_prefix(const struct device_node *np, const char *prefix)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
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_parent(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_u64_index(const struct device_node *np,
|
|
const char *propname, u32 index, u64 *out_value)
|
|
{
|
|
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 struct device_node *of_get_next_cpu_node(struct device_node *prev)
|
|
{
|
|
return NULL;
|
|
}
|
|
|
|
static inline struct device_node *of_get_cpu_state_node(struct device_node *cpu_node,
|
|
int index)
|
|
{
|
|
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_variable_u8_array(const struct device_node *np,
|
|
const char *propname, u8 *out_values,
|
|
size_t sz_min, size_t sz_max)
|
|
{
|
|
return -ENOSYS;
|
|
}
|
|
|
|
static inline 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)
|
|
{
|
|
return -ENOSYS;
|
|
}
|
|
|
|
static inline 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)
|
|
{
|
|
return -ENOSYS;
|
|
}
|
|
|
|
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_read_variable_u64_array(const struct device_node *np,
|
|
const char *propname,
|
|
u64 *out_values,
|
|
size_t sz_min,
|
|
size_t sz_max)
|
|
{
|
|
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_match_string(const struct device_node *np,
|
|
const char *propname,
|
|
const char *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 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_args_map(const struct device_node *np,
|
|
const char *list_name,
|
|
const char *stem_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_alias_get_alias_list(const struct of_device_id *matches,
|
|
const char *stem, unsigned long *bitmap,
|
|
unsigned int nbits)
|
|
{
|
|
return -ENOSYS;
|
|
}
|
|
|
|
static inline int of_machine_is_compatible(const char *compat)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
static inline int of_add_property(struct device_node *np, struct property *prop)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
static inline int of_remove_property(struct device_node *np, struct property *prop)
|
|
{
|
|
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;
|
|
}
|
|
|
|
static inline int of_map_id(struct device_node *np, u32 id,
|
|
const char *map_name, const char *map_mask_name,
|
|
struct device_node **target, u32 *id_out)
|
|
{
|
|
return -EINVAL;
|
|
}
|
|
|
|
static inline phys_addr_t of_dma_get_max_cpu_address(struct device_node *np)
|
|
{
|
|
return PHYS_ADDR_MAX;
|
|
}
|
|
|
|
#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
|
|
|
|
static inline int of_prop_val_eq(struct property *p1, struct property *p2)
|
|
{
|
|
return p1->length == p2->length &&
|
|
!memcmp(p1->value, p2->value, (size_t)p1->length);
|
|
}
|
|
|
|
#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);
|
|
}
|
|
|
|
static inline const char *of_node_get_device_type(const struct device_node *np)
|
|
{
|
|
return of_get_property(np, "device_type", NULL);
|
|
}
|
|
|
|
static inline bool of_node_is_type(const struct device_node *np, const char *type)
|
|
{
|
|
const char *match = of_node_get_device_type(np);
|
|
|
|
return np && match && type && !strcmp(match, type);
|
|
}
|
|
|
|
/**
|
|
* 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.
|
|
*
|
|
* Return: The 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.
|
|
*
|
|
* Return: The 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.
|
|
*
|
|
* Return: The 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.
|
|
*
|
|
* Return: The 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.
|
|
*
|
|
* Return: 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.
|
|
*
|
|
* Return: 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.
|
|
*
|
|
* Return: 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 - Find 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 boolean property in a device node. Usage on non-boolean
|
|
* property types is deprecated.
|
|
*
|
|
* Return: 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;
|
|
}
|
|
|
|
/**
|
|
* of_property_present - Test if a property is present in a node
|
|
* @np: device node to search for the property.
|
|
* @propname: name of the property to be searched.
|
|
*
|
|
* Test for a property present in a device node.
|
|
*
|
|
* Return: true if the property exists false otherwise.
|
|
*/
|
|
static inline bool of_property_present(const struct device_node *np, const char *propname)
|
|
{
|
|
return of_property_read_bool(np, propname);
|
|
}
|
|
|
|
/**
|
|
* 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.
|
|
*
|
|
* dts entry of array should be like:
|
|
* ``property = /bits/ 8 <0x50 0x60 0x70>;``
|
|
*
|
|
* Return: 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 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.
|
|
*
|
|
* dts entry of array should be like:
|
|
* ``property = /bits/ 16 <0x5000 0x6000 0x7000>;``
|
|
*
|
|
* Return: 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 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.
|
|
*
|
|
* Return: 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.
|
|
*
|
|
* Return: 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;
|
|
}
|
|
|
|
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_of_cpu_node(cpu) \
|
|
for (cpu = of_get_next_cpu_node(NULL); cpu != NULL; \
|
|
cpu = of_get_next_cpu_node(cpu))
|
|
|
|
#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;
|
|
}
|
|
|
|
#include <soc/qcom/of_common.h>
|
|
|
|
#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 */
|
|
|
|
/**
|
|
* 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 = 0,
|
|
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
|
|
|
|
int of_overlay_fdt_apply(const void *overlay_fdt, u32 overlay_fdt_size,
|
|
int *ovcs_id);
|
|
int of_overlay_remove(int *ovcs_id);
|
|
int of_overlay_remove_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_fdt_apply(void *overlay_fdt, u32 overlay_fdt_size,
|
|
int *ovcs_id)
|
|
{
|
|
return -ENOTSUPP;
|
|
}
|
|
|
|
static inline int of_overlay_remove(int *ovcs_id)
|
|
{
|
|
return -ENOTSUPP;
|
|
}
|
|
|
|
static inline int of_overlay_remove_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 */
|