This patch set aims to reduce the dependencies between headers, in
order to have cleaner code and speed up the build. It continues
previous efforts by other developers.
As a preparation, the first patch adds "#include" directives to source
files that were missing previously, but due to indirect includes, this
was never noticed. After the cleanup, many missing directives would
result in a compiler failure.
The second patch removes superfluous "#include" directives, some of
which may be a leftover from refactoring patches.
The third patch replaces existing "#include" directives with narrower
ones, e.g. use "spinlock_types.h" instead of "spinlock.h". This
continues the work others have done over the years.
The remaining patches add new "XXX_types.h" headers with lighter
dependencies. They have only basic struct/enum/const/macro
definitions and maybe a few trivial inline functions, but no "extern"
functions and no complex header dependencies.
Just like the other attempts to reduce header dependencies in the
past, this is just the beginning. There are still too many
dependencies, and the speedup gained by this large patch set is not
yet impressive.
Prior to this patch set:
real 0m34.677s
user 23m13.045s
sys 2m26.007s
With this patch set:
real 0m34.120s
user 22m45.595s
sys 2m21.611s
(Building the directories kernel,lib,mm on ARM64 "allyesconfig".)
I have tested this patch set with arm64 and amd64. Pretty sure, other
architectures may fail to build, but before I test all of them, I'd
like to get some feedback on wheter my approach would be accepted.
For more gains, huge headers like "linux/mm.h", "linux/fs.h" and
"linux/sched.h" would need to be optimized. Nearly everybody includes
them, and they include nearly everything.
Max Kellermann (28):
include: add missing includes
include: remove unnecessary #include directives
include: reduce header dependencies by using "*_types.h"
workqueue.h: move struct delayed_work to workqueue_types.h
kref.h: move declarations to kref_types.h
kobject.h: move declarations to kobject_types.h
sysfs.h: move declarations to sysfs_types.h
maple_tree.h: move declarations to maple_tree_types.h
rwsem.h: move declarations to rwsem_types.h
uprobes.h: move declarations to uprobes_types.h
percpu_counter.h: move declarations to percpu_counter_types.h
bvec.h: move declarations to bvec_types.h
wait.h: move declarations to wait_types.h
swait.h: move declarations to swait_types.h
completion.h: move declarations to completion_types.h
device.h: move declarations to device_types.h
xarray.h: move declarations to xarray_types.h
blkdev.h: move blk_op_is_passthrough() to blk_types.h
bio.h: move bio_has_data() and bio_no_advance_iter() to blk_types.h
bio.h: move declarations to bio_types.h
percpu-refcount.h: move declarations to percpu-refcount_types.h
blkdev.h: move declarations to blkdev_types.h
sbitmap.h: move declarations to sbitmap_types.h
list_lru.h: move declarations to list_lru_types.h
list_bl.h: move declarations to list_bl_types.h
percpu-rwsem.h: move declarations to percpu-rwsem_types.h
quota.h: move declarations to quota_types.h
radix-tree.h: move declarations to radix-tree_types.h
arch/arm64/kernel/cpufeature.c | 1 +
arch/arm64/kernel/cpuinfo.c | 2 +
arch/arm64/kernel/ftrace.c | 1 +
arch/arm64/kernel/mte.c | 2 +
arch/arm64/kernel/signal.c | 1 +
arch/arm64/kvm/arch_timer.c | 2 +
arch/arm64/kvm/hypercalls.c | 1 +
arch/arm64/kvm/vgic/vgic-mmio-v3.c | 1 +
arch/arm64/kvm/vgic/vgic-mmio.c | 1 +
arch/arm64/kvm/vgic/vgic-v2.c | 1 +
arch/arm64/kvm/vgic/vgic-v3.c | 1 +
arch/arm64/kvm/vgic/vgic-v4.c | 1 +
arch/arm64/kvm/vgic/vgic.h | 1 +
arch/x86/events/amd/uncore.c | 1 +
arch/x86/events/intel/uncore.c | 1 +
arch/x86/events/rapl.c | 1 +
arch/x86/kernel/cpu/intel.c | 1 +
arch/x86/kernel/cpu/umwait.c | 1 +
arch/x86/kvm/vmx/nested.c | 1 +
arch/x86/kvm/xen.c | 1 +
arch/x86/platform/efi/runtime-map.c | 1 +
block/bdev.c | 1 +
block/bfq-iosched.c | 1 +
block/blk-cgroup.c | 1 +
block/blk-crypto-sysfs.c | 2 +
block/blk-ia-ranges.c | 2 +
block/blk-iocost.c | 1 +
block/blk-mq-sched.c | 1 +
block/blk-mq-sysfs.c | 1 +
block/blk-mq.c | 1 +
block/blk-mq.h | 1 +
block/blk-sysfs.c | 1 +
block/bsg-lib.c | 1 +
block/bsg.c | 1 +
block/disk-events.c | 2 +
block/early-lookup.c | 1 +
block/elevator.c | 1 +
block/elevator.h | 1 +
block/genhd.c | 1 +
block/holder.c | 2 +
block/kyber-iosched.c | 2 +
block/mq-deadline.c | 2 +
block/partitions/core.c | 2 +
drivers/accel/ivpu/ivpu_pm.c | 1 +
.../accessibility/speakup/speakup_acntpc.c | 1 +
.../accessibility/speakup/speakup_acntsa.c | 2 +
.../accessibility/speakup/speakup_apollo.c | 1 +
.../accessibility/speakup/speakup_audptr.c | 2 +
drivers/accessibility/speakup/speakup_bns.c | 2 +
.../accessibility/speakup/speakup_decext.c | 1 +
drivers/accessibility/speakup/speakup_decpc.c | 1 +
.../accessibility/speakup/speakup_dectlk.c | 1 +
drivers/accessibility/speakup/speakup_dtlk.c | 1 +
drivers/accessibility/speakup/speakup_dummy.c | 2 +
drivers/accessibility/speakup/speakup_keypc.c | 1 +
drivers/accessibility/speakup/speakup_ltlk.c | 2 +
drivers/accessibility/speakup/speakup_soft.c | 1 +
.../accessibility/speakup/speakup_spkout.c | 2 +
drivers/accessibility/speakup/speakup_txprt.c | 2 +
drivers/acpi/ac.c | 1 +
drivers/acpi/acpi_fpdt.c | 1 +
drivers/acpi/acpi_ipmi.c | 1 +
drivers/acpi/bgrt.c | 1 +
drivers/acpi/bus.c | 1 +
drivers/acpi/container.c | 1 +
drivers/acpi/device_sysfs.c | 1 +
drivers/acpi/dock.c | 1 +
drivers/acpi/ec.c | 1 +
drivers/acpi/pfr_telemetry.c | 1 +
drivers/acpi/sbs.c | 1 +
drivers/acpi/sysfs.c | 1 +
drivers/ata/libata-acpi.c | 1 +
drivers/ata/libata-core.c | 1 +
drivers/ata/pata_parport/pata_parport.c | 1 +
drivers/base/base.h | 5 +
drivers/base/container.c | 1 +
drivers/base/core.c | 1 +
drivers/base/devcoredump.c | 1 +
drivers/base/firmware_loader/builtin/main.c | 1 +
drivers/base/firmware_loader/fallback.c | 1 +
drivers/base/firmware_loader/sysfs.c | 1 +
drivers/base/soc.c | 1 +
drivers/base/swnode.c | 1 +
drivers/base/topology.c | 2 +
drivers/base/transport_class.c | 3 +
drivers/block/drbd/drbd_nl.c | 1 +
drivers/block/loop.c | 1 +
drivers/block/nbd.c | 1 +
drivers/block/null_blk/main.c | 1 +
drivers/block/rnbd/rnbd-clt-sysfs.c | 1 +
drivers/block/rnbd/rnbd-clt.c | 1 +
drivers/block/rnbd/rnbd-srv.c | 1 +
drivers/block/ublk_drv.c | 1 +
drivers/block/virtio_blk.c | 1 +
drivers/block/xen-blkback/blkback.c | 2 +
drivers/block/zram/zcomp.c | 1 +
drivers/bus/mhi/ep/main.c | 2 +
drivers/bus/mhi/host/init.c | 1 +
drivers/char/hw_random/core.c | 1 +
drivers/char/hw_random/virtio-rng.c | 1 +
drivers/char/ipmi/ipmi_msghandler.c | 2 +
drivers/char/misc.c | 1 +
drivers/char/ppdev.c | 1 +
drivers/char/tpm/tpm-chip.c | 1 +
drivers/char/virtio_console.c | 1 +
drivers/char/xillybus/xillybus_class.c | 1 +
drivers/char/xillybus/xillyusb.c | 1 +
drivers/clk/clk.c | 1 +
drivers/clk/qcom/clk-regmap-mux-div.h | 1 +
drivers/clk/qcom/gdsc.c | 1 +
drivers/clk/samsung/clk-cpu.h | 2 +
drivers/clk/sunxi-ng/ccu_common.h | 1 +
drivers/comedi/comedi_buf.c | 1 +
drivers/comedi/comedi_fops.c | 2 +
drivers/counter/counter-chrdev.c | 1 +
drivers/cpufreq/apple-soc-cpufreq.c | 1 +
drivers/cpufreq/cpufreq_governor.h | 1 +
drivers/cpufreq/freq_table.c | 1 +
drivers/cxl/core/port.c | 1 +
drivers/cxl/cxl.h | 4 +
drivers/cxl/cxlmem.h | 1 +
drivers/dax/bus.c | 2 +
drivers/devfreq/devfreq-event.c | 1 +
drivers/devfreq/event/rockchip-dfi.c | 1 +
drivers/dma-buf/st-dma-fence.c | 1 +
drivers/dma/ioat/sysfs.c | 1 +
drivers/dma/qcom/hidma_mgmt_sys.c | 1 +
drivers/eisa/eisa-bus.c | 1 +
drivers/extcon/devres.c | 1 +
drivers/extcon/extcon.h | 1 +
drivers/firmware/arm_ffa/bus.c | 2 +
drivers/firmware/arm_scmi/bus.c | 1 +
drivers/firmware/dmi-id.c | 1 +
drivers/firmware/dmi-sysfs.c | 1 +
drivers/firmware/dmi_scan.c | 1 +
drivers/firmware/edd.c | 1 +
.../firmware/efi/libstub/efi-stub-helper.c | 1 +
drivers/firmware/google/gsmi.c | 1 +
drivers/firmware/memmap.c | 2 +
drivers/firmware/qemu_fw_cfg.c | 1 +
drivers/fpga/dfl.c | 2 +
drivers/gnss/core.c | 1 +
drivers/gpio/gpio-tegra.c | 1 +
drivers/gpio/gpio-tegra186.c | 1 +
drivers/gpio/gpio-thunderx.c | 1 +
drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.h | 1 +
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 1 +
drivers/gpu/drm/amd/amdgpu/amdgpu_ih.h | 3 +
.../arm/display/komeda/komeda_color_mgmt.c | 2 +
drivers/gpu/drm/drm_auth.c | 1 +
drivers/gpu/drm/drm_connector.c | 1 +
drivers/gpu/drm/drm_drv.c | 1 +
drivers/gpu/drm/i915/i915_perf.c | 1 +
drivers/gpu/drm/i915/i915_perf_types.h | 1 +
drivers/gpu/drm/i915/i915_scatterlist.h | 1 +
drivers/gpu/drm/mcde/mcde_clk_div.c | 1 +
drivers/gpu/drm/msm/msm_drv.h | 1 +
drivers/gpu/drm/msm/msm_gem.h | 1 +
drivers/gpu/drm/nouveau/dispnv50/disp.c | 1 +
drivers/gpu/drm/nouveau/nvkm/core/memory.c | 2 +
.../gpu/drm/nouveau/nvkm/engine/fifo/cgrp.c | 1 +
.../gpu/drm/nouveau/nvkm/engine/fifo/chid.c | 2 +
drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmm.c | 1 +
.../gpu/drm/renesas/rcar-du/rcar_du_encoder.c | 1 +
.../drm/renesas/rcar-du/rcar_du_writeback.c | 2 +
drivers/gpu/drm/sun4i/sun4i_layer.c | 2 +
drivers/gpu/drm/sun4i/sun4i_tcon_dclk.c | 1 +
drivers/gpu/drm/tidss/tidss_encoder.c | 1 +
drivers/gpu/drm/tidss/tidss_plane.c | 1 +
drivers/gpu/drm/xe/xe_gpu_scheduler.c | 2 +
drivers/gpu/drm/xe/xe_guc_ct.h | 2 +
drivers/greybus/connection.c | 1 +
drivers/greybus/core.c | 1 +
drivers/greybus/operation.c | 1 +
drivers/hid/hid-core.c | 2 +
drivers/hid/hid-cougar.c | 1 +
drivers/hid/hid-debug.c | 1 +
drivers/hid/hid-logitech-dj.c | 1 +
drivers/hid/hid-wiimote-core.c | 1 +
drivers/hid/intel-ish-hid/ishtp/bus.c | 1 +
drivers/hid/wacom_sys.c | 2 +
drivers/hwmon/acpi_power_meter.c | 1 +
drivers/hwmon/coretemp.c | 1 +
drivers/hwmon/nct6775-core.c | 1 +
drivers/hwtracing/stm/core.c | 1 +
drivers/iio/adc/ti-tsc2046.c | 1 +
drivers/iio/buffer/industrialio-buffer-dma.c | 1 +
drivers/iio/industrialio-buffer.c | 1 +
drivers/infiniband/core/cache.c | 1 +
drivers/infiniband/core/cm.c | 1 +
drivers/infiniband/core/counters.c | 2 +
drivers/infiniband/core/device.c | 2 +
drivers/infiniband/core/restrack.c | 1 +
drivers/infiniband/core/sysfs.c | 1 +
drivers/infiniband/hw/erdma/erdma_cm.c | 1 +
drivers/infiniband/hw/erdma/erdma_qp.c | 2 +
drivers/infiniband/hw/hfi1/rc.c | 1 +
drivers/infiniband/hw/mlx4/sysfs.c | 1 +
drivers/infiniband/hw/qedr/qedr_iw_cm.c | 2 +
drivers/infiniband/hw/qib/qib_file_ops.c | 1 +
drivers/infiniband/hw/usnic/usnic_ib_main.c | 1 +
drivers/infiniband/hw/usnic/usnic_ib_sysfs.c | 1 +
drivers/infiniband/sw/rdmavt/cq.c | 1 +
drivers/infiniband/sw/rdmavt/qp.c | 1 +
drivers/infiniband/sw/rxe/rxe_pool.h | 2 +
drivers/infiniband/sw/rxe/rxe_queue.c | 1 +
drivers/infiniband/sw/siw/siw.h | 1 +
drivers/infiniband/ulp/isert/ib_isert.c | 1 +
drivers/infiniband/ulp/rtrs/rtrs-clt-sysfs.c | 2 +
drivers/infiniband/ulp/rtrs/rtrs-clt.c | 1 +
drivers/infiniband/ulp/rtrs/rtrs-srv-sysfs.c | 2 +
drivers/infiniband/ulp/rtrs/rtrs-srv.c | 1 +
drivers/infiniband/ulp/rtrs/rtrs.c | 1 +
drivers/infiniband/ulp/srp/ib_srp.c | 1 +
drivers/infiniband/ulp/srpt/ib_srpt.c | 1 +
drivers/input/input.c | 1 +
drivers/input/serio/serio.c | 1 +
drivers/input/vivaldi-fmap.c | 1 +
drivers/iommu/virtio-iommu.c | 1 +
drivers/ipack/ipack.c | 1 +
drivers/isdn/mISDN/core.c | 1 +
drivers/leds/led-triggers.c | 1 +
drivers/mailbox/mailbox.c | 1 +
drivers/mcb/mcb-core.c | 1 +
drivers/md/bcache/bset.c | 1 +
drivers/md/bcache/sysfs.h | 2 +
drivers/md/dm-verity-target.c | 1 +
drivers/media/cec/core/cec-core.c | 1 +
drivers/media/cec/core/cec-pin.c | 1 +
drivers/media/dvb-core/dvb_ca_en50221.c | 1 +
drivers/media/dvb-core/dvb_frontend.c | 1 +
drivers/media/dvb-core/dvbdev.c | 1 +
drivers/media/mc/mc-devnode.c | 1 +
drivers/media/pci/pt3/pt3.c | 1 +
drivers/media/rc/rc-main.c | 1 +
drivers/memory/tegra/tegra234.c | 1 +
drivers/memstick/core/memstick.c | 1 +
drivers/mfd/abx500-core.c | 1 +
drivers/misc/cardreader/alcor_pci.c | 1 +
drivers/misc/dw-xdata-pcie.c | 1 +
drivers/misc/genwqe/card_dev.c | 1 +
drivers/misc/lkdtm/heap.c | 1 +
drivers/misc/mei/bus.c | 1 +
drivers/misc/mei/client.c | 1 +
drivers/misc/mei/debugfs.c | 1 +
drivers/misc/mei/main.c | 1 +
drivers/misc/pci_endpoint_test.c | 1 +
drivers/misc/ti-st/st_kim.c | 1 +
drivers/misc/tifm_core.c | 1 +
drivers/misc/vcpu_stall_detector.c | 1 +
drivers/misc/xilinx_sdfec.c | 1 +
drivers/most/most_cdev.c | 1 +
drivers/mtd/mtd_blkdevs.c | 2 +
drivers/net/bonding/bond_main.c | 1 +
.../net/can/spi/mcp251xfd/mcp251xfd-core.c | 1 +
.../net/can/spi/mcp251xfd/mcp251xfd-ring.c | 2 +
drivers/net/can/spi/mcp251xfd/mcp251xfd-rx.c | 1 +
drivers/net/can/spi/mcp251xfd/mcp251xfd-tef.c | 1 +
.../chelsio/inline_crypto/chtls/chtls.h | 1 +
.../chelsio/inline_crypto/chtls/chtls_cm.c | 1 +
.../ethernet/chelsio/libcxgb/libcxgb_ppm.c | 1 +
drivers/net/ethernet/cortina/gemini.c | 1 +
drivers/net/ethernet/freescale/fec_ptp.c | 1 +
drivers/net/ethernet/hisilicon/hip04_eth.c | 1 +
drivers/net/ethernet/intel/ice/ice_sriov.c | 2 +
drivers/net/ethernet/intel/ice/ice_vf_lib.c | 2 +
.../net/ethernet/mellanox/mlx5/core/lag/lag.c | 1 +
.../ethernet/mellanox/mlx5/core/lib/devcom.c | 1 +
drivers/net/ethernet/mellanox/mlx5/core/uar.c | 1 +
.../netronome/nfp/nfpcore/nfp_cppcore.c | 1 +
drivers/net/ethernet/qlogic/qede/qede_rdma.c | 1 +
.../ethernet/qlogic/qlcnic/qlcnic_minidump.c | 2 +
.../ethernet/qualcomm/rmnet/rmnet_map_data.c | 1 +
drivers/net/ethernet/ti/am65-cpsw-nuss.c | 1 +
drivers/net/mdio/mdio-mux-meson-gxl.c | 1 +
drivers/net/mdio/mdio-mux-multiplexer.c | 1 +
drivers/net/pse-pd/pse_core.c | 1 +
drivers/net/wireless/ath/carl9170/tx.c | 1 +
drivers/net/wireless/ath/wil6210/interrupt.c | 1 +
.../net/wireless/intel/iwlwifi/pcie/trans.c | 1 +
.../wireless/mediatek/mt76/mt76x02_usb_core.c | 2 +
drivers/net/wireless/virtual/mac80211_hwsim.c | 1 +
drivers/net/wwan/iosm/iosm_ipc_imem.c | 1 +
drivers/net/xen-netback/xenbus.c | 1 +
drivers/nvdimm/bus.c | 1 +
drivers/nvdimm/core.c | 1 +
drivers/nvdimm/dimm.c | 1 +
drivers/nvdimm/dimm_devs.c | 1 +
drivers/nvme/host/core.c | 1 +
drivers/nvme/host/fc.c | 1 +
drivers/nvme/host/nvme.h | 1 +
drivers/nvme/target/fc.c | 1 +
drivers/nvme/target/nvmet.h | 1 +
drivers/of/dynamic.c | 1 +
drivers/of/kobj.c | 1 +
drivers/of/of_numa.c | 1 +
drivers/of/unittest.c | 1 +
drivers/pci/controller/vmd.c | 1 +
drivers/pci/host-bridge.c | 1 +
drivers/pci/hotplug/acpiphp_glue.c | 1 +
drivers/pci/iov.c | 1 +
drivers/pci/pci.c | 1 +
drivers/pci/slot.c | 1 +
drivers/pci/switch/switchtec.c | 2 +
drivers/pcmcia/cs.c | 1 +
drivers/pcmcia/ds.c | 1 +
drivers/perf/thunderx2_pmu.c | 1 +
drivers/platform/chrome/wilco_ec/telemetry.c | 1 +
drivers/platform/surface/aggregator/bus.c | 1 +
drivers/platform/x86/amd/pmf/tee-if.c | 1 +
.../dell/dell-wmi-sysman/biosattr-interface.c | 1 +
.../dell/dell-wmi-sysman/enum-attributes.c | 2 +
.../x86/dell/dell-wmi-sysman/int-attributes.c | 2 +
.../dell/dell-wmi-sysman/passobj-attributes.c | 3 +
.../dell-wmi-sysman/passwordattr-interface.c | 1 +
.../dell/dell-wmi-sysman/string-attributes.c | 2 +
.../x86/dell/dell-wmi-sysman/sysman.c | 1 +
drivers/platform/x86/hp/hp-bioscfg/bioscfg.c | 1 +
.../x86/hp/hp-bioscfg/enum-attributes.c | 3 +
.../x86/hp/hp-bioscfg/int-attributes.c | 3 +
.../x86/hp/hp-bioscfg/order-list-attributes.c | 2 +
.../x86/hp/hp-bioscfg/passwdobj-attributes.c | 3 +
.../x86/hp/hp-bioscfg/spmobj-attributes.c | 2 +
.../x86/hp/hp-bioscfg/string-attributes.c | 3 +
.../x86/hp/hp-bioscfg/surestart-attributes.c | 2 +
drivers/platform/x86/intel/pmt/telemetry.c | 1 +
.../uncore-frequency-common.c | 1 +
.../uncore-frequency-common.h | 1 +
drivers/platform/x86/think-lmi.c | 1 +
drivers/platform/x86/wmi.c | 1 +
drivers/pmdomain/governor.c | 1 +
drivers/power/reset/ltc2952-poweroff.c | 1 +
drivers/power/supply/power_supply_sysfs.c | 1 +
drivers/powercap/dtpm.c | 1 +
drivers/pps/clients/pps-ktimer.c | 1 +
drivers/pps/clients/pps-ldisc.c | 1 +
drivers/pps/clients/pps_parport.c | 1 +
drivers/pps/kapi.c | 1 +
drivers/pps/pps.c | 2 +
drivers/rapidio/rio-driver.c | 1 +
drivers/rpmsg/mtk_rpmsg.c | 1 +
drivers/rpmsg/qcom_glink_native.c | 1 +
drivers/rpmsg/qcom_smd.c | 1 +
drivers/rpmsg/virtio_rpmsg_bus.c | 1 +
drivers/rtc/class.c | 1 +
drivers/rtc/interface.c | 1 +
drivers/scsi/bnx2fc/bnx2fc_els.c | 2 +
drivers/scsi/bnx2fc/bnx2fc_fcoe.c | 1 +
drivers/scsi/bnx2fc/bnx2fc_hwi.c | 2 +
drivers/scsi/bnx2fc/bnx2fc_io.c | 2 +
drivers/scsi/bnx2fc/bnx2fc_tgt.c | 3 +
drivers/scsi/ch.c | 1 +
drivers/scsi/cxgbi/libcxgbi.h | 1 +
drivers/scsi/device_handler/scsi_dh_alua.c | 1 +
drivers/scsi/device_handler/scsi_dh_rdac.c | 1 +
drivers/scsi/elx/efct/efct_hw.c | 2 +
drivers/scsi/elx/efct/efct_io.c | 2 +
drivers/scsi/elx/efct/efct_lio.c | 2 +
drivers/scsi/elx/efct/efct_scsi.c | 2 +
drivers/scsi/elx/efct/efct_unsol.c | 2 +
drivers/scsi/elx/libefc/efc_domain.c | 2 +
drivers/scsi/elx/libefc/efc_els.c | 1 +
drivers/scsi/elx/libefc/efc_node.c | 2 +
drivers/scsi/elx/libefc/efc_nport.c | 2 +
drivers/scsi/fcoe/fcoe_ctlr.c | 1 +
drivers/scsi/hosts.c | 1 +
drivers/scsi/ipr.c | 1 +
drivers/scsi/isci/isci.h | 1 +
drivers/scsi/iscsi_boot_sysfs.c | 1 +
drivers/scsi/libfc/fc_disc.c | 1 +
drivers/scsi/libfc/fc_exch.c | 1 +
drivers/scsi/libfc/fc_lport.c | 1 +
drivers/scsi/libfc/fc_rport.c | 1 +
drivers/scsi/libsas/sas_internal.h | 1 +
drivers/scsi/lpfc/lpfc_bsg.c | 1 +
drivers/scsi/lpfc/lpfc_debugfs.c | 1 +
drivers/scsi/lpfc/lpfc_els.c | 1 +
drivers/scsi/lpfc/lpfc_hbadisc.c | 1 +
drivers/scsi/lpfc/lpfc_init.c | 2 +
drivers/scsi/lpfc/lpfc_nportdisc.c | 1 +
drivers/scsi/lpfc/lpfc_nvme.c | 1 +
drivers/scsi/lpfc/lpfc_nvmet.c | 1 +
drivers/scsi/lpfc/lpfc_sli.c | 1 +
drivers/scsi/mpi3mr/mpi3mr.h | 1 +
drivers/scsi/mpt3sas/mpt3sas_base.h | 1 +
drivers/scsi/qedf/qedf_dbg.c | 1 +
drivers/scsi/qedf/qedf_els.c | 2 +
drivers/scsi/qedf/qedf_io.c | 1 +
drivers/scsi/qedf/qedf_main.c | 1 +
drivers/scsi/qla2xxx/qla_inline.h | 3 +
drivers/scsi/qla4xxx/ql4_isr.c | 2 +
drivers/scsi/qla4xxx/ql4_nx.c | 1 +
drivers/scsi/qla4xxx/ql4_os.c | 1 +
drivers/scsi/scsi_lib.c | 1 +
drivers/scsi/scsi_scan.c | 1 +
drivers/scsi/scsi_sysfs.c | 2 +
drivers/scsi/ses.c | 1 +
drivers/scsi/sg.c | 1 +
drivers/slimbus/slimbus.h | 1 +
drivers/soc/nuvoton/wpcm450-soc.c | 1 +
drivers/soc/qcom/smem_state.c | 1 +
drivers/soundwire/bus.c | 1 +
drivers/soundwire/intel_auxdevice.c | 1 +
drivers/spi/spi-stm32.c | 1 +
drivers/staging/fbtft/fb_ssd1351.c | 1 +
drivers/staging/fieldbus/dev_core.c | 1 +
.../staging/greybus/audio_manager_module.c | 1 +
drivers/staging/greybus/authentication.c | 1 +
drivers/staging/greybus/fw-download.c | 1 +
drivers/staging/greybus/fw-management.c | 1 +
drivers/staging/greybus/gbphy.c | 1 +
.../interface/vchiq_arm/vchiq_bus.c | 1 +
drivers/target/iscsi/iscsi_target.c | 1 +
drivers/target/iscsi/iscsi_target_nego.c | 1 +
drivers/target/iscsi/iscsi_target_tpg.c | 1 +
drivers/target/target_core_alua.c | 1 +
drivers/target/target_core_device.c | 1 +
drivers/target/target_core_fabric_configfs.c | 1 +
drivers/target/target_core_file.c | 1 +
drivers/target/target_core_pr.c | 2 +
drivers/target/target_core_tmr.c | 2 +
drivers/target/target_core_tpg.c | 1 +
drivers/target/target_core_transport.c | 1 +
drivers/target/target_core_user.c | 1 +
drivers/target/target_core_xcopy.c | 2 +
drivers/tee/tee_core.c | 1 +
drivers/thermal/devfreq_cooling.c | 1 +
drivers/thermal/intel/intel_powerclamp.c | 1 +
drivers/thermal/intel/therm_throt.c | 1 +
drivers/thunderbolt/domain.c | 1 +
drivers/thunderbolt/switch.c | 1 +
drivers/thunderbolt/tb.c | 1 +
drivers/thunderbolt/xdomain.c | 1 +
drivers/tty/rpmsg_tty.c | 1 +
drivers/tty/serial/8250/8250_bcm7271.c | 1 +
drivers/tty/serial/8250/8250_port.c | 1 +
drivers/tty/serial/imx.c | 1 +
drivers/tty/serial/serial_base.h | 2 +
drivers/tty/serial/sh-sci.c | 1 +
drivers/tty/serial/xilinx_uartps.c | 1 +
drivers/tty/tty_io.c | 1 +
drivers/usb/cdns3/cdnsp-mem.c | 1 +
drivers/usb/chipidea/otg_fsm.c | 1 +
drivers/usb/core/config.c | 1 +
drivers/usb/core/driver.c | 1 +
drivers/usb/core/hcd.c | 1 +
drivers/usb/core/hub.c | 1 +
drivers/usb/core/message.c | 1 +
drivers/usb/core/urb.c | 1 +
drivers/usb/dwc2/hcd_queue.c | 1 +
drivers/usb/gadget/function/f_fs.c | 1 +
drivers/usb/gadget/function/f_ncm.c | 1 +
drivers/usb/gadget/udc/core.c | 1 +
drivers/usb/gadget/udc/max3420_udc.c | 1 +
drivers/usb/host/oxu210hp-hcd.c | 1 +
drivers/usb/misc/usblcd.c | 1 +
drivers/usb/roles/class.c | 1 +
drivers/usb/typec/bus.c | 1 +
drivers/usb/typec/class.c | 1 +
drivers/usb/typec/class.h | 1 +
drivers/usb/typec/pd.c | 1 +
drivers/vdpa/vdpa_user/vduse_dev.c | 1 +
drivers/vfio/container.c | 1 +
drivers/vfio/group.c | 1 +
drivers/vfio/mdev/mdev_core.c | 1 +
drivers/vfio/mdev/mdev_sysfs.c | 1 +
drivers/vhost/scsi.c | 1 +
.../fbdev/omap2/omapfb/dss/display-sysfs.c | 1 +
drivers/video/fbdev/omap2/omapfb/dss/dsi.c | 1 +
.../fbdev/omap2/omapfb/dss/manager-sysfs.c | 1 +
drivers/video/fbdev/omap2/omapfb/dss/pll.c | 1 +
drivers/video/fbdev/smscufx.c | 1 +
drivers/virt/coco/tsm.c | 1 +
drivers/virt/vmgenid.c | 1 +
drivers/xen/xen-scsiback.c | 1 +
drivers/xen/xenbus/xenbus_dev_frontend.c | 1 +
drivers/xen/xenbus/xenbus_probe_backend.c | 1 +
drivers/xen/xenbus/xenbus_probe_frontend.c | 1 +
fs/9p/v9fs.c | 1 +
fs/aio.c | 1 +
fs/bcachefs/chardev.c | 1 +
fs/bcachefs/fs.c | 1 +
fs/btrfs/qgroup.c | 1 +
fs/btrfs/sysfs.c | 1 +
fs/buffer.c | 1 +
fs/ceph/metric.h | 2 +
fs/ceph/super.h | 1 +
fs/configfs/item.c | 1 +
fs/configfs/mount.c | 2 +
fs/crypto/bio.c | 1 +
fs/debugfs/inode.c | 1 +
fs/ecryptfs/main.c | 1 +
fs/erofs/data.c | 1 +
fs/erofs/internal.h | 1 +
fs/erofs/super.c | 1 +
fs/eventpoll.c | 1 +
fs/exec.c | 1 +
fs/ext4/super.c | 1 +
fs/ext4/sysfs.c | 2 +
fs/f2fs/f2fs.h | 1 +
fs/fs_struct.c | 1 +
fs/fuse/cuse.c | 1 +
fs/fuse/inode.c | 1 +
fs/gfs2/incore.h | 1 +
fs/gfs2/recovery.c | 1 +
fs/gfs2/sys.c | 1 +
fs/hfsplus/wrapper.c | 1 +
fs/iomap/buffered-io.c | 1 +
fs/iomap/direct-io.c | 1 +
fs/namespace.c | 2 +
fs/nfs/client.c | 1 +
fs/nfs/nfs42xattr.c | 1 +
fs/ntfs3/fsntfs.c | 3 +-
fs/ntfs3/super.c | 1 +
fs/pnode.c | 1 +
fs/proc/uptime.c | 1 +
fs/pstore/inode.c | 1 +
fs/reiserfs/reiserfs.h | 1 +
fs/super.c | 1 +
fs/sysctls.c | 1 +
fs/sysfs/mount.c | 1 +
fs/tracefs/inode.c | 1 +
fs/ubifs/io.c | 1 +
fs/ubifs/super.c | 1 +
fs/ubifs/sysfs.c | 1 +
fs/xfs/xfs_error.c | 1 +
fs/xfs/xfs_qm.h | 1 +
fs/xfs/xfs_qm_syscalls.c | 2 +
fs/xfs/xfs_quotaops.c | 1 +
fs/xfs/xfs_super.c | 1 +
fs/xfs/xfs_sysfs.c | 1 +
fs/xfs/xfs_sysfs.h | 2 +
fs/xfs/xfs_trans_dquot.c | 2 +
fs/zonefs/sysfs.c | 1 +
include/clocksource/samsung_pwm.h | 2 +-
include/crypto/algapi.h | 2 +-
include/crypto/drbg.h | 3 +-
include/crypto/if_alg.h | 1 -
include/crypto/internal/geniv.h | 2 +-
include/drm/drm_atomic.h | 2 +
include/drm/drm_audio_component.h | 2 +-
include/drm/drm_auth.h | 3 +-
include/drm/drm_bridge.h | 2 +-
include/drm/drm_client.h | 2 +-
include/drm/drm_color_mgmt.h | 1 +
include/drm/drm_crtc.h | 2 +-
include/drm/drm_debugfs.h | 2 +
include/drm/drm_device.h | 4 +-
include/drm/drm_file.h | 2 +-
include/drm/drm_flip_work.h | 4 +-
include/drm/drm_framebuffer.h | 1 +
include/drm/drm_gem.h | 2 +-
include/drm/drm_gem_shmem_helper.h | 1 -
include/drm/drm_gpuvm.h | 2 +-
include/drm/drm_managed.h | 2 +-
include/drm/drm_mipi_dbi.h | 2 +-
include/drm/drm_mm.h | 3 +-
include/drm/drm_mode_config.h | 4 +-
include/drm/drm_mode_object.h | 2 +-
include/drm/drm_modeset_lock.h | 1 +
include/drm/drm_panel.h | 2 +-
include/drm/drm_prime.h | 4 +-
include/drm/drm_print.h | 2 +
include/drm/drm_privacy_screen_driver.h | 2 +-
include/drm/drm_util.h | 1 -
include/drm/drm_vblank.h | 2 +-
include/drm/drm_vma_manager.h | 1 -
include/drm/drm_writeback.h | 2 +-
include/drm/gpu_scheduler.h | 7 +-
include/drm/i915_hdcp_interface.h | 2 +-
include/drm/i915_pxp_tee_interface.h | 2 +-
include/drm/ttm/ttm_device.h | 1 -
include/drm/ttm/ttm_pool.h | 2 +-
include/drm/ttm/ttm_resource.h | 1 -
include/keys/asymmetric-subtype.h | 1 +
include/kunit/test.h | 3 +-
include/kvm/arm_arch_timer.h | 2 +-
include/kvm/arm_vgic.h | 6 +-
include/linux/acpi.h | 4 +-
include/linux/acpi_amd_wbrf.h | 7 +-
include/linux/acpi_dma.h | 3 +-
include/linux/agpgart.h | 2 +-
include/linux/alarmtimer.h | 2 +-
include/linux/async_tx.h | 1 -
include/linux/atmdev.h | 2 -
include/linux/backing-dev-defs.h | 20 +-
include/linux/backing-dev.h | 1 +
include/linux/backlight.h | 2 +-
include/linux/badblocks.h | 2 +-
include/linux/balloon_compaction.h | 2 +-
include/linux/bcm47xx_wdt.h | 2 +-
include/linux/bio.h | 97 +---
include/linux/bio_types.h | 84 +++
include/linux/blk-crypto.h | 2 +-
include/linux/blk-integrity.h | 1 +
include/linux/blk-mq.h | 5 +-
include/linux/blk_types.h | 33 +-
include/linux/blkdev.h | 468 +---------------
include/linux/blkdev_types.h | 461 ++++++++++++++++
include/linux/blktrace_api.h | 2 -
include/linux/bpf-cgroup-defs.h | 4 +-
include/linux/bpf-cgroup.h | 2 +-
include/linux/bpf-netns.h | 1 -
include/linux/bpf.h | 7 +-
include/linux/bpf_mem_alloc.h | 2 +-
include/linux/bsg-lib.h | 2 +-
include/linux/buffer_head.h | 2 +-
include/linux/bvec.h | 84 +--
include/linux/bvec_types.h | 95 ++++
include/linux/cacheinfo.h | 1 -
include/linux/can/dev.h | 1 +
include/linux/capability.h | 2 +-
include/linux/cb710.h | 2 +-
include/linux/ccp.h | 2 +-
include/linux/cdev.h | 4 +-
include/linux/cdrom.h | 2 +-
include/linux/ceph/libceph.h | 5 +-
include/linux/ceph/messenger.h | 7 +-
include/linux/ceph/mon_client.h | 4 +-
include/linux/ceph/osd_client.h | 8 +-
include/linux/ceph/osdmap.h | 2 +-
include/linux/ceph/pagelist.h | 2 +-
include/linux/ceph/string_table.h | 2 +-
include/linux/cgroup-defs.h | 10 +-
include/linux/cgroup.h | 2 +-
include/linux/clk/zynq.h | 2 +-
include/linux/clocksource.h | 1 -
include/linux/comedi/comedidev.h | 6 +-
include/linux/completion.h | 18 +-
include/linux/completion_types.h | 31 ++
include/linux/configfs.h | 4 +-
include/linux/connector.h | 3 +-
include/linux/console_struct.h | 4 +-
include/linux/container.h | 2 +-
include/linux/coresight.h | 2 +-
include/linux/counter.h | 6 +-
include/linux/cpu_rmap.h | 4 +-
include/linux/cpufreq.h | 6 +-
include/linux/cpuidle.h | 1 -
include/linux/cpuset.h | 2 +-
include/linux/cred.h | 2 +-
include/linux/crush/crush.h | 2 +-
include/linux/crypto.h | 2 +-
include/linux/damon.h | 2 +-
include/linux/dax.h | 1 -
include/linux/dcache.h | 4 +-
include/linux/dccp.h | 1 -
include/linux/debugfs.h | 1 +
include/linux/debugobjects.h | 1 -
include/linux/dev_printk.h | 3 +-
include/linux/devfreq-event.h | 2 +-
include/linux/devfreq.h | 2 +-
include/linux/device-mapper.h | 1 -
include/linux/device.h | 475 +----------------
include/linux/device/bus.h | 4 +-
include/linux/device/class.h | 4 +-
include/linux/device/driver.h | 2 -
include/linux/device_types.h | 500 ++++++++++++++++++
include/linux/dim.h | 2 +-
include/linux/dm-bufio.h | 2 +-
include/linux/dma-buf.h | 2 +-
include/linux/dma-fence.h | 1 -
include/linux/dma-resv.h | 1 -
include/linux/dmaengine.h | 4 +-
include/linux/dmi.h | 1 -
include/linux/dpll.h | 1 -
include/linux/dtpm.h | 2 +
include/linux/edac.h | 6 +-
include/linux/enclosure.h | 2 +-
include/linux/energy_model.h | 4 +-
include/linux/eventfd.h | 2 +-
include/linux/extcon.h | 8 +-
include/linux/fault-inject.h | 2 +-
include/linux/fb.h | 6 +-
include/linux/fdtable.h | 2 +-
include/linux/filter.h | 1 -
include/linux/firewire.h | 11 +-
include/linux/firmware.h | 3 +-
include/linux/flex_proportions.h | 9 +-
include/linux/fpga/fpga-bridge.h | 2 +-
include/linux/fpga/fpga-mgr.h | 2 +-
include/linux/fpga/fpga-region.h | 2 +-
include/linux/framer/framer-provider.h | 1 +
include/linux/framer/framer.h | 6 +-
include/linux/freezer.h | 1 -
include/linux/fs.h | 13 +-
include/linux/fs_context.h | 4 +-
include/linux/fs_struct.h | 2 +-
include/linux/fsl/bestcomm/bestcomm_priv.h | 2 +-
include/linux/fsl/bestcomm/sram.h | 2 +-
include/linux/futex.h | 1 +
include/linux/gameport.h | 2 +-
include/linux/gfp_api.h | 2 +-
include/linux/gnss.h | 6 +-
include/linux/gpio/driver.h | 2 +-
include/linux/greybus/connection.h | 3 +-
include/linux/greybus/operation.h | 8 +-
include/linux/hdmi.h | 2 +-
include/linux/hid.h | 5 +-
include/linux/hisi_acc_qm.h | 1 +
include/linux/hp_sdc.h | 2 +-
include/linux/hrtimer.h | 7 +-
include/linux/hsi/hsi.h | 2 +-
include/linux/hugetlb.h | 4 +-
include/linux/hw_random.h | 4 +-
include/linux/hwmon-sysfs.h | 2 +-
include/linux/hyperv.h | 3 +-
include/linux/i2c-smbus.h | 2 -
include/linux/i2c.h | 2 +-
include/linux/i3c/master.h | 5 +-
include/linux/i8253.h | 2 +-
include/linux/idr.h | 2 +-
include/linux/if_eql.h | 4 +-
include/linux/if_pppox.h | 2 +-
include/linux/igmp.h | 4 +-
include/linux/iio/buffer-dma.h | 6 +-
include/linux/iio/buffer.h | 2 +-
include/linux/iio/buffer_impl.h | 5 +-
include/linux/iio/iio.h | 3 +-
include/linux/inetdevice.h | 2 +-
include/linux/init_task.h | 2 -
include/linux/input.h | 2 +-
include/linux/interconnect.h | 1 -
include/linux/interrupt.h | 5 +-
include/linux/interval_tree.h | 3 +-
include/linux/io_uring.h | 1 -
include/linux/io_uring_types.h | 2 +-
include/linux/iocontext.h | 4 +-
include/linux/iomap.h | 2 +-
include/linux/iov_iter.h | 2 +-
include/linux/iova.h | 2 +-
include/linux/ipc.h | 6 +-
include/linux/ipc_namespace.h | 4 +-
include/linux/irqdesc.h | 4 +-
include/linux/irqdomain.h | 4 +-
include/linux/ism.h | 2 -
include/linux/jbd2.h | 4 +-
include/linux/journal-head.h | 2 +-
include/linux/jump_label_ratelimit.h | 2 +-
include/linux/kernel_stat.h | 1 -
include/linux/kernfs.h | 9 +-
include/linux/key.h | 5 +-
include/linux/klist.h | 4 +-
include/linux/kmod.h | 2 +-
include/linux/kmsan.h | 2 +-
include/linux/kobj_map.h | 4 +-
include/linux/kobject.h | 83 +--
include/linux/kobject_types.h | 84 +++
include/linux/kprobes.h | 4 +-
include/linux/kref.h | 6 +-
include/linux/kref_types.h | 12 +
include/linux/kvm_host.h | 5 +-
include/linux/kvm_types.h | 2 +-
include/linux/lapb.h | 1 -
include/linux/lcd.h | 2 +-
include/linux/leds-pca9532.h | 2 +-
include/linux/leds.h | 8 +-
include/linux/libata.h | 2 +-
include/linux/libnvdimm.h | 5 +-
include/linux/libps2.h | 4 +-
include/linux/list_bl.h | 19 +-
include/linux/list_bl_types.h | 36 ++
include/linux/list_lru.h | 33 +-
include/linux/list_lru_types.h | 42 ++
include/linux/livepatch.h | 2 +-
include/linux/lockd/lockd.h | 4 +-
include/linux/lockref.h | 2 +-
include/linux/lp.h | 4 +-
include/linux/lru_cache.h | 1 -
include/linux/lsm_audit.h | 1 -
include/linux/mISDNhw.h | 2 +-
include/linux/mISDNif.h | 3 +-
include/linux/mailbox_client.h | 2 +-
include/linux/mailbox_controller.h | 6 +-
include/linux/maple_tree.h | 323 +----------
include/linux/maple_tree_types.h | 341 ++++++++++++
include/linux/mbcache.h | 2 +-
include/linux/mc146818rtc.h | 2 +-
include/linux/mdio-mux.h | 6 +-
include/linux/mdio/mdio-mscc-miim.h | 8 +-
include/linux/mdio/mdio-xgene.h | 2 +-
include/linux/memory-tiers.h | 4 +-
include/linux/memory.h | 2 +-
include/linux/memory_hotplug.h | 1 +
include/linux/mempolicy.h | 5 +-
include/linux/mempool.h | 2 +-
include/linux/memstick.h | 2 +-
include/linux/mfd/abx500/ab8500.h | 2 +-
include/linux/mfd/altera-a10sr.h | 1 -
include/linux/mfd/cs42l43.h | 6 +-
include/linux/mfd/da9052/da9052.h | 2 +-
include/linux/mfd/intel-m10-bmc.h | 2 +-
include/linux/mfd/ipaq-micro.h | 2 +-
include/linux/mfd/lochnagar.h | 2 +-
include/linux/mfd/madera/core.h | 2 +-
include/linux/mfd/max8907.h | 3 +-
include/linux/mfd/mt6397/core.h | 2 +-
include/linux/mfd/mt6397/rtc.h | 2 +-
include/linux/mfd/pcf50633/core.h | 3 +-
include/linux/mfd/rc5t583.h | 2 +-
include/linux/mfd/stmpe.h | 2 +-
include/linux/mfd/ucb1x00.h | 2 +-
include/linux/mfd/wm831x/core.h | 1 -
include/linux/mfd/wm8350/core.h | 4 +-
include/linux/mfd/wm8350/supply.h | 1 -
include/linux/mfd/wm8400-private.h | 1 -
include/linux/mfd/wm8994/core.h | 1 -
include/linux/mhi.h | 8 +-
include/linux/mlx4/device.h | 4 +-
include/linux/mlx5/cq.h | 1 +
include/linux/mlx5/driver.h | 10 +-
include/linux/mm.h | 7 +-
include/linux/mm_inline.h | 4 +
include/linux/mm_types.h | 20 +-
include/linux/mmc/core.h | 2 +-
include/linux/mmu_notifier.h | 1 -
include/linux/mmzone.h | 9 +-
include/linux/module.h | 3 +-
include/linux/moxtet.h | 2 +-
include/linux/mroute_base.h | 2 +-
include/linux/msi.h | 4 +-
include/linux/mtd/blktrans.h | 6 +-
include/linux/mtd/doc2000.h | 2 +-
include/linux/mtd/flashchip.h | 2 +-
include/linux/mtd/onenand.h | 4 +-
include/linux/mtd/qinfo.h | 2 -
include/linux/mtd/sh_flctl.h | 2 +-
include/linux/mtd/spinand.h | 2 +-
include/linux/mutex.h | 2 +-
include/linux/ndctl.h | 2 +
include/linux/net.h | 2 +-
include/linux/netdevice.h | 5 +-
include/linux/netfilter.h | 1 -
include/linux/netfs.h | 2 +-
include/linux/netpoll.h | 2 +-
include/linux/nfs4.h | 2 +-
include/linux/nfs_fs.h | 7 +-
include/linux/nfs_fs_sb.h | 4 +-
include/linux/nfs_page.h | 3 +-
include/linux/node.h | 4 +-
include/linux/nodemask.h | 3 +
include/linux/notifier.h | 1 +
include/linux/ns_common.h | 3 +-
include/linux/nsproxy.h | 1 -
include/linux/ntb.h | 2 +-
include/linux/objpool.h | 2 +-
include/linux/oom.h | 2 +-
include/linux/padata.h | 8 +-
include/linux/pagemap.h | 2 +-
include/linux/parport.h | 4 +-
include/linux/part_stat.h | 2 +-
include/linux/pci.h | 2 +-
include/linux/peci.h | 2 +-
include/linux/percpu-refcount.h | 66 +--
include/linux/percpu-refcount_types.h | 71 +++
include/linux/percpu-rwsem.h | 15 +-
include/linux/percpu-rwsem_types.h | 24 +
include/linux/percpu_counter.h | 18 +-
include/linux/percpu_counter_types.h | 37 ++
include/linux/perf/arm_pmu.h | 1 -
include/linux/perf_event.h | 12 +-
include/linux/phy.h | 6 +-
include/linux/phylink.h | 2 -
include/linux/pid.h | 2 +-
include/linux/pid_namespace.h | 1 -
include/linux/pktcdvd.h | 5 +-
include/linux/platform_data/asoc-ti-mcbsp.h | 1 -
include/linux/platform_data/cros_ec_proto.h | 2 +-
.../linux/platform_data/cros_ec_sensorhub.h | 2 +-
include/linux/platform_data/wilco-ec.h | 2 +-
include/linux/platform_data/xilinx-ll-temac.h | 2 +-
include/linux/pm.h | 15 +-
include/linux/pm_clock.h | 2 +-
include/linux/pm_domain.h | 6 +-
include/linux/pm_qos.h | 2 +-
include/linux/poll.h | 2 +-
include/linux/posix-clock.h | 2 +-
include/linux/posix-timers.h | 3 +-
include/linux/power_supply.h | 6 +-
include/linux/powercap.h | 2 +-
include/linux/pps_kernel.h | 3 +-
include/linux/pruss_driver.h | 2 +-
include/linux/psi_types.h | 5 +-
include/linux/pstore.h | 4 +-
include/linux/pwm.h | 1 -
include/linux/qed/qede_rdma.h | 2 +-
include/linux/quota.h | 40 +-
include/linux/quota_types.h | 68 +++
include/linux/quotaops.h | 1 +
include/linux/radix-tree.h | 45 +-
include/linux/radix-tree_types.h | 50 ++
include/linux/raid/pq.h | 2 +-
include/linux/raid_class.h | 2 +
include/linux/random.h | 1 -
include/linux/rcupdate_wait.h | 2 +-
include/linux/regmap.h | 3 +-
include/linux/relay.h | 5 +-
include/linux/remoteproc.h | 3 +-
include/linux/resctrl.h | 5 +-
include/linux/reset/reset-simple.h | 2 +-
include/linux/rfkill.h | 2 -
include/linux/rhashtable-types.h | 2 +-
include/linux/ring_buffer.h | 1 -
include/linux/rpmsg.h | 4 +-
include/linux/rslib.h | 2 +-
include/linux/rtc.h | 4 +-
include/linux/rtc/ds1685.h | 1 -
include/linux/rtnetlink.h | 4 +-
include/linux/rwsem.h | 48 +-
include/linux/rwsem_types.h | 78 +++
include/linux/sbitmap.h | 125 +----
include/linux/sbitmap_types.h | 129 +++++
include/linux/sched/clock.h | 2 +-
include/linux/sched/signal.h | 4 +-
include/linux/sched/user.h | 6 +-
include/linux/scs.h | 2 +-
include/linux/seq_file.h | 3 +-
include/linux/serial_core.h | 1 -
include/linux/serio.h | 2 +-
include/linux/sh_clk.h | 3 +-
include/linux/shmem_fs.h | 2 +-
include/linux/skbuff.h | 2 +-
include/linux/slab.h | 5 +-
include/linux/slimbus.h | 3 +-
include/linux/soc/apple/rtkit.h | 3 +-
include/linux/soc/apple/sart.h | 2 +-
include/linux/soc/mediatek/mtk-cmdq.h | 1 -
include/linux/soc/qcom/apr.h | 2 +-
include/linux/soc/qcom/qcom_aoss.h | 2 +-
include/linux/soc/qcom/qmi.h | 4 +-
include/linux/socket.h | 2 +-
include/linux/soundwire/sdw.h | 1 +
include/linux/spi/spi.h | 2 +-
include/linux/spi/spi_bitbang.h | 3 +-
include/linux/srcu.h | 2 -
include/linux/srcutree.h | 4 +-
include/linux/ssb/ssb.h | 2 +-
include/linux/ssb/ssb_driver_gige.h | 2 +-
include/linux/stackdepot.h | 3 +-
include/linux/stat.h | 2 +-
include/linux/stm.h | 4 +-
include/linux/sunrpc/auth.h | 1 -
include/linux/sunrpc/auth_gss.h | 2 +-
include/linux/sunrpc/clnt.h | 2 +-
include/linux/sunrpc/metrics.h | 5 +-
include/linux/sunrpc/rpc_pipe_fs.h | 4 +-
include/linux/sunrpc/sched.h | 5 +-
include/linux/sunrpc/svc.h | 1 -
include/linux/sunrpc/svc_rdma.h | 1 -
include/linux/sunrpc/types.h | 4 +-
include/linux/sunrpc/xprt.h | 2 +-
include/linux/surface_aggregator/serial_hub.h | 2 +-
include/linux/swait.h | 16 +-
include/linux/swait_types.h | 20 +
include/linux/swap.h | 2 +-
include/linux/swap_slots.h | 4 +-
include/linux/swapops.h | 1 -
include/linux/swiotlb.h | 7 +-
include/linux/sync_file.h | 1 -
include/linux/sys_soc.h | 3 +-
include/linux/syscalls.h | 1 -
include/linux/sysctl.h | 4 +-
include/linux/sysfs.h | 70 +--
include/linux/sysfs_types.h | 89 ++++
include/linux/syslog.h | 2 +-
include/linux/tee_drv.h | 2 +-
include/linux/thermal.h | 6 +-
include/linux/thunderbolt.h | 2 +-
include/linux/tifm.h | 4 +-
include/linux/torture.h | 4 -
include/linux/trace_recursion.h | 1 +
include/linux/tracefs.h | 1 -
include/linux/transport_class.h | 3 +-
include/linux/tty.h | 6 +-
include/linux/tty_buffer.h | 4 +-
include/linux/tty_driver.h | 1 +
include/linux/tty_ldisc.h | 4 +-
include/linux/tty_port.h | 2 +-
include/linux/u64_stats_sync.h | 5 +
include/linux/umh.h | 4 +-
include/linux/uprobes.h | 12 +-
include/linux/uprobes_types.h | 25 +
include/linux/usb.h | 6 +-
include/linux/usb/gadget.h | 2 +-
include/linux/usb/hcd.h | 1 -
include/linux/usb/ljca.h | 2 +-
include/linux/usb/otg-fsm.h | 2 +-
include/linux/usb/role.h | 5 +-
include/linux/usb/serial.h | 4 +-
include/linux/user_namespace.h | 5 +-
include/linux/vfio.h | 2 +-
include/linux/vfio_pci_core.h | 3 +-
include/linux/via-core.h | 2 +-
include/linux/virtio.h | 4 +-
include/linux/vmalloc.h | 3 +-
include/linux/vmpressure.h | 6 +-
include/linux/vmw_vmci_api.h | 2 +-
include/linux/vt_kern.h | 1 -
include/linux/w1.h | 2 +-
include/linux/wait.h | 23 +-
include/linux/wait_bit.h | 5 +-
include/linux/wait_types.h | 31 ++
include/linux/watch_queue.h | 2 +-
include/linux/workqueue.h | 9 -
include/linux/workqueue_types.h | 9 +
include/linux/writeback.h | 2 +-
include/linux/ww_mutex.h | 1 +
include/linux/xarray.h | 56 +-
include/linux/xarray_types.h | 70 +++
include/media/cec.h | 3 +-
include/media/dmxdev.h | 7 +-
include/media/drv-intf/saa7146.h | 2 +-
include/media/dvb_demux.h | 5 +-
include/media/dvb_frontend.h | 2 +-
include/media/dvb_ringbuffer.h | 4 +-
include/media/dvb_vb2.h | 2 +-
include/media/i2c/adp1653.h | 2 +-
include/media/media-device.h | 3 +-
include/media/media-devnode.h | 2 +-
include/media/media-request.h | 1 +
include/media/rc-core.h | 3 +-
include/media/v4l2-async.h | 1 -
include/media/v4l2-dev.h | 2 +-
include/media/v4l2-device.h | 2 +
include/media/v4l2-event.h | 1 -
include/media/v4l2-ioctl.h | 1 -
include/media/videobuf2-core.h | 2 +-
include/net/af_unix.h | 4 +-
include/net/af_vsock.h | 2 +-
include/net/atmclip.h | 2 +-
include/net/ax25.h | 5 +-
include/net/bluetooth/bluetooth.h | 3 +-
include/net/bluetooth/hci_core.h | 1 +
include/net/bonding.h | 1 -
include/net/bpf_sk_storage.h | 4 -
include/net/caif/cfcnfg.h | 1 -
include/net/caif/cfsrvl.h | 1 -
include/net/cfg802154.h | 2 +-
include/net/devlink.h | 11 +-
include/net/dsa.h | 2 -
include/net/dsa_stubs.h | 1 -
include/net/dst.h | 2 +-
include/net/flow.h | 2 +-
include/net/fq.h | 2 +-
include/net/hwbm.h | 2 +-
include/net/inet_connection_sock.h | 2 +-
include/net/inet_frag.h | 2 +-
include/net/inet_hashtables.h | 3 +-
include/net/inet_timewait_sock.h | 3 +-
include/net/inetpeer.h | 1 -
include/net/ip6_fib.h | 2 +-
include/net/ip_fib.h | 1 -
include/net/ip_vs.h | 6 +-
include/net/lib80211.h | 5 +-
include/net/llc.h | 2 +-
include/net/llc_conn.h | 2 +-
include/net/neighbour.h | 5 +-
include/net/net_namespace.h | 3 +-
include/net/net_ratelimit.h | 2 -
include/net/netdev_rx_queue.h | 4 +-
include/net/netfilter/nf_conntrack_count.h | 2 +-
include/net/netns/can.h | 4 +-
include/net/netns/conntrack.h | 2 -
include/net/netns/ipv4.h | 4 +-
include/net/netns/ipv6.h | 4 +
include/net/netns/mctp.h | 3 +-
include/net/netns/nexthop.h | 2 +-
include/net/netns/packet.h | 2 +-
include/net/netns/sctp.h | 2 +-
include/net/netns/smc.h | 2 +-
include/net/netns/unix.h | 2 +-
include/net/netns/xdp.h | 3 +-
include/net/netns/xfrm.h | 3 +-
include/net/netrom.h | 1 -
include/net/nfc/nfc.h | 2 +-
include/net/phonet/pn_dev.h | 2 +-
include/net/pkt_cls.h | 3 +-
include/net/sch_generic.h | 7 +-
include/net/sctp/sctp.h | 2 +-
include/net/sctp/structs.h | 2 +-
include/net/smc.h | 6 +-
include/net/snmp.h | 1 -
include/net/sock.h | 6 +-
include/net/sock_reuseport.h | 2 +-
include/net/tcp.h | 5 +-
include/net/tls.h | 2 +-
include/net/tls_toe.h | 2 +-
include/net/udp.h | 3 +-
include/net/xdp_sock.h | 6 +-
include/net/xfrm.h | 3 +-
include/pcmcia/ss.h | 4 +-
include/rdma/ib_sa.h | 2 +-
include/rdma/ib_sysfs.h | 2 +-
include/rdma/ib_umem.h | 1 -
include/rdma/ib_verbs.h | 6 +-
include/rdma/rdma_counter.h | 2 +-
include/rdma/rdma_vt.h | 2 +-
include/rdma/restrack.h | 5 +-
include/rdma/uverbs_types.h | 1 +
include/scsi/libfc.h | 2 +-
include/scsi/libfcoe.h | 2 +-
include/scsi/libiscsi.h | 8 +-
include/scsi/libsas.h | 2 +-
include/scsi/scsi_cmnd.h | 3 +-
include/scsi/scsi_device.h | 5 +-
include/scsi/scsi_host.h | 5 +-
include/scsi/scsi_tcq.h | 2 +-
include/scsi/scsi_transport.h | 2 +-
include/scsi/scsi_transport_iscsi.h | 2 +-
include/scsi/scsi_transport_sas.h | 2 +-
include/scsi/scsi_transport_spi.h | 2 +-
include/scsi/scsi_transport_srp.h | 2 +-
include/soc/fsl/qe/qe.h | 2 +-
include/sound/ac97_codec.h | 2 +-
include/sound/control.h | 2 +-
include/sound/core.h | 11 +-
include/sound/emu10k1.h | 2 +-
include/sound/rawmidi.h | 8 +-
include/sound/soc.h | 2 +-
include/sound/util_mem.h | 3 +-
include/target/iscsi/iscsi_target_stat.h | 2 +-
include/target/target_core_base.h | 4 +-
include/trace/events/block.h | 2 +-
include/trace/events/iommu.h | 3 +-
include/trace/events/kyber.h | 2 +-
include/trace/events/lock.h | 2 +-
include/trace/events/mmc.h | 2 +-
include/trace/events/power.h | 1 +
include/trace/events/workqueue.h | 2 +-
include/video/atmel_lcdc.h | 2 -
include/video/omapfb_dss.h | 2 +-
include/xen/interface/memory.h | 2 -
include/xen/xenbus.h | 3 +-
init/init_task.c | 1 +
init/initramfs.c | 1 +
init/main.c | 1 +
io_uring/cancel.c | 1 +
io_uring/io_uring.c | 2 +
io_uring/timeout.h | 2 +
ipc/mq_sysctl.c | 1 +
ipc/mqueue.c | 1 +
ipc/namespace.c | 1 +
ipc/sem.c | 1 +
kernel/bpf/helpers.c | 1 +
kernel/cgroup/cgroup.c | 1 +
kernel/cpu.c | 1 +
kernel/dma/debug.c | 1 +
kernel/entry/common.c | 1 +
kernel/events/core.c | 1 +
kernel/exit.c | 3 +
kernel/fork.c | 1 +
kernel/futex/core.c | 1 +
kernel/futex/pi.c | 1 +
kernel/futex/requeue.c | 1 +
kernel/futex/syscalls.c | 1 +
kernel/futex/waitwake.c | 1 +
kernel/irq/irqdomain.c | 1 +
kernel/irq/manage.c | 1 +
kernel/kheaders.c | 1 +
kernel/livepatch/core.c | 2 +
kernel/livepatch/transition.c | 1 +
kernel/locking/rtmutex.c | 1 +
kernel/locking/rtmutex_common.h | 1 +
kernel/module/main.c | 1 +
kernel/module/sysfs.c | 1 +
kernel/padata.c | 2 +
kernel/panic.c | 2 +
kernel/params.c | 1 +
kernel/power/energy_model.c | 1 +
kernel/reboot.c | 2 +
kernel/relay.c | 1 +
kernel/signal.c | 1 +
kernel/smpboot.c | 1 +
kernel/time/hrtimer.c | 1 +
kernel/time/namespace.c | 1 +
kernel/time/posix-timers.c | 1 +
kernel/time/timer_list.c | 1 +
kernel/trace/blktrace.c | 1 +
kernel/trace/bpf_trace.c | 1 +
kernel/trace/trace_osnoise.c | 1 +
kernel/tsacct.c | 1 +
kernel/ucount.c | 1 +
kernel/user.c | 3 +
kernel/watch_queue.c | 1 +
kernel/watchdog.c | 1 +
kernel/workqueue.c | 1 +
lib/cpu_rmap.c | 2 +
lib/flex_proportions.c | 3 +
lib/group_cpus.c | 1 +
lib/klist.c | 1 +
lib/kobject.c | 4 +
lib/lockref.c | 2 +
lib/objpool.c | 2 +
lib/test_lockup.c | 1 +
mm/cma_sysfs.c | 1 +
mm/damon/sysfs-common.c | 2 +
mm/damon/sysfs-common.h | 2 +-
mm/damon/sysfs-schemes.c | 2 +
mm/damon/sysfs.c | 2 +
mm/folio-compat.c | 1 +
mm/huge_memory.c | 1 +
mm/hugetlb.c | 1 +
mm/khugepaged.c | 2 +
mm/ksm.c | 2 +
mm/memory-tiers.c | 2 +
mm/memory.c | 1 +
mm/memory_hotplug.c | 1 +
mm/mempolicy.c | 2 +
mm/shmem.c | 1 +
mm/swap_state.c | 1 +
mm/vmscan.c | 1 +
mm/workingset.c | 1 +
mm/z3fold.c | 1 +
mm/zswap.c | 1 +
net/9p/trans_virtio.c | 1 +
net/bridge/br_sysfs_br.c | 1 +
net/can/j1939/bus.c | 2 +
net/can/j1939/main.c | 1 +
net/can/j1939/transport.c | 2 +
net/ceph/string_table.c | 1 +
net/dsa/dsa.c | 1 +
net/nfc/llcp_core.c | 1 +
net/qrtr/af_qrtr.c | 1 +
net/rds/message.c | 1 +
net/rds/rdma.c | 1 +
net/rfkill/core.c | 1 +
net/sched/act_gate.c | 1 +
net/tipc/node.c | 2 +
net/tipc/subscr.c | 2 +
net/tipc/topsrv.c | 1 +
net/tls/tls_toe.c | 1 +
net/wireless/reg.c | 1 +
net/xfrm/xfrm_state.c | 1 +
samples/vfio-mdev/mtty.c | 1 +
security/integrity/ima/ima_mok.c | 1 +
security/keys/proc.c | 1 +
sound/core/init.c | 1 +
sound/hda/hda_bus_type.c | 1 +
sound/hda/hdac_sysfs.c | 1 +
sound/soc/intel/avs/avs.h | 1 +
sound/soc/qcom/qdsp6/q6apm.c | 1 +
sound/soc/qcom/qdsp6/q6apm.h | 1 +
sound/soc/sof/sof-audio.h | 1 +
1243 files changed, 4054 insertions(+), 2940 deletions(-)
create mode 100644 include/linux/bio_types.h
create mode 100644 include/linux/blkdev_types.h
create mode 100644 include/linux/bvec_types.h
create mode 100644 include/linux/completion_types.h
create mode 100644 include/linux/device_types.h
create mode 100644 include/linux/kobject_types.h
create mode 100644 include/linux/kref_types.h
create mode 100644 include/linux/list_bl_types.h
create mode 100644 include/linux/list_lru_types.h
create mode 100644 include/linux/maple_tree_types.h
create mode 100644 include/linux/percpu-refcount_types.h
create mode 100644 include/linux/percpu-rwsem_types.h
create mode 100644 include/linux/percpu_counter_types.h
create mode 100644 include/linux/quota_types.h
create mode 100644 include/linux/radix-tree_types.h
create mode 100644 include/linux/rwsem_types.h
create mode 100644 include/linux/sbitmap_types.h
create mode 100644 include/linux/swait_types.h
create mode 100644 include/linux/sysfs_types.h
create mode 100644 include/linux/uprobes_types.h
create mode 100644 include/linux/wait_types.h
create mode 100644 include/linux/xarray_types.h
--
2.39.2
By providing declarations in a lean header, we can reduce header
dependencies.
Signed-off-by: Max Kellermann <[email protected]>
---
arch/arm64/kernel/signal.c | 1 +
include/linux/mm_types.h | 2 +-
include/linux/uprobes.h | 10 +---------
include/linux/uprobes_types.h | 25 +++++++++++++++++++++++++
kernel/entry/common.c | 1 +
kernel/trace/bpf_trace.c | 1 +
mm/memory.c | 1 +
7 files changed, 31 insertions(+), 10 deletions(-)
create mode 100644 include/linux/uprobes_types.h
diff --git a/arch/arm64/kernel/signal.c b/arch/arm64/kernel/signal.c
index 0e8beb3349ea..8990975d0c37 100644
--- a/arch/arm64/kernel/signal.c
+++ b/arch/arm64/kernel/signal.c
@@ -14,6 +14,7 @@
#include <linux/freezer.h>
#include <linux/stddef.h>
#include <linux/uaccess.h>
+#include <linux/uprobes.h>
#include <linux/sizes.h>
#include <linux/string.h>
#include <linux/resume_user_mode.h>
diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
index 6ee90f81e01d..88bbb724080f 100644
--- a/include/linux/mm_types.h
+++ b/include/linux/mm_types.h
@@ -12,7 +12,7 @@
#include <linux/maple_tree_types.h>
#include <linux/rwsem_types.h>
#include <linux/cpumask.h>
-#include <linux/uprobes.h>
+#include <linux/uprobes_types.h>
#include <linux/rcupdate.h>
#include <linux/page-flags-layout.h>
#include <linux/workqueue_types.h>
diff --git a/include/linux/uprobes.h b/include/linux/uprobes.h
index a76155cf8ceb..6ab950cce8a9 100644
--- a/include/linux/uprobes.h
+++ b/include/linux/uprobes.h
@@ -11,6 +11,7 @@
* Copyright (C) 2011-2012 Red Hat, Inc., Peter Zijlstra
*/
+#include <linux/uprobes_types.h>
#include <linux/errno.h>
#include <linux/types.h>
@@ -94,12 +95,6 @@ enum rp_check {
RP_CHECK_RET,
};
-struct xol_area;
-
-struct uprobes_state {
- struct xol_area *xol_area;
-};
-
extern void __init uprobes_init(void);
extern int set_swbp(struct arch_uprobe *aup, struct mm_struct *mm, unsigned long vaddr);
extern int set_orig_insn(struct arch_uprobe *aup, struct mm_struct *mm, unsigned long vaddr);
@@ -137,9 +132,6 @@ extern bool arch_uprobe_ignore(struct arch_uprobe *aup, struct pt_regs *regs);
extern void arch_uprobe_copy_ixol(struct page *page, unsigned long vaddr,
void *src, unsigned long len);
#else /* !CONFIG_UPROBES */
-struct uprobes_state {
-};
-
static inline void uprobes_init(void)
{
}
diff --git a/include/linux/uprobes_types.h b/include/linux/uprobes_types.h
new file mode 100644
index 000000000000..0ce0fe3801ea
--- /dev/null
+++ b/include/linux/uprobes_types.h
@@ -0,0 +1,25 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+#ifndef _LINUX_UPROBES_TYPES_H
+#define _LINUX_UPROBES_TYPES_H
+/*
+ * User-space Probes (UProbes)
+ *
+ * Copyright (C) IBM Corporation, 2008-2012
+ * Authors:
+ * Srikar Dronamraju
+ * Jim Keniston
+ * Copyright (C) 2011-2012 Red Hat, Inc., Peter Zijlstra
+ */
+
+#ifdef CONFIG_UPROBES
+
+struct xol_area;
+
+struct uprobes_state {
+ struct xol_area *xol_area;
+};
+#else /* !CONFIG_UPROBES */
+struct uprobes_state {
+};
+#endif /* !CONFIG_UPROBES */
+#endif /* _LINUX_UPROBES_TYPES_H */
diff --git a/kernel/entry/common.c b/kernel/entry/common.c
index 88cb3c88aaa5..364ea38c868e 100644
--- a/kernel/entry/common.c
+++ b/kernel/entry/common.c
@@ -9,6 +9,7 @@
#include <linux/livepatch.h>
#include <linux/audit.h>
#include <linux/tick.h>
+#include <linux/uprobes.h>
#include "common.h"
diff --git a/kernel/trace/bpf_trace.c b/kernel/trace/bpf_trace.c
index 64fdaf79d113..1f314e6461e5 100644
--- a/kernel/trace/bpf_trace.c
+++ b/kernel/trace/bpf_trace.c
@@ -11,6 +11,7 @@
#include <linux/btf.h>
#include <linux/filter.h>
#include <linux/uaccess.h>
+#include <linux/uprobes.h>
#include <linux/ctype.h>
#include <linux/kprobes.h>
#include <linux/spinlock.h>
diff --git a/mm/memory.c b/mm/memory.c
index 8d14ba440929..909a98b3d142 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -70,6 +70,7 @@
#include <linux/string.h>
#include <linux/memory-tiers.h>
#include <linux/debugfs.h>
+#include <linux/uprobes.h>
#include <linux/userfaultfd_k.h>
#include <linux/dax.h>
#include <linux/oom.h>
--
2.39.2
By providing declarations in a lean header, we can reduce header
dependencies.
Signed-off-by: Max Kellermann <[email protected]>
---
include/linux/maple_tree.h | 323 +----------------------------
include/linux/maple_tree_types.h | 341 +++++++++++++++++++++++++++++++
include/linux/mm.h | 1 +
include/linux/mm_types.h | 2 +-
4 files changed, 345 insertions(+), 322 deletions(-)
create mode 100644 include/linux/maple_tree_types.h
diff --git a/include/linux/maple_tree.h b/include/linux/maple_tree.h
index b3d63123b945..7f5dd33f4b94 100644
--- a/include/linux/maple_tree.h
+++ b/include/linux/maple_tree.h
@@ -8,147 +8,13 @@
* Matthew Wilcox <[email protected]>
*/
+#include <linux/maple_tree_types.h>
+
#include <linux/kernel.h>
#include <linux/rcupdate.h>
#include <linux/spinlock.h>
/* #define CONFIG_MAPLE_RCU_DISABLED */
-/*
- * Allocated nodes are mutable until they have been inserted into the tree,
- * at which time they cannot change their type until they have been removed
- * from the tree and an RCU grace period has passed.
- *
- * Removed nodes have their ->parent set to point to themselves. RCU readers
- * check ->parent before relying on the value that they loaded from the
- * slots array. This lets us reuse the slots array for the RCU head.
- *
- * Nodes in the tree point to their parent unless bit 0 is set.
- */
-#if defined(CONFIG_64BIT) || defined(BUILD_VDSO32_64)
-/* 64bit sizes */
-#define MAPLE_NODE_SLOTS 31 /* 256 bytes including ->parent */
-#define MAPLE_RANGE64_SLOTS 16 /* 256 bytes */
-#define MAPLE_ARANGE64_SLOTS 10 /* 240 bytes */
-#define MAPLE_ALLOC_SLOTS (MAPLE_NODE_SLOTS - 1)
-#else
-/* 32bit sizes */
-#define MAPLE_NODE_SLOTS 63 /* 256 bytes including ->parent */
-#define MAPLE_RANGE64_SLOTS 32 /* 256 bytes */
-#define MAPLE_ARANGE64_SLOTS 21 /* 240 bytes */
-#define MAPLE_ALLOC_SLOTS (MAPLE_NODE_SLOTS - 2)
-#endif /* defined(CONFIG_64BIT) || defined(BUILD_VDSO32_64) */
-
-#define MAPLE_NODE_MASK 255UL
-
-/*
- * The node->parent of the root node has bit 0 set and the rest of the pointer
- * is a pointer to the tree itself. No more bits are available in this pointer
- * (on m68k, the data structure may only be 2-byte aligned).
- *
- * Internal non-root nodes can only have maple_range_* nodes as parents. The
- * parent pointer is 256B aligned like all other tree nodes. When storing a 32
- * or 64 bit values, the offset can fit into 4 bits. The 16 bit values need an
- * extra bit to store the offset. This extra bit comes from a reuse of the last
- * bit in the node type. This is possible by using bit 1 to indicate if bit 2
- * is part of the type or the slot.
- *
- * Once the type is decided, the decision of an allocation range type or a range
- * type is done by examining the immutable tree flag for the MAPLE_ALLOC_RANGE
- * flag.
- *
- * Node types:
- * 0x??1 = Root
- * 0x?00 = 16 bit nodes
- * 0x010 = 32 bit nodes
- * 0x110 = 64 bit nodes
- *
- * Slot size and location in the parent pointer:
- * type : slot location
- * 0x??1 : Root
- * 0x?00 : 16 bit values, type in 0-1, slot in 2-6
- * 0x010 : 32 bit values, type in 0-2, slot in 3-6
- * 0x110 : 64 bit values, type in 0-2, slot in 3-6
- */
-
-/*
- * This metadata is used to optimize the gap updating code and in reverse
- * searching for gaps or any other code that needs to find the end of the data.
- */
-struct maple_metadata {
- unsigned char end;
- unsigned char gap;
-};
-
-/*
- * Leaf nodes do not store pointers to nodes, they store user data. Users may
- * store almost any bit pattern. As noted above, the optimisation of storing an
- * entry at 0 in the root pointer cannot be done for data which have the bottom
- * two bits set to '10'. We also reserve values with the bottom two bits set to
- * '10' which are below 4096 (ie 2, 6, 10 .. 4094) for internal use. Some APIs
- * return errnos as a negative errno shifted right by two bits and the bottom
- * two bits set to '10', and while choosing to store these values in the array
- * is not an error, it may lead to confusion if you're testing for an error with
- * mas_is_err().
- *
- * Non-leaf nodes store the type of the node pointed to (enum maple_type in bits
- * 3-6), bit 2 is reserved. That leaves bits 0-1 unused for now.
- *
- * In regular B-Tree terms, pivots are called keys. The term pivot is used to
- * indicate that the tree is specifying ranges, Pivots may appear in the
- * subtree with an entry attached to the value whereas keys are unique to a
- * specific position of a B-tree. Pivot values are inclusive of the slot with
- * the same index.
- */
-
-struct maple_range_64 {
- struct maple_pnode *parent;
- unsigned long pivot[MAPLE_RANGE64_SLOTS - 1];
- union {
- void __rcu *slot[MAPLE_RANGE64_SLOTS];
- struct {
- void __rcu *pad[MAPLE_RANGE64_SLOTS - 1];
- struct maple_metadata meta;
- };
- };
-};
-
-/*
- * At tree creation time, the user can specify that they're willing to trade off
- * storing fewer entries in a tree in return for storing more information in
- * each node.
- *
- * The maple tree supports recording the largest range of NULL entries available
- * in this node, also called gaps. This optimises the tree for allocating a
- * range.
- */
-struct maple_arange_64 {
- struct maple_pnode *parent;
- unsigned long pivot[MAPLE_ARANGE64_SLOTS - 1];
- void __rcu *slot[MAPLE_ARANGE64_SLOTS];
- unsigned long gap[MAPLE_ARANGE64_SLOTS];
- struct maple_metadata meta;
-};
-
-struct maple_alloc {
- unsigned long total;
- unsigned char node_count;
- unsigned int request_count;
- struct maple_alloc *slot[MAPLE_ALLOC_SLOTS];
-};
-
-struct maple_topiary {
- struct maple_pnode *parent;
- struct maple_enode *next; /* Overlaps the pivot */
-};
-
-enum maple_type {
- maple_dense,
- maple_leaf_64,
- maple_range_64,
- maple_arange_64,
-};
-
-
/**
* DOC: Maple tree flags
*
@@ -181,7 +47,6 @@ enum maple_type {
#define MAPLE_RESERVED_RANGE 4096
#ifdef CONFIG_LOCKDEP
-typedef struct lockdep_map *lockdep_map_p;
#define mt_lock_is_held(mt) \
(!(mt)->ma_external_lock || lock_is_held((mt)->ma_external_lock))
@@ -194,36 +59,12 @@ typedef struct lockdep_map *lockdep_map_p;
#define mt_on_stack(mt) (mt).ma_external_lock = NULL
#else
-typedef struct { /* nothing */ } lockdep_map_p;
#define mt_lock_is_held(mt) 1
#define mt_write_lock_is_held(mt) 1
#define mt_set_external_lock(mt, lock) do { } while (0)
#define mt_on_stack(mt) do { } while (0)
#endif
-/*
- * If the tree contains a single entry at index 0, it is usually stored in
- * tree->ma_root. To optimise for the page cache, an entry which ends in '00',
- * '01' or '11' is stored in the root, but an entry which ends in '10' will be
- * stored in a node. Bits 3-6 are used to store enum maple_type.
- *
- * The flags are used both to store some immutable information about this tree
- * (set at tree creation time) and dynamic information set under the spinlock.
- *
- * Another use of flags are to indicate global states of the tree. This is the
- * case with the MAPLE_USE_RCU flag, which indicates the tree is currently in
- * RCU mode. This mode was added to allow the tree to reuse nodes instead of
- * re-allocating and RCU freeing nodes when there is a single user.
- */
-struct maple_tree {
- union {
- spinlock_t ma_lock;
- lockdep_map_p ma_external_lock;
- };
- unsigned int ma_flags;
- void __rcu *ma_root;
-};
-
/**
* MTREE_INIT() - Initialize a maple tree
* @name: The maple tree name
@@ -260,56 +101,6 @@ struct maple_tree {
spin_lock_nested((&(mt)->ma_lock), subclass)
#define mtree_unlock(mt) spin_unlock((&(mt)->ma_lock))
-/*
- * The Maple Tree squeezes various bits in at various points which aren't
- * necessarily obvious. Usually, this is done by observing that pointers are
- * N-byte aligned and thus the bottom log_2(N) bits are available for use. We
- * don't use the high bits of pointers to store additional information because
- * we don't know what bits are unused on any given architecture.
- *
- * Nodes are 256 bytes in size and are also aligned to 256 bytes, giving us 8
- * low bits for our own purposes. Nodes are currently of 4 types:
- * 1. Single pointer (Range is 0-0)
- * 2. Non-leaf Allocation Range nodes
- * 3. Non-leaf Range nodes
- * 4. Leaf Range nodes All nodes consist of a number of node slots,
- * pivots, and a parent pointer.
- */
-
-struct maple_node {
- union {
- struct {
- struct maple_pnode *parent;
- void __rcu *slot[MAPLE_NODE_SLOTS];
- };
- struct {
- void *pad;
- struct rcu_head rcu;
- struct maple_enode *piv_parent;
- unsigned char parent_slot;
- enum maple_type type;
- unsigned char slot_len;
- unsigned int ma_flags;
- };
- struct maple_range_64 mr64;
- struct maple_arange_64 ma64;
- struct maple_alloc alloc;
- };
-};
-
-/*
- * More complicated stores can cause two nodes to become one or three and
- * potentially alter the height of the tree. Either half of the tree may need
- * to be rebalanced against the other. The ma_topiary struct is used to track
- * which nodes have been 'cut' from the tree so that the change can be done
- * safely at a later date. This is done to support RCU.
- */
-struct ma_topiary {
- struct maple_enode *head;
- struct maple_enode *tail;
- struct maple_tree *mtree;
-};
-
void *mtree_load(struct maple_tree *mt, unsigned long index);
int mtree_insert(struct maple_tree *mt, unsigned long index,
@@ -349,105 +140,6 @@ static inline bool mtree_empty(const struct maple_tree *mt)
/* Advanced API */
-/*
- * Maple State Status
- * ma_active means the maple state is pointing to a node and offset and can
- * continue operating on the tree.
- * ma_start means we have not searched the tree.
- * ma_root means we have searched the tree and the entry we found lives in
- * the root of the tree (ie it has index 0, length 1 and is the only entry in
- * the tree).
- * ma_none means we have searched the tree and there is no node in the
- * tree for this entry. For example, we searched for index 1 in an empty
- * tree. Or we have a tree which points to a full leaf node and we
- * searched for an entry which is larger than can be contained in that
- * leaf node.
- * ma_pause means the data within the maple state may be stale, restart the
- * operation
- * ma_overflow means the search has reached the upper limit of the search
- * ma_underflow means the search has reached the lower limit of the search
- * ma_error means there was an error, check the node for the error number.
- */
-enum maple_status {
- ma_active,
- ma_start,
- ma_root,
- ma_none,
- ma_pause,
- ma_overflow,
- ma_underflow,
- ma_error,
-};
-
-/*
- * The maple state is defined in the struct ma_state and is used to keep track
- * of information during operations, and even between operations when using the
- * advanced API.
- *
- * If state->node has bit 0 set then it references a tree location which is not
- * a node (eg the root). If bit 1 is set, the rest of the bits are a negative
- * errno. Bit 2 (the 'unallocated slots' bit) is clear. Bits 3-6 indicate the
- * node type.
- *
- * state->alloc either has a request number of nodes or an allocated node. If
- * stat->alloc has a requested number of nodes, the first bit will be set (0x1)
- * and the remaining bits are the value. If state->alloc is a node, then the
- * node will be of type maple_alloc. maple_alloc has MAPLE_NODE_SLOTS - 1 for
- * storing more allocated nodes, a total number of nodes allocated, and the
- * node_count in this node. node_count is the number of allocated nodes in this
- * node. The scaling beyond MAPLE_NODE_SLOTS - 1 is handled by storing further
- * nodes into state->alloc->slot[0]'s node. Nodes are taken from state->alloc
- * by removing a node from the state->alloc node until state->alloc->node_count
- * is 1, when state->alloc is returned and the state->alloc->slot[0] is promoted
- * to state->alloc. Nodes are pushed onto state->alloc by putting the current
- * state->alloc into the pushed node's slot[0].
- *
- * The state also contains the implied min/max of the state->node, the depth of
- * this search, and the offset. The implied min/max are either from the parent
- * node or are 0-oo for the root node. The depth is incremented or decremented
- * every time a node is walked down or up. The offset is the slot/pivot of
- * interest in the node - either for reading or writing.
- *
- * When returning a value the maple state index and last respectively contain
- * the start and end of the range for the entry. Ranges are inclusive in the
- * Maple Tree.
- *
- * The status of the state is used to determine how the next action should treat
- * the state. For instance, if the status is ma_start then the next action
- * should start at the root of the tree and walk down. If the status is
- * ma_pause then the node may be stale data and should be discarded. If the
- * status is ma_overflow, then the last action hit the upper limit.
- *
- */
-struct ma_state {
- struct maple_tree *tree; /* The tree we're operating in */
- unsigned long index; /* The index we're operating on - range start */
- unsigned long last; /* The last index we're operating on - range end */
- struct maple_enode *node; /* The node containing this entry */
- unsigned long min; /* The minimum index of this node - implied pivot min */
- unsigned long max; /* The maximum index of this node - implied pivot max */
- struct maple_alloc *alloc; /* Allocated nodes for this operation */
- enum maple_status status; /* The status of the state (active, start, none, etc) */
- unsigned char depth; /* depth of tree descent during write */
- unsigned char offset;
- unsigned char mas_flags;
- unsigned char end; /* The end of the node */
-};
-
-struct ma_wr_state {
- struct ma_state *mas;
- struct maple_node *node; /* Decoded mas->node */
- unsigned long r_min; /* range min */
- unsigned long r_max; /* range max */
- enum maple_type type; /* mas->node type */
- unsigned char offset_end; /* The offset where the write ends */
- unsigned long *pivots; /* mas->node->pivots pointer */
- unsigned long end_piv; /* The pivot at the offset end */
- void __rcu **slots; /* mas->node->slots pointer */
- void *entry; /* The entry to write */
- void *content; /* The existing entry that is being overwritten */
-};
-
#define mas_lock(mas) spin_lock(&((mas)->tree->ma_lock))
#define mas_lock_nested(mas, subclass) \
spin_lock_nested(&((mas)->tree->ma_lock), subclass)
@@ -520,17 +212,6 @@ int mas_empty_area(struct ma_state *mas, unsigned long min, unsigned long max,
int mas_empty_area_rev(struct ma_state *mas, unsigned long min,
unsigned long max, unsigned long size);
-static inline void mas_init(struct ma_state *mas, struct maple_tree *tree,
- unsigned long addr)
-{
- memset(mas, 0, sizeof(struct ma_state));
- mas->tree = tree;
- mas->index = mas->last = addr;
- mas->max = ULONG_MAX;
- mas->status = ma_start;
- mas->node = NULL;
-}
-
static inline bool mas_is_active(struct ma_state *mas)
{
return mas->status == ma_active;
diff --git a/include/linux/maple_tree_types.h b/include/linux/maple_tree_types.h
new file mode 100644
index 000000000000..fe13414f239d
--- /dev/null
+++ b/include/linux/maple_tree_types.h
@@ -0,0 +1,341 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+#ifndef _LINUX_MAPLE_TREE_TYPES_H
+#define _LINUX_MAPLE_TREE_TYPES_H
+/*
+ * Maple Tree - An RCU-safe adaptive tree for storing ranges
+ * Copyright (c) 2018-2022 Oracle
+ * Authors: Liam R. Howlett <[email protected]>
+ * Matthew Wilcox <[email protected]>
+ */
+
+#include <linux/spinlock_types.h>
+#include <linux/string.h> // for memset()
+#include <linux/limits.h> // for ULONG_MAX
+
+/*
+ * Allocated nodes are mutable until they have been inserted into the tree,
+ * at which time they cannot change their type until they have been removed
+ * from the tree and an RCU grace period has passed.
+ *
+ * Removed nodes have their ->parent set to point to themselves. RCU readers
+ * check ->parent before relying on the value that they loaded from the
+ * slots array. This lets us reuse the slots array for the RCU head.
+ *
+ * Nodes in the tree point to their parent unless bit 0 is set.
+ */
+#if defined(CONFIG_64BIT) || defined(BUILD_VDSO32_64)
+/* 64bit sizes */
+#define MAPLE_NODE_SLOTS 31 /* 256 bytes including ->parent */
+#define MAPLE_RANGE64_SLOTS 16 /* 256 bytes */
+#define MAPLE_ARANGE64_SLOTS 10 /* 240 bytes */
+#define MAPLE_ALLOC_SLOTS (MAPLE_NODE_SLOTS - 1)
+#else
+/* 32bit sizes */
+#define MAPLE_NODE_SLOTS 63 /* 256 bytes including ->parent */
+#define MAPLE_RANGE64_SLOTS 32 /* 256 bytes */
+#define MAPLE_ARANGE64_SLOTS 21 /* 240 bytes */
+#define MAPLE_ALLOC_SLOTS (MAPLE_NODE_SLOTS - 2)
+#endif /* defined(CONFIG_64BIT) || defined(BUILD_VDSO32_64) */
+
+#define MAPLE_NODE_MASK 255UL
+
+/*
+ * The node->parent of the root node has bit 0 set and the rest of the pointer
+ * is a pointer to the tree itself. No more bits are available in this pointer
+ * (on m68k, the data structure may only be 2-byte aligned).
+ *
+ * Internal non-root nodes can only have maple_range_* nodes as parents. The
+ * parent pointer is 256B aligned like all other tree nodes. When storing a 32
+ * or 64 bit values, the offset can fit into 4 bits. The 16 bit values need an
+ * extra bit to store the offset. This extra bit comes from a reuse of the last
+ * bit in the node type. This is possible by using bit 1 to indicate if bit 2
+ * is part of the type or the slot.
+ *
+ * Once the type is decided, the decision of an allocation range type or a range
+ * type is done by examining the immutable tree flag for the MAPLE_ALLOC_RANGE
+ * flag.
+ *
+ * Node types:
+ * 0x??1 = Root
+ * 0x?00 = 16 bit nodes
+ * 0x010 = 32 bit nodes
+ * 0x110 = 64 bit nodes
+ *
+ * Slot size and location in the parent pointer:
+ * type : slot location
+ * 0x??1 : Root
+ * 0x?00 : 16 bit values, type in 0-1, slot in 2-6
+ * 0x010 : 32 bit values, type in 0-2, slot in 3-6
+ * 0x110 : 64 bit values, type in 0-2, slot in 3-6
+ */
+
+/*
+ * This metadata is used to optimize the gap updating code and in reverse
+ * searching for gaps or any other code that needs to find the end of the data.
+ */
+struct maple_metadata {
+ unsigned char end;
+ unsigned char gap;
+};
+
+/*
+ * Leaf nodes do not store pointers to nodes, they store user data. Users may
+ * store almost any bit pattern. As noted above, the optimisation of storing an
+ * entry at 0 in the root pointer cannot be done for data which have the bottom
+ * two bits set to '10'. We also reserve values with the bottom two bits set to
+ * '10' which are below 4096 (ie 2, 6, 10 .. 4094) for internal use. Some APIs
+ * return errnos as a negative errno shifted right by two bits and the bottom
+ * two bits set to '10', and while choosing to store these values in the array
+ * is not an error, it may lead to confusion if you're testing for an error with
+ * mas_is_err().
+ *
+ * Non-leaf nodes store the type of the node pointed to (enum maple_type in bits
+ * 3-6), bit 2 is reserved. That leaves bits 0-1 unused for now.
+ *
+ * In regular B-Tree terms, pivots are called keys. The term pivot is used to
+ * indicate that the tree is specifying ranges, Pivots may appear in the
+ * subtree with an entry attached to the value whereas keys are unique to a
+ * specific position of a B-tree. Pivot values are inclusive of the slot with
+ * the same index.
+ */
+
+struct maple_range_64 {
+ struct maple_pnode *parent;
+ unsigned long pivot[MAPLE_RANGE64_SLOTS - 1];
+ union {
+ void __rcu *slot[MAPLE_RANGE64_SLOTS];
+ struct {
+ void __rcu *pad[MAPLE_RANGE64_SLOTS - 1];
+ struct maple_metadata meta;
+ };
+ };
+};
+
+/*
+ * At tree creation time, the user can specify that they're willing to trade off
+ * storing fewer entries in a tree in return for storing more information in
+ * each node.
+ *
+ * The maple tree supports recording the largest range of NULL entries available
+ * in this node, also called gaps. This optimises the tree for allocating a
+ * range.
+ */
+struct maple_arange_64 {
+ struct maple_pnode *parent;
+ unsigned long pivot[MAPLE_ARANGE64_SLOTS - 1];
+ void __rcu *slot[MAPLE_ARANGE64_SLOTS];
+ unsigned long gap[MAPLE_ARANGE64_SLOTS];
+ struct maple_metadata meta;
+};
+
+struct maple_alloc {
+ unsigned long total;
+ unsigned char node_count;
+ unsigned int request_count;
+ struct maple_alloc *slot[MAPLE_ALLOC_SLOTS];
+};
+
+struct maple_topiary {
+ struct maple_pnode *parent;
+ struct maple_enode *next; /* Overlaps the pivot */
+};
+
+enum maple_type {
+ maple_dense,
+ maple_leaf_64,
+ maple_range_64,
+ maple_arange_64,
+};
+
+#ifdef CONFIG_LOCKDEP
+typedef struct lockdep_map *lockdep_map_p;
+#else
+typedef struct { /* nothing */ } lockdep_map_p;
+#endif
+
+/*
+ * If the tree contains a single entry at index 0, it is usually stored in
+ * tree->ma_root. To optimise for the page cache, an entry which ends in '00',
+ * '01' or '11' is stored in the root, but an entry which ends in '10' will be
+ * stored in a node. Bits 3-6 are used to store enum maple_type.
+ *
+ * The flags are used both to store some immutable information about this tree
+ * (set at tree creation time) and dynamic information set under the spinlock.
+ *
+ * Another use of flags are to indicate global states of the tree. This is the
+ * case with the MAPLE_USE_RCU flag, which indicates the tree is currently in
+ * RCU mode. This mode was added to allow the tree to reuse nodes instead of
+ * re-allocating and RCU freeing nodes when there is a single user.
+ */
+struct maple_tree {
+ union {
+ spinlock_t ma_lock;
+ lockdep_map_p ma_external_lock;
+ };
+ unsigned int ma_flags;
+ void __rcu *ma_root;
+};
+
+/*
+ * The Maple Tree squeezes various bits in at various points which aren't
+ * necessarily obvious. Usually, this is done by observing that pointers are
+ * N-byte aligned and thus the bottom log_2(N) bits are available for use. We
+ * don't use the high bits of pointers to store additional information because
+ * we don't know what bits are unused on any given architecture.
+ *
+ * Nodes are 256 bytes in size and are also aligned to 256 bytes, giving us 8
+ * low bits for our own purposes. Nodes are currently of 4 types:
+ * 1. Single pointer (Range is 0-0)
+ * 2. Non-leaf Allocation Range nodes
+ * 3. Non-leaf Range nodes
+ * 4. Leaf Range nodes All nodes consist of a number of node slots,
+ * pivots, and a parent pointer.
+ */
+
+struct maple_node {
+ union {
+ struct {
+ struct maple_pnode *parent;
+ void __rcu *slot[MAPLE_NODE_SLOTS];
+ };
+ struct {
+ void *pad;
+ struct rcu_head rcu;
+ struct maple_enode *piv_parent;
+ unsigned char parent_slot;
+ enum maple_type type;
+ unsigned char slot_len;
+ unsigned int ma_flags;
+ };
+ struct maple_range_64 mr64;
+ struct maple_arange_64 ma64;
+ struct maple_alloc alloc;
+ };
+};
+
+/*
+ * More complicated stores can cause two nodes to become one or three and
+ * potentially alter the height of the tree. Either half of the tree may need
+ * to be rebalanced against the other. The ma_topiary struct is used to track
+ * which nodes have been 'cut' from the tree so that the change can be done
+ * safely at a later date. This is done to support RCU.
+ */
+struct ma_topiary {
+ struct maple_enode *head;
+ struct maple_enode *tail;
+ struct maple_tree *mtree;
+};
+
+/* Advanced API */
+
+/*
+ * Maple State Status
+ * ma_active means the maple state is pointing to a node and offset and can
+ * continue operating on the tree.
+ * ma_start means we have not searched the tree.
+ * ma_root means we have searched the tree and the entry we found lives in
+ * the root of the tree (ie it has index 0, length 1 and is the only entry in
+ * the tree).
+ * ma_none means we have searched the tree and there is no node in the
+ * tree for this entry. For example, we searched for index 1 in an empty
+ * tree. Or we have a tree which points to a full leaf node and we
+ * searched for an entry which is larger than can be contained in that
+ * leaf node.
+ * ma_pause means the data within the maple state may be stale, restart the
+ * operation
+ * ma_overflow means the search has reached the upper limit of the search
+ * ma_underflow means the search has reached the lower limit of the search
+ * ma_error means there was an error, check the node for the error number.
+ */
+enum maple_status {
+ ma_active,
+ ma_start,
+ ma_root,
+ ma_none,
+ ma_pause,
+ ma_overflow,
+ ma_underflow,
+ ma_error,
+};
+
+/*
+ * The maple state is defined in the struct ma_state and is used to keep track
+ * of information during operations, and even between operations when using the
+ * advanced API.
+ *
+ * If state->node has bit 0 set then it references a tree location which is not
+ * a node (eg the root). If bit 1 is set, the rest of the bits are a negative
+ * errno. Bit 2 (the 'unallocated slots' bit) is clear. Bits 3-6 indicate the
+ * node type.
+ *
+ * state->alloc either has a request number of nodes or an allocated node. If
+ * stat->alloc has a requested number of nodes, the first bit will be set (0x1)
+ * and the remaining bits are the value. If state->alloc is a node, then the
+ * node will be of type maple_alloc. maple_alloc has MAPLE_NODE_SLOTS - 1 for
+ * storing more allocated nodes, a total number of nodes allocated, and the
+ * node_count in this node. node_count is the number of allocated nodes in this
+ * node. The scaling beyond MAPLE_NODE_SLOTS - 1 is handled by storing further
+ * nodes into state->alloc->slot[0]'s node. Nodes are taken from state->alloc
+ * by removing a node from the state->alloc node until state->alloc->node_count
+ * is 1, when state->alloc is returned and the state->alloc->slot[0] is promoted
+ * to state->alloc. Nodes are pushed onto state->alloc by putting the current
+ * state->alloc into the pushed node's slot[0].
+ *
+ * The state also contains the implied min/max of the state->node, the depth of
+ * this search, and the offset. The implied min/max are either from the parent
+ * node or are 0-oo for the root node. The depth is incremented or decremented
+ * every time a node is walked down or up. The offset is the slot/pivot of
+ * interest in the node - either for reading or writing.
+ *
+ * When returning a value the maple state index and last respectively contain
+ * the start and end of the range for the entry. Ranges are inclusive in the
+ * Maple Tree.
+ *
+ * The status of the state is used to determine how the next action should treat
+ * the state. For instance, if the status is ma_start then the next action
+ * should start at the root of the tree and walk down. If the status is
+ * ma_pause then the node may be stale data and should be discarded. If the
+ * status is ma_overflow, then the last action hit the upper limit.
+ *
+ */
+struct ma_state {
+ struct maple_tree *tree; /* The tree we're operating in */
+ unsigned long index; /* The index we're operating on - range start */
+ unsigned long last; /* The last index we're operating on - range end */
+ struct maple_enode *node; /* The node containing this entry */
+ unsigned long min; /* The minimum index of this node - implied pivot min */
+ unsigned long max; /* The maximum index of this node - implied pivot max */
+ struct maple_alloc *alloc; /* Allocated nodes for this operation */
+ enum maple_status status; /* The status of the state (active, start, none, etc) */
+ unsigned char depth; /* depth of tree descent during write */
+ unsigned char offset;
+ unsigned char mas_flags;
+ unsigned char end; /* The end of the node */
+};
+
+struct ma_wr_state {
+ struct ma_state *mas;
+ struct maple_node *node; /* Decoded mas->node */
+ unsigned long r_min; /* range min */
+ unsigned long r_max; /* range max */
+ enum maple_type type; /* mas->node type */
+ unsigned char offset_end; /* The offset where the write ends */
+ unsigned long *pivots; /* mas->node->pivots pointer */
+ unsigned long end_piv; /* The pivot at the offset end */
+ void __rcu **slots; /* mas->node->slots pointer */
+ void *entry; /* The entry to write */
+ void *content; /* The existing entry that is being overwritten */
+};
+
+static inline void mas_init(struct ma_state *mas, struct maple_tree *tree,
+ unsigned long addr)
+{
+ memset(mas, 0, sizeof(struct ma_state));
+ mas->tree = tree;
+ mas->index = mas->last = addr;
+ mas->max = ULONG_MAX;
+ mas->status = ma_start;
+ mas->node = NULL;
+}
+
+#endif /*_LINUX_MAPLE_TREE_TYPES_H */
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 9338b6217e3c..68910777dd1c 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -13,6 +13,7 @@
#include <linux/debug_locks.h>
#include <linux/mm_types.h>
#include <linux/mmap_lock.h>
+#include <linux/maple_tree.h>
#include <linux/range.h>
#include <linux/pfn.h>
#include <linux/bit_spinlock.h>
diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
index 28856bc6fdde..122a9011985b 100644
--- a/include/linux/mm_types.h
+++ b/include/linux/mm_types.h
@@ -9,7 +9,7 @@
#include <linux/list.h>
#include <linux/spinlock_types.h>
#include <linux/rbtree_types.h>
-#include <linux/maple_tree.h>
+#include <linux/maple_tree_types.h>
#include <linux/rwsem.h>
#include <linux/cpumask.h>
#include <linux/uprobes.h>
--
2.39.2
By providing declarations in a lean header, we can reduce header
dependencies.
Signed-off-by: Max Kellermann <[email protected]>
---
include/linux/backing-dev-defs.h | 2 +-
include/linux/flex_proportions.h | 2 +-
include/linux/ipc_namespace.h | 2 +-
include/linux/mm_types.h | 3 ++-
include/linux/percpu_counter.h | 17 +------------
include/linux/percpu_counter_types.h | 37 ++++++++++++++++++++++++++++
include/linux/sched/user.h | 2 +-
include/linux/shmem_fs.h | 2 +-
kernel/user.c | 1 +
lib/flex_proportions.c | 1 +
10 files changed, 47 insertions(+), 22 deletions(-)
create mode 100644 include/linux/percpu_counter_types.h
diff --git a/include/linux/backing-dev-defs.h b/include/linux/backing-dev-defs.h
index 68fdec049456..720a88bb3513 100644
--- a/include/linux/backing-dev-defs.h
+++ b/include/linux/backing-dev-defs.h
@@ -6,7 +6,7 @@
#include <linux/radix-tree.h>
#include <linux/rbtree_types.h>
#include <linux/spinlock_types.h>
-#include <linux/percpu_counter.h>
+#include <linux/percpu_counter_types.h>
#include <linux/percpu-refcount.h>
#include <linux/flex_proportions.h>
#include <linux/timer_types.h>
diff --git a/include/linux/flex_proportions.h b/include/linux/flex_proportions.h
index 35204b64addf..df9017a61046 100644
--- a/include/linux/flex_proportions.h
+++ b/include/linux/flex_proportions.h
@@ -8,7 +8,7 @@
#ifndef _LINUX_FLEX_PROPORTIONS_H
#define _LINUX_FLEX_PROPORTIONS_H
-#include <linux/percpu_counter.h>
+#include <linux/percpu_counter_types.h>
#include <linux/spinlock_types.h>
#include <linux/seqlock_types.h>
#include <linux/gfp_types.h>
diff --git a/include/linux/ipc_namespace.h b/include/linux/ipc_namespace.h
index a0011b6cd5d1..7c758ab565fe 100644
--- a/include/linux/ipc_namespace.h
+++ b/include/linux/ipc_namespace.h
@@ -11,7 +11,7 @@
#include <linux/refcount.h>
#include <linux/rhashtable-types.h>
#include <linux/sysctl.h>
-#include <linux/percpu_counter.h>
+#include <linux/percpu_counter_types.h>
struct user_namespace;
diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
index 88bbb724080f..80d5a1762cca 100644
--- a/include/linux/mm_types.h
+++ b/include/linux/mm_types.h
@@ -17,7 +17,8 @@
#include <linux/page-flags-layout.h>
#include <linux/workqueue_types.h>
#include <linux/seqlock_types.h>
-#include <linux/percpu_counter.h>
+#include <linux/percpu_counter_types.h>
+#include <linux/percpu.h>
#include <asm/mmu.h>
diff --git a/include/linux/percpu_counter.h b/include/linux/percpu_counter.h
index 8d45785b3448..bec5e7cdd476 100644
--- a/include/linux/percpu_counter.h
+++ b/include/linux/percpu_counter.h
@@ -7,26 +7,15 @@
* WARNING: these things are HUGE. 4 kbytes per counter on 32-way P4.
*/
-#include <linux/spinlock_types.h>
-#include <linux/list.h>
+#include <linux/percpu_counter_types.h>
#include <linux/threads.h>
#include <linux/percpu.h>
-#include <linux/types.h>
/* percpu_counter batch for local add or sub */
#define PERCPU_COUNTER_LOCAL_BATCH INT_MAX
#ifdef CONFIG_SMP
-struct percpu_counter {
- raw_spinlock_t lock;
- s64 count;
-#ifdef CONFIG_HOTPLUG_CPU
- struct list_head list; /* All percpu_counters are on a list */
-#endif
- s32 __percpu *counters;
-};
-
extern int percpu_counter_batch;
int __percpu_counter_init_many(struct percpu_counter *fbc, s64 amount,
@@ -131,10 +120,6 @@ static inline bool percpu_counter_initialized(struct percpu_counter *fbc)
#else /* !CONFIG_SMP */
-struct percpu_counter {
- s64 count;
-};
-
static inline int percpu_counter_init_many(struct percpu_counter *fbc,
s64 amount, gfp_t gfp,
u32 nr_counters)
diff --git a/include/linux/percpu_counter_types.h b/include/linux/percpu_counter_types.h
new file mode 100644
index 000000000000..faccd9869a5a
--- /dev/null
+++ b/include/linux/percpu_counter_types.h
@@ -0,0 +1,37 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef _LINUX_PERCPU_COUNTER_TYPES_H
+#define _LINUX_PERCPU_COUNTER_TYPES_H
+/*
+ * A simple "approximate counter" for use in ext2 and ext3 superblocks.
+ *
+ * WARNING: these things are HUGE. 4 kbytes per counter on 32-way P4.
+ */
+
+#include <linux/types.h>
+
+#ifdef CONFIG_SMP
+
+#include <linux/spinlock_types.h>
+
+#ifdef CONFIG_HOTPLUG_CPU
+#include <linux/list.h>
+#endif
+
+struct percpu_counter {
+ raw_spinlock_t lock;
+ s64 count;
+#ifdef CONFIG_HOTPLUG_CPU
+ struct list_head list; /* All percpu_counters are on a list */
+#endif
+ s32 __percpu *counters;
+};
+
+#else /* !CONFIG_SMP */
+
+struct percpu_counter {
+ s64 count;
+};
+
+#endif /* CONFIG_SMP */
+
+#endif /* _LINUX_PERCPU_COUNTER_TYPES_H */
diff --git a/include/linux/sched/user.h b/include/linux/sched/user.h
index 671ecee08d23..913da0aba05c 100644
--- a/include/linux/sched/user.h
+++ b/include/linux/sched/user.h
@@ -4,7 +4,7 @@
#include <linux/uidgid_types.h>
#include <linux/atomic.h>
-#include <linux/percpu_counter.h>
+#include <linux/percpu_counter_types.h>
#include <linux/refcount.h>
#include <linux/ratelimit_types.h>
diff --git a/include/linux/shmem_fs.h b/include/linux/shmem_fs.h
index 2caa6b86106a..1d7e56eab60f 100644
--- a/include/linux/shmem_fs.h
+++ b/include/linux/shmem_fs.h
@@ -6,7 +6,7 @@
#include <linux/swap.h>
#include <linux/mempolicy.h>
#include <linux/pagemap.h>
-#include <linux/percpu_counter.h>
+#include <linux/percpu_counter_types.h>
#include <linux/xattr.h>
#include <linux/fs_parser.h>
#include <linux/userfaultfd_k.h>
diff --git a/kernel/user.c b/kernel/user.c
index 28da71ea1e74..6c8b818419f8 100644
--- a/kernel/user.c
+++ b/kernel/user.c
@@ -22,6 +22,7 @@
#include <linux/proc_ns.h>
#include <linux/ratelimit.h>
#include <linux/uidgid.h>
+#include <linux/percpu_counter.h>
#if IS_ENABLED(CONFIG_BINFMT_MISC)
struct binfmt_misc init_binfmt_misc = {
diff --git a/lib/flex_proportions.c b/lib/flex_proportions.c
index 35784f94f0a7..967626b48bd0 100644
--- a/lib/flex_proportions.c
+++ b/lib/flex_proportions.c
@@ -34,6 +34,7 @@
* which something happened with proportion of type j.
*/
#include <linux/flex_proportions.h>
+#include <linux/percpu_counter.h>
#include <linux/math64.h>
#include <linux/seqlock.h>
--
2.39.2
By providing declarations in a lean header, we can reduce header
dependencies.
Signed-off-by: Max Kellermann <[email protected]>
---
include/linux/blk_types.h | 2 +-
include/linux/bvec.h | 84 +--------------------------------
include/linux/bvec_types.h | 95 ++++++++++++++++++++++++++++++++++++++
include/linux/iov_iter.h | 2 +-
include/linux/skbuff.h | 2 +-
5 files changed, 99 insertions(+), 86 deletions(-)
create mode 100644 include/linux/bvec_types.h
diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h
index 1c07848dea7e..9d2d8a8328a6 100644
--- a/include/linux/blk_types.h
+++ b/include/linux/blk_types.h
@@ -7,7 +7,7 @@
#define __LINUX_BLK_TYPES_H
#include <linux/types.h>
-#include <linux/bvec.h>
+#include <linux/bvec_types.h>
#include <linux/device.h>
#include <linux/ktime.h>
diff --git a/include/linux/bvec.h b/include/linux/bvec.h
index 555aae5448ae..fbb79e6ba953 100644
--- a/include/linux/bvec.h
+++ b/include/linux/bvec.h
@@ -7,6 +7,7 @@
#ifndef __LINUX_BVEC_H
#define __LINUX_BVEC_H
+#include <linux/bvec_types.h>
#include <linux/highmem.h>
#include <linux/bug.h>
#include <linux/errno.h>
@@ -14,26 +15,6 @@
#include <linux/minmax.h>
#include <linux/types.h>
-struct page;
-
-/**
- * struct bio_vec - a contiguous range of physical memory addresses
- * @bv_page: First page associated with the address range.
- * @bv_len: Number of bytes in the address range.
- * @bv_offset: Start of the address range relative to the start of @bv_page.
- *
- * The following holds for a bvec if n * PAGE_SIZE < bv_offset + bv_len:
- *
- * nth_page(@bv_page, n) == @bv_page + n
- *
- * This holds because page_is_mergeable() checks the above property.
- */
-struct bio_vec {
- struct page *bv_page;
- unsigned int bv_len;
- unsigned int bv_offset;
-};
-
/**
* bvec_set_page - initialize a bvec based off a struct page
* @bv: bvec to initialize
@@ -74,69 +55,6 @@ static inline void bvec_set_virt(struct bio_vec *bv, void *vaddr,
bvec_set_page(bv, virt_to_page(vaddr), len, offset_in_page(vaddr));
}
-struct bvec_iter {
- sector_t bi_sector; /* device address in 512 byte
- sectors */
- unsigned int bi_size; /* residual I/O count */
-
- unsigned int bi_idx; /* current index into bvl_vec */
-
- unsigned int bi_bvec_done; /* number of bytes completed in
- current bvec */
-} __packed;
-
-struct bvec_iter_all {
- struct bio_vec bv;
- int idx;
- unsigned done;
-};
-
-/*
- * various member access, note that bio_data should of course not be used
- * on highmem page vectors
- */
-#define __bvec_iter_bvec(bvec, iter) (&(bvec)[(iter).bi_idx])
-
-/* multi-page (mp_bvec) helpers */
-#define mp_bvec_iter_page(bvec, iter) \
- (__bvec_iter_bvec((bvec), (iter))->bv_page)
-
-#define mp_bvec_iter_len(bvec, iter) \
- min((iter).bi_size, \
- __bvec_iter_bvec((bvec), (iter))->bv_len - (iter).bi_bvec_done)
-
-#define mp_bvec_iter_offset(bvec, iter) \
- (__bvec_iter_bvec((bvec), (iter))->bv_offset + (iter).bi_bvec_done)
-
-#define mp_bvec_iter_page_idx(bvec, iter) \
- (mp_bvec_iter_offset((bvec), (iter)) / PAGE_SIZE)
-
-#define mp_bvec_iter_bvec(bvec, iter) \
-((struct bio_vec) { \
- .bv_page = mp_bvec_iter_page((bvec), (iter)), \
- .bv_len = mp_bvec_iter_len((bvec), (iter)), \
- .bv_offset = mp_bvec_iter_offset((bvec), (iter)), \
-})
-
-/* For building single-page bvec in flight */
- #define bvec_iter_offset(bvec, iter) \
- (mp_bvec_iter_offset((bvec), (iter)) % PAGE_SIZE)
-
-#define bvec_iter_len(bvec, iter) \
- min_t(unsigned, mp_bvec_iter_len((bvec), (iter)), \
- PAGE_SIZE - bvec_iter_offset((bvec), (iter)))
-
-#define bvec_iter_page(bvec, iter) \
- (mp_bvec_iter_page((bvec), (iter)) + \
- mp_bvec_iter_page_idx((bvec), (iter)))
-
-#define bvec_iter_bvec(bvec, iter) \
-((struct bio_vec) { \
- .bv_page = bvec_iter_page((bvec), (iter)), \
- .bv_len = bvec_iter_len((bvec), (iter)), \
- .bv_offset = bvec_iter_offset((bvec), (iter)), \
-})
-
static inline bool bvec_iter_advance(const struct bio_vec *bv,
struct bvec_iter *iter, unsigned bytes)
{
diff --git a/include/linux/bvec_types.h b/include/linux/bvec_types.h
new file mode 100644
index 000000000000..23453c988154
--- /dev/null
+++ b/include/linux/bvec_types.h
@@ -0,0 +1,95 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * bvec iterator
+ *
+ * Copyright (C) 2001 Ming Lei <[email protected]>
+ */
+#ifndef __LINUX_BVEC_TYPES_H
+#define __LINUX_BVEC_TYPES_H
+
+#include <linux/types.h>
+
+struct page;
+
+/**
+ * struct bio_vec - a contiguous range of physical memory addresses
+ * @bv_page: First page associated with the address range.
+ * @bv_len: Number of bytes in the address range.
+ * @bv_offset: Start of the address range relative to the start of @bv_page.
+ *
+ * The following holds for a bvec if n * PAGE_SIZE < bv_offset + bv_len:
+ *
+ * nth_page(@bv_page, n) == @bv_page + n
+ *
+ * This holds because page_is_mergeable() checks the above property.
+ */
+struct bio_vec {
+ struct page *bv_page;
+ unsigned int bv_len;
+ unsigned int bv_offset;
+};
+
+struct bvec_iter {
+ sector_t bi_sector; /* device address in 512 byte
+ sectors */
+ unsigned int bi_size; /* residual I/O count */
+
+ unsigned int bi_idx; /* current index into bvl_vec */
+
+ unsigned int bi_bvec_done; /* number of bytes completed in
+ current bvec */
+} __packed;
+
+struct bvec_iter_all {
+ struct bio_vec bv;
+ int idx;
+ unsigned done;
+};
+
+/*
+ * various member access, note that bio_data should of course not be used
+ * on highmem page vectors
+ */
+#define __bvec_iter_bvec(bvec, iter) (&(bvec)[(iter).bi_idx])
+
+/* multi-page (mp_bvec) helpers */
+#define mp_bvec_iter_page(bvec, iter) \
+ (__bvec_iter_bvec((bvec), (iter))->bv_page)
+
+#define mp_bvec_iter_len(bvec, iter) \
+ min((iter).bi_size, \
+ __bvec_iter_bvec((bvec), (iter))->bv_len - (iter).bi_bvec_done)
+
+#define mp_bvec_iter_offset(bvec, iter) \
+ (__bvec_iter_bvec((bvec), (iter))->bv_offset + (iter).bi_bvec_done)
+
+#define mp_bvec_iter_page_idx(bvec, iter) \
+ (mp_bvec_iter_offset((bvec), (iter)) / PAGE_SIZE)
+
+#define mp_bvec_iter_bvec(bvec, iter) \
+((struct bio_vec) { \
+ .bv_page = mp_bvec_iter_page((bvec), (iter)), \
+ .bv_len = mp_bvec_iter_len((bvec), (iter)), \
+ .bv_offset = mp_bvec_iter_offset((bvec), (iter)), \
+})
+
+/* For building single-page bvec in flight */
+ #define bvec_iter_offset(bvec, iter) \
+ (mp_bvec_iter_offset((bvec), (iter)) % PAGE_SIZE)
+
+#define bvec_iter_len(bvec, iter) \
+ min_t(unsigned, mp_bvec_iter_len((bvec), (iter)), \
+ PAGE_SIZE - bvec_iter_offset((bvec), (iter)))
+
+#define bvec_iter_page(bvec, iter) \
+ (mp_bvec_iter_page((bvec), (iter)) + \
+ mp_bvec_iter_page_idx((bvec), (iter)))
+
+#define bvec_iter_bvec(bvec, iter) \
+((struct bio_vec) { \
+ .bv_page = bvec_iter_page((bvec), (iter)), \
+ .bv_len = bvec_iter_len((bvec), (iter)), \
+ .bv_offset = bvec_iter_offset((bvec), (iter)), \
+})
+
+#endif /* __LINUX_BVEC_TYPES_H */
diff --git a/include/linux/iov_iter.h b/include/linux/iov_iter.h
index 270454a6703d..6e0749779ca5 100644
--- a/include/linux/iov_iter.h
+++ b/include/linux/iov_iter.h
@@ -9,7 +9,7 @@
#define _LINUX_IOV_ITER_H
#include <linux/uio.h>
-#include <linux/bvec.h>
+#include <linux/bvec_types.h>
typedef size_t (*iov_step_f)(void *iter_base, size_t progress, size_t len,
void *priv, void *priv2);
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 2dde34c29203..8ee67e49699b 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -14,7 +14,7 @@
#include <linux/compiler.h>
#include <linux/time.h>
#include <linux/bug.h>
-#include <linux/bvec.h>
+#include <linux/bvec_types.h>
#include <linux/cache.h>
#include <linux/rbtree.h>
#include <linux/socket.h>
--
2.39.2
By providing declarations in a lean header, we can reduce header
dependencies.
Signed-off-by: Max Kellermann <[email protected]>
---
include/linux/backing-dev-defs.h | 2 +-
include/linux/comedi/comedidev.h | 2 +-
include/linux/gnss.h | 2 +-
include/linux/i3c/master.h | 2 +-
include/linux/ipc_namespace.h | 2 +-
include/linux/leds.h | 2 +-
include/linux/mfd/intel-m10-bmc.h | 2 +-
include/linux/mm_types.h | 2 +-
include/linux/nfs_fs.h | 2 +-
include/linux/posix-clock.h | 2 +-
include/linux/quota.h | 2 +-
include/linux/rwsem.h | 48 +------------------
include/linux/rwsem_types.h | 78 +++++++++++++++++++++++++++++++
include/linux/tty.h | 2 +-
include/linux/user_namespace.h | 2 +-
include/net/sch_generic.h | 2 +-
include/rdma/ib_verbs.h | 2 +-
include/sound/core.h | 2 +-
18 files changed, 95 insertions(+), 63 deletions(-)
create mode 100644 include/linux/rwsem_types.h
diff --git a/include/linux/backing-dev-defs.h b/include/linux/backing-dev-defs.h
index b379687434fa..68fdec049456 100644
--- a/include/linux/backing-dev-defs.h
+++ b/include/linux/backing-dev-defs.h
@@ -15,7 +15,7 @@
#include <linux/kref_types.h>
#ifdef CONFIG_CGROUP_WRITEBACK
-#include <linux/rwsem.h>
+#include <linux/rwsem_types.h>
#endif
struct page;
diff --git a/include/linux/comedi/comedidev.h b/include/linux/comedi/comedidev.h
index d7a75b15c6f7..a3c2268f7ae5 100644
--- a/include/linux/comedi/comedidev.h
+++ b/include/linux/comedi/comedidev.h
@@ -13,7 +13,7 @@
#include <linux/dma-mapping.h>
#include <linux/mutex_types.h>
#include <linux/spinlock_types.h>
-#include <linux/rwsem.h>
+#include <linux/rwsem_types.h>
#include <linux/kref_types.h>
#include <linux/comedi.h>
diff --git a/include/linux/gnss.h b/include/linux/gnss.h
index 8fc4bdd38dc6..9f38ff948d78 100644
--- a/include/linux/gnss.h
+++ b/include/linux/gnss.h
@@ -12,7 +12,7 @@
#include <linux/device.h>
#include <linux/kfifo.h>
#include <linux/mutex_types.h>
-#include <linux/rwsem.h>
+#include <linux/rwsem_types.h>
#include <linux/types.h>
#include <linux/wait.h>
diff --git a/include/linux/i3c/master.h b/include/linux/i3c/master.h
index 16cc81e55b12..0e456edeebbf 100644
--- a/include/linux/i3c/master.h
+++ b/include/linux/i3c/master.h
@@ -14,7 +14,7 @@
#include <linux/i2c.h>
#include <linux/i3c/ccc.h>
#include <linux/i3c/device.h>
-#include <linux/rwsem.h>
+#include <linux/rwsem_types.h>
#include <linux/workqueue_types.h>
#define I3C_HOT_JOIN_ADDR 0x2
diff --git a/include/linux/ipc_namespace.h b/include/linux/ipc_namespace.h
index e8240cf2611a..a0011b6cd5d1 100644
--- a/include/linux/ipc_namespace.h
+++ b/include/linux/ipc_namespace.h
@@ -4,7 +4,7 @@
#include <linux/err.h>
#include <linux/idr.h>
-#include <linux/rwsem.h>
+#include <linux/rwsem_types.h>
#include <linux/notifier.h>
#include <linux/nsproxy.h>
#include <linux/ns_common.h>
diff --git a/include/linux/leds.h b/include/linux/leds.h
index 71385b333f25..0f6f44f05a54 100644
--- a/include/linux/leds.h
+++ b/include/linux/leds.h
@@ -11,7 +11,7 @@
#include <dt-bindings/leds/common.h>
#include <linux/device.h>
#include <linux/mutex_types.h>
-#include <linux/rwsem.h>
+#include <linux/rwsem_types.h>
#include <linux/spinlock_types.h>
#include <linux/timer_types.h>
#include <linux/types.h>
diff --git a/include/linux/mfd/intel-m10-bmc.h b/include/linux/mfd/intel-m10-bmc.h
index ee66c9751003..3500f5fa8057 100644
--- a/include/linux/mfd/intel-m10-bmc.h
+++ b/include/linux/mfd/intel-m10-bmc.h
@@ -11,7 +11,7 @@
#include <linux/bits.h>
#include <linux/dev_printk.h>
#include <linux/regmap.h>
-#include <linux/rwsem.h>
+#include <linux/rwsem_types.h>
#define M10BMC_N3000_LEGACY_BUILD_VER 0x300468
#define M10BMC_N3000_SYS_BASE 0x300800
diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
index 122a9011985b..6ee90f81e01d 100644
--- a/include/linux/mm_types.h
+++ b/include/linux/mm_types.h
@@ -10,7 +10,7 @@
#include <linux/spinlock_types.h>
#include <linux/rbtree_types.h>
#include <linux/maple_tree_types.h>
-#include <linux/rwsem.h>
+#include <linux/rwsem_types.h>
#include <linux/cpumask.h>
#include <linux/uprobes.h>
#include <linux/rcupdate.h>
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h
index 4511d8a50e15..8f14fce5d7e2 100644
--- a/include/linux/nfs_fs.h
+++ b/include/linux/nfs_fs.h
@@ -24,7 +24,7 @@
#include <linux/pagemap.h>
#include <linux/rbtree_types.h>
#include <linux/refcount_types.h>
-#include <linux/rwsem.h>
+#include <linux/rwsem_types.h>
#include <linux/sunrpc/debug.h>
#include <linux/sunrpc/auth.h>
diff --git a/include/linux/posix-clock.h b/include/linux/posix-clock.h
index ef8619f48920..f8e0c65d262d 100644
--- a/include/linux/posix-clock.h
+++ b/include/linux/posix-clock.h
@@ -11,7 +11,7 @@
#include <linux/fs.h>
#include <linux/poll.h>
#include <linux/posix-timers.h>
-#include <linux/rwsem.h>
+#include <linux/rwsem_types.h>
struct posix_clock;
struct posix_clock_context;
diff --git a/include/linux/quota.h b/include/linux/quota.h
index bf16d9d2866c..956281c84850 100644
--- a/include/linux/quota.h
+++ b/include/linux/quota.h
@@ -34,7 +34,7 @@
#include <linux/list.h>
#include <linux/mutex_types.h>
-#include <linux/rwsem.h>
+#include <linux/rwsem_types.h>
#include <linux/spinlock_types.h>
#include <linux/percpu_counter.h>
diff --git a/include/linux/rwsem.h b/include/linux/rwsem.h
index 9c29689ff505..ba9532734bf6 100644
--- a/include/linux/rwsem.h
+++ b/include/linux/rwsem.h
@@ -8,10 +8,10 @@
#ifndef _LINUX_RWSEM_H
#define _LINUX_RWSEM_H
+#include <linux/rwsem_types.h>
#include <linux/linkage.h>
#include <linux/types.h>
-#include <linux/list.h>
#include <linux/spinlock.h>
#include <linux/atomic.h>
#include <linux/err.h>
@@ -29,43 +29,6 @@
#ifndef CONFIG_PREEMPT_RT
-#ifdef CONFIG_RWSEM_SPIN_ON_OWNER
-#include <linux/osq_lock.h>
-#endif
-
-/*
- * For an uncontended rwsem, count and owner are the only fields a task
- * needs to touch when acquiring the rwsem. So they are put next to each
- * other to increase the chance that they will share the same cacheline.
- *
- * In a contended rwsem, the owner is likely the most frequently accessed
- * field in the structure as the optimistic waiter that holds the osq lock
- * will spin on owner. For an embedded rwsem, other hot fields in the
- * containing structure should be moved further away from the rwsem to
- * reduce the chance that they will share the same cacheline causing
- * cacheline bouncing problem.
- */
-struct rw_semaphore {
- atomic_long_t count;
- /*
- * Write owner or one of the read owners as well flags regarding
- * the current state of the rwsem. Can be used as a speculative
- * check to see if the write owner is running on the cpu.
- */
- atomic_long_t owner;
-#ifdef CONFIG_RWSEM_SPIN_ON_OWNER
- struct optimistic_spin_queue osq; /* spinner MCS lock */
-#endif
- raw_spinlock_t wait_lock;
- struct list_head wait_list;
-#ifdef CONFIG_DEBUG_RWSEMS
- void *magic;
-#endif
-#ifdef CONFIG_DEBUG_LOCK_ALLOC
- struct lockdep_map dep_map;
-#endif
-};
-
/* In all implementations count != 0 means locked */
static inline int rwsem_is_locked(struct rw_semaphore *sem)
{
@@ -124,15 +87,6 @@ static inline int rwsem_is_contended(struct rw_semaphore *sem)
#else /* !CONFIG_PREEMPT_RT */
-#include <linux/rwbase_rt.h>
-
-struct rw_semaphore {
- struct rwbase_rt rwbase;
-#ifdef CONFIG_DEBUG_LOCK_ALLOC
- struct lockdep_map dep_map;
-#endif
-};
-
#define __RWSEM_INITIALIZER(name) \
{ \
.rwbase = __RWBASE_INITIALIZER(name), \
diff --git a/include/linux/rwsem_types.h b/include/linux/rwsem_types.h
new file mode 100644
index 000000000000..105142147b9b
--- /dev/null
+++ b/include/linux/rwsem_types.h
@@ -0,0 +1,78 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/* rwsem.h: R/W semaphores, public interface
+ *
+ * Written by David Howells ([email protected]).
+ * Derived from asm-i386/semaphore.h
+ */
+
+#ifndef _LINUX_RWSEM_TYPES_H
+#define _LINUX_RWSEM_TYPES_H
+
+#include <linux/list.h>
+#include <linux/spinlock_types.h>
+#include <linux/atomic.h>
+
+#ifdef CONFIG_DEBUG_LOCK_ALLOC
+#include <linux/lockdep_types.h>
+# define __RWSEM_DEP_MAP_INIT(lockname) \
+ .dep_map = { \
+ .name = #lockname, \
+ .wait_type_inner = LD_WAIT_SLEEP, \
+ },
+#else
+# define __RWSEM_DEP_MAP_INIT(lockname)
+#endif
+
+#ifndef CONFIG_PREEMPT_RT
+
+#ifdef CONFIG_RWSEM_SPIN_ON_OWNER
+#include <linux/osq_lock.h>
+#endif
+
+/*
+ * For an uncontended rwsem, count and owner are the only fields a task
+ * needs to touch when acquiring the rwsem. So they are put next to each
+ * other to increase the chance that they will share the same cacheline.
+ *
+ * In a contended rwsem, the owner is likely the most frequently accessed
+ * field in the structure as the optimistic waiter that holds the osq lock
+ * will spin on owner. For an embedded rwsem, other hot fields in the
+ * containing structure should be moved further away from the rwsem to
+ * reduce the chance that they will share the same cacheline causing
+ * cacheline bouncing problem.
+ */
+struct rw_semaphore {
+ atomic_long_t count;
+ /*
+ * Write owner or one of the read owners as well flags regarding
+ * the current state of the rwsem. Can be used as a speculative
+ * check to see if the write owner is running on the cpu.
+ */
+ atomic_long_t owner;
+#ifdef CONFIG_RWSEM_SPIN_ON_OWNER
+ struct optimistic_spin_queue osq; /* spinner MCS lock */
+#endif
+ raw_spinlock_t wait_lock;
+ struct list_head wait_list;
+#ifdef CONFIG_DEBUG_RWSEMS
+ void *magic;
+#endif
+#ifdef CONFIG_DEBUG_LOCK_ALLOC
+ struct lockdep_map dep_map;
+#endif
+};
+
+#else /* !CONFIG_PREEMPT_RT */
+
+#include <linux/rwbase_rt.h>
+
+struct rw_semaphore {
+ struct rwbase_rt rwbase;
+#ifdef CONFIG_DEBUG_LOCK_ALLOC
+ struct lockdep_map dep_map;
+#endif
+};
+
+#endif /* CONFIG_PREEMPT_RT */
+
+#endif /* _LINUX_RWSEM_TYPES_H */
diff --git a/include/linux/tty.h b/include/linux/tty.h
index 5a3815e7d73d..da820609bc77 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -13,7 +13,7 @@
#include <linux/mutex_types.h>
#include <linux/tty_flags.h>
#include <uapi/linux/tty.h>
-#include <linux/rwsem.h>
+#include <linux/rwsem_types.h>
#include <linux/llist.h>
diff --git a/include/linux/user_namespace.h b/include/linux/user_namespace.h
index 7d0e3418d497..c82e1b50dfcb 100644
--- a/include/linux/user_namespace.h
+++ b/include/linux/user_namespace.h
@@ -6,7 +6,7 @@
#include <linux/ns_common.h>
#include <linux/sched.h>
#include <linux/workqueue_types.h>
-#include <linux/rwsem.h>
+#include <linux/rwsem_types.h>
#include <linux/sysctl.h>
#include <linux/err.h>
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
index bab44a435a62..6ec5064156d9 100644
--- a/include/net/sch_generic.h
+++ b/include/net/sch_generic.h
@@ -12,7 +12,7 @@
#include <linux/list.h>
#include <linux/refcount.h>
#include <linux/mutex_types.h>
-#include <linux/rwsem.h>
+#include <linux/rwsem_types.h>
#include <linux/atomic.h>
#include <linux/hashtable.h>
#include <net/gen_stats.h>
diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
index 64b62d1388a4..7d6216e85b0e 100644
--- a/include/rdma/ib_verbs.h
+++ b/include/rdma/ib_verbs.h
@@ -18,7 +18,7 @@
#include <linux/dma-mapping.h>
#include <linux/kref_types.h>
#include <linux/list.h>
-#include <linux/rwsem.h>
+#include <linux/rwsem_types.h>
#include <linux/workqueue_types.h>
#include <linux/irq_poll.h>
#include <uapi/linux/if_ether.h>
diff --git a/include/sound/core.h b/include/sound/core.h
index 0c512acac050..f95f6863986f 100644
--- a/include/sound/core.h
+++ b/include/sound/core.h
@@ -10,7 +10,7 @@
#include <linux/device.h>
#include <linux/sched.h> /* wake_up() */
#include <linux/mutex_types.h> /* struct mutex */
-#include <linux/rwsem.h> /* struct rw_semaphore */
+#include <linux/rwsem_types.h> /* struct rw_semaphore */
#include <linux/stringify.h>
#include <linux/printk.h>
#include <linux/wait.h>
--
2.39.2
By providing declarations in a lean header, we can reduce header
dependencies.
Signed-off-by: Max Kellermann <[email protected]>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_ih.h | 2 +-
include/drm/gpu_scheduler.h | 2 +-
include/linux/backing-dev-defs.h | 2 +-
include/linux/blkdev.h | 2 +-
include/linux/buffer_head.h | 2 +-
include/linux/ceph/libceph.h | 2 +-
include/linux/cgroup-defs.h | 2 +-
include/linux/console_struct.h | 2 +-
include/linux/counter.h | 2 +-
include/linux/dcache.h | 2 +-
include/linux/dma-buf.h | 2 +-
include/linux/eventfd.h | 2 +-
include/linux/gnss.h | 2 +-
include/linux/libps2.h | 2 +-
include/linux/lp.h | 2 +-
include/linux/mempool.h | 2 +-
include/linux/mhi.h | 2 +-
include/linux/mmzone.h | 2 +-
include/linux/net.h | 2 +-
include/linux/nfs_fs_sb.h | 2 +-
include/linux/parport.h | 2 +-
include/linux/pid.h | 2 +-
include/linux/pm.h | 2 +-
include/linux/poll.h | 2 +-
include/linux/psi_types.h | 2 +-
include/linux/relay.h | 2 +-
include/linux/rtnetlink.h | 2 +-
include/linux/sbitmap.h | 2 +-
include/linux/sunrpc/rpc_pipe_fs.h | 2 +-
include/linux/syslog.h | 2 +-
include/linux/wait.h | 23 +------------------
include/linux/wait_bit.h | 2 +-
include/linux/wait_types.h | 31 ++++++++++++++++++++++++++
include/media/dvb_ringbuffer.h | 2 +-
include/net/smc.h | 2 +-
include/net/sock.h | 2 +-
include/scsi/libiscsi.h | 2 +-
include/sound/control.h | 2 +-
include/sound/rawmidi.h | 2 +-
39 files changed, 69 insertions(+), 59 deletions(-)
create mode 100644 include/linux/wait_types.h
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ih.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_ih.h
index 59a5bc9b1120..6e01527b2be5 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ih.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ih.h
@@ -25,7 +25,7 @@
#define __AMDGPU_IH_H__
#include <linux/types.h>
-#include <linux/wait.h>
+#include <linux/wait_types.h>
/* Maximum number of IVs processed at once */
#define AMDGPU_IH_MAX_NUM_IVS 32
diff --git a/include/drm/gpu_scheduler.h b/include/drm/gpu_scheduler.h
index 4edd7ac64b62..05591cc987c2 100644
--- a/include/drm/gpu_scheduler.h
+++ b/include/drm/gpu_scheduler.h
@@ -28,7 +28,7 @@
#include <linux/dma-fence.h>
#include <linux/completion.h>
#include <linux/xarray.h>
-#include <linux/wait.h>
+#include <linux/wait_types.h>
#include <linux/workqueue_types.h>
#define MAX_WAIT_SCHED_ENTITY_Q_EMPTY msecs_to_jiffies(1000)
diff --git a/include/linux/backing-dev-defs.h b/include/linux/backing-dev-defs.h
index 720a88bb3513..ffdd82f2f3e6 100644
--- a/include/linux/backing-dev-defs.h
+++ b/include/linux/backing-dev-defs.h
@@ -10,7 +10,7 @@
#include <linux/percpu-refcount.h>
#include <linux/flex_proportions.h>
#include <linux/timer_types.h>
-#include <linux/wait.h>
+#include <linux/wait_types.h>
#include <linux/workqueue_types.h>
#include <linux/kref_types.h>
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index ec4940fcc489..3a14de75286a 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -13,7 +13,7 @@
#include <linux/minmax.h>
#include <linux/timer_types.h>
#include <linux/workqueue_types.h>
-#include <linux/wait.h>
+#include <linux/wait_types.h>
#include <linux/bio.h>
#include <linux/gfp_types.h>
#include <linux/kdev_t.h>
diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h
index d78454a4dd1f..15dffb5374fb 100644
--- a/include/linux/buffer_head.h
+++ b/include/linux/buffer_head.h
@@ -13,7 +13,7 @@
#include <linux/fs.h>
#include <linux/linkage.h>
#include <linux/pagemap.h>
-#include <linux/wait.h>
+#include <linux/wait_types.h>
#include <linux/atomic.h>
enum bh_state_bits {
diff --git a/include/linux/ceph/libceph.h b/include/linux/ceph/libceph.h
index d01be9103e56..12eb9c9f6620 100644
--- a/include/linux/ceph/libceph.h
+++ b/include/linux/ceph/libceph.h
@@ -11,7 +11,7 @@
#include <linux/fs.h>
#include <linux/mempool.h>
#include <linux/pagemap.h>
-#include <linux/wait.h>
+#include <linux/wait_types.h>
#include <linux/writeback.h>
#include <linux/slab.h>
#include <linux/refcount_types.h>
diff --git a/include/linux/cgroup-defs.h b/include/linux/cgroup-defs.h
index 380a59b31624..99e24f3034df 100644
--- a/include/linux/cgroup-defs.h
+++ b/include/linux/cgroup-defs.h
@@ -11,7 +11,7 @@
#include <linux/limits.h>
#include <linux/list.h>
#include <linux/idr.h>
-#include <linux/wait.h>
+#include <linux/wait_types.h>
#include <linux/mutex_types.h>
#include <linux/rcupdate.h>
#include <linux/refcount_types.h>
diff --git a/include/linux/console_struct.h b/include/linux/console_struct.h
index a0142b93eaf9..8babdd50a4ca 100644
--- a/include/linux/console_struct.h
+++ b/include/linux/console_struct.h
@@ -13,7 +13,7 @@
#ifndef _LINUX_CONSOLE_STRUCT_H
#define _LINUX_CONSOLE_STRUCT_H
-#include <linux/wait.h>
+#include <linux/wait_types.h>
#include <linux/vt.h>
#include <linux/workqueue_types.h>
diff --git a/include/linux/counter.h b/include/linux/counter.h
index 846b94517c5b..638ebb5b4d27 100644
--- a/include/linux/counter.h
+++ b/include/linux/counter.h
@@ -13,7 +13,7 @@
#include <linux/mutex_types.h>
#include <linux/spinlock_types.h>
#include <linux/types.h>
-#include <linux/wait.h>
+#include <linux/wait_types.h>
#include <uapi/linux/counter.h>
struct counter_device;
diff --git a/include/linux/dcache.h b/include/linux/dcache.h
index a2d39fef6a4a..cbfc0f6c468d 100644
--- a/include/linux/dcache.h
+++ b/include/linux/dcache.h
@@ -13,7 +13,7 @@
#include <linux/rcupdate.h>
#include <linux/lockref.h>
#include <linux/stringhash.h>
-#include <linux/wait.h>
+#include <linux/wait_types.h>
struct path;
struct file;
diff --git a/include/linux/dma-buf.h b/include/linux/dma-buf.h
index 8ff4add71f88..ab67e5a4b0ec 100644
--- a/include/linux/dma-buf.h
+++ b/include/linux/dma-buf.h
@@ -21,7 +21,7 @@
#include <linux/dma-mapping.h>
#include <linux/fs.h>
#include <linux/dma-fence.h>
-#include <linux/wait.h>
+#include <linux/wait_types.h>
struct device;
struct dma_buf;
diff --git a/include/linux/eventfd.h b/include/linux/eventfd.h
index e32bee4345fb..e021a18f53b5 100644
--- a/include/linux/eventfd.h
+++ b/include/linux/eventfd.h
@@ -9,7 +9,7 @@
#ifndef _LINUX_EVENTFD_H
#define _LINUX_EVENTFD_H
-#include <linux/wait.h>
+#include <linux/wait_types.h>
#include <linux/err.h>
#include <linux/percpu-defs.h>
#include <linux/percpu.h>
diff --git a/include/linux/gnss.h b/include/linux/gnss.h
index 9f38ff948d78..3c24e934b732 100644
--- a/include/linux/gnss.h
+++ b/include/linux/gnss.h
@@ -14,7 +14,7 @@
#include <linux/mutex_types.h>
#include <linux/rwsem_types.h>
#include <linux/types.h>
-#include <linux/wait.h>
+#include <linux/wait_types.h>
struct gnss_device;
diff --git a/include/linux/libps2.h b/include/linux/libps2.h
index 006c38667e75..c2f438730ae1 100644
--- a/include/linux/libps2.h
+++ b/include/linux/libps2.h
@@ -11,7 +11,7 @@
#include <linux/interrupt.h>
#include <linux/mutex_types.h>
#include <linux/types.h>
-#include <linux/wait.h>
+#include <linux/wait_types.h>
struct ps2dev;
diff --git a/include/linux/lp.h b/include/linux/lp.h
index 337573412852..d700bf3255b1 100644
--- a/include/linux/lp.h
+++ b/include/linux/lp.h
@@ -9,7 +9,7 @@
#define _LINUX_LP_H
-#include <linux/wait.h>
+#include <linux/wait_types.h>
#include <linux/mutex_types.h>
#include <uapi/linux/lp.h>
diff --git a/include/linux/mempool.h b/include/linux/mempool.h
index 7be1e32e6d42..ea9cfabd9897 100644
--- a/include/linux/mempool.h
+++ b/include/linux/mempool.h
@@ -5,7 +5,7 @@
#ifndef _LINUX_MEMPOOL_H
#define _LINUX_MEMPOOL_H
-#include <linux/wait.h>
+#include <linux/wait_types.h>
#include <linux/compiler.h>
struct kmem_cache;
diff --git a/include/linux/mhi.h b/include/linux/mhi.h
index bd99f47726dc..243bfae1a94c 100644
--- a/include/linux/mhi.h
+++ b/include/linux/mhi.h
@@ -12,7 +12,7 @@
#include <linux/skbuff.h>
#include <linux/slab.h>
#include <linux/spinlock_types.h>
-#include <linux/wait.h>
+#include <linux/wait_types.h>
#include <linux/workqueue_types.h>
#define MHI_MAX_OEM_PK_HASH_SEGMENTS 16
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index ce11c2dab2bc..fa41c34f16da 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -8,7 +8,7 @@
#include <linux/spinlock_types.h>
#include <linux/list.h>
#include <linux/list_nulls.h>
-#include <linux/wait.h>
+#include <linux/wait_types.h>
#include <linux/bitops.h>
#include <linux/cache.h>
#include <linux/threads.h>
diff --git a/include/linux/net.h b/include/linux/net.h
index c9b4a63791a4..139a936fb772 100644
--- a/include/linux/net.h
+++ b/include/linux/net.h
@@ -16,7 +16,7 @@
#include <linux/stringify.h>
#include <linux/random.h>
-#include <linux/wait.h>
+#include <linux/wait_types.h>
#include <linux/fcntl.h> /* For O_CLOEXEC and O_NONBLOCK */
#include <linux/rcupdate.h>
#include <linux/once.h>
diff --git a/include/linux/nfs_fs_sb.h b/include/linux/nfs_fs_sb.h
index 08860ceda787..1c9a1e28b13e 100644
--- a/include/linux/nfs_fs_sb.h
+++ b/include/linux/nfs_fs_sb.h
@@ -5,7 +5,7 @@
#include <linux/list.h>
#include <linux/backing-dev.h>
#include <linux/idr.h>
-#include <linux/wait.h>
+#include <linux/wait_types.h>
#include <linux/nfs_xdr.h>
#include <linux/sunrpc/xprt.h>
diff --git a/include/linux/parport.h b/include/linux/parport.h
index c8e3b71a3b49..783835d05d9b 100644
--- a/include/linux/parport.h
+++ b/include/linux/parport.h
@@ -10,7 +10,7 @@
#include <linux/jiffies.h>
#include <linux/proc_fs.h>
#include <linux/spinlock_types.h>
-#include <linux/wait.h>
+#include <linux/wait_types.h>
#include <linux/irqreturn.h>
#include <linux/semaphore.h>
#include <linux/device.h>
diff --git a/include/linux/pid.h b/include/linux/pid.h
index e6a041cb8bac..585886644e3d 100644
--- a/include/linux/pid.h
+++ b/include/linux/pid.h
@@ -7,7 +7,7 @@
#include <linux/rcupdate.h>
#include <linux/refcount.h>
#include <linux/sched.h>
-#include <linux/wait.h>
+#include <linux/wait_types.h>
/*
* What is struct pid?
diff --git a/include/linux/pm.h b/include/linux/pm.h
index f94a78728f1e..14f95d7e67ab 100644
--- a/include/linux/pm.h
+++ b/include/linux/pm.h
@@ -12,7 +12,7 @@
#include <linux/list.h>
#include <linux/workqueue_types.h>
#include <linux/spinlock_types.h>
-#include <linux/wait.h>
+#include <linux/wait_types.h>
#include <linux/hrtimer_types.h>
#include <linux/completion.h>
diff --git a/include/linux/poll.h b/include/linux/poll.h
index a9e0e1c2d1f2..043aa684b09c 100644
--- a/include/linux/poll.h
+++ b/include/linux/poll.h
@@ -5,7 +5,7 @@
#include <linux/compiler.h>
#include <linux/ktime.h>
-#include <linux/wait.h>
+#include <linux/wait_types.h>
#include <linux/string.h>
#include <linux/fs.h>
#include <linux/uaccess.h>
diff --git a/include/linux/psi_types.h b/include/linux/psi_types.h
index 8af6452b36e2..de72dcc6e0bf 100644
--- a/include/linux/psi_types.h
+++ b/include/linux/psi_types.h
@@ -5,7 +5,7 @@
#include <linux/kthread.h>
#include <linux/seqlock_types.h>
#include <linux/types.h>
-#include <linux/wait.h>
+#include <linux/wait_types.h>
#ifdef CONFIG_PSI
diff --git a/include/linux/relay.h b/include/linux/relay.h
index d33735edc3cb..79ecc446ed48 100644
--- a/include/linux/relay.h
+++ b/include/linux/relay.h
@@ -13,7 +13,7 @@
#include <linux/types.h>
#include <linux/sched.h>
-#include <linux/wait.h>
+#include <linux/wait_types.h>
#include <linux/list.h>
#include <linux/irq_work.h>
#include <linux/bug.h>
diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h
index 904cf20a7ae6..0cce3f1a73d6 100644
--- a/include/linux/rtnetlink.h
+++ b/include/linux/rtnetlink.h
@@ -3,7 +3,7 @@
#define __LINUX_RTNETLINK_H
#include <linux/netdevice.h>
-#include <linux/wait.h>
+#include <linux/wait_types.h>
#include <linux/refcount.h>
#include <uapi/linux/rtnetlink.h>
diff --git a/include/linux/sbitmap.h b/include/linux/sbitmap.h
index d7d3fba174f8..f7279f7632fe 100644
--- a/include/linux/sbitmap.h
+++ b/include/linux/sbitmap.h
@@ -18,7 +18,7 @@
#include <linux/percpu.h>
#include <linux/slab.h>
#include <linux/types.h>
-#include <linux/wait.h>
+#include <linux/wait_types.h>
struct seq_file;
diff --git a/include/linux/sunrpc/rpc_pipe_fs.h b/include/linux/sunrpc/rpc_pipe_fs.h
index c26733d8fde7..3f4d6fc0a8a3 100644
--- a/include/linux/sunrpc/rpc_pipe_fs.h
+++ b/include/linux/sunrpc/rpc_pipe_fs.h
@@ -4,7 +4,7 @@
#include <linux/list.h>
#include <linux/spinlock_types.h>
-#include <linux/wait.h>
+#include <linux/wait_types.h>
struct rpc_pipe_dir_head {
struct list_head pdh_entries;
diff --git a/include/linux/syslog.h b/include/linux/syslog.h
index 955f80e34d4f..2a4c9199d718 100644
--- a/include/linux/syslog.h
+++ b/include/linux/syslog.h
@@ -8,7 +8,7 @@
#ifndef _LINUX_SYSLOG_H
#define _LINUX_SYSLOG_H
-#include <linux/wait.h>
+#include <linux/wait_types.h>
/* Close the log. Currently a NOP. */
#define SYSLOG_ACTION_CLOSE 0
diff --git a/include/linux/wait.h b/include/linux/wait.h
index 8aa3372f21a0..b36000bb012c 100644
--- a/include/linux/wait.h
+++ b/include/linux/wait.h
@@ -4,17 +4,12 @@
/*
* Linux wait queue related types and methods
*/
-#include <linux/list.h>
+#include <linux/wait_types.h>
#include <linux/stddef.h>
#include <linux/spinlock.h>
#include <asm/current.h>
-typedef struct wait_queue_entry wait_queue_entry_t;
-
-typedef int (*wait_queue_func_t)(struct wait_queue_entry *wq_entry, unsigned mode, int flags, void *key);
-int default_wake_function(struct wait_queue_entry *wq_entry, unsigned mode, int flags, void *key);
-
/* wait_queue_entry::flags */
#define WQ_FLAG_EXCLUSIVE 0x01
#define WQ_FLAG_WOKEN 0x02
@@ -22,22 +17,6 @@ int default_wake_function(struct wait_queue_entry *wq_entry, unsigned mode, int
#define WQ_FLAG_DONE 0x08
#define WQ_FLAG_PRIORITY 0x10
-/*
- * A single wait-queue entry structure:
- */
-struct wait_queue_entry {
- unsigned int flags;
- void *private;
- wait_queue_func_t func;
- struct list_head entry;
-};
-
-struct wait_queue_head {
- spinlock_t lock;
- struct list_head head;
-};
-typedef struct wait_queue_head wait_queue_head_t;
-
struct task_struct;
/*
diff --git a/include/linux/wait_bit.h b/include/linux/wait_bit.h
index 96c90fbcf652..514f68eff79d 100644
--- a/include/linux/wait_bit.h
+++ b/include/linux/wait_bit.h
@@ -8,7 +8,7 @@
#include <linux/bitops.h>
#include <linux/init.h> // for __init
#include <linux/kernel.h> // for might_sleep()
-#include <linux/wait.h>
+#include <linux/wait_types.h>
struct wait_bit_key {
void *flags;
diff --git a/include/linux/wait_types.h b/include/linux/wait_types.h
new file mode 100644
index 000000000000..4b43e7bc6dac
--- /dev/null
+++ b/include/linux/wait_types.h
@@ -0,0 +1,31 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef _LINUX_WAIT_TYPES_H
+#define _LINUX_WAIT_TYPES_H
+/*
+ * Linux wait queue related types and methods
+ */
+#include <linux/list.h>
+#include <linux/spinlock_types.h>
+
+typedef struct wait_queue_entry wait_queue_entry_t;
+
+typedef int (*wait_queue_func_t)(struct wait_queue_entry *wq_entry, unsigned mode, int flags, void *key);
+int default_wake_function(struct wait_queue_entry *wq_entry, unsigned mode, int flags, void *key);
+
+/*
+ * A single wait-queue entry structure:
+ */
+struct wait_queue_entry {
+ unsigned int flags;
+ void *private;
+ wait_queue_func_t func;
+ struct list_head entry;
+};
+
+struct wait_queue_head {
+ spinlock_t lock;
+ struct list_head head;
+};
+typedef struct wait_queue_head wait_queue_head_t;
+
+#endif /* _LINUX_WAIT_TYPES_H */
diff --git a/include/media/dvb_ringbuffer.h b/include/media/dvb_ringbuffer.h
index 131997d1f131..22da81bff624 100644
--- a/include/media/dvb_ringbuffer.h
+++ b/include/media/dvb_ringbuffer.h
@@ -24,7 +24,7 @@
#define _DVB_RINGBUFFER_H_
#include <linux/spinlock_types.h>
-#include <linux/wait.h>
+#include <linux/wait_types.h>
/**
* struct dvb_ringbuffer - Describes a ring buffer used at DVB framework
diff --git a/include/net/smc.h b/include/net/smc.h
index 44a01bd3da10..92611a9cf0e9 100644
--- a/include/net/smc.h
+++ b/include/net/smc.h
@@ -13,7 +13,7 @@
#include <linux/spinlock_types.h>
#include <linux/types.h>
-#include <linux/wait.h>
+#include <linux/wait_types.h>
#include "linux/ism.h"
struct device;
diff --git a/include/net/sock.h b/include/net/sock.h
index bebdc45cf622..008a6c5a3bfc 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -53,7 +53,7 @@
#include <linux/memcontrol.h>
#include <linux/static_key.h>
#include <linux/sched.h>
-#include <linux/wait.h>
+#include <linux/wait_types.h>
#include <linux/cgroup-defs.h>
#include <linux/rbtree_types.h>
#include <linux/rculist_nulls.h>
diff --git a/include/scsi/libiscsi.h b/include/scsi/libiscsi.h
index 01f13729ad24..d30e65c5f137 100644
--- a/include/scsi/libiscsi.h
+++ b/include/scsi/libiscsi.h
@@ -11,7 +11,7 @@
#define LIBISCSI_H
#include <linux/types.h>
-#include <linux/wait.h>
+#include <linux/wait_types.h>
#include <linux/mutex_types.h>
#include <linux/timer_types.h>
#include <linux/workqueue_types.h>
diff --git a/include/sound/control.h b/include/sound/control.h
index 9a4f4f7138da..b921cdb94082 100644
--- a/include/sound/control.h
+++ b/include/sound/control.h
@@ -7,7 +7,7 @@
* Copyright (c) by Jaroslav Kysela <[email protected]>
*/
-#include <linux/wait.h>
+#include <linux/wait_types.h>
#include <linux/nospec.h>
#include <sound/asound.h>
diff --git a/include/sound/rawmidi.h b/include/sound/rawmidi.h
index 46678a38dbb9..6c380196bff4 100644
--- a/include/sound/rawmidi.h
+++ b/include/sound/rawmidi.h
@@ -10,7 +10,7 @@
#include <sound/asound.h>
#include <linux/interrupt.h>
#include <linux/spinlock_types.h>
-#include <linux/wait.h>
+#include <linux/wait_types.h>
#include <linux/mutex_types.h>
#include <linux/workqueue_types.h>
#include <linux/device.h>
--
2.39.2
This is a very low-level function without any additional dependencies,
and moving it will allow certain sources to omit the "blkdev.h"
dependency.
Signed-off-by: Max Kellermann <[email protected]>
---
include/linux/blk_types.h | 6 ++++++
include/linux/blkdev.h | 6 ------
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h
index 96a37f399928..ad48c3f5ddd6 100644
--- a/include/linux/blk_types.h
+++ b/include/linux/blk_types.h
@@ -434,6 +434,12 @@ static inline enum req_op bio_op(const struct bio *bio)
return bio->bi_opf & REQ_OP_MASK;
}
+static inline bool blk_op_is_passthrough(blk_opf_t op)
+{
+ op &= REQ_OP_MASK;
+ return op == REQ_OP_DRV_IN || op == REQ_OP_DRV_OUT;
+}
+
static inline bool op_is_write(blk_opf_t op)
{
return !!(op & (__force blk_opf_t)1);
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index d2c0934a7224..a5e41a54de18 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -259,12 +259,6 @@ static inline int blk_validate_block_size(unsigned long bsize)
return 0;
}
-static inline bool blk_op_is_passthrough(blk_opf_t op)
-{
- op &= REQ_OP_MASK;
- return op == REQ_OP_DRV_IN || op == REQ_OP_DRV_OUT;
-}
-
/*
* BLK_BOUNCE_NONE: never bounce (default)
* BLK_BOUNCE_HIGH: bounce all highmem pages
--
2.39.2
By providing declarations in a lean header, we can reduce header
dependencies.
Signed-off-by: Max Kellermann <[email protected]>
---
arch/arm64/kernel/cpuinfo.c | 1 +
block/bdev.c | 1 +
block/bfq-iosched.c | 1 +
block/blk-crypto-sysfs.c | 1 +
block/blk-ia-ranges.c | 1 +
block/blk-mq-sched.c | 1 +
block/blk-mq-sysfs.c | 1 +
block/blk-mq.c | 1 +
block/blk-sysfs.c | 1 +
block/disk-events.c | 1 +
block/elevator.c | 1 +
block/genhd.c | 1 +
block/holder.c | 1 +
block/kyber-iosched.c | 1 +
block/mq-deadline.c | 1 +
block/partitions/core.c | 1 +
.../accessibility/speakup/speakup_acntpc.c | 1 +
.../accessibility/speakup/speakup_acntsa.c | 2 +
.../accessibility/speakup/speakup_apollo.c | 1 +
.../accessibility/speakup/speakup_audptr.c | 2 +
drivers/accessibility/speakup/speakup_bns.c | 2 +
.../accessibility/speakup/speakup_decext.c | 1 +
drivers/accessibility/speakup/speakup_decpc.c | 1 +
.../accessibility/speakup/speakup_dectlk.c | 1 +
drivers/accessibility/speakup/speakup_dtlk.c | 1 +
drivers/accessibility/speakup/speakup_dummy.c | 2 +
drivers/accessibility/speakup/speakup_keypc.c | 1 +
drivers/accessibility/speakup/speakup_ltlk.c | 2 +
drivers/accessibility/speakup/speakup_soft.c | 1 +
.../accessibility/speakup/speakup_spkout.c | 2 +
drivers/accessibility/speakup/speakup_txprt.c | 2 +
drivers/acpi/ac.c | 1 +
drivers/acpi/acpi_fpdt.c | 1 +
drivers/acpi/bgrt.c | 1 +
drivers/acpi/bus.c | 1 +
drivers/acpi/container.c | 1 +
drivers/acpi/device_sysfs.c | 1 +
drivers/acpi/dock.c | 1 +
drivers/acpi/sysfs.c | 1 +
drivers/ata/libata-acpi.c | 1 +
drivers/base/devcoredump.c | 1 +
drivers/base/firmware_loader/fallback.c | 1 +
drivers/base/firmware_loader/sysfs.c | 1 +
drivers/block/drbd/drbd_nl.c | 1 +
drivers/block/loop.c | 1 +
drivers/block/nbd.c | 1 +
drivers/block/rnbd/rnbd-clt-sysfs.c | 1 +
drivers/block/rnbd/rnbd-clt.c | 1 +
drivers/block/rnbd/rnbd-srv.c | 1 +
drivers/block/ublk_drv.c | 1 +
drivers/bus/mhi/ep/main.c | 1 +
drivers/bus/mhi/host/init.c | 1 +
drivers/char/virtio_console.c | 1 +
drivers/char/xillybus/xillybus_class.c | 1 +
drivers/comedi/comedi_fops.c | 1 +
drivers/cxl/core/port.c | 1 +
drivers/dax/bus.c | 1 +
drivers/dma/qcom/hidma_mgmt_sys.c | 1 +
drivers/firmware/arm_ffa/bus.c | 1 +
drivers/firmware/dmi-id.c | 1 +
drivers/firmware/dmi_scan.c | 1 +
drivers/firmware/memmap.c | 1 +
drivers/firmware/qemu_fw_cfg.c | 1 +
drivers/gnss/core.c | 1 +
drivers/greybus/core.c | 1 +
drivers/hid/hid-core.c | 1 +
drivers/hid/hid-wiimote-core.c | 1 +
drivers/hid/wacom_sys.c | 1 +
drivers/hwmon/acpi_power_meter.c | 1 +
drivers/hwtracing/stm/core.c | 1 +
drivers/infiniband/core/device.c | 1 +
drivers/infiniband/core/sysfs.c | 1 +
drivers/infiniband/hw/mlx4/sysfs.c | 1 +
drivers/infiniband/ulp/rtrs/rtrs-clt-sysfs.c | 2 +
drivers/infiniband/ulp/rtrs/rtrs-clt.c | 1 +
drivers/infiniband/ulp/rtrs/rtrs-srv-sysfs.c | 2 +
drivers/infiniband/ulp/rtrs/rtrs-srv.c | 1 +
drivers/input/input.c | 1 +
drivers/input/serio/serio.c | 1 +
drivers/ipack/ipack.c | 1 +
drivers/isdn/mISDN/core.c | 1 +
drivers/leds/led-triggers.c | 1 +
drivers/mcb/mcb-core.c | 1 +
drivers/md/dm-verity-target.c | 1 +
drivers/media/cec/core/cec-core.c | 1 +
drivers/media/mc/mc-devnode.c | 1 +
drivers/media/rc/rc-main.c | 1 +
drivers/memstick/core/memstick.c | 1 +
drivers/misc/ti-st/st_kim.c | 1 +
drivers/misc/tifm_core.c | 1 +
drivers/most/most_cdev.c | 1 +
drivers/net/bonding/bond_main.c | 1 +
.../ethernet/qlogic/qlcnic/qlcnic_minidump.c | 2 +
drivers/net/wireless/ath/wil6210/interrupt.c | 1 +
.../net/wireless/intel/iwlwifi/pcie/trans.c | 1 +
drivers/net/xen-netback/xenbus.c | 1 +
drivers/nvdimm/bus.c | 1 +
drivers/nvme/host/core.c | 1 +
drivers/nvme/host/fc.c | 1 +
drivers/pci/host-bridge.c | 1 +
drivers/pci/iov.c | 1 +
drivers/pcmcia/cs.c | 1 +
drivers/pcmcia/ds.c | 1 +
drivers/platform/surface/aggregator/bus.c | 1 +
drivers/power/supply/power_supply_sysfs.c | 1 +
drivers/pps/pps.c | 1 +
drivers/rapidio/rio-driver.c | 1 +
drivers/scsi/ipr.c | 1 +
drivers/scsi/iscsi_boot_sysfs.c | 1 +
drivers/scsi/qedf/qedf_dbg.c | 1 +
drivers/scsi/qla4xxx/ql4_nx.c | 1 +
drivers/scsi/scsi_lib.c | 1 +
drivers/scsi/scsi_sysfs.c | 1 +
drivers/scsi/ses.c | 1 +
drivers/staging/fieldbus/dev_core.c | 1 +
drivers/staging/greybus/gbphy.c | 1 +
.../interface/vchiq_arm/vchiq_bus.c | 1 +
drivers/tee/tee_core.c | 1 +
drivers/thunderbolt/domain.c | 1 +
drivers/thunderbolt/switch.c | 1 +
drivers/thunderbolt/tb.c | 1 +
drivers/thunderbolt/xdomain.c | 1 +
drivers/tty/tty_io.c | 1 +
drivers/usb/core/driver.c | 1 +
drivers/usb/gadget/udc/core.c | 1 +
drivers/usb/roles/class.c | 1 +
drivers/usb/typec/bus.c | 1 +
drivers/usb/typec/class.c | 1 +
drivers/vdpa/vdpa_user/vduse_dev.c | 1 +
drivers/vfio/mdev/mdev_core.c | 1 +
drivers/vfio/mdev/mdev_sysfs.c | 1 +
.../fbdev/omap2/omapfb/dss/display-sysfs.c | 1 +
.../fbdev/omap2/omapfb/dss/manager-sysfs.c | 1 +
drivers/virt/vmgenid.c | 1 +
drivers/xen/xenbus/xenbus_probe_backend.c | 1 +
drivers/xen/xenbus/xenbus_probe_frontend.c | 1 +
fs/9p/v9fs.c | 1 +
fs/configfs/mount.c | 1 +
fs/ecryptfs/main.c | 1 +
fs/ext4/super.c | 1 +
fs/ext4/sysfs.c | 1 +
fs/fuse/cuse.c | 1 +
fs/fuse/inode.c | 1 +
fs/namespace.c | 1 +
fs/nfs/client.c | 1 +
fs/ubifs/sysfs.c | 1 +
fs/xfs/xfs_sysfs.h | 2 +
include/linux/cdev.h | 2 +-
include/linux/cpufreq.h | 2 +-
include/linux/device.h | 2 +-
include/linux/irqdesc.h | 2 +-
include/linux/kobject.h | 78 +----------------
include/linux/kobject_types.h | 84 +++++++++++++++++++
include/linux/module.h | 2 +-
include/linux/padata.h | 2 +-
include/linux/pci.h | 2 +-
include/net/netdev_rx_queue.h | 2 +-
include/video/omapfb_dss.h | 2 +-
init/initramfs.c | 1 +
kernel/cgroup/cgroup.c | 1 +
kernel/exit.c | 2 +
kernel/module/main.c | 1 +
kernel/module/sysfs.c | 1 +
kernel/padata.c | 1 +
kernel/panic.c | 1 +
kernel/params.c | 1 +
kernel/reboot.c | 1 +
mm/damon/sysfs-common.c | 1 +
mm/damon/sysfs-common.h | 2 +-
mm/damon/sysfs-schemes.c | 1 +
mm/damon/sysfs.c | 1 +
mm/huge_memory.c | 1 +
mm/hugetlb.c | 1 +
mm/khugepaged.c | 1 +
mm/mempolicy.c | 1 +
mm/shmem.c | 1 +
mm/swap_state.c | 1 +
mm/vmscan.c | 1 +
net/9p/trans_virtio.c | 1 +
net/bridge/br_sysfs_br.c | 1 +
net/rfkill/core.c | 1 +
net/wireless/reg.c | 1 +
sound/core/init.c | 1 +
sound/hda/hda_bus_type.c | 1 +
sound/hda/hdac_sysfs.c | 1 +
185 files changed, 280 insertions(+), 87 deletions(-)
create mode 100644 include/linux/kobject_types.h
diff --git a/arch/arm64/kernel/cpuinfo.c b/arch/arm64/kernel/cpuinfo.c
index d30ad1215ab8..d7a9a8bb5d80 100644
--- a/arch/arm64/kernel/cpuinfo.c
+++ b/arch/arm64/kernel/cpuinfo.c
@@ -17,6 +17,7 @@
#include <linux/elf.h>
#include <linux/init.h>
#include <linux/kernel.h>
+#include <linux/kobject.h>
#include <linux/personality.h>
#include <linux/preempt.h>
#include <linux/printk.h>
diff --git a/block/bdev.c b/block/bdev.c
index e9f1b12bd75c..995d575c819a 100644
--- a/block/bdev.c
+++ b/block/bdev.c
@@ -9,6 +9,7 @@
#include <linux/mm.h>
#include <linux/slab.h>
#include <linux/kmod.h>
+#include <linux/kobject.h>
#include <linux/major.h>
#include <linux/device_cgroup.h>
#include <linux/blkdev.h>
diff --git a/block/bfq-iosched.c b/block/bfq-iosched.c
index 88df08a246fa..fc36ffa488f8 100644
--- a/block/bfq-iosched.c
+++ b/block/bfq-iosched.c
@@ -117,6 +117,7 @@
#include <linux/slab.h>
#include <linux/blkdev.h>
#include <linux/cgroup.h>
+#include <linux/kobject.h>
#include <linux/ktime.h>
#include <linux/rbtree.h>
#include <linux/ioprio.h>
diff --git a/block/blk-crypto-sysfs.c b/block/blk-crypto-sysfs.c
index 233d04b9116b..67a62b907419 100644
--- a/block/blk-crypto-sysfs.c
+++ b/block/blk-crypto-sysfs.c
@@ -7,6 +7,7 @@
*/
#include <linux/blk-crypto-profile.h>
+#include <linux/kobject.h>
#include <linux/sysfs.h>
#include "blk-crypto-internal.h"
diff --git a/block/blk-ia-ranges.c b/block/blk-ia-ranges.c
index 4a6bb87a0143..75602267fbe7 100644
--- a/block/blk-ia-ranges.c
+++ b/block/blk-ia-ranges.c
@@ -9,6 +9,7 @@
#include <linux/slab.h>
#include <linux/sysfs.h>
#include <linux/init.h>
+#include <linux/kobject.h>
#include "blk.h"
diff --git a/block/blk-mq-sched.c b/block/blk-mq-sched.c
index 451a2c1f1f32..6f4a294057d0 100644
--- a/block/blk-mq-sched.c
+++ b/block/blk-mq-sched.c
@@ -5,6 +5,7 @@
* Copyright (C) 2016 Jens Axboe
*/
#include <linux/kernel.h>
+#include <linux/kobject.h>
#include <linux/module.h>
#include <linux/list_sort.h>
diff --git a/block/blk-mq-sysfs.c b/block/blk-mq-sysfs.c
index 156e9bb07abf..88d2220860b1 100644
--- a/block/blk-mq-sysfs.c
+++ b/block/blk-mq-sysfs.c
@@ -4,6 +4,7 @@
#include <linux/backing-dev.h>
#include <linux/bio.h>
#include <linux/blkdev.h>
+#include <linux/kobject.h>
#include <linux/mm.h>
#include <linux/init.h>
#include <linux/slab.h>
diff --git a/block/blk-mq.c b/block/blk-mq.c
index aff9e9492f59..88b5bac815eb 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -12,6 +12,7 @@
#include <linux/blkdev.h>
#include <linux/blk-integrity.h>
#include <linux/kmemleak.h>
+#include <linux/kobject.h>
#include <linux/mm.h>
#include <linux/init.h>
#include <linux/slab.h>
diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c
index 6b2429cad81a..2dd002780316 100644
--- a/block/blk-sysfs.c
+++ b/block/blk-sysfs.c
@@ -10,6 +10,7 @@
#include <linux/backing-dev.h>
#include <linux/blktrace_api.h>
#include <linux/debugfs.h>
+#include <linux/kobject.h>
#include "blk.h"
#include "blk-mq.h"
diff --git a/block/disk-events.c b/block/disk-events.c
index 2f697224386a..e5b3006bcef6 100644
--- a/block/disk-events.c
+++ b/block/disk-events.c
@@ -5,6 +5,7 @@
#include <linux/export.h>
#include <linux/moduleparam.h>
#include <linux/blkdev.h>
+#include <linux/kobject.h>
#include "blk.h"
struct disk_events {
diff --git a/block/elevator.c b/block/elevator.c
index 5ff093cb3cf8..9aa58cf86ac2 100644
--- a/block/elevator.c
+++ b/block/elevator.c
@@ -35,6 +35,7 @@
#include <linux/hash.h>
#include <linux/uaccess.h>
#include <linux/pm_runtime.h>
+#include <linux/kobject.h>
#include <trace/events/block.h>
diff --git a/block/genhd.c b/block/genhd.c
index d74fb5b4ae68..4202ca032195 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -10,6 +10,7 @@
#include <linux/fs.h>
#include <linux/kdev_t.h>
#include <linux/kernel.h>
+#include <linux/kobject.h>
#include <linux/blkdev.h>
#include <linux/backing-dev.h>
#include <linux/init.h>
diff --git a/block/holder.c b/block/holder.c
index a9affd4757cd..fe8d5f707f60 100644
--- a/block/holder.c
+++ b/block/holder.c
@@ -1,5 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
#include <linux/blkdev.h>
+#include <linux/kobject.h>
#include <linux/slab.h>
#include <linux/sysfs.h>
diff --git a/block/kyber-iosched.c b/block/kyber-iosched.c
index 68fe2b6c12de..b46f1d84ad25 100644
--- a/block/kyber-iosched.c
+++ b/block/kyber-iosched.c
@@ -8,6 +8,7 @@
#include <linux/kernel.h>
#include <linux/blkdev.h>
+#include <linux/kobject.h>
#include <linux/module.h>
#include <linux/sbitmap.h>
#include <linux/sysfs.h>
diff --git a/block/mq-deadline.c b/block/mq-deadline.c
index 25dee768d2ba..38ea20cee530 100644
--- a/block/mq-deadline.c
+++ b/block/mq-deadline.c
@@ -9,6 +9,7 @@
#include <linux/fs.h>
#include <linux/blkdev.h>
#include <linux/bio.h>
+#include <linux/kobject.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/init.h>
diff --git a/block/partitions/core.c b/block/partitions/core.c
index 5f5ed5c75f04..e6aad6f5f97f 100644
--- a/block/partitions/core.c
+++ b/block/partitions/core.c
@@ -5,6 +5,7 @@
* Copyright (C) 2020 Christoph Hellwig
*/
#include <linux/fs.h>
+#include <linux/kobject.h>
#include <linux/major.h>
#include <linux/slab.h>
#include <linux/ctype.h>
diff --git a/drivers/accessibility/speakup/speakup_acntpc.c b/drivers/accessibility/speakup/speakup_acntpc.c
index a27e6bbf05da..1b348204e396 100644
--- a/drivers/accessibility/speakup/speakup_acntpc.c
+++ b/drivers/accessibility/speakup/speakup_acntpc.c
@@ -14,6 +14,7 @@
#include <linux/jiffies.h>
#include <linux/sched.h>
#include <linux/timer.h>
+#include <linux/kobject.h>
#include <linux/kthread.h>
#include "spk_priv.h"
diff --git a/drivers/accessibility/speakup/speakup_acntsa.c b/drivers/accessibility/speakup/speakup_acntsa.c
index 26bb9f9399d3..fc2e6ff9167c 100644
--- a/drivers/accessibility/speakup/speakup_acntsa.c
+++ b/drivers/accessibility/speakup/speakup_acntsa.c
@@ -14,6 +14,8 @@
#include "speakup.h"
#include "speakup_acnt.h" /* local header file for Accent values */
+#include <linux/kobject.h>
+
#define DRV_VERSION "2.11"
#define PROCSPEECH '\r'
diff --git a/drivers/accessibility/speakup/speakup_apollo.c b/drivers/accessibility/speakup/speakup_apollo.c
index d2fbb3f57221..2d9b39b85d04 100644
--- a/drivers/accessibility/speakup/speakup_apollo.c
+++ b/drivers/accessibility/speakup/speakup_apollo.c
@@ -12,6 +12,7 @@
#include <linux/jiffies.h>
#include <linux/sched.h>
#include <linux/timer.h>
+#include <linux/kobject.h>
#include <linux/kthread.h>
#include <linux/serial_reg.h> /* for UART_MCR* constants */
diff --git a/drivers/accessibility/speakup/speakup_audptr.c b/drivers/accessibility/speakup/speakup_audptr.c
index 55813f3e40ff..d73001b90b5e 100644
--- a/drivers/accessibility/speakup/speakup_audptr.c
+++ b/drivers/accessibility/speakup/speakup_audptr.c
@@ -12,6 +12,8 @@
#include "spk_priv.h"
#include "speakup.h"
+#include <linux/kobject.h>
+
#define DRV_VERSION "2.11"
#define SYNTH_CLEAR 0x18 /* flush synth buffer */
#define PROCSPEECH '\r' /* start synth processing speech char */
diff --git a/drivers/accessibility/speakup/speakup_bns.c b/drivers/accessibility/speakup/speakup_bns.c
index 60507756499c..c5802637f723 100644
--- a/drivers/accessibility/speakup/speakup_bns.c
+++ b/drivers/accessibility/speakup/speakup_bns.c
@@ -12,6 +12,8 @@
#include "spk_priv.h"
#include "speakup.h"
+#include <linux/kobject.h>
+
#define DRV_VERSION "2.11"
#define SYNTH_CLEAR 0x18
#define PROCSPEECH '\r'
diff --git a/drivers/accessibility/speakup/speakup_decext.c b/drivers/accessibility/speakup/speakup_decext.c
index 271bcf279bf9..41ece15f408b 100644
--- a/drivers/accessibility/speakup/speakup_decext.c
+++ b/drivers/accessibility/speakup/speakup_decext.c
@@ -12,6 +12,7 @@
#include <linux/jiffies.h>
#include <linux/sched.h>
#include <linux/timer.h>
+#include <linux/kobject.h>
#include <linux/kthread.h>
#include "spk_priv.h"
diff --git a/drivers/accessibility/speakup/speakup_decpc.c b/drivers/accessibility/speakup/speakup_decpc.c
index 083ca9265805..5b539641aa62 100644
--- a/drivers/accessibility/speakup/speakup_decpc.c
+++ b/drivers/accessibility/speakup/speakup_decpc.c
@@ -19,6 +19,7 @@
#include <linux/jiffies.h>
#include <linux/sched.h>
#include <linux/timer.h>
+#include <linux/kobject.h>
#include <linux/kthread.h>
#include "spk_priv.h"
diff --git a/drivers/accessibility/speakup/speakup_dectlk.c b/drivers/accessibility/speakup/speakup_dectlk.c
index 56334405d865..859fd7c7a878 100644
--- a/drivers/accessibility/speakup/speakup_dectlk.c
+++ b/drivers/accessibility/speakup/speakup_dectlk.c
@@ -15,6 +15,7 @@
#include <linux/spinlock.h>
#include <linux/sched.h>
#include <linux/timer.h>
+#include <linux/kobject.h>
#include <linux/kthread.h>
#include "speakup.h"
#include "spk_priv.h"
diff --git a/drivers/accessibility/speakup/speakup_dtlk.c b/drivers/accessibility/speakup/speakup_dtlk.c
index fa826568937b..d47274678e73 100644
--- a/drivers/accessibility/speakup/speakup_dtlk.c
+++ b/drivers/accessibility/speakup/speakup_dtlk.c
@@ -13,6 +13,7 @@
#include <linux/jiffies.h>
#include <linux/sched.h>
#include <linux/timer.h>
+#include <linux/kobject.h>
#include <linux/kthread.h>
#include "spk_priv.h"
diff --git a/drivers/accessibility/speakup/speakup_dummy.c b/drivers/accessibility/speakup/speakup_dummy.c
index 52b2c5d44576..0e11bebb8db0 100644
--- a/drivers/accessibility/speakup/speakup_dummy.c
+++ b/drivers/accessibility/speakup/speakup_dummy.c
@@ -14,6 +14,8 @@
#include "spk_priv.h"
#include "speakup.h"
+#include <linux/kobject.h>
+
#define PROCSPEECH '\n'
#define DRV_VERSION "2.11"
#define SYNTH_CLEAR '!'
diff --git a/drivers/accessibility/speakup/speakup_keypc.c b/drivers/accessibility/speakup/speakup_keypc.c
index 9356f6379560..d5ff75843f74 100644
--- a/drivers/accessibility/speakup/speakup_keypc.c
+++ b/drivers/accessibility/speakup/speakup_keypc.c
@@ -11,6 +11,7 @@
#include <linux/jiffies.h>
#include <linux/sched.h>
#include <linux/timer.h>
+#include <linux/kobject.h>
#include <linux/kthread.h>
#include <linux/serial_reg.h>
diff --git a/drivers/accessibility/speakup/speakup_ltlk.c b/drivers/accessibility/speakup/speakup_ltlk.c
index 1e279ae143bf..f1806c86ea6b 100644
--- a/drivers/accessibility/speakup/speakup_ltlk.c
+++ b/drivers/accessibility/speakup/speakup_ltlk.c
@@ -13,6 +13,8 @@
#include "spk_priv.h"
#include "speakup_dtlk.h" /* local header file for LiteTalk values */
+#include <linux/kobject.h>
+
#define DRV_VERSION "2.11"
#define PROCSPEECH 0x0d
diff --git a/drivers/accessibility/speakup/speakup_soft.c b/drivers/accessibility/speakup/speakup_soft.c
index 6d446824677b..48e0fab55682 100644
--- a/drivers/accessibility/speakup/speakup_soft.c
+++ b/drivers/accessibility/speakup/speakup_soft.c
@@ -10,6 +10,7 @@
*/
#include <linux/unistd.h>
+#include <linux/kobject.h>
#include <linux/miscdevice.h> /* for misc_register, and MISC_DYNAMIC_MINOR */
#include <linux/poll.h> /* for poll_wait() */
diff --git a/drivers/accessibility/speakup/speakup_spkout.c b/drivers/accessibility/speakup/speakup_spkout.c
index d3f26095b0ee..2929c5b6236a 100644
--- a/drivers/accessibility/speakup/speakup_spkout.c
+++ b/drivers/accessibility/speakup/speakup_spkout.c
@@ -12,6 +12,8 @@
#include "spk_priv.h"
#include "speakup.h"
+#include <linux/kobject.h>
+
#define DRV_VERSION "2.11"
#define SYNTH_CLEAR 0x18
#define PROCSPEECH '\r'
diff --git a/drivers/accessibility/speakup/speakup_txprt.c b/drivers/accessibility/speakup/speakup_txprt.c
index 4d0a0d4c41f0..361d6cd6ba75 100644
--- a/drivers/accessibility/speakup/speakup_txprt.c
+++ b/drivers/accessibility/speakup/speakup_txprt.c
@@ -12,6 +12,8 @@
#include "spk_priv.h"
#include "speakup.h"
+#include <linux/kobject.h>
+
#define DRV_VERSION "2.11"
#define SYNTH_CLEAR 0x18
#define PROCSPEECH '\r' /* process speech char */
diff --git a/drivers/acpi/ac.c b/drivers/acpi/ac.c
index 2d4a35e6dd18..3c500e4bec6d 100644
--- a/drivers/acpi/ac.c
+++ b/drivers/acpi/ac.c
@@ -9,6 +9,7 @@
#define pr_fmt(fmt) "ACPI: AC: " fmt
#include <linux/kernel.h>
+#include <linux/kobject.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/init.h>
diff --git a/drivers/acpi/acpi_fpdt.c b/drivers/acpi/acpi_fpdt.c
index 271092f2700a..e4a73eb0cb66 100644
--- a/drivers/acpi/acpi_fpdt.c
+++ b/drivers/acpi/acpi_fpdt.c
@@ -9,6 +9,7 @@
#define pr_fmt(fmt) "ACPI FPDT: " fmt
#include <linux/acpi.h>
+#include <linux/kobject.h>
/*
* FPDT contains ACPI table header and a number of fpdt_subtable_entries.
diff --git a/drivers/acpi/bgrt.c b/drivers/acpi/bgrt.c
index e4fb9e225ddf..f7936665160f 100644
--- a/drivers/acpi/bgrt.c
+++ b/drivers/acpi/bgrt.c
@@ -7,6 +7,7 @@
*/
#include <linux/kernel.h>
+#include <linux/kobject.h>
#include <linux/init.h>
#include <linux/device.h>
#include <linux/sysfs.h>
diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c
index 569bd15f211b..2824ee35d5b9 100644
--- a/drivers/acpi/bus.c
+++ b/drivers/acpi/bus.c
@@ -11,6 +11,7 @@
#include <linux/init.h>
#include <linux/ioport.h>
#include <linux/kernel.h>
+#include <linux/kobject.h>
#include <linux/list.h>
#include <linux/sched.h>
#include <linux/pm.h>
diff --git a/drivers/acpi/container.c b/drivers/acpi/container.c
index 5b7e3b9ae370..5ee7b4aadb1e 100644
--- a/drivers/acpi/container.c
+++ b/drivers/acpi/container.c
@@ -11,6 +11,7 @@
*/
#include <linux/acpi.h>
#include <linux/container.h>
+#include <linux/kobject.h>
#include "internal.h"
diff --git a/drivers/acpi/device_sysfs.c b/drivers/acpi/device_sysfs.c
index 23373faa35ec..0855833166a1 100644
--- a/drivers/acpi/device_sysfs.c
+++ b/drivers/acpi/device_sysfs.c
@@ -14,6 +14,7 @@
#include <linux/acpi.h>
#include <linux/device.h>
#include <linux/export.h>
+#include <linux/kobject.h>
#include <linux/nls.h>
#include "internal.h"
diff --git a/drivers/acpi/dock.c b/drivers/acpi/dock.c
index a89bdbe00184..4586f9d10868 100644
--- a/drivers/acpi/dock.c
+++ b/drivers/acpi/dock.c
@@ -8,6 +8,7 @@
*/
#include <linux/kernel.h>
+#include <linux/kobject.h>
#include <linux/moduleparam.h>
#include <linux/slab.h>
#include <linux/init.h>
diff --git a/drivers/acpi/sysfs.c b/drivers/acpi/sysfs.c
index 687524b50085..852a4b80ce04 100644
--- a/drivers/acpi/sysfs.c
+++ b/drivers/acpi/sysfs.c
@@ -9,6 +9,7 @@
#include <linux/bitmap.h>
#include <linux/init.h>
#include <linux/kernel.h>
+#include <linux/kobject.h>
#include <linux/kstrtox.h>
#include <linux/moduleparam.h>
diff --git a/drivers/ata/libata-acpi.c b/drivers/ata/libata-acpi.c
index d36e71f475ab..a8130c6edaa7 100644
--- a/drivers/ata/libata-acpi.c
+++ b/drivers/ata/libata-acpi.c
@@ -13,6 +13,7 @@
#include <linux/device.h>
#include <linux/errno.h>
#include <linux/kernel.h>
+#include <linux/kobject.h>
#include <linux/acpi.h>
#include <linux/libata.h>
#include <linux/pci.h>
diff --git a/drivers/base/devcoredump.c b/drivers/base/devcoredump.c
index 7e2d1f0d903a..7fb7ecd270c4 100644
--- a/drivers/base/devcoredump.c
+++ b/drivers/base/devcoredump.c
@@ -6,6 +6,7 @@
* Author: Johannes Berg <[email protected]>
*/
#include <linux/module.h>
+#include <linux/kobject.h>
#include <linux/device.h>
#include <linux/devcoredump.h>
#include <linux/list.h>
diff --git a/drivers/base/firmware_loader/fallback.c b/drivers/base/firmware_loader/fallback.c
index 3ef0b312ae71..2f5f613fbd1e 100644
--- a/drivers/base/firmware_loader/fallback.c
+++ b/drivers/base/firmware_loader/fallback.c
@@ -6,6 +6,7 @@
#include <linux/security.h>
#include <linux/umh.h>
#include <linux/sysctl.h>
+#include <linux/kobject.h>
#include <linux/module.h>
#include "fallback.h"
diff --git a/drivers/base/firmware_loader/sysfs.c b/drivers/base/firmware_loader/sysfs.c
index c9c93b47d9a5..895943a20c04 100644
--- a/drivers/base/firmware_loader/sysfs.c
+++ b/drivers/base/firmware_loader/sysfs.c
@@ -1,6 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
#include <linux/highmem.h>
+#include <linux/kobject.h>
#include <linux/module.h>
#include <linux/security.h>
#include <linux/slab.h>
diff --git a/drivers/block/drbd/drbd_nl.c b/drivers/block/drbd/drbd_nl.c
index 43747a1aae43..3d20b724f762 100644
--- a/drivers/block/drbd/drbd_nl.c
+++ b/drivers/block/drbd/drbd_nl.c
@@ -28,6 +28,7 @@
#include <asm/unaligned.h>
#include <linux/drbd_limits.h>
#include <linux/kthread.h>
+#include <linux/kobject.h>
#include <net/genetlink.h>
diff --git a/drivers/block/loop.c b/drivers/block/loop.c
index f8145499da38..77be516ee6f8 100644
--- a/drivers/block/loop.c
+++ b/drivers/block/loop.c
@@ -4,6 +4,7 @@
*/
#include <linux/module.h>
#include <linux/moduleparam.h>
+#include <linux/kobject.h>
#include <linux/sched.h>
#include <linux/fs.h>
#include <linux/pagemap.h>
diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
index 33a8f37bb6a1..2df76356d74a 100644
--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -38,6 +38,7 @@
#include <linux/types.h>
#include <linux/debugfs.h>
#include <linux/blk-mq.h>
+#include <linux/kobject.h>
#include <linux/uaccess.h>
#include <asm/types.h>
diff --git a/drivers/block/rnbd/rnbd-clt-sysfs.c b/drivers/block/rnbd/rnbd-clt-sysfs.c
index 39887556cf95..8d11b2e563b9 100644
--- a/drivers/block/rnbd/rnbd-clt-sysfs.c
+++ b/drivers/block/rnbd/rnbd-clt-sysfs.c
@@ -18,6 +18,7 @@
#include <linux/fs.h>
#include <linux/uaccess.h>
#include <linux/device.h>
+#include <linux/kobject.h>
#include <rdma/ib.h>
#include <rdma/rdma_cm.h>
diff --git a/drivers/block/rnbd/rnbd-clt.c b/drivers/block/rnbd/rnbd-clt.c
index 4044c369d22a..8a67a173b744 100644
--- a/drivers/block/rnbd/rnbd-clt.c
+++ b/drivers/block/rnbd/rnbd-clt.c
@@ -13,6 +13,7 @@
#include <linux/module.h>
#include <linux/blkdev.h>
#include <linux/hdreg.h>
+#include <linux/kobject.h>
#include <linux/scatterlist.h>
#include <linux/idr.h>
diff --git a/drivers/block/rnbd/rnbd-srv.c b/drivers/block/rnbd/rnbd-srv.c
index 3a0d5dcec6f2..3b88036cbc77 100644
--- a/drivers/block/rnbd/rnbd-srv.c
+++ b/drivers/block/rnbd/rnbd-srv.c
@@ -11,6 +11,7 @@
#include <linux/module.h>
#include <linux/blkdev.h>
+#include <linux/kobject.h>
#include "rnbd-srv.h"
#include "rnbd-srv-trace.h"
diff --git a/drivers/block/ublk_drv.c b/drivers/block/ublk_drv.c
index 1dfb2e77898b..dca6fa1063ef 100644
--- a/drivers/block/ublk_drv.c
+++ b/drivers/block/ublk_drv.c
@@ -43,6 +43,7 @@
#include <asm/page.h>
#include <linux/task_work.h>
#include <linux/namei.h>
+#include <linux/kobject.h>
#include <linux/kref.h>
#include <uapi/linux/ublk_cmd.h>
diff --git a/drivers/bus/mhi/ep/main.c b/drivers/bus/mhi/ep/main.c
index e358d192f0d8..2c3926b51e18 100644
--- a/drivers/bus/mhi/ep/main.c
+++ b/drivers/bus/mhi/ep/main.c
@@ -13,6 +13,7 @@
#include <linux/interrupt.h>
#include <linux/io.h>
#include <linux/irq.h>
+#include <linux/kobject.h>
#include <linux/mhi_ep.h>
#include <linux/mod_devicetable.h>
#include <linux/module.h>
diff --git a/drivers/bus/mhi/host/init.c b/drivers/bus/mhi/host/init.c
index 6d3b045ab259..e9f74e1af4d2 100644
--- a/drivers/bus/mhi/host/init.c
+++ b/drivers/bus/mhi/host/init.c
@@ -12,6 +12,7 @@
#include <linux/idr.h>
#include <linux/interrupt.h>
#include <linux/list.h>
+#include <linux/kobject.h>
#include <linux/mhi.h>
#include <linux/mod_devicetable.h>
#include <linux/module.h>
diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c
index 035f89f1a251..f1c5aa63260b 100644
--- a/drivers/char/virtio_console.c
+++ b/drivers/char/virtio_console.c
@@ -26,6 +26,7 @@
#include <linux/workqueue.h>
#include <linux/module.h>
#include <linux/dma-mapping.h>
+#include <linux/kobject.h>
#include "../tty/hvc/hvc_console.h"
#define is_rproc_enabled IS_ENABLED(CONFIG_REMOTEPROC)
diff --git a/drivers/char/xillybus/xillybus_class.c b/drivers/char/xillybus/xillybus_class.c
index c92a628e389e..62bbdd3ed2fe 100644
--- a/drivers/char/xillybus/xillybus_class.c
+++ b/drivers/char/xillybus/xillybus_class.c
@@ -11,6 +11,7 @@
#include <linux/fs.h>
#include <linux/cdev.h>
#include <linux/slab.h>
+#include <linux/kobject.h>
#include <linux/list.h>
#include <linux/mutex.h>
diff --git a/drivers/comedi/comedi_fops.c b/drivers/comedi/comedi_fops.c
index 469560b7aba6..d15caee0504e 100644
--- a/drivers/comedi/comedi_fops.c
+++ b/drivers/comedi/comedi_fops.c
@@ -25,6 +25,7 @@
#include <linux/fs.h>
#include <linux/comedi/comedidev.h>
#include <linux/cdev.h>
+#include <linux/kobject.h>
#include <linux/kref.h>
#include <linux/io.h>
diff --git a/drivers/cxl/core/port.c b/drivers/cxl/core/port.c
index e59d9d37aa65..abfd43666e60 100644
--- a/drivers/cxl/core/port.c
+++ b/drivers/cxl/core/port.c
@@ -1,6 +1,7 @@
// SPDX-License-Identifier: GPL-2.0-only
/* Copyright(c) 2020 Intel Corporation. All rights reserved. */
#include <linux/platform_device.h>
+#include <linux/kobject.h>
#include <linux/memregion.h>
#include <linux/workqueue.h>
#include <linux/debugfs.h>
diff --git a/drivers/dax/bus.c b/drivers/dax/bus.c
index 7a54bca555c4..5c90dd345d65 100644
--- a/drivers/dax/bus.c
+++ b/drivers/dax/bus.c
@@ -7,6 +7,7 @@
#include <linux/slab.h>
#include <linux/dax.h>
#include <linux/io.h>
+#include <linux/kobject.h>
#include <linux/kref.h>
#include "dax-private.h"
#include "bus.h"
diff --git a/drivers/dma/qcom/hidma_mgmt_sys.c b/drivers/dma/qcom/hidma_mgmt_sys.c
index 930eae0a6257..4ea5bdfc4b3a 100644
--- a/drivers/dma/qcom/hidma_mgmt_sys.c
+++ b/drivers/dma/qcom/hidma_mgmt_sys.c
@@ -7,6 +7,7 @@
#include <linux/sysfs.h>
#include <linux/platform_device.h>
+#include <linux/kobject.h>
#include "hidma_mgmt.h"
diff --git a/drivers/firmware/arm_ffa/bus.c b/drivers/firmware/arm_ffa/bus.c
index 50914dd5afd6..3795fa0bfb01 100644
--- a/drivers/firmware/arm_ffa/bus.c
+++ b/drivers/firmware/arm_ffa/bus.c
@@ -10,6 +10,7 @@
#include <linux/fs.h>
#include <linux/idr.h>
#include <linux/kernel.h>
+#include <linux/kobject.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/types.h>
diff --git a/drivers/firmware/dmi-id.c b/drivers/firmware/dmi-id.c
index 5f3a3e913d28..72ac916e8e34 100644
--- a/drivers/firmware/dmi-id.c
+++ b/drivers/firmware/dmi-id.c
@@ -7,6 +7,7 @@
#include <linux/module.h>
#include <linux/kernel.h>
+#include <linux/kobject.h>
#include <linux/init.h>
#include <linux/dmi.h>
#include <linux/device.h>
diff --git a/drivers/firmware/dmi_scan.c b/drivers/firmware/dmi_scan.c
index 015c95a825d3..cef3b638c23b 100644
--- a/drivers/firmware/dmi_scan.c
+++ b/drivers/firmware/dmi_scan.c
@@ -2,6 +2,7 @@
#include <linux/types.h>
#include <linux/string.h>
#include <linux/init.h>
+#include <linux/kobject.h>
#include <linux/module.h>
#include <linux/ctype.h>
#include <linux/dmi.h>
diff --git a/drivers/firmware/memmap.c b/drivers/firmware/memmap.c
index 8e59be3782cb..a92d17c6fc0f 100644
--- a/drivers/firmware/memmap.c
+++ b/drivers/firmware/memmap.c
@@ -8,6 +8,7 @@
#include <linux/string.h>
#include <linux/firmware-map.h>
#include <linux/kernel.h>
+#include <linux/kobject.h>
#include <linux/module.h>
#include <linux/types.h>
#include <linux/memblock.h>
diff --git a/drivers/firmware/qemu_fw_cfg.c b/drivers/firmware/qemu_fw_cfg.c
index 5f43dfa22f79..dbca29ceb504 100644
--- a/drivers/firmware/qemu_fw_cfg.c
+++ b/drivers/firmware/qemu_fw_cfg.c
@@ -34,6 +34,7 @@
#include <linux/slab.h>
#include <linux/io.h>
#include <linux/ioport.h>
+#include <linux/kobject.h>
#include <uapi/linux/qemu_fw_cfg.h>
#include <linux/delay.h>
#include <linux/crash_dump.h>
diff --git a/drivers/gnss/core.c b/drivers/gnss/core.c
index 48f2ee0f78c4..24b914fb0581 100644
--- a/drivers/gnss/core.c
+++ b/drivers/gnss/core.c
@@ -14,6 +14,7 @@
#include <linux/idr.h>
#include <linux/init.h>
#include <linux/kernel.h>
+#include <linux/kobject.h>
#include <linux/module.h>
#include <linux/poll.h>
#include <linux/slab.h>
diff --git a/drivers/greybus/core.c b/drivers/greybus/core.c
index 5714be740470..6ec29875fcfd 100644
--- a/drivers/greybus/core.c
+++ b/drivers/greybus/core.c
@@ -10,6 +10,7 @@
#define CREATE_TRACE_POINTS
#include <linux/greybus.h>
+#include <linux/kobject.h>
#include "greybus_trace.h"
#define GB_BUNDLE_AUTOSUSPEND_MS 3000
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index d429bc5cc183..a7f16517cc1c 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -17,6 +17,7 @@
#include <linux/slab.h>
#include <linux/init.h>
#include <linux/kernel.h>
+#include <linux/kobject.h>
#include <linux/kref.h>
#include <linux/list.h>
#include <linux/mm.h>
diff --git a/drivers/hid/hid-wiimote-core.c b/drivers/hid/hid-wiimote-core.c
index 26167cfb696f..ca1a4101b2d0 100644
--- a/drivers/hid/hid-wiimote-core.c
+++ b/drivers/hid/hid-wiimote-core.c
@@ -11,6 +11,7 @@
#include <linux/device.h>
#include <linux/hid.h>
#include <linux/input.h>
+#include <linux/kobject.h>
#include <linux/module.h>
#include <linux/mutex.h>
#include <linux/spinlock.h>
diff --git a/drivers/hid/wacom_sys.c b/drivers/hid/wacom_sys.c
index 157de6bdd639..660dd3edeb62 100644
--- a/drivers/hid/wacom_sys.c
+++ b/drivers/hid/wacom_sys.c
@@ -6,6 +6,7 @@
#include "wacom_wac.h"
#include "wacom.h"
#include <linux/input/mt.h>
+#include <linux/kobject.h>
#include <linux/kref.h>
#define WAC_MSG_RETRIES 5
diff --git a/drivers/hwmon/acpi_power_meter.c b/drivers/hwmon/acpi_power_meter.c
index 703666b95bf4..33fe78a620f7 100644
--- a/drivers/hwmon/acpi_power_meter.c
+++ b/drivers/hwmon/acpi_power_meter.c
@@ -18,6 +18,7 @@
#include <linux/time.h>
#include <linux/err.h>
#include <linux/acpi.h>
+#include <linux/kobject.h>
#define ACPI_POWER_METER_NAME "power_meter"
#define ACPI_POWER_METER_DEVICE_NAME "Power Meter"
diff --git a/drivers/hwtracing/stm/core.c b/drivers/hwtracing/stm/core.c
index 534fbefc7f6a..b7563efeabf6 100644
--- a/drivers/hwtracing/stm/core.c
+++ b/drivers/hwtracing/stm/core.c
@@ -10,6 +10,7 @@
#include <linux/pm_runtime.h>
#include <linux/uaccess.h>
#include <linux/kernel.h>
+#include <linux/kobject.h>
#include <linux/module.h>
#include <linux/device.h>
#include <linux/compat.h>
diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c
index cd2599f49168..a067ee0439d9 100644
--- a/drivers/infiniband/core/device.c
+++ b/drivers/infiniband/core/device.c
@@ -35,6 +35,7 @@
#include <linux/string.h>
#include <linux/errno.h>
#include <linux/kernel.h>
+#include <linux/kobject.h>
#include <linux/kref.h>
#include <linux/slab.h>
#include <linux/init.h>
diff --git a/drivers/infiniband/core/sysfs.c b/drivers/infiniband/core/sysfs.c
index 9f97bef02149..e43f72567d51 100644
--- a/drivers/infiniband/core/sysfs.c
+++ b/drivers/infiniband/core/sysfs.c
@@ -39,6 +39,7 @@
#include <linux/string.h>
#include <linux/netdevice.h>
#include <linux/ethtool.h>
+#include <linux/kobject.h>
#include <rdma/ib_mad.h>
#include <rdma/ib_pma.h>
diff --git a/drivers/infiniband/hw/mlx4/sysfs.c b/drivers/infiniband/hw/mlx4/sysfs.c
index 88f534cf690e..d45d2bd1995f 100644
--- a/drivers/infiniband/hw/mlx4/sysfs.c
+++ b/drivers/infiniband/hw/mlx4/sysfs.c
@@ -32,6 +32,7 @@
/*#include "core_priv.h"*/
#include "mlx4_ib.h"
+#include <linux/kobject.h>
#include <linux/slab.h>
#include <linux/string.h>
#include <linux/stat.h>
diff --git a/drivers/infiniband/ulp/rtrs/rtrs-clt-sysfs.c b/drivers/infiniband/ulp/rtrs/rtrs-clt-sysfs.c
index d3c436ead694..1cc12c3bda71 100644
--- a/drivers/infiniband/ulp/rtrs/rtrs-clt-sysfs.c
+++ b/drivers/infiniband/ulp/rtrs/rtrs-clt-sysfs.c
@@ -13,6 +13,8 @@
#include "rtrs-clt.h"
#include "rtrs-log.h"
+#include <linux/kobject.h>
+
#define MIN_MAX_RECONN_ATT -1
#define MAX_MAX_RECONN_ATT 9999
diff --git a/drivers/infiniband/ulp/rtrs/rtrs-clt.c b/drivers/infiniband/ulp/rtrs/rtrs-clt.c
index 79dcbfad93c0..1fdc0a3a9aa5 100644
--- a/drivers/infiniband/ulp/rtrs/rtrs-clt.c
+++ b/drivers/infiniband/ulp/rtrs/rtrs-clt.c
@@ -10,6 +10,7 @@
#undef pr_fmt
#define pr_fmt(fmt) KBUILD_MODNAME " L" __stringify(__LINE__) ": " fmt
+#include <linux/kobject.h>
#include <linux/module.h>
#include <linux/rculist.h>
#include <linux/random.h>
diff --git a/drivers/infiniband/ulp/rtrs/rtrs-srv-sysfs.c b/drivers/infiniband/ulp/rtrs/rtrs-srv-sysfs.c
index 3f305e694fe8..60c7dc4e6e61 100644
--- a/drivers/infiniband/ulp/rtrs/rtrs-srv-sysfs.c
+++ b/drivers/infiniband/ulp/rtrs/rtrs-srv-sysfs.c
@@ -13,6 +13,8 @@
#include "rtrs-srv.h"
#include "rtrs-log.h"
+#include <linux/kobject.h>
+
static void rtrs_srv_release(struct kobject *kobj)
{
struct rtrs_srv_path *srv_path;
diff --git a/drivers/infiniband/ulp/rtrs/rtrs-srv.c b/drivers/infiniband/ulp/rtrs/rtrs-srv.c
index 1d33efb8fb03..015e77e82177 100644
--- a/drivers/infiniband/ulp/rtrs/rtrs-srv.c
+++ b/drivers/infiniband/ulp/rtrs/rtrs-srv.c
@@ -10,6 +10,7 @@
#undef pr_fmt
#define pr_fmt(fmt) KBUILD_MODNAME " L" __stringify(__LINE__) ": " fmt
+#include <linux/kobject.h>
#include <linux/module.h>
#include "rtrs-srv.h"
diff --git a/drivers/input/input.c b/drivers/input/input.c
index de7884a5be39..715daa05becb 100644
--- a/drivers/input/input.c
+++ b/drivers/input/input.c
@@ -22,6 +22,7 @@
#include <linux/pm.h>
#include <linux/poll.h>
#include <linux/device.h>
+#include <linux/kobject.h>
#include <linux/kstrtox.h>
#include <linux/mutex.h>
#include <linux/rcupdate.h>
diff --git a/drivers/input/serio/serio.c b/drivers/input/serio/serio.c
index 767fc9efb4a8..345e78f69ffe 100644
--- a/drivers/input/serio/serio.c
+++ b/drivers/input/serio/serio.c
@@ -10,6 +10,7 @@
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/stddef.h>
+#include <linux/kobject.h>
#include <linux/module.h>
#include <linux/serio.h>
#include <linux/errno.h>
diff --git a/drivers/ipack/ipack.c b/drivers/ipack/ipack.c
index b1471ba016a5..377b86a78155 100644
--- a/drivers/ipack/ipack.c
+++ b/drivers/ipack/ipack.c
@@ -11,6 +11,7 @@
#include <linux/idr.h>
#include <linux/io.h>
#include <linux/ipack.h>
+#include <linux/kobject.h>
#define to_ipack_dev(device) container_of(device, struct ipack_device, dev)
#define to_ipack_driver(drv) container_of(drv, struct ipack_driver, driver)
diff --git a/drivers/isdn/mISDN/core.c b/drivers/isdn/mISDN/core.c
index c829c4eac0e2..caf593b8af78 100644
--- a/drivers/isdn/mISDN/core.c
+++ b/drivers/isdn/mISDN/core.c
@@ -6,6 +6,7 @@
#include <linux/slab.h>
#include <linux/types.h>
#include <linux/stddef.h>
+#include <linux/kobject.h>
#include <linux/module.h>
#include <linux/spinlock.h>
#include <linux/mISDNif.h>
diff --git a/drivers/leds/led-triggers.c b/drivers/leds/led-triggers.c
index bd59a14a4a90..3cd5719ac2a9 100644
--- a/drivers/leds/led-triggers.c
+++ b/drivers/leds/led-triggers.c
@@ -9,6 +9,7 @@
#include <linux/export.h>
#include <linux/kernel.h>
+#include <linux/kobject.h>
#include <linux/list.h>
#include <linux/spinlock.h>
#include <linux/device.h>
diff --git a/drivers/mcb/mcb-core.c b/drivers/mcb/mcb-core.c
index 61994da7bad0..b2f484818c12 100644
--- a/drivers/mcb/mcb-core.c
+++ b/drivers/mcb/mcb-core.c
@@ -6,6 +6,7 @@
* Author: Johannes Thumshirn <[email protected]>
*/
#include <linux/kernel.h>
+#include <linux/kobject.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/types.h>
diff --git a/drivers/md/dm-verity-target.c b/drivers/md/dm-verity-target.c
index 14e58ae70521..c56c3a3871e0 100644
--- a/drivers/md/dm-verity-target.c
+++ b/drivers/md/dm-verity-target.c
@@ -17,6 +17,7 @@
#include "dm-verity-fec.h"
#include "dm-verity-verify-sig.h"
#include "dm-audit.h"
+#include <linux/kobject.h>
#include <linux/module.h>
#include <linux/reboot.h>
#include <linux/scatterlist.h>
diff --git a/drivers/media/cec/core/cec-core.c b/drivers/media/cec/core/cec-core.c
index 7e153c5cad04..dcd171fc3923 100644
--- a/drivers/media/cec/core/cec-core.c
+++ b/drivers/media/cec/core/cec-core.c
@@ -10,6 +10,7 @@
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/kmod.h>
+#include <linux/kobject.h>
#include <linux/slab.h>
#include <linux/mm.h>
#include <linux/string.h>
diff --git a/drivers/media/mc/mc-devnode.c b/drivers/media/mc/mc-devnode.c
index 9c8fe9335dc1..e3cb51595fb2 100644
--- a/drivers/media/mc/mc-devnode.c
+++ b/drivers/media/mc/mc-devnode.c
@@ -25,6 +25,7 @@
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/kmod.h>
+#include <linux/kobject.h>
#include <linux/slab.h>
#include <linux/mm.h>
#include <linux/string.h>
diff --git a/drivers/media/rc/rc-main.c b/drivers/media/rc/rc-main.c
index 6bdad6341844..197a4c9f4214 100644
--- a/drivers/media/rc/rc-main.c
+++ b/drivers/media/rc/rc-main.c
@@ -15,6 +15,7 @@
#include <linux/idr.h>
#include <linux/device.h>
#include <linux/module.h>
+#include <linux/kobject.h>
#include "rc-core-priv.h"
/* Sizes are in bytes, 256 bytes allows for 32 entries on x64 */
diff --git a/drivers/memstick/core/memstick.c b/drivers/memstick/core/memstick.c
index bbfaf6536903..15ff608c934b 100644
--- a/drivers/memstick/core/memstick.c
+++ b/drivers/memstick/core/memstick.c
@@ -13,6 +13,7 @@
#include <linux/fs.h>
#include <linux/delay.h>
#include <linux/slab.h>
+#include <linux/kobject.h>
#include <linux/module.h>
#include <linux/pm_runtime.h>
diff --git a/drivers/misc/ti-st/st_kim.c b/drivers/misc/ti-st/st_kim.c
index 4b1be0bb6ac0..899f3723e317 100644
--- a/drivers/misc/ti-st/st_kim.c
+++ b/drivers/misc/ti-st/st_kim.c
@@ -19,6 +19,7 @@
#include <linux/sched.h>
#include <linux/sysfs.h>
#include <linux/tty.h>
+#include <linux/kobject.h>
#include <linux/skbuff.h>
#include <linux/ti_wilink_st.h>
diff --git a/drivers/misc/tifm_core.c b/drivers/misc/tifm_core.c
index eee9b6581604..25812dfde277 100644
--- a/drivers/misc/tifm_core.c
+++ b/drivers/misc/tifm_core.c
@@ -7,6 +7,7 @@
#include <linux/tifm.h>
#include <linux/slab.h>
+#include <linux/kobject.h>
#include <linux/init.h>
#include <linux/idr.h>
#include <linux/module.h>
diff --git a/drivers/most/most_cdev.c b/drivers/most/most_cdev.c
index 3ed8f461e01e..d106ac4879cb 100644
--- a/drivers/most/most_cdev.c
+++ b/drivers/most/most_cdev.c
@@ -13,6 +13,7 @@
#include <linux/cdev.h>
#include <linux/poll.h>
#include <linux/kfifo.h>
+#include <linux/kobject.h>
#include <linux/uaccess.h>
#include <linux/idr.h>
#include <linux/most.h>
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 4e0600c7b050..27b5a9ef70d4 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -33,6 +33,7 @@
*/
#include <linux/kernel.h>
+#include <linux/kobject.h>
#include <linux/module.h>
#include <linux/types.h>
#include <linux/fcntl.h>
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_minidump.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_minidump.c
index 7ecb3dfe30bd..cf1038e15c1a 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_minidump.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_minidump.c
@@ -11,6 +11,8 @@
#include "qlcnic_83xx_hw.h"
#include "qlcnic_hw.h"
+#include <linux/kobject.h>
+
#define QLC_83XX_MINIDUMP_FLASH 0x520000
#define QLC_83XX_OCM_INDEX 3
#define QLC_83XX_PCI_INDEX 0
diff --git a/drivers/net/wireless/ath/wil6210/interrupt.c b/drivers/net/wireless/ath/wil6210/interrupt.c
index 67172385a5d6..831bf61b6e35 100644
--- a/drivers/net/wireless/ath/wil6210/interrupt.c
+++ b/drivers/net/wireless/ath/wil6210/interrupt.c
@@ -5,6 +5,7 @@
*/
#include <linux/interrupt.h>
+#include <linux/kobject.h>
#include "wil6210.h"
#include "trace.h"
diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/trans.c b/drivers/net/wireless/intel/iwlwifi/pcie/trans.c
index 63e13577aff8..14648c9c5d7d 100644
--- a/drivers/net/wireless/intel/iwlwifi/pcie/trans.c
+++ b/drivers/net/wireless/intel/iwlwifi/pcie/trans.c
@@ -11,6 +11,7 @@
#include <linux/bitops.h>
#include <linux/gfp.h>
#include <linux/vmalloc.h>
+#include <linux/kobject.h>
#include <linux/module.h>
#include <linux/wait.h>
#include <linux/seq_file.h>
diff --git a/drivers/net/xen-netback/xenbus.c b/drivers/net/xen-netback/xenbus.c
index a78a25b87240..c226915dd72b 100644
--- a/drivers/net/xen-netback/xenbus.c
+++ b/drivers/net/xen-netback/xenbus.c
@@ -9,6 +9,7 @@
#include "common.h"
#include <linux/vmalloc.h>
#include <linux/rtnetlink.h>
+#include <linux/kobject.h>
static int connect_data_rings(struct backend_info *be,
struct xenvif_queue *queue);
diff --git a/drivers/nvdimm/bus.c b/drivers/nvdimm/bus.c
index ef3d0f83318b..1d9e7ff22cdc 100644
--- a/drivers/nvdimm/bus.c
+++ b/drivers/nvdimm/bus.c
@@ -19,6 +19,7 @@
#include <linux/io.h>
#include <linux/mm.h>
#include <linux/nd.h>
+#include <linux/kobject.h>
#include "nd-core.h"
#include "nd.h"
#include "pfn.h"
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 85ab0fcf9e88..5af4ead71a29 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -12,6 +12,7 @@
#include <linux/errno.h>
#include <linux/hdreg.h>
#include <linux/kernel.h>
+#include <linux/kobject.h>
#include <linux/module.h>
#include <linux/backing-dev.h>
#include <linux/slab.h>
diff --git a/drivers/nvme/host/fc.c b/drivers/nvme/host/fc.c
index 16847a316421..ff144e1d854b 100644
--- a/drivers/nvme/host/fc.c
+++ b/drivers/nvme/host/fc.c
@@ -17,6 +17,7 @@
#include "fc.h"
#include <scsi/scsi_transport_fc.h>
#include <linux/blk-mq-pci.h>
+#include <linux/kobject.h>
/* *************************** Data Structures/Defines ****************** */
diff --git a/drivers/pci/host-bridge.c b/drivers/pci/host-bridge.c
index afa50b446567..5893d33878ca 100644
--- a/drivers/pci/host-bridge.c
+++ b/drivers/pci/host-bridge.c
@@ -4,6 +4,7 @@
*/
#include <linux/kernel.h>
+#include <linux/kobject.h>
#include <linux/pci.h>
#include <linux/module.h>
diff --git a/drivers/pci/iov.c b/drivers/pci/iov.c
index aaa33e8dc4c9..36c595e0b733 100644
--- a/drivers/pci/iov.c
+++ b/drivers/pci/iov.c
@@ -9,6 +9,7 @@
#include <linux/pci.h>
#include <linux/slab.h>
+#include <linux/kobject.h>
#include <linux/export.h>
#include <linux/string.h>
#include <linux/delay.h>
diff --git a/drivers/pcmcia/cs.c b/drivers/pcmcia/cs.c
index b33be1e63c98..858c8ed73655 100644
--- a/drivers/pcmcia/cs.c
+++ b/drivers/pcmcia/cs.c
@@ -13,6 +13,7 @@
#include <linux/moduleparam.h>
#include <linux/init.h>
#include <linux/kernel.h>
+#include <linux/kobject.h>
#include <linux/string.h>
#include <linux/major.h>
#include <linux/errno.h>
diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c
index b4b8363d1de2..12b4ad3d37d4 100644
--- a/drivers/pcmcia/ds.c
+++ b/drivers/pcmcia/ds.c
@@ -19,6 +19,7 @@
#include <linux/workqueue.h>
#include <linux/crc32.h>
#include <linux/firmware.h>
+#include <linux/kobject.h>
#include <linux/kref.h>
#include <linux/dma-mapping.h>
#include <linux/slab.h>
diff --git a/drivers/platform/surface/aggregator/bus.c b/drivers/platform/surface/aggregator/bus.c
index 118caa651bec..ffbecf4160ea 100644
--- a/drivers/platform/surface/aggregator/bus.c
+++ b/drivers/platform/surface/aggregator/bus.c
@@ -6,6 +6,7 @@
*/
#include <linux/device.h>
+#include <linux/kobject.h>
#include <linux/property.h>
#include <linux/slab.h>
diff --git a/drivers/power/supply/power_supply_sysfs.c b/drivers/power/supply/power_supply_sysfs.c
index 977611e16373..86fb1807e889 100644
--- a/drivers/power/supply/power_supply_sysfs.c
+++ b/drivers/power/supply/power_supply_sysfs.c
@@ -12,6 +12,7 @@
#include <linux/ctype.h>
#include <linux/device.h>
+#include <linux/kobject.h>
#include <linux/power_supply.h>
#include <linux/slab.h>
#include <linux/stat.h>
diff --git a/drivers/pps/pps.c b/drivers/pps/pps.c
index a689fd42ccaa..02db9c69df9e 100644
--- a/drivers/pps/pps.c
+++ b/drivers/pps/pps.c
@@ -8,6 +8,7 @@
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/kernel.h>
+#include <linux/kobject.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/sched.h>
diff --git a/drivers/rapidio/rio-driver.c b/drivers/rapidio/rio-driver.c
index 1b3b4c2e015d..b3a687983de4 100644
--- a/drivers/rapidio/rio-driver.c
+++ b/drivers/rapidio/rio-driver.c
@@ -7,6 +7,7 @@
*/
#include <linux/init.h>
+#include <linux/kobject.h>
#include <linux/module.h>
#include <linux/rio.h>
#include <linux/rio_ids.h>
diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c
index 3819f7c42788..b06e21cdd384 100644
--- a/drivers/scsi/ipr.c
+++ b/drivers/scsi/ipr.c
@@ -45,6 +45,7 @@
#include <linux/types.h>
#include <linux/errno.h>
#include <linux/kernel.h>
+#include <linux/kobject.h>
#include <linux/slab.h>
#include <linux/vmalloc.h>
#include <linux/ioport.h>
diff --git a/drivers/scsi/iscsi_boot_sysfs.c b/drivers/scsi/iscsi_boot_sysfs.c
index a64abe38db2d..03a8b98bf819 100644
--- a/drivers/scsi/iscsi_boot_sysfs.c
+++ b/drivers/scsi/iscsi_boot_sysfs.c
@@ -7,6 +7,7 @@
*/
#include <linux/module.h>
+#include <linux/kobject.h>
#include <linux/string.h>
#include <linux/slab.h>
#include <linux/sysfs.h>
diff --git a/drivers/scsi/qedf/qedf_dbg.c b/drivers/scsi/qedf/qedf_dbg.c
index 0d2aed82882a..476e10ffdd66 100644
--- a/drivers/scsi/qedf/qedf_dbg.c
+++ b/drivers/scsi/qedf/qedf_dbg.c
@@ -4,6 +4,7 @@
* Copyright (c) 2016-2018 Cavium Inc.
*/
#include "qedf_dbg.h"
+#include <linux/kobject.h>
#include <linux/vmalloc.h>
void
diff --git a/drivers/scsi/qla4xxx/ql4_nx.c b/drivers/scsi/qla4xxx/ql4_nx.c
index 47adff9f0506..8d6974ee2bc7 100644
--- a/drivers/scsi/qla4xxx/ql4_nx.c
+++ b/drivers/scsi/qla4xxx/ql4_nx.c
@@ -5,6 +5,7 @@
*/
#include <linux/delay.h>
#include <linux/io.h>
+#include <linux/kobject.h>
#include <linux/pci.h>
#include <linux/ratelimit.h>
#include "ql4_def.h"
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index c095ea928847..f711b3a5fe3c 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -14,6 +14,7 @@
#include <linux/blkdev.h>
#include <linux/completion.h>
#include <linux/kernel.h>
+#include <linux/kobject.h>
#include <linux/export.h>
#include <linux/init.h>
#include <linux/pci.h>
diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c
index dbd5e097a1fd..99fe53486ce0 100644
--- a/drivers/scsi/scsi_sysfs.c
+++ b/drivers/scsi/scsi_sysfs.c
@@ -14,6 +14,7 @@
#include <linux/device.h>
#include <linux/pm_runtime.h>
#include <linux/bsg.h>
+#include <linux/kobject.h>
#include <linux/kref.h>
#include <scsi/scsi.h>
diff --git a/drivers/scsi/ses.c b/drivers/scsi/ses.c
index 0f2c87cc95e6..6e9bc4c675ae 100644
--- a/drivers/scsi/ses.c
+++ b/drivers/scsi/ses.c
@@ -8,6 +8,7 @@
#include <linux/slab.h>
#include <linux/module.h>
#include <linux/kernel.h>
+#include <linux/kobject.h>
#include <linux/enclosure.h>
#include <asm/unaligned.h>
diff --git a/drivers/staging/fieldbus/dev_core.c b/drivers/staging/fieldbus/dev_core.c
index 370a229443a1..4edf1feb3a44 100644
--- a/drivers/staging/fieldbus/dev_core.c
+++ b/drivers/staging/fieldbus/dev_core.c
@@ -8,6 +8,7 @@
#include <linux/module.h>
#include <linux/device.h>
#include <linux/idr.h>
+#include <linux/kobject.h>
#include <linux/fs.h>
#include <linux/slab.h>
#include <linux/poll.h>
diff --git a/drivers/staging/greybus/gbphy.c b/drivers/staging/greybus/gbphy.c
index d827f03f5253..32dd32020124 100644
--- a/drivers/staging/greybus/gbphy.c
+++ b/drivers/staging/greybus/gbphy.c
@@ -11,6 +11,7 @@
#include <linux/types.h>
#include <linux/module.h>
#include <linux/kernel.h>
+#include <linux/kobject.h>
#include <linux/slab.h>
#include <linux/device.h>
#include <linux/greybus.h>
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_bus.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_bus.c
index 933027e0011e..d6b84a5d8e80 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_bus.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_bus.c
@@ -7,6 +7,7 @@
#include <linux/device/bus.h>
#include <linux/dma-mapping.h>
+#include <linux/kobject.h>
#include <linux/of_device.h>
#include <linux/slab.h>
#include <linux/string.h>
diff --git a/drivers/tee/tee_core.c b/drivers/tee/tee_core.c
index 792d6fae4354..98c409cb42e7 100644
--- a/drivers/tee/tee_core.c
+++ b/drivers/tee/tee_core.c
@@ -9,6 +9,7 @@
#include <linux/cred.h>
#include <linux/fs.h>
#include <linux/idr.h>
+#include <linux/kobject.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/tee_drv.h>
diff --git a/drivers/thunderbolt/domain.c b/drivers/thunderbolt/domain.c
index ee8a894bd70d..3d1855ae627e 100644
--- a/drivers/thunderbolt/domain.c
+++ b/drivers/thunderbolt/domain.c
@@ -8,6 +8,7 @@
#include <linux/device.h>
#include <linux/idr.h>
+#include <linux/kobject.h>
#include <linux/module.h>
#include <linux/pm_runtime.h>
#include <linux/slab.h>
diff --git a/drivers/thunderbolt/switch.c b/drivers/thunderbolt/switch.c
index bca6f28c553b..a44543e15ba8 100644
--- a/drivers/thunderbolt/switch.c
+++ b/drivers/thunderbolt/switch.c
@@ -8,6 +8,7 @@
#include <linux/delay.h>
#include <linux/idr.h>
+#include <linux/kobject.h>
#include <linux/module.h>
#include <linux/nvmem-provider.h>
#include <linux/pm_runtime.h>
diff --git a/drivers/thunderbolt/tb.c b/drivers/thunderbolt/tb.c
index 9a261560d0f4..2455d51e76a4 100644
--- a/drivers/thunderbolt/tb.c
+++ b/drivers/thunderbolt/tb.c
@@ -11,6 +11,7 @@
#include <linux/delay.h>
#include <linux/pm_runtime.h>
#include <linux/platform_data/x86/apple.h>
+#include <linux/kobject.h>
#include "tb.h"
#include "tb_regs.h"
diff --git a/drivers/thunderbolt/xdomain.c b/drivers/thunderbolt/xdomain.c
index b48df88981bd..7c0a8744771d 100644
--- a/drivers/thunderbolt/xdomain.c
+++ b/drivers/thunderbolt/xdomain.c
@@ -10,6 +10,7 @@
#include <linux/device.h>
#include <linux/delay.h>
#include <linux/kmod.h>
+#include <linux/kobject.h>
#include <linux/module.h>
#include <linux/pm_runtime.h>
#include <linux/prandom.h>
diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c
index 407b0d87b7c1..c823939b2689 100644
--- a/drivers/tty/tty_io.c
+++ b/drivers/tty/tty_io.c
@@ -83,6 +83,7 @@
#include <linux/timer.h>
#include <linux/ctype.h>
#include <linux/kd.h>
+#include <linux/kobject.h>
#include <linux/mm.h>
#include <linux/string.h>
#include <linux/slab.h>
diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c
index e02ba15f6e34..0cee73f8d326 100644
--- a/drivers/usb/core/driver.c
+++ b/drivers/usb/core/driver.c
@@ -31,6 +31,7 @@
#include <linux/usb.h>
#include <linux/usb/quirks.h>
#include <linux/usb/hcd.h>
+#include <linux/kobject.h>
#include "usb.h"
diff --git a/drivers/usb/gadget/udc/core.c b/drivers/usb/gadget/udc/core.c
index d59f94464b87..76ff62c42959 100644
--- a/drivers/usb/gadget/udc/core.c
+++ b/drivers/usb/gadget/udc/core.c
@@ -9,6 +9,7 @@
#define pr_fmt(fmt) "UDC core: " fmt
#include <linux/kernel.h>
+#include <linux/kobject.h>
#include <linux/module.h>
#include <linux/device.h>
#include <linux/list.h>
diff --git a/drivers/usb/roles/class.c b/drivers/usb/roles/class.c
index ae41578bd014..7e20cb977804 100644
--- a/drivers/usb/roles/class.c
+++ b/drivers/usb/roles/class.c
@@ -10,6 +10,7 @@
#include <linux/usb/role.h>
#include <linux/property.h>
#include <linux/device.h>
+#include <linux/kobject.h>
#include <linux/module.h>
#include <linux/mutex.h>
#include <linux/slab.h>
diff --git a/drivers/usb/typec/bus.c b/drivers/usb/typec/bus.c
index 6ea103e1abae..8675faa2a360 100644
--- a/drivers/usb/typec/bus.c
+++ b/drivers/usb/typec/bus.c
@@ -7,6 +7,7 @@
*/
#include <linux/usb/pd_vdo.h>
+#include <linux/kobject.h>
#include "bus.h"
#include "class.h"
diff --git a/drivers/usb/typec/class.c b/drivers/usb/typec/class.c
index caea2b829980..4b3dd32992d0 100644
--- a/drivers/usb/typec/class.c
+++ b/drivers/usb/typec/class.c
@@ -6,6 +6,7 @@
* Author: Heikki Krogerus <[email protected]>
*/
+#include <linux/kobject.h>
#include <linux/module.h>
#include <linux/mutex.h>
#include <linux/property.h>
diff --git a/drivers/vdpa/vdpa_user/vduse_dev.c b/drivers/vdpa/vdpa_user/vduse_dev.c
index 1d24da79c399..0670955456ce 100644
--- a/drivers/vdpa/vdpa_user/vduse_dev.c
+++ b/drivers/vdpa/vdpa_user/vduse_dev.c
@@ -23,6 +23,7 @@
#include <linux/nospec.h>
#include <linux/vmalloc.h>
#include <linux/sched/mm.h>
+#include <linux/kobject.h>
#include <uapi/linux/vduse.h>
#include <uapi/linux/vdpa.h>
#include <uapi/linux/virtio_config.h>
diff --git a/drivers/vfio/mdev/mdev_core.c b/drivers/vfio/mdev/mdev_core.c
index ed4737de4528..c1668a8d634f 100644
--- a/drivers/vfio/mdev/mdev_core.c
+++ b/drivers/vfio/mdev/mdev_core.c
@@ -10,6 +10,7 @@
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/sysfs.h>
+#include <linux/kobject.h>
#include <linux/mdev.h>
#include "mdev_private.h"
diff --git a/drivers/vfio/mdev/mdev_sysfs.c b/drivers/vfio/mdev/mdev_sysfs.c
index 9d2738e10c0b..e1f2af0c4def 100644
--- a/drivers/vfio/mdev/mdev_sysfs.c
+++ b/drivers/vfio/mdev/mdev_sysfs.c
@@ -10,6 +10,7 @@
#include <linux/sysfs.h>
#include <linux/ctype.h>
#include <linux/slab.h>
+#include <linux/kobject.h>
#include <linux/mdev.h>
#include "mdev_private.h"
diff --git a/drivers/video/fbdev/omap2/omapfb/dss/display-sysfs.c b/drivers/video/fbdev/omap2/omapfb/dss/display-sysfs.c
index ae937854403b..dbb97f50b92b 100644
--- a/drivers/video/fbdev/omap2/omapfb/dss/display-sysfs.c
+++ b/drivers/video/fbdev/omap2/omapfb/dss/display-sysfs.c
@@ -10,6 +10,7 @@
#define DSS_SUBSYS_NAME "DISPLAY"
#include <linux/kernel.h>
+#include <linux/kobject.h>
#include <linux/kstrtox.h>
#include <linux/module.h>
#include <linux/platform_device.h>
diff --git a/drivers/video/fbdev/omap2/omapfb/dss/manager-sysfs.c b/drivers/video/fbdev/omap2/omapfb/dss/manager-sysfs.c
index 1b644be5fe2e..dac243070c65 100644
--- a/drivers/video/fbdev/omap2/omapfb/dss/manager-sysfs.c
+++ b/drivers/video/fbdev/omap2/omapfb/dss/manager-sysfs.c
@@ -12,6 +12,7 @@
#include <linux/kernel.h>
#include <linux/kstrtox.h>
#include <linux/slab.h>
+#include <linux/kobject.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/jiffies.h>
diff --git a/drivers/virt/vmgenid.c b/drivers/virt/vmgenid.c
index b67a28da4702..884fefcd569e 100644
--- a/drivers/virt/vmgenid.c
+++ b/drivers/virt/vmgenid.c
@@ -8,6 +8,7 @@
*/
#include <linux/kernel.h>
+#include <linux/kobject.h>
#include <linux/module.h>
#include <linux/acpi.h>
#include <linux/random.h>
diff --git a/drivers/xen/xenbus/xenbus_probe_backend.c b/drivers/xen/xenbus/xenbus_probe_backend.c
index 5ebb7233076f..d9fdf215837f 100644
--- a/drivers/xen/xenbus/xenbus_probe_backend.c
+++ b/drivers/xen/xenbus/xenbus_probe_backend.c
@@ -43,6 +43,7 @@
#include <linux/ctype.h>
#include <linux/fcntl.h>
#include <linux/mm.h>
+#include <linux/kobject.h>
#include <linux/notifier.h>
#include <linux/export.h>
#include <linux/semaphore.h>
diff --git a/drivers/xen/xenbus/xenbus_probe_frontend.c b/drivers/xen/xenbus/xenbus_probe_frontend.c
index fcb335bb7b18..691356164521 100644
--- a/drivers/xen/xenbus/xenbus_probe_frontend.c
+++ b/drivers/xen/xenbus/xenbus_probe_frontend.c
@@ -13,6 +13,7 @@
#include <linux/mm.h>
#include <linux/proc_fs.h>
#include <linux/notifier.h>
+#include <linux/kobject.h>
#include <linux/kthread.h>
#include <linux/mutex.h>
#include <linux/io.h>
diff --git a/fs/9p/v9fs.c b/fs/9p/v9fs.c
index 61dbe52bb3a3..790484189659 100644
--- a/fs/9p/v9fs.c
+++ b/fs/9p/v9fs.c
@@ -11,6 +11,7 @@
#include <linux/module.h>
#include <linux/errno.h>
#include <linux/fs.h>
+#include <linux/kobject.h>
#include <linux/sched.h>
#include <linux/cred.h>
#include <linux/parser.h>
diff --git a/fs/configfs/mount.c b/fs/configfs/mount.c
index 57a6ab996950..7b4a67d02a10 100644
--- a/fs/configfs/mount.c
+++ b/fs/configfs/mount.c
@@ -9,6 +9,7 @@
*/
#include <linux/fs.h>
+#include <linux/kobject.h>
#include <linux/module.h>
#include <linux/mount.h>
#include <linux/fs_context.h>
diff --git a/fs/ecryptfs/main.c b/fs/ecryptfs/main.c
index 2dc927ba067f..7cb95a278bd9 100644
--- a/fs/ecryptfs/main.c
+++ b/fs/ecryptfs/main.c
@@ -18,6 +18,7 @@
#include <linux/mount.h>
#include <linux/pagemap.h>
#include <linux/key.h>
+#include <linux/kobject.h>
#include <linux/parser.h>
#include <linux/fs_stack.h>
#include <linux/slab.h>
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index dcba0f85dfe2..fbbb70f85bc1 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -43,6 +43,7 @@
#include <linux/iversion.h>
#include <linux/unicode.h>
#include <linux/part_stat.h>
+#include <linux/kobject.h>
#include <linux/kthread.h>
#include <linux/freezer.h>
#include <linux/fsnotify.h>
diff --git a/fs/ext4/sysfs.c b/fs/ext4/sysfs.c
index a982ea569b9d..9860b03368fa 100644
--- a/fs/ext4/sysfs.c
+++ b/fs/ext4/sysfs.c
@@ -10,6 +10,7 @@
#include <linux/time.h>
#include <linux/fs.h>
+#include <linux/kobject.h>
#include <linux/seq_file.h>
#include <linux/slab.h>
#include <linux/sysfs.h>
diff --git a/fs/fuse/cuse.c b/fs/fuse/cuse.c
index 91e89e68177e..1100a450225c 100644
--- a/fs/fuse/cuse.c
+++ b/fs/fuse/cuse.c
@@ -40,6 +40,7 @@
#include <linux/file.h>
#include <linux/fs.h>
#include <linux/kdev_t.h>
+#include <linux/kobject.h>
#include <linux/kthread.h>
#include <linux/list.h>
#include <linux/magic.h>
diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c
index 2a6d44f91729..54ad222af837 100644
--- a/fs/fuse/inode.c
+++ b/fs/fuse/inode.c
@@ -13,6 +13,7 @@
#include <linux/file.h>
#include <linux/seq_file.h>
#include <linux/init.h>
+#include <linux/kobject.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/fs_context.h>
diff --git a/fs/namespace.c b/fs/namespace.c
index d80479bcf76c..e8ff4faaac9f 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -34,6 +34,7 @@
#include <linux/sysfs.h>
#include <linux/mnt_idmapping.h>
#include <linux/nospec.h>
+#include <linux/kobject.h>
#include "pnode.h"
#include "internal.h"
diff --git a/fs/nfs/client.c b/fs/nfs/client.c
index 44eca51b2808..898283bfd202 100644
--- a/fs/nfs/client.c
+++ b/fs/nfs/client.c
@@ -11,6 +11,7 @@
#include <linux/sched.h>
#include <linux/time.h>
#include <linux/kernel.h>
+#include <linux/kobject.h>
#include <linux/mm.h>
#include <linux/string.h>
#include <linux/stat.h>
diff --git a/fs/ubifs/sysfs.c b/fs/ubifs/sysfs.c
index 1c958148bb87..ac5eef88af0d 100644
--- a/fs/ubifs/sysfs.c
+++ b/fs/ubifs/sysfs.c
@@ -9,6 +9,7 @@
#include <linux/fs.h>
+#include <linux/kobject.h>
#include "ubifs.h"
enum attr_id_t {
diff --git a/fs/xfs/xfs_sysfs.h b/fs/xfs/xfs_sysfs.h
index 148893ebfdef..72a2d45be825 100644
--- a/fs/xfs/xfs_sysfs.h
+++ b/fs/xfs/xfs_sysfs.h
@@ -7,6 +7,8 @@
#ifndef __XFS_SYSFS_H__
#define __XFS_SYSFS_H__
+#include <linux/kobject.h>
+
extern const struct kobj_type xfs_mp_ktype; /* xfs_mount */
extern const struct kobj_type xfs_dbg_ktype; /* debug */
extern const struct kobj_type xfs_log_ktype; /* xlog */
diff --git a/include/linux/cdev.h b/include/linux/cdev.h
index 6f4892ff3a40..81f07bc82f3c 100644
--- a/include/linux/cdev.h
+++ b/include/linux/cdev.h
@@ -2,7 +2,7 @@
#ifndef _LINUX_CDEV_H
#define _LINUX_CDEV_H
-#include <linux/kobject.h>
+#include <linux/kobject_types.h>
#include <linux/kdev_t.h>
#include <linux/list.h>
diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h
index 25658fe36a9b..9f57e106b040 100644
--- a/include/linux/cpufreq.h
+++ b/include/linux/cpufreq.h
@@ -12,7 +12,7 @@
#include <linux/cpu.h>
#include <linux/cpumask.h>
#include <linux/completion.h>
-#include <linux/kobject.h>
+#include <linux/kobject_types.h>
#include <linux/notifier.h>
#include <linux/of.h>
#include <linux/pm_opp.h>
diff --git a/include/linux/device.h b/include/linux/device.h
index 235c780b5b65..3e221c132d89 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -15,7 +15,7 @@
#include <linux/dev_printk.h>
#include <linux/energy_model.h>
#include <linux/ioport.h>
-#include <linux/kobject.h>
+#include <linux/kobject_types.h>
#include <linux/klist.h>
#include <linux/list.h>
#include <linux/lockdep.h>
diff --git a/include/linux/irqdesc.h b/include/linux/irqdesc.h
index 1f2c9b81baae..ec5c41b36569 100644
--- a/include/linux/irqdesc.h
+++ b/include/linux/irqdesc.h
@@ -3,7 +3,7 @@
#define _LINUX_IRQDESC_H
#include <linux/rcupdate.h>
-#include <linux/kobject.h>
+#include <linux/kobject_types.h>
#include <linux/mutex_types.h>
/*
diff --git a/include/linux/kobject.h b/include/linux/kobject.h
index c120ea4addca..fc5c0fffc262 100644
--- a/include/linux/kobject.h
+++ b/include/linux/kobject.h
@@ -15,20 +15,16 @@
#ifndef _KOBJECT_H_
#define _KOBJECT_H_
+#include <linux/kobject_types.h>
#include <linux/types.h>
#include <linux/list.h>
#include <linux/sysfs.h>
#include <linux/compiler.h>
#include <linux/container_of.h>
#include <linux/spinlock_types.h>
-#include <linux/kref_types.h>
#include <linux/kobject_ns.h>
#include <linux/uidgid_types.h>
-#ifdef CONFIG_DEBUG_KOBJECT_RELEASE
-#include <linux/workqueue_types.h>
-#endif
-
#define UEVENT_HELPER_PATH_LEN 256
#define UEVENT_NUM_ENVP 64 /* number of env pointers */
#define UEVENT_BUFFER_SIZE 2048 /* buffer for the variables */
@@ -41,55 +37,9 @@ extern char uevent_helper[];
/* counter to tag the uevent, read only except for the kobject core */
extern u64 uevent_seqnum;
-/*
- * The actions here must match the index to the string array
- * in lib/kobject_uevent.c
- *
- * Do not add new actions here without checking with the driver-core
- * maintainers. Action strings are not meant to express subsystem
- * or device specific properties. In most cases you want to send a
- * kobject_uevent_env(kobj, KOBJ_CHANGE, env) with additional event
- * specific variables added to the event environment.
- */
-enum kobject_action {
- KOBJ_ADD,
- KOBJ_REMOVE,
- KOBJ_CHANGE,
- KOBJ_MOVE,
- KOBJ_ONLINE,
- KOBJ_OFFLINE,
- KOBJ_BIND,
- KOBJ_UNBIND,
-};
-
-struct kobject {
- const char *name;
- struct list_head entry;
- struct kobject *parent;
- struct kset *kset;
- const struct kobj_type *ktype;
- struct kernfs_node *sd; /* sysfs directory entry */
- struct kref kref;
-
- unsigned int state_initialized:1;
- unsigned int state_in_sysfs:1;
- unsigned int state_add_uevent_sent:1;
- unsigned int state_remove_uevent_sent:1;
- unsigned int uevent_suppress:1;
-
-#ifdef CONFIG_DEBUG_KOBJECT_RELEASE
- struct delayed_work release;
-#endif
-};
-
__printf(2, 3) int kobject_set_name(struct kobject *kobj, const char *name, ...);
__printf(2, 0) int kobject_set_name_vargs(struct kobject *kobj, const char *fmt, va_list vargs);
-static inline const char *kobject_name(const struct kobject *kobj)
-{
- return kobj->name;
-}
-
void kobject_init(struct kobject *kobj, const struct kobj_type *ktype);
__printf(3, 4) __must_check int kobject_add(struct kobject *kobj,
struct kobject *parent,
@@ -147,32 +97,6 @@ struct kobj_attribute {
extern const struct sysfs_ops kobj_sysfs_ops;
-struct sock;
-
-/**
- * struct kset - a set of kobjects of a specific type, belonging to a specific subsystem.
- *
- * A kset defines a group of kobjects. They can be individually
- * different "types" but overall these kobjects all want to be grouped
- * together and operated on in the same manner. ksets are used to
- * define the attribute callbacks and other common events that happen to
- * a kobject.
- *
- * @list: the list of all kobjects for this kset
- * @list_lock: a lock for iterating over the kobjects
- * @kobj: the embedded kobject for this kset (recursion, isn't it fun...)
- * @uevent_ops: the set of uevent operations for this kset. These are
- * called whenever a kobject has something happen to it so that the kset
- * can add new environment variables, or filter out the uevents if so
- * desired.
- */
-struct kset {
- struct list_head list;
- spinlock_t list_lock;
- struct kobject kobj;
- const struct kset_uevent_ops *uevent_ops;
-} __randomize_layout;
-
void kset_init(struct kset *kset);
int __must_check kset_register(struct kset *kset);
void kset_unregister(struct kset *kset);
diff --git a/include/linux/kobject_types.h b/include/linux/kobject_types.h
new file mode 100644
index 000000000000..b7a6b880354e
--- /dev/null
+++ b/include/linux/kobject_types.h
@@ -0,0 +1,84 @@
+// SPDX-License-Identifier: GPL-2.0
+
+#ifndef _KOBJECT_TYPES_H_
+#define _KOBJECT_TYPES_H_
+
+#include <linux/list.h>
+#include <linux/kref_types.h>
+#include <linux/spinlock_types.h>
+
+#ifdef CONFIG_DEBUG_KOBJECT_RELEASE
+#include <linux/workqueue.h>
+#endif
+
+/*
+ * The actions here must match the index to the string array
+ * in lib/kobject_uevent.c
+ *
+ * Do not add new actions here without checking with the driver-core
+ * maintainers. Action strings are not meant to express subsystem
+ * or device specific properties. In most cases you want to send a
+ * kobject_uevent_env(kobj, KOBJ_CHANGE, env) with additional event
+ * specific variables added to the event environment.
+ */
+enum kobject_action {
+ KOBJ_ADD,
+ KOBJ_REMOVE,
+ KOBJ_CHANGE,
+ KOBJ_MOVE,
+ KOBJ_ONLINE,
+ KOBJ_OFFLINE,
+ KOBJ_BIND,
+ KOBJ_UNBIND,
+};
+
+struct kobject {
+ const char *name;
+ struct list_head entry;
+ struct kobject *parent;
+ struct kset *kset;
+ const struct kobj_type *ktype;
+ struct kernfs_node *sd; /* sysfs directory entry */
+ struct kref kref;
+
+ unsigned int state_initialized:1;
+ unsigned int state_in_sysfs:1;
+ unsigned int state_add_uevent_sent:1;
+ unsigned int state_remove_uevent_sent:1;
+ unsigned int uevent_suppress:1;
+
+#ifdef CONFIG_DEBUG_KOBJECT_RELEASE
+ struct delayed_work release;
+#endif
+};
+
+static inline const char *kobject_name(const struct kobject *kobj)
+{
+ return kobj->name;
+}
+
+/**
+ * struct kset - a set of kobjects of a specific type, belonging to a specific subsystem.
+ *
+ * A kset defines a group of kobjects. They can be individually
+ * different "types" but overall these kobjects all want to be grouped
+ * together and operated on in the same manner. ksets are used to
+ * define the attribute callbacks and other common events that happen to
+ * a kobject.
+ *
+ * @list: the list of all kobjects for this kset
+ * @list_lock: a lock for iterating over the kobjects
+ * @kobj: the embedded kobject for this kset (recursion, isn't it fun...)
+ * @uevent_ops: the set of uevent operations for this kset. These are
+ * called whenever a kobject has something happen to it so that the kset
+ * can add new environment variables, or filter out the uevents if so
+ * desired.
+ */
+struct kset {
+ struct list_head list;
+ spinlock_t list_lock;
+ struct kobject kobj;
+ const struct kset_uevent_ops *uevent_ops;
+} __randomize_layout;
+
+#endif /* _KOBJECT_TYPES_H_ */
diff --git a/include/linux/module.h b/include/linux/module.h
index fd3c85e4d95f..426d3bdf83bb 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -18,7 +18,7 @@
#include <linux/init.h>
#include <linux/elf.h>
#include <linux/stringify.h>
-#include <linux/kobject.h>
+#include <linux/kobject_types.h>
#include <linux/moduleparam.h>
#include <linux/jump_label.h>
#include <linux/export.h>
diff --git a/include/linux/padata.h b/include/linux/padata.h
index d00a89e41518..2eeadb6b0bb3 100644
--- a/include/linux/padata.h
+++ b/include/linux/padata.h
@@ -17,7 +17,7 @@
#include <linux/workqueue_types.h>
#include <linux/spinlock_types.h>
#include <linux/list.h>
-#include <linux/kobject.h>
+#include <linux/kobject_types.h>
#define PADATA_CPU_SERIAL 0x01
#define PADATA_CPU_PARALLEL 0x02
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 7ab0d13672da..74330cc2b261 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -32,7 +32,7 @@
#include <linux/list.h>
#include <linux/compiler.h>
#include <linux/errno.h>
-#include <linux/kobject.h>
+#include <linux/kobject_types.h>
#include <linux/atomic.h>
#include <linux/device.h>
#include <linux/interrupt.h>
diff --git a/include/net/netdev_rx_queue.h b/include/net/netdev_rx_queue.h
index aa1716fb0e53..4841ec031857 100644
--- a/include/net/netdev_rx_queue.h
+++ b/include/net/netdev_rx_queue.h
@@ -2,7 +2,7 @@
#ifndef _LINUX_NETDEV_RX_QUEUE_H
#define _LINUX_NETDEV_RX_QUEUE_H
-#include <linux/kobject.h>
+#include <linux/kobject_types.h>
#include <linux/netdevice.h>
#include <linux/sysfs.h>
#include <net/xdp.h>
diff --git a/include/video/omapfb_dss.h b/include/video/omapfb_dss.h
index e8eaac2cb7b8..9c082ab4ed62 100644
--- a/include/video/omapfb_dss.h
+++ b/include/video/omapfb_dss.h
@@ -7,7 +7,7 @@
#define __OMAPFB_DSS_H
#include <linux/list.h>
-#include <linux/kobject.h>
+#include <linux/kobject_types.h>
#include <linux/device.h>
#include <linux/interrupt.h>
#include <linux/platform_data/omapdss.h>
diff --git a/init/initramfs.c b/init/initramfs.c
index 70cdefa0911b..5cbb6f6a7492 100644
--- a/init/initramfs.c
+++ b/init/initramfs.c
@@ -18,6 +18,7 @@
#include <linux/init_syscalls.h>
#include <linux/task_work.h>
#include <linux/umh.h>
+#include <linux/kobject.h> // for firmware_kobj
static __initdata bool csum_present;
static __initdata u32 io_csum;
diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c
index a66c088c851c..0b44e03df12f 100644
--- a/kernel/cgroup/cgroup.c
+++ b/kernel/cgroup/cgroup.c
@@ -35,6 +35,7 @@
#include <linux/errno.h>
#include <linux/init_task.h>
#include <linux/kernel.h>
+#include <linux/kobject.h>
#include <linux/magic.h>
#include <linux/mutex.h>
#include <linux/mount.h>
diff --git a/kernel/exit.c b/kernel/exit.c
index 9b4f638322b0..1f53c60fc7db 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -71,6 +71,8 @@
#include <linux/user_events.h>
#include <linux/uaccess.h>
#include <linux/hrtimer.h>
+#include <linux/sysfs.h>
+#include <linux/kobject.h>
#include <uapi/linux/wait.h>
diff --git a/kernel/module/main.c b/kernel/module/main.c
index a9a4a4885102..f8ae27b19012 100644
--- a/kernel/module/main.c
+++ b/kernel/module/main.c
@@ -18,6 +18,7 @@
#include <linux/fs.h>
#include <linux/kernel.h>
#include <linux/kernel_read_file.h>
+#include <linux/kobject.h>
#include <linux/kstrtox.h>
#include <linux/slab.h>
#include <linux/vmalloc.h>
diff --git a/kernel/module/sysfs.c b/kernel/module/sysfs.c
index d964167c6658..706aa34d3f50 100644
--- a/kernel/module/sysfs.c
+++ b/kernel/module/sysfs.c
@@ -7,6 +7,7 @@
#include <linux/module.h>
#include <linux/kernel.h>
+#include <linux/kobject.h>
#include <linux/fs.h>
#include <linux/sysfs.h>
#include <linux/slab.h>
diff --git a/kernel/padata.c b/kernel/padata.c
index 9d051ab75dad..409795156ff6 100644
--- a/kernel/padata.c
+++ b/kernel/padata.c
@@ -17,6 +17,7 @@
#include <linux/err.h>
#include <linux/cpu.h>
#include <linux/padata.h>
+#include <linux/kobject.h>
#include <linux/mutex.h>
#include <linux/sched.h>
#include <linux/slab.h>
diff --git a/kernel/panic.c b/kernel/panic.c
index 29b49d03b73e..730729561afb 100644
--- a/kernel/panic.c
+++ b/kernel/panic.c
@@ -23,6 +23,7 @@
#include <linux/reboot.h>
#include <linux/delay.h>
#include <linux/kexec.h>
+#include <linux/kobject.h>
#include <linux/panic_notifier.h>
#include <linux/sched.h>
#include <linux/string_helpers.h>
diff --git a/kernel/params.c b/kernel/params.c
index 2e447f8ae183..0153e4f0a5dc 100644
--- a/kernel/params.c
+++ b/kernel/params.c
@@ -8,6 +8,7 @@
#include <linux/err.h>
#include <linux/errno.h>
#include <linux/kernel.h>
+#include <linux/kobject.h>
#include <linux/kstrtox.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
diff --git a/kernel/reboot.c b/kernel/reboot.c
index ec96587c78cd..564a018c34f6 100644
--- a/kernel/reboot.c
+++ b/kernel/reboot.c
@@ -19,6 +19,7 @@
#include <linux/syscalls.h>
#include <linux/syscore_ops.h>
#include <linux/uaccess.h>
+#include <linux/kobject.h>
/*
* this indicates whether you can reboot with ctrl-alt-del: the default is yes
diff --git a/mm/damon/sysfs-common.c b/mm/damon/sysfs-common.c
index 9217de9eb813..b1610af8dd6c 100644
--- a/mm/damon/sysfs-common.c
+++ b/mm/damon/sysfs-common.c
@@ -5,6 +5,7 @@
* Author: SeongJae Park <[email protected]>
*/
+#include <linux/kobject.h>
#include <linux/slab.h>
#include <linux/sysfs.h>
diff --git a/mm/damon/sysfs-common.h b/mm/damon/sysfs-common.h
index 4c37a166eb81..75db8ca6ad64 100644
--- a/mm/damon/sysfs-common.h
+++ b/mm/damon/sysfs-common.h
@@ -6,7 +6,7 @@
*/
#include <linux/damon.h>
-#include <linux/kobject.h>
+#include <linux/kobject_types.h>
extern struct mutex damon_sysfs_lock;
diff --git a/mm/damon/sysfs-schemes.c b/mm/damon/sysfs-schemes.c
index 17dfd8cf7a36..8eb49e2f0baa 100644
--- a/mm/damon/sysfs-schemes.c
+++ b/mm/damon/sysfs-schemes.c
@@ -5,6 +5,7 @@
* Copyright (c) 2022 SeongJae Park <[email protected]>
*/
+#include <linux/kobject.h>
#include <linux/slab.h>
#include <linux/sysfs.h>
diff --git a/mm/damon/sysfs.c b/mm/damon/sysfs.c
index 05962d593810..bbc86b069592 100644
--- a/mm/damon/sysfs.c
+++ b/mm/damon/sysfs.c
@@ -5,6 +5,7 @@
* Copyright (c) 2022 SeongJae Park <[email protected]>
*/
+#include <linux/kobject.h>
#include <linux/pid.h>
#include <linux/sched.h>
#include <linux/slab.h>
diff --git a/mm/huge_memory.c b/mm/huge_memory.c
index 016e20bd813e..f524aef031dc 100644
--- a/mm/huge_memory.c
+++ b/mm/huge_memory.c
@@ -21,6 +21,7 @@
#include <linux/backing-dev.h>
#include <linux/dax.h>
#include <linux/khugepaged.h>
+#include <linux/kobject.h>
#include <linux/freezer.h>
#include <linux/pfn_t.h>
#include <linux/mman.h>
diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index 9d996fe4ecd9..77322e407219 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -36,6 +36,7 @@
#include <linux/memory.h>
#include <linux/mm_inline.h>
#include <linux/padata.h>
+#include <linux/kobject.h>
#include <asm/page.h>
#include <asm/pgalloc.h>
diff --git a/mm/khugepaged.c b/mm/khugepaged.c
index d61fcca99c02..84d1d9ab90fc 100644
--- a/mm/khugepaged.c
+++ b/mm/khugepaged.c
@@ -12,6 +12,7 @@
#include <linux/mm_inline.h>
#include <linux/kthread.h>
#include <linux/khugepaged.h>
+#include <linux/kobject.h>
#include <linux/freezer.h>
#include <linux/mman.h>
#include <linux/hashtable.h>
diff --git a/mm/mempolicy.c b/mm/mempolicy.c
index 2bfa7f1dd9a3..3888a7ff0f78 100644
--- a/mm/mempolicy.c
+++ b/mm/mempolicy.c
@@ -110,6 +110,7 @@
#include <linux/mmu_notifier.h>
#include <linux/printk.h>
#include <linux/swapops.h>
+#include <linux/kobject.h>
#include <asm/tlbflush.h>
#include <asm/tlb.h>
diff --git a/mm/shmem.c b/mm/shmem.c
index d7c84ff62186..ee634869fad0 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -24,6 +24,7 @@
#include <linux/fs.h>
#include <linux/init.h>
#include <linux/vfs.h>
+#include <linux/kobject.h>
#include <linux/mount.h>
#include <linux/ramfs.h>
#include <linux/pagemap.h>
diff --git a/mm/swap_state.c b/mm/swap_state.c
index e671266ad772..637144196f61 100644
--- a/mm/swap_state.c
+++ b/mm/swap_state.c
@@ -10,6 +10,7 @@
#include <linux/mm.h>
#include <linux/gfp.h>
#include <linux/kernel_stat.h>
+#include <linux/kobject.h>
#include <linux/mempolicy.h>
#include <linux/swap.h>
#include <linux/swapops.h>
diff --git a/mm/vmscan.c b/mm/vmscan.c
index 895f03e2d932..c3d9ee010123 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -17,6 +17,7 @@
#include <linux/module.h>
#include <linux/gfp.h>
#include <linux/kernel_stat.h>
+#include <linux/kobject.h>
#include <linux/swap.h>
#include <linux/pagemap.h>
#include <linux/init.h>
diff --git a/net/9p/trans_virtio.c b/net/9p/trans_virtio.c
index e305071eb7b8..d8f119b4a122 100644
--- a/net/9p/trans_virtio.c
+++ b/net/9p/trans_virtio.c
@@ -19,6 +19,7 @@
#include <linux/ipv6.h>
#include <linux/errno.h>
#include <linux/kernel.h>
+#include <linux/kobject.h>
#include <linux/un.h>
#include <linux/uaccess.h>
#include <linux/inet.h>
diff --git a/net/bridge/br_sysfs_br.c b/net/bridge/br_sysfs_br.c
index ea733542244c..06d35083f67d 100644
--- a/net/bridge/br_sysfs_br.c
+++ b/net/bridge/br_sysfs_br.c
@@ -9,6 +9,7 @@
#include <linux/capability.h>
#include <linux/kernel.h>
+#include <linux/kobject.h>
#include <linux/netdevice.h>
#include <linux/etherdevice.h>
#include <linux/if_bridge.h>
diff --git a/net/rfkill/core.c b/net/rfkill/core.c
index c3feb4f49d09..406aafcf7237 100644
--- a/net/rfkill/core.c
+++ b/net/rfkill/core.c
@@ -6,6 +6,7 @@
*/
#include <linux/kernel.h>
+#include <linux/kobject.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/workqueue.h>
diff --git a/net/wireless/reg.c b/net/wireless/reg.c
index 2741b626919a..76746e04bdcf 100644
--- a/net/wireless/reg.c
+++ b/net/wireless/reg.c
@@ -55,6 +55,7 @@
#include <linux/nl80211.h>
#include <linux/platform_device.h>
#include <linux/verification.h>
+#include <linux/kobject.h>
#include <linux/moduleparam.h>
#include <linux/firmware.h>
#include <net/cfg80211.h>
diff --git a/sound/core/init.c b/sound/core/init.c
index 22c0d217b860..804dd1f9ab5a 100644
--- a/sound/core/init.c
+++ b/sound/core/init.c
@@ -16,6 +16,7 @@
#include <linux/debugfs.h>
#include <linux/completion.h>
#include <linux/interrupt.h>
+#include <linux/kobject.h>
#include <sound/core.h>
#include <sound/control.h>
diff --git a/sound/hda/hda_bus_type.c b/sound/hda/hda_bus_type.c
index cce2c30511a2..cece361bf8e7 100644
--- a/sound/hda/hda_bus_type.c
+++ b/sound/hda/hda_bus_type.c
@@ -4,6 +4,7 @@
*/
#include <linux/init.h>
#include <linux/device.h>
+#include <linux/kobject.h>
#include <linux/module.h>
#include <linux/mod_devicetable.h>
#include <linux/export.h>
diff --git a/sound/hda/hdac_sysfs.c b/sound/hda/hdac_sysfs.c
index 60b0a70428d5..728ba0c1bf56 100644
--- a/sound/hda/hdac_sysfs.c
+++ b/sound/hda/hdac_sysfs.c
@@ -6,6 +6,7 @@
#include <linux/slab.h>
#include <linux/sysfs.h>
#include <linux/device.h>
+#include <linux/kobject.h>
#include <sound/core.h>
#include <sound/hdaudio.h>
#include "local.h"
--
2.39.2
These headers are lighter because they only contain declarations and
do not include many other headers.
Signed-off-by: Max Kellermann <[email protected]>
---
fs/fs_struct.c | 1 +
include/clocksource/samsung_pwm.h | 2 +-
include/crypto/algapi.h | 2 +-
include/crypto/drbg.h | 2 +-
include/crypto/internal/geniv.h | 2 +-
include/drm/drm_bridge.h | 2 +-
include/drm/drm_client.h | 2 +-
include/drm/drm_crtc.h | 2 +-
include/drm/drm_device.h | 2 +-
include/drm/drm_flip_work.h | 4 ++--
include/drm/drm_gem.h | 2 +-
include/drm/drm_gpuvm.h | 2 +-
include/drm/drm_managed.h | 2 +-
include/drm/drm_mipi_dbi.h | 2 +-
include/drm/drm_mm.h | 2 +-
include/drm/drm_mode_config.h | 4 ++--
include/drm/drm_panel.h | 2 +-
include/drm/drm_prime.h | 4 ++--
include/drm/drm_privacy_screen_driver.h | 2 +-
include/drm/drm_vblank.h | 2 +-
include/drm/drm_writeback.h | 2 +-
include/drm/gpu_scheduler.h | 2 +-
include/drm/i915_hdcp_interface.h | 2 +-
include/drm/i915_pxp_tee_interface.h | 2 +-
include/drm/ttm/ttm_pool.h | 2 +-
include/kunit/test.h | 2 +-
include/kvm/arm_arch_timer.h | 2 +-
include/kvm/arm_vgic.h | 4 ++--
include/linux/acpi.h | 2 +-
include/linux/agpgart.h | 2 +-
include/linux/alarmtimer.h | 2 +-
include/linux/backing-dev-defs.h | 8 ++++----
include/linux/badblocks.h | 2 +-
include/linux/balloon_compaction.h | 2 +-
include/linux/bcm47xx_wdt.h | 2 +-
include/linux/blk-crypto.h | 2 +-
include/linux/blk-mq.h | 2 +-
include/linux/blkdev.h | 6 +++---
include/linux/bpf-cgroup-defs.h | 2 +-
include/linux/bpf-cgroup.h | 2 +-
include/linux/bpf.h | 4 ++--
include/linux/bpf_mem_alloc.h | 2 +-
include/linux/bsg-lib.h | 2 +-
include/linux/capability.h | 2 +-
include/linux/cb710.h | 2 +-
include/linux/ccp.h | 2 +-
include/linux/ceph/libceph.h | 2 +-
include/linux/ceph/messenger.h | 4 ++--
include/linux/ceph/mon_client.h | 2 +-
include/linux/ceph/osd_client.h | 4 ++--
include/linux/ceph/osdmap.h | 2 +-
include/linux/ceph/pagelist.h | 2 +-
include/linux/ceph/string_table.h | 2 +-
include/linux/cgroup-defs.h | 4 ++--
include/linux/clk/zynq.h | 2 +-
include/linux/comedi/comedidev.h | 2 +-
include/linux/configfs.h | 2 +-
include/linux/connector.h | 2 +-
include/linux/console_struct.h | 2 +-
include/linux/counter.h | 2 +-
include/linux/cpu_rmap.h | 2 +-
include/linux/cpufreq.h | 2 +-
include/linux/cpuset.h | 2 +-
include/linux/cred.h | 2 +-
include/linux/crush/crush.h | 2 +-
include/linux/crypto.h | 2 +-
include/linux/damon.h | 2 +-
include/linux/dcache.h | 2 +-
include/linux/dev_printk.h | 2 +-
include/linux/device-mapper.h | 1 -
include/linux/device.h | 4 ++--
include/linux/dim.h | 2 +-
include/linux/dm-bufio.h | 2 +-
include/linux/edac.h | 2 +-
include/linux/fault-inject.h | 2 +-
include/linux/fb.h | 4 ++--
include/linux/fdtable.h | 2 +-
include/linux/firewire.h | 8 ++++----
include/linux/firmware.h | 2 +-
include/linux/flex_proportions.h | 6 +++---
include/linux/fpga/fpga-mgr.h | 2 +-
include/linux/framer/framer.h | 4 ++--
include/linux/fs.h | 8 ++++----
include/linux/fs_context.h | 4 ++--
include/linux/fs_struct.h | 2 +-
include/linux/fsl/bestcomm/bestcomm_priv.h | 2 +-
include/linux/fsl/bestcomm/sram.h | 2 +-
include/linux/gameport.h | 2 +-
include/linux/gfp_api.h | 2 +-
include/linux/gnss.h | 2 +-
include/linux/gpio/driver.h | 2 +-
include/linux/greybus/operation.h | 4 ++--
include/linux/hid.h | 5 ++---
include/linux/hp_sdc.h | 2 +-
include/linux/hrtimer.h | 4 ++--
include/linux/hsi/hsi.h | 2 +-
include/linux/hugetlb.h | 2 +-
include/linux/i2c.h | 2 +-
include/linux/i3c/master.h | 2 +-
include/linux/i8253.h | 2 +-
include/linux/idr.h | 2 +-
include/linux/if_eql.h | 4 ++--
include/linux/if_pppox.h | 2 +-
include/linux/igmp.h | 4 ++--
include/linux/iio/buffer-dma.h | 4 ++--
include/linux/inetdevice.h | 2 +-
include/linux/input.h | 2 +-
include/linux/interrupt.h | 2 +-
include/linux/interval_tree.h | 3 ++-
include/linux/iocontext.h | 2 +-
include/linux/iomap.h | 2 +-
include/linux/iova.h | 2 +-
include/linux/ipc.h | 4 ++--
include/linux/irqdesc.h | 2 +-
include/linux/irqdomain.h | 2 +-
include/linux/jbd2.h | 4 ++--
include/linux/journal-head.h | 2 +-
include/linux/kernfs.h | 4 ++--
include/linux/key.h | 5 +++--
include/linux/klist.h | 2 +-
include/linux/kmod.h | 2 +-
include/linux/kmsan.h | 2 +-
include/linux/kobject.h | 4 ++--
include/linux/kprobes.h | 2 +-
include/linux/kref.h | 1 -
include/linux/kvm_host.h | 4 ++--
include/linux/kvm_types.h | 2 +-
include/linux/leds-pca9532.h | 2 +-
include/linux/leds.h | 6 +++---
include/linux/libata.h | 2 +-
include/linux/libnvdimm.h | 2 +-
include/linux/libps2.h | 2 +-
include/linux/lockd/lockd.h | 2 +-
include/linux/lockref.h | 2 +-
include/linux/lp.h | 2 +-
include/linux/mISDNhw.h | 2 +-
include/linux/mailbox_controller.h | 2 +-
include/linux/mc146818rtc.h | 2 +-
include/linux/mdio/mdio-xgene.h | 2 +-
include/linux/memory-tiers.h | 2 +-
include/linux/memory.h | 2 +-
include/linux/mempolicy.h | 4 ++--
include/linux/memstick.h | 2 +-
include/linux/mfd/abx500/ab8500.h | 2 +-
include/linux/mfd/cs42l43.h | 4 ++--
include/linux/mfd/ipaq-micro.h | 2 +-
include/linux/mfd/lochnagar.h | 2 +-
include/linux/mfd/madera/core.h | 2 +-
include/linux/mfd/max8907.h | 2 +-
include/linux/mfd/mt6397/core.h | 2 +-
include/linux/mfd/mt6397/rtc.h | 2 +-
include/linux/mfd/pcf50633/core.h | 3 +--
include/linux/mfd/rc5t583.h | 2 +-
include/linux/mfd/stmpe.h | 2 +-
include/linux/mfd/ucb1x00.h | 2 +-
include/linux/mfd/wm8350/core.h | 2 +-
include/linux/mhi.h | 6 +++---
include/linux/mlx5/driver.h | 6 +++---
include/linux/mm.h | 2 +-
include/linux/mm_types.h | 8 ++++----
include/linux/mmzone.h | 7 +++++--
include/linux/moxtet.h | 2 +-
include/linux/mroute_base.h | 2 +-
include/linux/msi.h | 2 +-
include/linux/mtd/blktrans.h | 2 +-
include/linux/mtd/doc2000.h | 2 +-
include/linux/mtd/flashchip.h | 2 +-
include/linux/mtd/onenand.h | 2 +-
include/linux/mtd/spinand.h | 2 +-
include/linux/mutex.h | 2 +-
include/linux/netdevice.h | 4 ++--
include/linux/netfs.h | 2 +-
include/linux/netpoll.h | 2 +-
include/linux/nfs4.h | 2 +-
include/linux/nfs_fs.h | 4 ++--
include/linux/nfs_fs_sb.h | 2 +-
include/linux/ns_common.h | 2 +-
include/linux/objpool.h | 2 +-
include/linux/oom.h | 2 +-
include/linux/padata.h | 6 +++---
include/linux/pagemap.h | 2 +-
include/linux/parport.h | 2 +-
include/linux/part_stat.h | 2 +-
include/linux/peci.h | 2 +-
include/linux/percpu-refcount.h | 2 +-
include/linux/percpu_counter.h | 2 +-
include/linux/perf_event.h | 10 +++++-----
include/linux/phy.h | 4 ++--
include/linux/pktcdvd.h | 2 +-
include/linux/platform_data/cros_ec_proto.h | 2 +-
include/linux/platform_data/cros_ec_sensorhub.h | 2 +-
include/linux/platform_data/wilco-ec.h | 2 +-
include/linux/platform_data/xilinx-ll-temac.h | 2 +-
include/linux/pm.h | 6 +++---
include/linux/pm_domain.h | 4 ++--
include/linux/posix-timers.h | 2 +-
include/linux/power_supply.h | 4 ++--
include/linux/pruss_driver.h | 2 +-
include/linux/psi_types.h | 2 +-
include/linux/pstore.h | 4 ++--
include/linux/qed/qede_rdma.h | 2 +-
include/linux/quota.h | 6 +++---
include/linux/radix-tree.h | 1 -
include/linux/raid/pq.h | 2 +-
include/linux/regmap.h | 2 +-
include/linux/remoteproc.h | 2 +-
include/linux/resctrl.h | 5 ++++-
include/linux/reset/reset-simple.h | 2 +-
include/linux/rhashtable-types.h | 2 +-
include/linux/rpmsg.h | 2 +-
include/linux/rslib.h | 2 +-
include/linux/rtc.h | 2 +-
include/linux/sched/signal.h | 2 +-
include/linux/sched/user.h | 4 ++--
include/linux/scs.h | 2 +-
include/linux/seq_file.h | 2 +-
include/linux/serial_core.h | 1 -
include/linux/serio.h | 2 +-
include/linux/slab.h | 2 +-
include/linux/soc/qcom/apr.h | 2 +-
include/linux/soc/qcom/qmi.h | 2 +-
include/linux/ssb/ssb.h | 2 +-
include/linux/ssb/ssb_driver_gige.h | 2 +-
include/linux/stackdepot.h | 2 +-
include/linux/stat.h | 2 +-
include/linux/sunrpc/auth_gss.h | 2 +-
include/linux/sunrpc/clnt.h | 2 +-
include/linux/sunrpc/metrics.h | 2 +-
include/linux/sunrpc/sched.h | 4 ++--
include/linux/sunrpc/types.h | 4 ++--
include/linux/swait.h | 2 +-
include/linux/swap.h | 2 +-
include/linux/swap_slots.h | 4 ++--
include/linux/swiotlb.h | 4 ++--
include/linux/sysctl.h | 4 ++--
include/linux/sysfs.h | 2 +-
include/linux/thermal.h | 2 +-
include/linux/thunderbolt.h | 2 +-
include/linux/tifm.h | 4 ++--
include/linux/tty.h | 4 ++--
include/linux/tty_buffer.h | 4 ++--
include/linux/tty_ldisc.h | 2 +-
include/linux/tty_port.h | 2 +-
include/linux/umh.h | 4 ++--
include/linux/usb.h | 2 +-
include/linux/usb/gadget.h | 2 +-
include/linux/usb/ljca.h | 2 +-
include/linux/usb/otg-fsm.h | 2 +-
include/linux/usb/serial.h | 2 +-
include/linux/user_namespace.h | 2 +-
include/linux/vfio.h | 2 +-
include/linux/vfio_pci_core.h | 2 +-
include/linux/via-core.h | 2 +-
include/linux/virtio.h | 4 ++--
include/linux/vmalloc.h | 2 +-
include/linux/vmpressure.h | 6 +++---
include/linux/vmw_vmci_api.h | 2 +-
include/linux/xarray.h | 2 +-
include/media/dmxdev.h | 6 +++---
include/media/drv-intf/saa7146.h | 2 +-
include/media/dvb_demux.h | 4 ++--
include/media/dvb_frontend.h | 2 +-
include/media/dvb_ringbuffer.h | 2 +-
include/media/dvb_vb2.h | 2 +-
include/media/i2c/adp1653.h | 2 +-
include/media/media-device.h | 2 +-
include/media/rc-core.h | 2 +-
include/media/v4l2-dev.h | 2 +-
include/media/videobuf2-core.h | 2 +-
include/net/af_unix.h | 4 ++--
include/net/af_vsock.h | 2 +-
include/net/atmclip.h | 2 +-
include/net/ax25.h | 4 ++--
include/net/cfg802154.h | 2 +-
include/net/devlink.h | 8 ++++----
include/net/dst.h | 2 +-
include/net/flow.h | 2 +-
include/net/fq.h | 2 +-
include/net/hwbm.h | 2 +-
include/net/inet_connection_sock.h | 2 +-
include/net/inet_hashtables.h | 2 +-
include/net/inet_timewait_sock.h | 2 +-
include/net/ip6_fib.h | 2 +-
include/net/ip_vs.h | 6 +++---
include/net/lib80211.h | 2 +-
include/net/llc.h | 2 +-
include/net/llc_conn.h | 2 +-
include/net/neighbour.h | 2 +-
include/net/netfilter/nf_conntrack_count.h | 2 +-
include/net/netns/can.h | 4 ++--
include/net/netns/conntrack.h | 1 -
include/net/netns/ipv4.h | 4 ++--
include/net/netns/mctp.h | 2 +-
include/net/netns/nexthop.h | 2 +-
include/net/netns/packet.h | 2 +-
include/net/netns/sctp.h | 2 +-
include/net/netns/smc.h | 2 +-
include/net/netns/unix.h | 2 +-
include/net/netns/xdp.h | 2 +-
include/net/netns/xfrm.h | 2 +-
include/net/phonet/pn_dev.h | 2 +-
include/net/sch_generic.h | 2 +-
include/net/sctp/sctp.h | 2 +-
include/net/sctp/structs.h | 2 +-
include/net/smc.h | 2 +-
include/net/sock.h | 4 ++--
include/net/sock_reuseport.h | 2 +-
include/net/tls.h | 2 +-
include/net/xdp_sock.h | 6 +++---
include/net/xfrm.h | 2 +-
include/pcmcia/ss.h | 2 +-
include/rdma/ib_verbs.h | 2 +-
include/rdma/rdma_counter.h | 2 +-
include/rdma/rdma_vt.h | 2 +-
include/scsi/libfc.h | 2 +-
include/scsi/libfcoe.h | 2 +-
include/scsi/libiscsi.h | 6 +++---
include/scsi/libsas.h | 2 +-
include/scsi/scsi_cmnd.h | 2 +-
include/scsi/scsi_device.h | 4 ++--
include/scsi/scsi_host.h | 4 ++--
include/scsi/scsi_tcq.h | 2 +-
include/scsi/scsi_transport.h | 2 +-
include/scsi/scsi_transport_iscsi.h | 2 +-
include/scsi/scsi_transport_sas.h | 2 +-
include/scsi/scsi_transport_spi.h | 2 +-
include/scsi/scsi_transport_srp.h | 2 +-
include/soc/fsl/qe/qe.h | 2 +-
include/sound/ac97_codec.h | 2 +-
include/sound/core.h | 2 +-
include/sound/emu10k1.h | 2 +-
include/sound/rawmidi.h | 6 +++---
include/sound/util_mem.h | 2 +-
include/target/iscsi/iscsi_target_stat.h | 2 +-
include/trace/events/block.h | 2 +-
include/trace/events/kyber.h | 2 +-
include/trace/events/lock.h | 2 +-
include/trace/events/mmc.h | 2 +-
include/trace/events/workqueue.h | 2 +-
339 files changed, 441 insertions(+), 439 deletions(-)
diff --git a/fs/fs_struct.c b/fs/fs_struct.c
index 64c2d0814ed6..42f5072413c0 100644
--- a/fs/fs_struct.c
+++ b/fs/fs_struct.c
@@ -4,6 +4,7 @@
#include <linux/sched/task.h>
#include <linux/fs.h>
#include <linux/path.h>
+#include <linux/seqlock.h>
#include <linux/slab.h>
#include <linux/fs_struct.h>
#include "internal.h"
diff --git a/include/clocksource/samsung_pwm.h b/include/clocksource/samsung_pwm.h
index 9b435caa95fe..a33c84f9bf32 100644
--- a/include/clocksource/samsung_pwm.h
+++ b/include/clocksource/samsung_pwm.h
@@ -5,7 +5,7 @@
#ifndef __CLOCKSOURCE_SAMSUNG_PWM_H
#define __CLOCKSOURCE_SAMSUNG_PWM_H
-#include <linux/spinlock.h>
+#include <linux/spinlock_types.h>
#define SAMSUNG_PWM_NUM 5
diff --git a/include/crypto/algapi.h b/include/crypto/algapi.h
index 7a4a71af653f..6898af8cf182 100644
--- a/include/crypto/algapi.h
+++ b/include/crypto/algapi.h
@@ -12,7 +12,7 @@
#include <linux/cache.h>
#include <linux/crypto.h>
#include <linux/types.h>
-#include <linux/workqueue.h>
+#include <linux/workqueue_types.h>
/*
* Maximum values for blocksize and alignmask, used to allocate
diff --git a/include/crypto/drbg.h b/include/crypto/drbg.h
index e78a671a9e76..35dd65e37c8d 100644
--- a/include/crypto/drbg.h
+++ b/include/crypto/drbg.h
@@ -50,7 +50,7 @@
#include <crypto/internal/rng.h>
#include <crypto/rng.h>
#include <linux/fips.h>
-#include <linux/mutex.h>
+#include <linux/mutex_types.h>
#include <linux/list.h>
/*
diff --git a/include/crypto/internal/geniv.h b/include/crypto/internal/geniv.h
index 7fd7126f593a..3228b4a34c52 100644
--- a/include/crypto/internal/geniv.h
+++ b/include/crypto/internal/geniv.h
@@ -9,7 +9,7 @@
#define _CRYPTO_INTERNAL_GENIV_H
#include <crypto/internal/aead.h>
-#include <linux/spinlock.h>
+#include <linux/spinlock_types.h>
#include <linux/types.h>
struct aead_geniv_ctx {
diff --git a/include/drm/drm_bridge.h b/include/drm/drm_bridge.h
index e39da5807ba7..a853bfbf5d94 100644
--- a/include/drm/drm_bridge.h
+++ b/include/drm/drm_bridge.h
@@ -25,7 +25,7 @@
#include <linux/ctype.h>
#include <linux/list.h>
-#include <linux/mutex.h>
+#include <linux/mutex_types.h>
#include <drm/drm_atomic.h>
#include <drm/drm_encoder.h>
diff --git a/include/drm/drm_client.h b/include/drm/drm_client.h
index d47458ecdac4..2af71d481957 100644
--- a/include/drm/drm_client.h
+++ b/include/drm/drm_client.h
@@ -5,7 +5,7 @@
#include <linux/iosys-map.h>
#include <linux/lockdep.h>
-#include <linux/mutex.h>
+#include <linux/mutex_types.h>
#include <linux/types.h>
#include <drm/drm_connector.h>
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index 8b48a1974da3..a73d94b1c2fd 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -25,7 +25,7 @@
#ifndef __DRM_CRTC_H__
#define __DRM_CRTC_H__
-#include <linux/spinlock.h>
+#include <linux/spinlock_types.h>
#include <linux/types.h>
#include <drm/drm_modeset_lock.h>
#include <drm/drm_mode_object.h>
diff --git a/include/drm/drm_device.h b/include/drm/drm_device.h
index 63767cf24371..6a1bbdd515cd 100644
--- a/include/drm/drm_device.h
+++ b/include/drm/drm_device.h
@@ -3,7 +3,7 @@
#include <linux/list.h>
#include <linux/kref.h>
-#include <linux/mutex.h>
+#include <linux/mutex_types.h>
#include <linux/idr.h>
#include <drm/drm_mode_config.h>
diff --git a/include/drm/drm_flip_work.h b/include/drm/drm_flip_work.h
index 1eef3283a109..380720e0963e 100644
--- a/include/drm/drm_flip_work.h
+++ b/include/drm/drm_flip_work.h
@@ -25,8 +25,8 @@
#define DRM_FLIP_WORK_H
#include <linux/kfifo.h>
-#include <linux/spinlock.h>
-#include <linux/workqueue.h>
+#include <linux/spinlock_types.h>
+#include <linux/workqueue_types.h>
/**
* DOC: flip utils
diff --git a/include/drm/drm_gem.h b/include/drm/drm_gem.h
index 369505447acd..e2257ca92bec 100644
--- a/include/drm/drm_gem.h
+++ b/include/drm/drm_gem.h
@@ -37,7 +37,7 @@
#include <linux/kref.h>
#include <linux/dma-resv.h>
#include <linux/list.h>
-#include <linux/mutex.h>
+#include <linux/mutex_types.h>
#include <drm/drm_vma_manager.h>
diff --git a/include/drm/drm_gpuvm.h b/include/drm/drm_gpuvm.h
index 9060f9fae6f1..1fb6e2dfbc65 100644
--- a/include/drm/drm_gpuvm.h
+++ b/include/drm/drm_gpuvm.h
@@ -27,7 +27,7 @@
#include <linux/dma-resv.h>
#include <linux/list.h>
-#include <linux/rbtree.h>
+#include <linux/rbtree_types.h>
#include <linux/types.h>
#include <drm/drm_device.h>
diff --git a/include/drm/drm_managed.h b/include/drm/drm_managed.h
index ad08f834af40..3b96f8103827 100644
--- a/include/drm/drm_managed.h
+++ b/include/drm/drm_managed.h
@@ -3,7 +3,7 @@
#ifndef _DRM_MANAGED_H_
#define _DRM_MANAGED_H_
-#include <linux/gfp.h>
+#include <linux/gfp_types.h>
#include <linux/overflow.h>
#include <linux/types.h>
diff --git a/include/drm/drm_mipi_dbi.h b/include/drm/drm_mipi_dbi.h
index e8e0f8d39f3a..4cbc82e23320 100644
--- a/include/drm/drm_mipi_dbi.h
+++ b/include/drm/drm_mipi_dbi.h
@@ -8,7 +8,7 @@
#ifndef __LINUX_MIPI_DBI_H
#define __LINUX_MIPI_DBI_H
-#include <linux/mutex.h>
+#include <linux/mutex_types.h>
#include <drm/drm_device.h>
#include <drm/drm_simple_kms_helper.h>
diff --git a/include/drm/drm_mm.h b/include/drm/drm_mm.h
index abc1d1d48142..963656c94507 100644
--- a/include/drm/drm_mm.h
+++ b/include/drm/drm_mm.h
@@ -38,7 +38,7 @@
* Generic range manager structs
*/
#include <linux/bug.h>
-#include <linux/rbtree.h>
+#include <linux/rbtree_types.h>
#include <linux/limits.h>
#include <linux/mm_types.h>
#include <linux/list.h>
diff --git a/include/drm/drm_mode_config.h b/include/drm/drm_mode_config.h
index 973119a9176b..526c57657fb6 100644
--- a/include/drm/drm_mode_config.h
+++ b/include/drm/drm_mode_config.h
@@ -23,10 +23,10 @@
#ifndef __DRM_MODE_CONFIG_H__
#define __DRM_MODE_CONFIG_H__
-#include <linux/mutex.h>
+#include <linux/mutex_types.h>
#include <linux/types.h>
#include <linux/idr.h>
-#include <linux/workqueue.h>
+#include <linux/workqueue_types.h>
#include <linux/llist.h>
#include <drm/drm_modeset_lock.h>
diff --git a/include/drm/drm_panel.h b/include/drm/drm_panel.h
index 10015891b056..23d3b88a50e3 100644
--- a/include/drm/drm_panel.h
+++ b/include/drm/drm_panel.h
@@ -27,7 +27,7 @@
#include <linux/err.h>
#include <linux/errno.h>
#include <linux/list.h>
-#include <linux/mutex.h>
+#include <linux/mutex_types.h>
struct backlight_device;
struct dentry;
diff --git a/include/drm/drm_prime.h b/include/drm/drm_prime.h
index 2a1d01e5b56b..057491baf262 100644
--- a/include/drm/drm_prime.h
+++ b/include/drm/drm_prime.h
@@ -32,8 +32,8 @@
#ifndef __DRM_PRIME_H__
#define __DRM_PRIME_H__
-#include <linux/mutex.h>
-#include <linux/rbtree.h>
+#include <linux/mutex_types.h>
+#include <linux/rbtree_types.h>
#include <linux/scatterlist.h>
/**
diff --git a/include/drm/drm_privacy_screen_driver.h b/include/drm/drm_privacy_screen_driver.h
index 4ef246d5706f..88097a1d7b99 100644
--- a/include/drm/drm_privacy_screen_driver.h
+++ b/include/drm/drm_privacy_screen_driver.h
@@ -11,7 +11,7 @@
#include <linux/device.h>
#include <linux/list.h>
-#include <linux/mutex.h>
+#include <linux/mutex_types.h>
#include <drm/drm_connector.h>
struct drm_privacy_screen;
diff --git a/include/drm/drm_vblank.h b/include/drm/drm_vblank.h
index 7f3957943dd1..1a031507c128 100644
--- a/include/drm/drm_vblank.h
+++ b/include/drm/drm_vblank.h
@@ -24,7 +24,7 @@
#ifndef _DRM_VBLANK_H_
#define _DRM_VBLANK_H_
-#include <linux/seqlock.h>
+#include <linux/seqlock_types.h>
#include <linux/idr.h>
#include <linux/poll.h>
#include <linux/kthread.h>
diff --git a/include/drm/drm_writeback.h b/include/drm/drm_writeback.h
index 17e576c80169..826b348e2c95 100644
--- a/include/drm/drm_writeback.h
+++ b/include/drm/drm_writeback.h
@@ -13,7 +13,7 @@
#define __DRM_WRITEBACK_H__
#include <drm/drm_connector.h>
#include <drm/drm_encoder.h>
-#include <linux/workqueue.h>
+#include <linux/workqueue_types.h>
/**
* struct drm_writeback_connector - DRM writeback connector
diff --git a/include/drm/gpu_scheduler.h b/include/drm/gpu_scheduler.h
index 4c598cfc2af3..4edd7ac64b62 100644
--- a/include/drm/gpu_scheduler.h
+++ b/include/drm/gpu_scheduler.h
@@ -29,7 +29,7 @@
#include <linux/completion.h>
#include <linux/xarray.h>
#include <linux/wait.h>
-#include <linux/workqueue.h>
+#include <linux/workqueue_types.h>
#define MAX_WAIT_SCHED_ENTITY_Q_EMPTY msecs_to_jiffies(1000)
diff --git a/include/drm/i915_hdcp_interface.h b/include/drm/i915_hdcp_interface.h
index 4c9c8167c2d5..a8237d271ad8 100644
--- a/include/drm/i915_hdcp_interface.h
+++ b/include/drm/i915_hdcp_interface.h
@@ -9,7 +9,7 @@
#ifndef _I915_HDCP_INTERFACE_H_
#define _I915_HDCP_INTERFACE_H_
-#include <linux/mutex.h>
+#include <linux/mutex_types.h>
#include <linux/device.h>
#include <drm/display/drm_hdcp.h>
diff --git a/include/drm/i915_pxp_tee_interface.h b/include/drm/i915_pxp_tee_interface.h
index 7d96985f2d05..4639d9fba19a 100644
--- a/include/drm/i915_pxp_tee_interface.h
+++ b/include/drm/i915_pxp_tee_interface.h
@@ -6,7 +6,7 @@
#ifndef _I915_PXP_TEE_INTERFACE_H_
#define _I915_PXP_TEE_INTERFACE_H_
-#include <linux/mutex.h>
+#include <linux/mutex_types.h>
#include <linux/device.h>
struct scatterlist;
diff --git a/include/drm/ttm/ttm_pool.h b/include/drm/ttm/ttm_pool.h
index 4490d43c63e3..b5038049062a 100644
--- a/include/drm/ttm/ttm_pool.h
+++ b/include/drm/ttm/ttm_pool.h
@@ -28,7 +28,7 @@
#include <linux/mmzone.h>
#include <linux/llist.h>
-#include <linux/spinlock.h>
+#include <linux/spinlock_types.h>
#include <drm/ttm/ttm_caching.h>
struct device;
diff --git a/include/kunit/test.h b/include/kunit/test.h
index febd48635ab1..26b2e4cfafa1 100644
--- a/include/kunit/test.h
+++ b/include/kunit/test.h
@@ -22,7 +22,7 @@
#include <linux/list.h>
#include <linux/module.h>
#include <linux/slab.h>
-#include <linux/spinlock.h>
+#include <linux/spinlock_types.h>
#include <linux/string.h>
#include <linux/types.h>
diff --git a/include/kvm/arm_arch_timer.h b/include/kvm/arm_arch_timer.h
index c819c5d16613..c271865175b0 100644
--- a/include/kvm/arm_arch_timer.h
+++ b/include/kvm/arm_arch_timer.h
@@ -8,7 +8,7 @@
#define __ASM_ARM_KVM_ARCH_TIMER_H
#include <linux/clocksource.h>
-#include <linux/hrtimer.h>
+#include <linux/hrtimer_types.h>
enum kvm_arch_timers {
TIMER_PTIMER,
diff --git a/include/kvm/arm_vgic.h b/include/kvm/arm_vgic.h
index 8cc38e836f54..c1c4a6266b58 100644
--- a/include/kvm/arm_vgic.h
+++ b/include/kvm/arm_vgic.h
@@ -9,8 +9,8 @@
#include <linux/kvm.h>
#include <linux/irqreturn.h>
#include <linux/kref.h>
-#include <linux/mutex.h>
-#include <linux/spinlock.h>
+#include <linux/mutex_types.h>
+#include <linux/spinlock_types.h>
#include <linux/static_key.h>
#include <linux/types.h>
#include <kvm/iodev.h>
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index b7165e52b3c6..3beab76d31d4 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -30,7 +30,7 @@ struct irq_domain_ops;
#include <linux/list.h>
#include <linux/dynamic_debug.h>
#include <linux/module.h>
-#include <linux/mutex.h>
+#include <linux/mutex_types.h>
#include <linux/fw_table.h>
#include <acpi/acpi_bus.h>
diff --git a/include/linux/agpgart.h b/include/linux/agpgart.h
index 21b34a96cfd8..56d8db3784c1 100644
--- a/include/linux/agpgart.h
+++ b/include/linux/agpgart.h
@@ -26,7 +26,7 @@
#ifndef _AGP_H
#define _AGP_H 1
-#include <linux/mutex.h>
+#include <linux/mutex_types.h>
#include <linux/agp_backend.h>
#include <uapi/linux/agpgart.h>
diff --git a/include/linux/alarmtimer.h b/include/linux/alarmtimer.h
index 05e758b8b894..92d10358e2f0 100644
--- a/include/linux/alarmtimer.h
+++ b/include/linux/alarmtimer.h
@@ -3,7 +3,7 @@
#define _LINUX_ALARMTIMER_H
#include <linux/time.h>
-#include <linux/hrtimer.h>
+#include <linux/hrtimer_types.h>
#include <linux/timerqueue.h>
struct rtc_device;
diff --git a/include/linux/backing-dev-defs.h b/include/linux/backing-dev-defs.h
index 7bf50450cd69..977f0323383d 100644
--- a/include/linux/backing-dev-defs.h
+++ b/include/linux/backing-dev-defs.h
@@ -4,14 +4,14 @@
#include <linux/list.h>
#include <linux/radix-tree.h>
-#include <linux/rbtree.h>
-#include <linux/spinlock.h>
+#include <linux/rbtree_types.h>
+#include <linux/spinlock_types.h>
#include <linux/percpu_counter.h>
#include <linux/percpu-refcount.h>
#include <linux/flex_proportions.h>
-#include <linux/timer.h>
+#include <linux/timer_types.h>
#include <linux/wait.h>
-#include <linux/workqueue.h>
+#include <linux/workqueue_types.h>
#include <linux/kref.h>
#ifdef CONFIG_CGROUP_WRITEBACK
diff --git a/include/linux/badblocks.h b/include/linux/badblocks.h
index 670f2dae692f..bd14c9de160a 100644
--- a/include/linux/badblocks.h
+++ b/include/linux/badblocks.h
@@ -2,7 +2,7 @@
#ifndef _LINUX_BADBLOCKS_H
#define _LINUX_BADBLOCKS_H
-#include <linux/seqlock.h>
+#include <linux/seqlock_types.h>
#include <linux/device.h>
#include <linux/kernel.h>
#include <linux/stddef.h>
diff --git a/include/linux/balloon_compaction.h b/include/linux/balloon_compaction.h
index 5ca2d5699620..6538ca2674a9 100644
--- a/include/linux/balloon_compaction.h
+++ b/include/linux/balloon_compaction.h
@@ -39,7 +39,7 @@
#include <linux/pagemap.h>
#include <linux/page-flags.h>
#include <linux/migrate.h>
-#include <linux/gfp.h>
+#include <linux/gfp_types.h>
#include <linux/err.h>
#include <linux/fs.h>
#include <linux/list.h>
diff --git a/include/linux/bcm47xx_wdt.h b/include/linux/bcm47xx_wdt.h
index fc9dcdb4b979..4198a11e2077 100644
--- a/include/linux/bcm47xx_wdt.h
+++ b/include/linux/bcm47xx_wdt.h
@@ -2,7 +2,7 @@
#ifndef LINUX_BCM47XX_WDT_H_
#define LINUX_BCM47XX_WDT_H_
-#include <linux/timer.h>
+#include <linux/timer_types.h>
#include <linux/types.h>
#include <linux/watchdog.h>
diff --git a/include/linux/blk-crypto.h b/include/linux/blk-crypto.h
index 5e5822c18ee4..c1463dcedc84 100644
--- a/include/linux/blk-crypto.h
+++ b/include/linux/blk-crypto.h
@@ -70,7 +70,7 @@ struct bio_crypt_ctx {
};
#include <linux/blk_types.h>
-#include <linux/blkdev.h>
+#include <linux/blk_types.h>
#ifdef CONFIG_BLK_INLINE_ENCRYPTION
diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h
index d3e9e69aaa3c..ed3760b04baa 100644
--- a/include/linux/blk-mq.h
+++ b/include/linux/blk-mq.h
@@ -5,7 +5,7 @@
#include <linux/bio.h>
#include <linux/blkdev.h>
#include <linux/sbitmap.h>
-#include <linux/lockdep.h>
+#include <linux/lockdep_types.h>
#include <linux/scatterlist.h>
#include <linux/prefetch.h>
#include <linux/srcu.h>
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index a98a9f1d21a0..ec4940fcc489 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -11,11 +11,11 @@
#include <linux/device.h>
#include <linux/list.h>
#include <linux/minmax.h>
-#include <linux/timer.h>
-#include <linux/workqueue.h>
+#include <linux/timer_types.h>
+#include <linux/workqueue_types.h>
#include <linux/wait.h>
#include <linux/bio.h>
-#include <linux/gfp.h>
+#include <linux/gfp_types.h>
#include <linux/kdev_t.h>
#include <linux/rcupdate.h>
#include <linux/percpu-refcount.h>
diff --git a/include/linux/bpf-cgroup-defs.h b/include/linux/bpf-cgroup-defs.h
index 0985221d5478..f3b400858129 100644
--- a/include/linux/bpf-cgroup-defs.h
+++ b/include/linux/bpf-cgroup-defs.h
@@ -6,7 +6,7 @@
#include <linux/list.h>
#include <linux/percpu-refcount.h>
-#include <linux/workqueue.h>
+#include <linux/workqueue_types.h>
struct bpf_prog_array;
diff --git a/include/linux/bpf-cgroup.h b/include/linux/bpf-cgroup.h
index a789266feac3..4b214fa7da47 100644
--- a/include/linux/bpf-cgroup.h
+++ b/include/linux/bpf-cgroup.h
@@ -7,7 +7,7 @@
#include <linux/errno.h>
#include <linux/jump_label.h>
#include <linux/percpu.h>
-#include <linux/rbtree.h>
+#include <linux/rbtree_types.h>
#include <net/sock.h>
#include <uapi/linux/bpf.h>
diff --git a/include/linux/bpf.h b/include/linux/bpf.h
index 5f2ee4e017db..40fce6ce3de9 100644
--- a/include/linux/bpf.h
+++ b/include/linux/bpf.h
@@ -7,14 +7,14 @@
#include <uapi/linux/bpf.h>
#include <uapi/linux/filter.h>
-#include <linux/workqueue.h>
+#include <linux/workqueue_types.h>
#include <linux/file.h>
#include <linux/percpu.h>
#include <linux/err.h>
#include <linux/rbtree_latch.h>
#include <linux/numa.h>
#include <linux/mm_types.h>
-#include <linux/refcount.h>
+#include <linux/refcount_types.h>
#include <linux/mutex.h>
#include <linux/module.h>
#include <linux/kallsyms.h>
diff --git a/include/linux/bpf_mem_alloc.h b/include/linux/bpf_mem_alloc.h
index aaf004d94322..7512e136ad5f 100644
--- a/include/linux/bpf_mem_alloc.h
+++ b/include/linux/bpf_mem_alloc.h
@@ -3,7 +3,7 @@
#ifndef _BPF_MEM_ALLOC_H
#define _BPF_MEM_ALLOC_H
#include <linux/compiler_types.h>
-#include <linux/workqueue.h>
+#include <linux/workqueue_types.h>
struct bpf_mem_cache;
struct bpf_mem_caches;
diff --git a/include/linux/bsg-lib.h b/include/linux/bsg-lib.h
index 9e97ced2896d..2f7a68344e42 100644
--- a/include/linux/bsg-lib.h
+++ b/include/linux/bsg-lib.h
@@ -9,7 +9,7 @@
#ifndef _BLK_BSG_
#define _BLK_BSG_
-#include <linux/blkdev.h>
+#include <linux/blk_types.h>
struct bsg_job;
struct request;
diff --git a/include/linux/capability.h b/include/linux/capability.h
index 0c356a517991..da2aa81391f6 100644
--- a/include/linux/capability.h
+++ b/include/linux/capability.h
@@ -14,7 +14,7 @@
#define _LINUX_CAPABILITY_H
#include <uapi/linux/capability.h>
-#include <linux/uidgid.h>
+#include <linux/uidgid_types.h>
#include <linux/bits.h>
#define _KERNEL_CAPABILITY_VERSION _LINUX_CAPABILITY_VERSION_3
diff --git a/include/linux/cb710.h b/include/linux/cb710.h
index 405657a9a0d5..6ad1ccf3b79c 100644
--- a/include/linux/cb710.h
+++ b/include/linux/cb710.h
@@ -9,7 +9,7 @@
#include <linux/io.h>
#include <linux/interrupt.h>
-#include <linux/spinlock.h>
+#include <linux/spinlock_types.h>
#include <linux/pci.h>
#include <linux/platform_device.h>
#include <linux/mmc/host.h>
diff --git a/include/linux/ccp.h b/include/linux/ccp.h
index 868924dec5a1..d3635efdbdef 100644
--- a/include/linux/ccp.h
+++ b/include/linux/ccp.h
@@ -12,7 +12,7 @@
#define __CCP_H__
#include <linux/scatterlist.h>
-#include <linux/workqueue.h>
+#include <linux/workqueue_types.h>
#include <linux/list.h>
#include <crypto/aes.h>
#include <crypto/sha1.h>
diff --git a/include/linux/ceph/libceph.h b/include/linux/ceph/libceph.h
index b86a567e9493..d01be9103e56 100644
--- a/include/linux/ceph/libceph.h
+++ b/include/linux/ceph/libceph.h
@@ -14,7 +14,7 @@
#include <linux/wait.h>
#include <linux/writeback.h>
#include <linux/slab.h>
-#include <linux/refcount.h>
+#include <linux/refcount_types.h>
#include <linux/ceph/types.h>
#include <linux/ceph/messenger.h>
diff --git a/include/linux/ceph/messenger.h b/include/linux/ceph/messenger.h
index e1a440f6c353..908b4a7fcb45 100644
--- a/include/linux/ceph/messenger.h
+++ b/include/linux/ceph/messenger.h
@@ -5,10 +5,10 @@
#include <linux/bvec.h>
#include <linux/crypto.h>
#include <linux/kref.h>
-#include <linux/mutex.h>
+#include <linux/mutex_types.h>
#include <linux/net.h>
#include <linux/uio.h>
-#include <linux/workqueue.h>
+#include <linux/workqueue_types.h>
#include <net/net_namespace.h>
#include <linux/ceph/types.h>
diff --git a/include/linux/ceph/mon_client.h b/include/linux/ceph/mon_client.h
index 7a9a40163c0f..8226ea42fc78 100644
--- a/include/linux/ceph/mon_client.h
+++ b/include/linux/ceph/mon_client.h
@@ -4,7 +4,7 @@
#include <linux/completion.h>
#include <linux/kref.h>
-#include <linux/rbtree.h>
+#include <linux/rbtree_types.h>
#include <linux/ceph/messenger.h>
diff --git a/include/linux/ceph/osd_client.h b/include/linux/ceph/osd_client.h
index fa018d5864e7..b27b9faeabf7 100644
--- a/include/linux/ceph/osd_client.h
+++ b/include/linux/ceph/osd_client.h
@@ -6,8 +6,8 @@
#include <linux/completion.h>
#include <linux/kref.h>
#include <linux/mempool.h>
-#include <linux/rbtree.h>
-#include <linux/refcount.h>
+#include <linux/rbtree_types.h>
+#include <linux/refcount_types.h>
#include <linux/ktime.h>
#include <linux/ceph/types.h>
diff --git a/include/linux/ceph/osdmap.h b/include/linux/ceph/osdmap.h
index 5553019c3f07..44ba159f56e7 100644
--- a/include/linux/ceph/osdmap.h
+++ b/include/linux/ceph/osdmap.h
@@ -2,7 +2,7 @@
#ifndef _FS_CEPH_OSDMAP_H
#define _FS_CEPH_OSDMAP_H
-#include <linux/rbtree.h>
+#include <linux/rbtree_types.h>
#include <linux/ceph/types.h>
#include <linux/ceph/decode.h>
#include <linux/crush/crush.h>
diff --git a/include/linux/ceph/pagelist.h b/include/linux/ceph/pagelist.h
index 5dead8486fd8..2eaa150695d7 100644
--- a/include/linux/ceph/pagelist.h
+++ b/include/linux/ceph/pagelist.h
@@ -3,7 +3,7 @@
#define __FS_CEPH_PAGELIST_H
#include <asm/byteorder.h>
-#include <linux/refcount.h>
+#include <linux/refcount_types.h>
#include <linux/list.h>
#include <linux/types.h>
diff --git a/include/linux/ceph/string_table.h b/include/linux/ceph/string_table.h
index a4a9962d1e14..c016ca326f35 100644
--- a/include/linux/ceph/string_table.h
+++ b/include/linux/ceph/string_table.h
@@ -4,7 +4,7 @@
#include <linux/types.h>
#include <linux/kref.h>
-#include <linux/rbtree.h>
+#include <linux/rbtree_types.h>
#include <linux/rcupdate.h>
struct ceph_string {
diff --git a/include/linux/cgroup-defs.h b/include/linux/cgroup-defs.h
index ea48c861cd36..380a59b31624 100644
--- a/include/linux/cgroup-defs.h
+++ b/include/linux/cgroup-defs.h
@@ -12,9 +12,9 @@
#include <linux/list.h>
#include <linux/idr.h>
#include <linux/wait.h>
-#include <linux/mutex.h>
+#include <linux/mutex_types.h>
#include <linux/rcupdate.h>
-#include <linux/refcount.h>
+#include <linux/refcount_types.h>
#include <linux/percpu-refcount.h>
#include <linux/percpu-rwsem.h>
#include <linux/u64_stats_sync.h>
diff --git a/include/linux/clk/zynq.h b/include/linux/clk/zynq.h
index a198dd9255a4..c8feff296da2 100644
--- a/include/linux/clk/zynq.h
+++ b/include/linux/clk/zynq.h
@@ -7,7 +7,7 @@
#ifndef __LINUX_CLK_ZYNQ_H_
#define __LINUX_CLK_ZYNQ_H_
-#include <linux/spinlock.h>
+#include <linux/spinlock_types.h>
void zynq_clock_init(void);
diff --git a/include/linux/comedi/comedidev.h b/include/linux/comedi/comedidev.h
index c08416a7364b..bde0255d4406 100644
--- a/include/linux/comedi/comedidev.h
+++ b/include/linux/comedi/comedidev.h
@@ -11,7 +11,7 @@
#define _COMEDIDEV_H
#include <linux/dma-mapping.h>
-#include <linux/mutex.h>
+#include <linux/mutex_types.h>
#include <linux/spinlock_types.h>
#include <linux/rwsem.h>
#include <linux/kref.h>
diff --git a/include/linux/configfs.h b/include/linux/configfs.h
index 2606711adb18..4a8326e7342b 100644
--- a/include/linux/configfs.h
+++ b/include/linux/configfs.h
@@ -23,7 +23,7 @@
#include <linux/types.h> /* ssize_t */
#include <linux/list.h> /* struct list_head */
#include <linux/kref.h> /* struct kref */
-#include <linux/mutex.h> /* struct mutex */
+#include <linux/mutex_types.h> /* struct mutex */
#define CONFIGFS_ITEM_NAME_LEN 20
diff --git a/include/linux/connector.h b/include/linux/connector.h
index c85ddfc2094e..34fc5023782c 100644
--- a/include/linux/connector.h
+++ b/include/linux/connector.h
@@ -9,7 +9,7 @@
#define __CONNECTOR_H
-#include <linux/refcount.h>
+#include <linux/refcount_types.h>
#include <linux/list.h>
diff --git a/include/linux/console_struct.h b/include/linux/console_struct.h
index 20f564e98552..a0142b93eaf9 100644
--- a/include/linux/console_struct.h
+++ b/include/linux/console_struct.h
@@ -15,7 +15,7 @@
#include <linux/wait.h>
#include <linux/vt.h>
-#include <linux/workqueue.h>
+#include <linux/workqueue_types.h>
struct uni_pagedict;
diff --git a/include/linux/counter.h b/include/linux/counter.h
index b767b5c821f5..846b94517c5b 100644
--- a/include/linux/counter.h
+++ b/include/linux/counter.h
@@ -10,7 +10,7 @@
#include <linux/device.h>
#include <linux/kernel.h>
#include <linux/kfifo.h>
-#include <linux/mutex.h>
+#include <linux/mutex_types.h>
#include <linux/spinlock_types.h>
#include <linux/types.h>
#include <linux/wait.h>
diff --git a/include/linux/cpu_rmap.h b/include/linux/cpu_rmap.h
index cae324d10965..effe8bef0a3a 100644
--- a/include/linux/cpu_rmap.h
+++ b/include/linux/cpu_rmap.h
@@ -8,7 +8,7 @@
*/
#include <linux/cpumask.h>
-#include <linux/gfp.h>
+#include <linux/gfp_types.h>
#include <linux/slab.h>
#include <linux/kref.h>
diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h
index 8ff3e79727d8..25658fe36a9b 100644
--- a/include/linux/cpufreq.h
+++ b/include/linux/cpufreq.h
@@ -17,7 +17,7 @@
#include <linux/of.h>
#include <linux/pm_opp.h>
#include <linux/pm_qos.h>
-#include <linux/spinlock.h>
+#include <linux/spinlock_types.h>
#include <linux/sysfs.h>
#include <linux/minmax.h>
diff --git a/include/linux/cpuset.h b/include/linux/cpuset.h
index 875d12598bd2..38370bd20f2f 100644
--- a/include/linux/cpuset.h
+++ b/include/linux/cpuset.h
@@ -13,7 +13,7 @@
#include <linux/sched/topology.h>
#include <linux/sched/task.h>
#include <linux/cpumask.h>
-#include <linux/nodemask.h>
+#include <linux/nodemask_types.h>
#include <linux/mm.h>
#include <linux/mmu_context.h>
#include <linux/jump_label.h>
diff --git a/include/linux/cred.h b/include/linux/cred.h
index 2976f534a7a3..0c35c0e3084e 100644
--- a/include/linux/cred.h
+++ b/include/linux/cred.h
@@ -13,7 +13,7 @@
#include <linux/key.h>
#include <linux/atomic.h>
#include <linux/refcount.h>
-#include <linux/uidgid.h>
+#include <linux/uidgid_types.h>
#include <linux/sched.h>
#include <linux/sched/user.h>
diff --git a/include/linux/crush/crush.h b/include/linux/crush/crush.h
index 30dba392b730..e32c10fb647a 100644
--- a/include/linux/crush/crush.h
+++ b/include/linux/crush/crush.h
@@ -3,7 +3,7 @@
#define CEPH_CRUSH_CRUSH_H
#ifdef __KERNEL__
-# include <linux/rbtree.h>
+# include <linux/rbtree_types.h>
# include <linux/types.h>
#else
# include "crush_compat.h"
diff --git a/include/linux/crypto.h b/include/linux/crypto.h
index b164da5e129e..5c82ca3ab80d 100644
--- a/include/linux/crypto.h
+++ b/include/linux/crypto.h
@@ -13,7 +13,7 @@
#define _LINUX_CRYPTO_H
#include <linux/completion.h>
-#include <linux/refcount.h>
+#include <linux/refcount_types.h>
#include <linux/slab.h>
#include <linux/types.h>
diff --git a/include/linux/damon.h b/include/linux/damon.h
index 5881e4ac30be..584cbafda006 100644
--- a/include/linux/damon.h
+++ b/include/linux/damon.h
@@ -9,7 +9,7 @@
#define _DAMON_H_
#include <linux/memcontrol.h>
-#include <linux/mutex.h>
+#include <linux/mutex_types.h>
#include <linux/time64.h>
#include <linux/types.h>
#include <linux/random.h>
diff --git a/include/linux/dcache.h b/include/linux/dcache.h
index 1666c387861f..a2d39fef6a4a 100644
--- a/include/linux/dcache.h
+++ b/include/linux/dcache.h
@@ -8,7 +8,7 @@
#include <linux/rculist.h>
#include <linux/rculist_bl.h>
#include <linux/spinlock.h>
-#include <linux/seqlock.h>
+#include <linux/seqlock_types.h>
#include <linux/cache.h>
#include <linux/rcupdate.h>
#include <linux/lockref.h>
diff --git a/include/linux/dev_printk.h b/include/linux/dev_printk.h
index a5151e4b9bde..dc1f1f83692e 100644
--- a/include/linux/dev_printk.h
+++ b/include/linux/dev_printk.h
@@ -14,7 +14,7 @@
#include <linux/compiler.h>
#include <linux/stdarg.h>
#include <linux/types.h>
-#include <linux/ratelimit.h>
+#include <linux/ratelimit_types.h>
#ifndef dev_fmt
#define dev_fmt(fmt) fmt
diff --git a/include/linux/device-mapper.h b/include/linux/device-mapper.h
index 772ab4d74d94..00af37767301 100644
--- a/include/linux/device-mapper.h
+++ b/include/linux/device-mapper.h
@@ -13,7 +13,6 @@
#include <linux/blkdev.h>
#include <linux/dm-ioctl.h>
#include <linux/math64.h>
-#include <linux/ratelimit.h>
struct dm_dev;
struct dm_target;
diff --git a/include/linux/device.h b/include/linux/device.h
index 5e47c9b5d0fa..235c780b5b65 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -22,8 +22,8 @@
#include <linux/compiler.h>
#include <linux/types.h>
#include <linux/mutex.h>
-#include <linux/uidgid.h>
-#include <linux/gfp.h>
+#include <linux/uidgid_types.h>
+#include <linux/gfp_types.h>
#include <linux/overflow.h>
#include <linux/device/bus.h>
#include <linux/device/class.h>
diff --git a/include/linux/dim.h b/include/linux/dim.h
index f343bc9aa2ec..e4ff5829963f 100644
--- a/include/linux/dim.h
+++ b/include/linux/dim.h
@@ -8,7 +8,7 @@
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/types.h>
-#include <linux/workqueue.h>
+#include <linux/workqueue_types.h>
/*
* Number of events between DIM iterations.
diff --git a/include/linux/dm-bufio.h b/include/linux/dm-bufio.h
index 75e7d8cbb532..3f909b2d1f0c 100644
--- a/include/linux/dm-bufio.h
+++ b/include/linux/dm-bufio.h
@@ -10,7 +10,7 @@
#ifndef _LINUX_DM_BUFIO_H
#define _LINUX_DM_BUFIO_H
-#include <linux/blkdev.h>
+#include <linux/blk_types.h>
#include <linux/types.h>
/*----------------------------------------------------------------*/
diff --git a/include/linux/edac.h b/include/linux/edac.h
index b4ee8961e623..f939d5fad491 100644
--- a/include/linux/edac.h
+++ b/include/linux/edac.h
@@ -15,7 +15,7 @@
#include <linux/atomic.h>
#include <linux/device.h>
#include <linux/completion.h>
-#include <linux/workqueue.h>
+#include <linux/workqueue_types.h>
#include <linux/debugfs.h>
#include <linux/numa.h>
diff --git a/include/linux/fault-inject.h b/include/linux/fault-inject.h
index 6d5edef09d45..04992b2732f1 100644
--- a/include/linux/fault-inject.h
+++ b/include/linux/fault-inject.h
@@ -7,7 +7,7 @@
#include <linux/types.h>
#include <linux/debugfs.h>
#include <linux/configfs.h>
-#include <linux/ratelimit.h>
+#include <linux/ratelimit_types.h>
#include <linux/atomic.h>
/*
diff --git a/include/linux/fb.h b/include/linux/fb.h
index 2bbad4a85a5d..66d6f3974d4d 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -2,7 +2,7 @@
#ifndef _LINUX_FB_H
#define _LINUX_FB_H
-#include <linux/refcount.h>
+#include <linux/refcount_types.h>
#include <linux/kgdb.h>
#include <uapi/linux/fb.h>
@@ -10,7 +10,7 @@
#include <linux/fs.h>
#include <linux/init.h>
-#include <linux/workqueue.h>
+#include <linux/workqueue_types.h>
#include <linux/notifier.h>
#include <linux/list.h>
#include <linux/slab.h>
diff --git a/include/linux/fdtable.h b/include/linux/fdtable.h
index 78c8326d74ae..2d37e4d071e9 100644
--- a/include/linux/fdtable.h
+++ b/include/linux/fdtable.h
@@ -8,7 +8,7 @@
#include <linux/posix_types.h>
#include <linux/compiler.h>
-#include <linux/spinlock.h>
+#include <linux/spinlock_types.h>
#include <linux/rcupdate.h>
#include <linux/nospec.h>
#include <linux/types.h>
diff --git a/include/linux/firewire.h b/include/linux/firewire.h
index c325e3523f93..feef7e09b60a 100644
--- a/include/linux/firewire.h
+++ b/include/linux/firewire.h
@@ -8,11 +8,11 @@
#include <linux/kernel.h>
#include <linux/kref.h>
#include <linux/list.h>
-#include <linux/mutex.h>
-#include <linux/spinlock.h>
-#include <linux/timer.h>
+#include <linux/mutex_types.h>
+#include <linux/spinlock_types.h>
+#include <linux/timer_types.h>
#include <linux/types.h>
-#include <linux/workqueue.h>
+#include <linux/workqueue_types.h>
#include <linux/atomic.h>
#include <asm/byteorder.h>
diff --git a/include/linux/firmware.h b/include/linux/firmware.h
index d45acd8c1e84..ee745b260b7e 100644
--- a/include/linux/firmware.h
+++ b/include/linux/firmware.h
@@ -5,7 +5,7 @@
#include <linux/err.h>
#include <linux/types.h>
#include <linux/compiler.h>
-#include <linux/gfp.h>
+#include <linux/gfp_types.h>
#define FW_ACTION_NOUEVENT 0
#define FW_ACTION_UEVENT 1
diff --git a/include/linux/flex_proportions.h b/include/linux/flex_proportions.h
index b5d8c1a1b2a9..35204b64addf 100644
--- a/include/linux/flex_proportions.h
+++ b/include/linux/flex_proportions.h
@@ -9,9 +9,9 @@
#define _LINUX_FLEX_PROPORTIONS_H
#include <linux/percpu_counter.h>
-#include <linux/spinlock.h>
-#include <linux/seqlock.h>
-#include <linux/gfp.h>
+#include <linux/spinlock_types.h>
+#include <linux/seqlock_types.h>
+#include <linux/gfp_types.h>
#include <linux/irqflags.h> // for local_irq_save()
/*
diff --git a/include/linux/fpga/fpga-mgr.h b/include/linux/fpga/fpga-mgr.h
index 54f63459efd6..c141f396b210 100644
--- a/include/linux/fpga/fpga-mgr.h
+++ b/include/linux/fpga/fpga-mgr.h
@@ -8,7 +8,7 @@
#ifndef _LINUX_FPGA_MGR_H
#define _LINUX_FPGA_MGR_H
-#include <linux/mutex.h>
+#include <linux/mutex_types.h>
#include <linux/platform_device.h>
struct fpga_manager;
diff --git a/include/linux/framer/framer.h b/include/linux/framer/framer.h
index 9a9b88962c29..2352a52d7d0f 100644
--- a/include/linux/framer/framer.h
+++ b/include/linux/framer/framer.h
@@ -11,11 +11,11 @@
#define __DRIVERS_FRAMER_H
#include <linux/err.h>
-#include <linux/mutex.h>
+#include <linux/mutex_types.h>
#include <linux/notifier.h>
#include <linux/of.h>
#include <linux/device.h>
-#include <linux/workqueue.h>
+#include <linux/workqueue_types.h>
/**
* enum framer_iface - Framer interface
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 4048cf6ebb4f..7b37a22c9513 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -15,9 +15,9 @@
#include <linux/xarray.h>
#include <linux/rbtree.h>
#include <linux/init.h>
-#include <linux/pid.h>
+#include <linux/pid_types.h>
#include <linux/bug.h>
-#include <linux/mutex.h>
+#include <linux/mutex_types.h>
#include <linux/rwsem.h>
#include <linux/mm_types.h>
#include <linux/capability.h>
@@ -27,10 +27,10 @@
#include <linux/atomic.h>
#include <linux/shrinker.h>
#include <linux/migrate_mode.h>
-#include <linux/uidgid.h>
+#include <linux/uidgid_types.h>
#include <linux/lockdep.h>
#include <linux/percpu-rwsem.h>
-#include <linux/workqueue.h>
+#include <linux/workqueue_types.h>
#include <linux/delayed_call.h>
#include <linux/uuid.h>
#include <linux/errseq.h>
diff --git a/include/linux/fs_context.h b/include/linux/fs_context.h
index c13e99cbbf81..34ad2597640e 100644
--- a/include/linux/fs_context.h
+++ b/include/linux/fs_context.h
@@ -9,10 +9,10 @@
#define _LINUX_FS_CONTEXT_H
#include <linux/kernel.h>
-#include <linux/refcount.h>
+#include <linux/refcount_types.h>
#include <linux/errno.h>
#include <linux/security.h>
-#include <linux/mutex.h>
+#include <linux/mutex_types.h>
struct cred;
struct dentry;
diff --git a/include/linux/fs_struct.h b/include/linux/fs_struct.h
index 783b48dedb72..dd4d675cfe04 100644
--- a/include/linux/fs_struct.h
+++ b/include/linux/fs_struct.h
@@ -4,7 +4,7 @@
#include <linux/path.h>
#include <linux/spinlock.h>
-#include <linux/seqlock.h>
+#include <linux/seqlock_types.h>
struct fs_struct {
int users;
diff --git a/include/linux/fsl/bestcomm/bestcomm_priv.h b/include/linux/fsl/bestcomm/bestcomm_priv.h
index 3b52f3ffbdf8..e544c26f842e 100644
--- a/include/linux/fsl/bestcomm/bestcomm_priv.h
+++ b/include/linux/fsl/bestcomm/bestcomm_priv.h
@@ -19,7 +19,7 @@
#ifndef __BESTCOMM_PRIV_H__
#define __BESTCOMM_PRIV_H__
-#include <linux/spinlock.h>
+#include <linux/spinlock_types.h>
#include <linux/of.h>
#include <asm/io.h>
#include <asm/mpc52xx.h>
diff --git a/include/linux/fsl/bestcomm/sram.h b/include/linux/fsl/bestcomm/sram.h
index b6d668963cce..557c62706bd5 100644
--- a/include/linux/fsl/bestcomm/sram.h
+++ b/include/linux/fsl/bestcomm/sram.h
@@ -14,7 +14,7 @@
#include <asm/rheap.h>
#include <asm/mmu.h>
-#include <linux/spinlock.h>
+#include <linux/spinlock_types.h>
/* Structure used internally */
diff --git a/include/linux/gameport.h b/include/linux/gameport.h
index 07e370113b2b..2d2dbf29c775 100644
--- a/include/linux/gameport.h
+++ b/include/linux/gameport.h
@@ -9,7 +9,7 @@
#include <linux/list.h>
#include <linux/mutex.h>
#include <linux/device.h>
-#include <linux/timer.h>
+#include <linux/timer_types.h>
#include <linux/slab.h>
#include <uapi/linux/gameport.h>
diff --git a/include/linux/gfp_api.h b/include/linux/gfp_api.h
index 5a05a2764a86..d4ea4f638050 100644
--- a/include/linux/gfp_api.h
+++ b/include/linux/gfp_api.h
@@ -1 +1 @@
-#include <linux/gfp.h>
+#include <linux/gfp_types.h>
diff --git a/include/linux/gnss.h b/include/linux/gnss.h
index 36968a0f33e8..8fc4bdd38dc6 100644
--- a/include/linux/gnss.h
+++ b/include/linux/gnss.h
@@ -11,7 +11,7 @@
#include <linux/cdev.h>
#include <linux/device.h>
#include <linux/kfifo.h>
-#include <linux/mutex.h>
+#include <linux/mutex_types.h>
#include <linux/rwsem.h>
#include <linux/types.h>
#include <linux/wait.h>
diff --git a/include/linux/gpio/driver.h b/include/linux/gpio/driver.h
index 3a37d058cfcf..801357469a3d 100644
--- a/include/linux/gpio/driver.h
+++ b/include/linux/gpio/driver.h
@@ -8,7 +8,7 @@
#include <linux/irqchip/chained_irq.h>
#include <linux/irqdomain.h>
#include <linux/irqhandler.h>
-#include <linux/lockdep.h>
+#include <linux/lockdep_types.h>
#include <linux/pinctrl/pinconf-generic.h>
#include <linux/pinctrl/pinctrl.h>
#include <linux/property.h>
diff --git a/include/linux/greybus/operation.h b/include/linux/greybus/operation.h
index cb8e4ef45222..ba5f09816035 100644
--- a/include/linux/greybus/operation.h
+++ b/include/linux/greybus/operation.h
@@ -11,9 +11,9 @@
#include <linux/completion.h>
#include <linux/kref.h>
-#include <linux/timer.h>
+#include <linux/timer_types.h>
#include <linux/types.h>
-#include <linux/workqueue.h>
+#include <linux/workqueue_types.h>
struct gb_host_device;
struct gb_operation;
diff --git a/include/linux/hid.h b/include/linux/hid.h
index 7c26db874ff0..68a160859e3e 100644
--- a/include/linux/hid.h
+++ b/include/linux/hid.h
@@ -19,11 +19,10 @@
#include <linux/slab.h>
#include <linux/list.h>
#include <linux/mod_devicetable.h> /* hid_device_id */
-#include <linux/timer.h>
-#include <linux/workqueue.h>
+#include <linux/workqueue_types.h>
#include <linux/input.h>
#include <linux/semaphore.h>
-#include <linux/mutex.h>
+#include <linux/mutex_types.h>
#include <linux/power_supply.h>
#include <uapi/linux/hid.h>
#include <linux/hid_bpf.h>
diff --git a/include/linux/hp_sdc.h b/include/linux/hp_sdc.h
index 9be8704e2d38..63e74e315a85 100644
--- a/include/linux/hp_sdc.h
+++ b/include/linux/hp_sdc.h
@@ -41,7 +41,7 @@
#include <linux/interrupt.h>
#include <linux/types.h>
#include <linux/time.h>
-#include <linux/timer.h>
+#include <linux/timer_types.h>
#if defined(__hppa__)
#include <asm/hardware.h>
#endif
diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h
index d31dd0be881b..dad968b60b55 100644
--- a/include/linux/hrtimer.h
+++ b/include/linux/hrtimer.h
@@ -17,8 +17,8 @@
#include <linux/init.h>
#include <linux/list.h>
#include <linux/percpu-defs.h>
-#include <linux/seqlock.h>
-#include <linux/timer.h>
+#include <linux/seqlock_types.h>
+#include <linux/timerqueue_types.h>
#include <asm/processor.h> /* for cpu_relax() */
struct restart_block;
diff --git a/include/linux/hsi/hsi.h b/include/linux/hsi/hsi.h
index 6ca92bff02c6..42c18904c480 100644
--- a/include/linux/hsi/hsi.h
+++ b/include/linux/hsi/hsi.h
@@ -11,7 +11,7 @@
#define __LINUX_HSI_H__
#include <linux/device.h>
-#include <linux/mutex.h>
+#include <linux/mutex_types.h>
#include <linux/scatterlist.h>
#include <linux/list.h>
#include <linux/module.h>
diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
index 77b30a8c6076..444d509c2647 100644
--- a/include/linux/hugetlb.h
+++ b/include/linux/hugetlb.h
@@ -12,7 +12,7 @@
#include <linux/list.h>
#include <linux/kref.h>
#include <linux/pgtable.h>
-#include <linux/gfp.h>
+#include <linux/gfp_types.h>
#include <linux/userfaultfd_k.h>
struct ctl_table;
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index 652ecb7abeda..4c868e8d5bec 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -15,7 +15,7 @@
#include <linux/mod_devicetable.h>
#include <linux/device.h> /* for struct device */
#include <linux/sched.h> /* for completion */
-#include <linux/mutex.h>
+#include <linux/mutex_types.h>
#include <linux/regulator/consumer.h>
#include <linux/rtmutex.h>
#include <linux/irqdomain.h> /* for Host Notify IRQ */
diff --git a/include/linux/i3c/master.h b/include/linux/i3c/master.h
index 7fc1e0bb4122..16cc81e55b12 100644
--- a/include/linux/i3c/master.h
+++ b/include/linux/i3c/master.h
@@ -15,7 +15,7 @@
#include <linux/i3c/ccc.h>
#include <linux/i3c/device.h>
#include <linux/rwsem.h>
-#include <linux/workqueue.h>
+#include <linux/workqueue_types.h>
#define I3C_HOT_JOIN_ADDR 0x2
#define I3C_BROADCAST_ADDR 0x7e
diff --git a/include/linux/i8253.h b/include/linux/i8253.h
index 8336b2f6f834..3be75bc72626 100644
--- a/include/linux/i8253.h
+++ b/include/linux/i8253.h
@@ -10,7 +10,7 @@
#define __LINUX_I8253_H
#include <linux/param.h>
-#include <linux/spinlock.h>
+#include <linux/spinlock_types.h>
#include <linux/timex.h>
/* i8253A PIT registers */
diff --git a/include/linux/idr.h b/include/linux/idr.h
index da5f5fa4a3a6..066fd41aaab7 100644
--- a/include/linux/idr.h
+++ b/include/linux/idr.h
@@ -13,7 +13,7 @@
#define __IDR_H__
#include <linux/radix-tree.h>
-#include <linux/gfp.h>
+#include <linux/gfp_types.h>
#include <linux/percpu.h>
struct idr {
diff --git a/include/linux/if_eql.h b/include/linux/if_eql.h
index 07f9b660b741..eb34161956a7 100644
--- a/include/linux/if_eql.h
+++ b/include/linux/if_eql.h
@@ -19,8 +19,8 @@
#define _LINUX_IF_EQL_H
-#include <linux/timer.h>
-#include <linux/spinlock.h>
+#include <linux/timer_types.h>
+#include <linux/spinlock_types.h>
#include <net/net_trackers.h>
#include <uapi/linux/if_eql.h>
diff --git a/include/linux/if_pppox.h b/include/linux/if_pppox.h
index ff3beda1312c..c0dd367ca9b0 100644
--- a/include/linux/if_pppox.h
+++ b/include/linux/if_pppox.h
@@ -13,7 +13,7 @@
#include <linux/netdevice.h>
#include <linux/ppp_channel.h>
#include <linux/skbuff.h>
-#include <linux/workqueue.h>
+#include <linux/workqueue_types.h>
#include <uapi/linux/if_pppox.h>
static inline struct pppoe_hdr *pppoe_hdr(const struct sk_buff *skb)
diff --git a/include/linux/igmp.h b/include/linux/igmp.h
index 5171231f70a8..283716e25e6c 100644
--- a/include/linux/igmp.h
+++ b/include/linux/igmp.h
@@ -11,10 +11,10 @@
#define _LINUX_IGMP_H
#include <linux/skbuff.h>
-#include <linux/timer.h>
+#include <linux/timer_types.h>
#include <linux/in.h>
#include <linux/ip.h>
-#include <linux/refcount.h>
+#include <linux/refcount_types.h>
#include <linux/sockptr.h>
#include <uapi/linux/igmp.h>
diff --git a/include/linux/iio/buffer-dma.h b/include/linux/iio/buffer-dma.h
index 18d3702fa95d..395762ed9bf1 100644
--- a/include/linux/iio/buffer-dma.h
+++ b/include/linux/iio/buffer-dma.h
@@ -9,8 +9,8 @@
#include <linux/list.h>
#include <linux/kref.h>
-#include <linux/spinlock.h>
-#include <linux/mutex.h>
+#include <linux/spinlock_types.h>
+#include <linux/mutex_types.h>
#include <linux/iio/buffer_impl.h>
struct iio_dma_buffer_queue;
diff --git a/include/linux/inetdevice.h b/include/linux/inetdevice.h
index ddb27fc0ee8c..17f92f8b77c1 100644
--- a/include/linux/inetdevice.h
+++ b/include/linux/inetdevice.h
@@ -9,7 +9,7 @@
#include <linux/ip.h>
#include <linux/netdevice.h>
#include <linux/rcupdate.h>
-#include <linux/timer.h>
+#include <linux/timer_types.h>
#include <linux/sysctl.h>
#include <linux/rtnetlink.h>
#include <linux/refcount.h>
diff --git a/include/linux/input.h b/include/linux/input.h
index de6503c0edb8..735b32eee9b4 100644
--- a/include/linux/input.h
+++ b/include/linux/input.h
@@ -18,7 +18,7 @@
#include <linux/device.h>
#include <linux/fs.h>
-#include <linux/timer.h>
+#include <linux/timer_types.h>
#include <linux/mod_devicetable.h>
struct input_dev_poller;
diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h
index 6322804d7534..2ac9e5f9af3d 100644
--- a/include/linux/interrupt.h
+++ b/include/linux/interrupt.h
@@ -11,7 +11,7 @@
#include <linux/hardirq.h>
#include <linux/irqflags.h>
#include <linux/kref.h>
-#include <linux/workqueue.h>
+#include <linux/workqueue_types.h>
#include <linux/jump_label.h>
#include <linux/atomic.h>
diff --git a/include/linux/interval_tree.h b/include/linux/interval_tree.h
index 2b8026a39906..684f713d962f 100644
--- a/include/linux/interval_tree.h
+++ b/include/linux/interval_tree.h
@@ -2,7 +2,8 @@
#ifndef _LINUX_INTERVAL_TREE_H
#define _LINUX_INTERVAL_TREE_H
-#include <linux/rbtree.h>
+#include <linux/rbtree_types.h>
+#include <linux/types.h>
struct interval_tree_node {
struct rb_node rb;
diff --git a/include/linux/iocontext.h b/include/linux/iocontext.h
index 14f7eaf1b443..a05d8a45cce5 100644
--- a/include/linux/iocontext.h
+++ b/include/linux/iocontext.h
@@ -4,7 +4,7 @@
#include <linux/radix-tree.h>
#include <linux/rcupdate.h>
-#include <linux/workqueue.h>
+#include <linux/workqueue_types.h>
enum {
ICQ_EXITED = 1 << 2,
diff --git a/include/linux/iomap.h b/include/linux/iomap.h
index 96dd0acbba44..d1398f46a86f 100644
--- a/include/linux/iomap.h
+++ b/include/linux/iomap.h
@@ -8,7 +8,7 @@
#include <linux/mm.h>
#include <linux/types.h>
#include <linux/mm_types.h>
-#include <linux/blkdev.h>
+#include <linux/blk_types.h>
struct address_space;
struct fiemap_extent_info;
diff --git a/include/linux/iova.h b/include/linux/iova.h
index 83c00fac2acb..ee656a0490ed 100644
--- a/include/linux/iova.h
+++ b/include/linux/iova.h
@@ -11,7 +11,7 @@
#include <linux/types.h>
#include <linux/kernel.h>
-#include <linux/rbtree.h>
+#include <linux/rbtree_types.h>
#include <linux/dma-mapping.h>
/* iova structure */
diff --git a/include/linux/ipc.h b/include/linux/ipc.h
index 12f6839fad5b..4c024fcdea56 100644
--- a/include/linux/ipc.h
+++ b/include/linux/ipc.h
@@ -3,10 +3,10 @@
#define _LINUX_IPC_H
#include <linux/spinlock_types.h>
-#include <linux/uidgid.h>
+#include <linux/uidgid_types.h>
#include <linux/rhashtable-types.h>
#include <uapi/linux/ipc.h>
-#include <linux/refcount.h>
+#include <linux/refcount_types.h>
#include <linux/cache.h> // for ____cacheline_aligned_in_smp
#include <linux/compiler_types.h> // for __randomize_layout
diff --git a/include/linux/irqdesc.h b/include/linux/irqdesc.h
index d9451d456a73..1f2c9b81baae 100644
--- a/include/linux/irqdesc.h
+++ b/include/linux/irqdesc.h
@@ -4,7 +4,7 @@
#include <linux/rcupdate.h>
#include <linux/kobject.h>
-#include <linux/mutex.h>
+#include <linux/mutex_types.h>
/*
* Core internal functions to deal with irq descriptors
diff --git a/include/linux/irqdomain.h b/include/linux/irqdomain.h
index ee0a82c60508..0503bd4ea55b 100644
--- a/include/linux/irqdomain.h
+++ b/include/linux/irqdomain.h
@@ -34,7 +34,7 @@
#include <linux/irqdomain_defs.h>
#include <linux/irqhandler.h>
#include <linux/of.h>
-#include <linux/mutex.h>
+#include <linux/mutex_types.h>
#include <linux/radix-tree.h>
struct device_node;
diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h
index 971f3e826e15..498a7dabe4cf 100644
--- a/include/linux/jbd2.h
+++ b/include/linux/jbd2.h
@@ -23,8 +23,8 @@
#include <linux/buffer_head.h>
#include <linux/journal-head.h>
#include <linux/stddef.h>
-#include <linux/mutex.h>
-#include <linux/timer.h>
+#include <linux/mutex_types.h>
+#include <linux/timer_types.h>
#include <linux/slab.h>
#include <linux/bit_spinlock.h>
#include <linux/blkdev.h>
diff --git a/include/linux/journal-head.h b/include/linux/journal-head.h
index 75bc56109031..427a57eee5eb 100644
--- a/include/linux/journal-head.h
+++ b/include/linux/journal-head.h
@@ -11,7 +11,7 @@
#ifndef JOURNAL_HEAD_H_INCLUDED
#define JOURNAL_HEAD_H_INCLUDED
-#include <linux/spinlock.h>
+#include <linux/spinlock_types.h>
typedef unsigned int tid_t; /* Unique transaction ID */
typedef struct transaction_s transaction_t; /* Compound transaction type */
diff --git a/include/linux/kernfs.h b/include/linux/kernfs.h
index 5d16cb9c2d02..7aba4eed9270 100644
--- a/include/linux/kernfs.h
+++ b/include/linux/kernfs.h
@@ -8,8 +8,8 @@
#include <linux/err.h>
#include <linux/list.h>
-#include <linux/mutex.h>
-#include <linux/lockdep.h>
+#include <linux/mutex_types.h>
+#include <linux/lockdep_types.h>
#include <linux/rbtree.h>
#include <linux/bug.h>
#include <linux/types.h>
diff --git a/include/linux/key.h b/include/linux/key.h
index 943a432da3ae..10649fec6004 100644
--- a/include/linux/key.h
+++ b/include/linux/key.h
@@ -12,7 +12,7 @@
#include <linux/types.h>
#include <linux/list.h>
-#include <linux/rbtree.h>
+#include <linux/rbtree_types.h>
#include <linux/rcupdate.h>
#include <linux/sysctl.h>
#include <linux/rwsem.h>
@@ -22,7 +22,7 @@
#include <linux/time64.h>
#ifdef __KERNEL__
-#include <linux/uidgid.h>
+#include <linux/uidgid_types.h>
/* key handle serial number */
typedef int32_t key_serial_t;
@@ -32,6 +32,7 @@ typedef uint32_t key_perm_t;
struct key;
struct net;
+struct user_namespace;
#ifdef CONFIG_KEYS
diff --git a/include/linux/klist.h b/include/linux/klist.h
index b0f238f20dbb..632ae9c720ac 100644
--- a/include/linux/klist.h
+++ b/include/linux/klist.h
@@ -10,7 +10,7 @@
#ifndef _LINUX_KLIST_H
#define _LINUX_KLIST_H
-#include <linux/spinlock.h>
+#include <linux/spinlock_types.h>
#include <linux/kref.h>
#include <linux/list.h>
diff --git a/include/linux/kmod.h b/include/linux/kmod.h
index 68f69362d427..c46c65b5fb25 100644
--- a/include/linux/kmod.h
+++ b/include/linux/kmod.h
@@ -7,7 +7,7 @@
*/
#include <linux/umh.h>
-#include <linux/gfp.h>
+#include <linux/gfp_types.h>
#include <linux/stddef.h>
#include <linux/errno.h>
#include <linux/compiler.h>
diff --git a/include/linux/kmsan.h b/include/linux/kmsan.h
index e0c23a32cdf0..2217a29a8d02 100644
--- a/include/linux/kmsan.h
+++ b/include/linux/kmsan.h
@@ -10,7 +10,7 @@
#define _LINUX_KMSAN_H
#include <linux/dma-direction.h>
-#include <linux/gfp.h>
+#include <linux/gfp_types.h>
#include <linux/kmsan-checks.h>
#include <linux/types.h>
diff --git a/include/linux/kobject.h b/include/linux/kobject.h
index b02c756fc4f2..1d58fc9f6ffb 100644
--- a/include/linux/kobject.h
+++ b/include/linux/kobject.h
@@ -20,11 +20,11 @@
#include <linux/sysfs.h>
#include <linux/compiler.h>
#include <linux/container_of.h>
-#include <linux/spinlock.h>
+#include <linux/spinlock_types.h>
#include <linux/kref.h>
#include <linux/kobject_ns.h>
#include <linux/workqueue.h>
-#include <linux/uidgid.h>
+#include <linux/uidgid_types.h>
#define UEVENT_HELPER_PATH_LEN 256
#define UEVENT_NUM_ENVP 64 /* number of env pointers */
diff --git a/include/linux/kprobes.h b/include/linux/kprobes.h
index b0511d1090ed..63b981edcffa 100644
--- a/include/linux/kprobes.h
+++ b/include/linux/kprobes.h
@@ -22,7 +22,7 @@
#include <linux/bug.h>
#include <linux/percpu.h>
#include <linux/rcupdate.h>
-#include <linux/mutex.h>
+#include <linux/mutex_types.h>
#include <linux/ftrace.h>
#include <linux/objpool.h>
#include <linux/rethook.h>
diff --git a/include/linux/kref.h b/include/linux/kref.h
index d32e21a2538c..536ada1a1bc4 100644
--- a/include/linux/kref.h
+++ b/include/linux/kref.h
@@ -13,7 +13,6 @@
#ifndef _KREF_H_
#define _KREF_H_
-#include <linux/spinlock.h>
#include <linux/refcount.h>
struct kref {
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index c5c00ecaf27e..91193e4eb718 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -6,8 +6,8 @@
#include <linux/types.h>
#include <linux/hardirq.h>
#include <linux/list.h>
-#include <linux/mutex.h>
-#include <linux/spinlock.h>
+#include <linux/mutex_types.h>
+#include <linux/spinlock_types.h>
#include <linux/signal.h>
#include <linux/sched.h>
#include <linux/sched/stat.h>
diff --git a/include/linux/kvm_types.h b/include/linux/kvm_types.h
index 9d1f7835d8c1..267616d24ac3 100644
--- a/include/linux/kvm_types.h
+++ b/include/linux/kvm_types.h
@@ -20,7 +20,7 @@ struct kvm_memslots;
enum kvm_mr_change;
#include <linux/bits.h>
-#include <linux/mutex.h>
+#include <linux/mutex_types.h>
#include <linux/types.h>
#include <linux/spinlock_types.h>
diff --git a/include/linux/leds-pca9532.h b/include/linux/leds-pca9532.h
index f4796d333974..07b1a4d6c071 100644
--- a/include/linux/leds-pca9532.h
+++ b/include/linux/leds-pca9532.h
@@ -11,7 +11,7 @@
#define __LINUX_PCA9532_H
#include <linux/leds.h>
-#include <linux/workqueue.h>
+#include <linux/workqueue_types.h>
#include <dt-bindings/leds/leds-pca9532.h>
enum pca9532_state {
diff --git a/include/linux/leds.h b/include/linux/leds.h
index 4754b02d3a2c..71385b333f25 100644
--- a/include/linux/leds.h
+++ b/include/linux/leds.h
@@ -10,10 +10,10 @@
#include <dt-bindings/leds/common.h>
#include <linux/device.h>
-#include <linux/mutex.h>
+#include <linux/mutex_types.h>
#include <linux/rwsem.h>
-#include <linux/spinlock.h>
-#include <linux/timer.h>
+#include <linux/spinlock_types.h>
+#include <linux/timer_types.h>
#include <linux/types.h>
#include <linux/workqueue.h>
diff --git a/include/linux/libata.h b/include/linux/libata.h
index 26d68115afb8..7d8a0afbac63 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -17,7 +17,7 @@
#include <linux/scatterlist.h>
#include <linux/io.h>
#include <linux/ata.h>
-#include <linux/workqueue.h>
+#include <linux/workqueue_types.h>
#include <scsi/scsi_host.h>
#include <linux/acpi.h>
#include <linux/cdrom.h>
diff --git a/include/linux/libnvdimm.h b/include/linux/libnvdimm.h
index f8ab7da9cc28..04be45d6a9ab 100644
--- a/include/linux/libnvdimm.h
+++ b/include/linux/libnvdimm.h
@@ -10,7 +10,7 @@
#include <linux/sizes.h>
#include <linux/types.h>
#include <linux/uuid.h>
-#include <linux/spinlock.h>
+#include <linux/spinlock_types.h>
struct bio;
diff --git a/include/linux/libps2.h b/include/linux/libps2.h
index 9ca9ce4e6e64..006c38667e75 100644
--- a/include/linux/libps2.h
+++ b/include/linux/libps2.h
@@ -9,7 +9,7 @@
#include <linux/bitops.h>
#include <linux/interrupt.h>
-#include <linux/mutex.h>
+#include <linux/mutex_types.h>
#include <linux/types.h>
#include <linux/wait.h>
diff --git a/include/linux/lockd/lockd.h b/include/linux/lockd/lockd.h
index 9f565416d186..81432629646d 100644
--- a/include/linux/lockd/lockd.h
+++ b/include/linux/lockd/lockd.h
@@ -17,7 +17,7 @@
#include <net/ipv6.h>
#include <linux/fs.h>
#include <linux/kref.h>
-#include <linux/refcount.h>
+#include <linux/refcount_types.h>
#include <linux/utsname.h>
#include <linux/lockd/bind.h>
#include <linux/lockd/xdr.h>
diff --git a/include/linux/lockref.h b/include/linux/lockref.h
index c3a1f78bc884..79c8402c7079 100644
--- a/include/linux/lockref.h
+++ b/include/linux/lockref.h
@@ -15,7 +15,7 @@
* example).
*/
-#include <linux/spinlock.h>
+#include <linux/spinlock_types.h>
#include <generated/bounds.h>
#define USE_CMPXCHG_LOCKREF \
diff --git a/include/linux/lp.h b/include/linux/lp.h
index be8a07eb2083..337573412852 100644
--- a/include/linux/lp.h
+++ b/include/linux/lp.h
@@ -10,7 +10,7 @@
#include <linux/wait.h>
-#include <linux/mutex.h>
+#include <linux/mutex_types.h>
#include <uapi/linux/lp.h>
/* Magic numbers for defining port-device mappings */
diff --git a/include/linux/mISDNhw.h b/include/linux/mISDNhw.h
index ef4f8eb02eac..9d65caceebc8 100644
--- a/include/linux/mISDNhw.h
+++ b/include/linux/mISDNhw.h
@@ -11,7 +11,7 @@
#ifndef MISDNHW_H
#define MISDNHW_H
#include <linux/mISDNif.h>
-#include <linux/timer.h>
+#include <linux/timer_types.h>
/*
* HW DEBUG 0xHHHHGGGG
diff --git a/include/linux/mailbox_controller.h b/include/linux/mailbox_controller.h
index 254b329f7699..fec4affa1543 100644
--- a/include/linux/mailbox_controller.h
+++ b/include/linux/mailbox_controller.h
@@ -5,7 +5,7 @@
#include <linux/of.h>
#include <linux/types.h>
-#include <linux/hrtimer.h>
+#include <linux/hrtimer_types.h>
#include <linux/completion.h>
struct device;
diff --git a/include/linux/mc146818rtc.h b/include/linux/mc146818rtc.h
index 34dfcc77f505..000edef612e1 100644
--- a/include/linux/mc146818rtc.h
+++ b/include/linux/mc146818rtc.h
@@ -19,7 +19,7 @@
#include <linux/pm-trace.h>
#ifdef __KERNEL__
-#include <linux/spinlock.h> /* spinlock_t */
+#include <linux/spinlock_types.h> /* spinlock_t */
extern spinlock_t rtc_lock; /* serialize CMOS RAM access */
/* Some RTCs extend the mc146818 register set to support alarms of more
diff --git a/include/linux/mdio/mdio-xgene.h b/include/linux/mdio/mdio-xgene.h
index 9e588965dc83..90e8b780de96 100644
--- a/include/linux/mdio/mdio-xgene.h
+++ b/include/linux/mdio/mdio-xgene.h
@@ -9,7 +9,7 @@
#define __MDIO_XGENE_H__
#include <linux/bits.h>
-#include <linux/spinlock.h>
+#include <linux/spinlock_types.h>
#include <linux/types.h>
#define BLOCK_XG_MDIO_CSR_OFFSET 0x5000
diff --git a/include/linux/memory-tiers.h b/include/linux/memory-tiers.h
index 69e781900082..f3f91280d20b 100644
--- a/include/linux/memory-tiers.h
+++ b/include/linux/memory-tiers.h
@@ -3,7 +3,7 @@
#define _LINUX_MEMORY_TIERS_H
#include <linux/types.h>
-#include <linux/nodemask.h>
+#include <linux/nodemask_types.h>
#include <linux/kref.h>
#include <linux/mmzone.h>
#include <linux/notifier.h>
diff --git a/include/linux/memory.h b/include/linux/memory.h
index 939a16bd5cea..3979b05e7979 100644
--- a/include/linux/memory.h
+++ b/include/linux/memory.h
@@ -18,7 +18,7 @@
#include <linux/node.h>
#include <linux/compiler.h>
-#include <linux/mutex.h>
+#include <linux/mutex_types.h>
#define MIN_MEMORY_BLOCK_SIZE (1UL << SECTION_SIZE_BITS)
diff --git a/include/linux/mempolicy.h b/include/linux/mempolicy.h
index 8128706b9ea0..f32a9bb497af 100644
--- a/include/linux/mempolicy.h
+++ b/include/linux/mempolicy.h
@@ -9,8 +9,8 @@
#include <linux/sched.h>
#include <linux/mmzone.h>
#include <linux/slab.h>
-#include <linux/rbtree.h>
-#include <linux/nodemask.h>
+#include <linux/rbtree_types.h>
+#include <linux/nodemask_types.h>
#include <linux/pagemap.h>
#include <uapi/linux/mempolicy.h>
diff --git a/include/linux/memstick.h b/include/linux/memstick.h
index ebf73d4ee969..8e1c7daa7c3b 100644
--- a/include/linux/memstick.h
+++ b/include/linux/memstick.h
@@ -8,7 +8,7 @@
#ifndef _MEMSTICK_H
#define _MEMSTICK_H
-#include <linux/workqueue.h>
+#include <linux/workqueue_types.h>
#include <linux/scatterlist.h>
#include <linux/device.h>
diff --git a/include/linux/mfd/abx500/ab8500.h b/include/linux/mfd/abx500/ab8500.h
index 76d326ea8eba..7542f6692de2 100644
--- a/include/linux/mfd/abx500/ab8500.h
+++ b/include/linux/mfd/abx500/ab8500.h
@@ -8,7 +8,7 @@
#define MFD_AB8500_H
#include <linux/atomic.h>
-#include <linux/mutex.h>
+#include <linux/mutex_types.h>
#include <linux/irqdomain.h>
struct device;
diff --git a/include/linux/mfd/cs42l43.h b/include/linux/mfd/cs42l43.h
index cf8263aab41b..7649f2770697 100644
--- a/include/linux/mfd/cs42l43.h
+++ b/include/linux/mfd/cs42l43.h
@@ -9,11 +9,11 @@
#include <linux/completion.h>
#include <linux/device.h>
#include <linux/gpio/consumer.h>
-#include <linux/mutex.h>
+#include <linux/mutex_types.h>
#include <linux/regmap.h>
#include <linux/regulator/consumer.h>
#include <linux/soundwire/sdw.h>
-#include <linux/workqueue.h>
+#include <linux/workqueue_types.h>
#ifndef CS42L43_CORE_EXT_H
#define CS42L43_CORE_EXT_H
diff --git a/include/linux/mfd/ipaq-micro.h b/include/linux/mfd/ipaq-micro.h
index d5caa4c86ecc..b40311799346 100644
--- a/include/linux/mfd/ipaq-micro.h
+++ b/include/linux/mfd/ipaq-micro.h
@@ -6,7 +6,7 @@
#ifndef _MFD_IPAQ_MICRO_H_
#define _MFD_IPAQ_MICRO_H_
-#include <linux/spinlock.h>
+#include <linux/spinlock_types.h>
#include <linux/completion.h>
#include <linux/list.h>
diff --git a/include/linux/mfd/lochnagar.h b/include/linux/mfd/lochnagar.h
index ff9e64cfc9fb..056f1f9dc2bd 100644
--- a/include/linux/mfd/lochnagar.h
+++ b/include/linux/mfd/lochnagar.h
@@ -9,7 +9,7 @@
*/
#include <linux/device.h>
-#include <linux/mutex.h>
+#include <linux/mutex_types.h>
#include <linux/regmap.h>
#ifndef CIRRUS_LOCHNAGAR_H
diff --git a/include/linux/mfd/madera/core.h b/include/linux/mfd/madera/core.h
index 03a8a788424a..a62b13a954b8 100644
--- a/include/linux/mfd/madera/core.h
+++ b/include/linux/mfd/madera/core.h
@@ -12,7 +12,7 @@
#include <linux/gpio/consumer.h>
#include <linux/interrupt.h>
#include <linux/mfd/madera/pdata.h>
-#include <linux/mutex.h>
+#include <linux/mutex_types.h>
#include <linux/notifier.h>
#include <linux/regmap.h>
#include <linux/regulator/consumer.h>
diff --git a/include/linux/mfd/max8907.h b/include/linux/mfd/max8907.h
index db4de95d3b9e..38600988cc89 100644
--- a/include/linux/mfd/max8907.h
+++ b/include/linux/mfd/max8907.h
@@ -9,7 +9,7 @@
#ifndef __LINUX_MFD_MAX8907_H
#define __LINUX_MFD_MAX8907_H
-#include <linux/mutex.h>
+#include <linux/mutex_types.h>
#define MAX8907_GEN_I2C_ADDR (0x78 >> 1)
#define MAX8907_ADC_I2C_ADDR (0x8e >> 1)
diff --git a/include/linux/mfd/mt6397/core.h b/include/linux/mfd/mt6397/core.h
index 627487e26287..30fa2a63f3a0 100644
--- a/include/linux/mfd/mt6397/core.h
+++ b/include/linux/mfd/mt6397/core.h
@@ -7,7 +7,7 @@
#ifndef __MFD_MT6397_CORE_H__
#define __MFD_MT6397_CORE_H__
-#include <linux/mutex.h>
+#include <linux/mutex_types.h>
#include <linux/notifier.h>
enum chip_id {
diff --git a/include/linux/mfd/mt6397/rtc.h b/include/linux/mfd/mt6397/rtc.h
index 068ae1c0f0e8..763f38cdc6af 100644
--- a/include/linux/mfd/mt6397/rtc.h
+++ b/include/linux/mfd/mt6397/rtc.h
@@ -10,7 +10,7 @@
#define _LINUX_MFD_MT6397_RTC_H_
#include <linux/jiffies.h>
-#include <linux/mutex.h>
+#include <linux/mutex_types.h>
#include <linux/regmap.h>
#include <linux/rtc.h>
diff --git a/include/linux/mfd/pcf50633/core.h b/include/linux/mfd/pcf50633/core.h
index 539f27f8bd89..b088002b27a0 100644
--- a/include/linux/mfd/pcf50633/core.h
+++ b/include/linux/mfd/pcf50633/core.h
@@ -10,10 +10,9 @@
#define __LINUX_MFD_PCF50633_CORE_H
#include <linux/i2c.h>
-#include <linux/workqueue.h>
+#include <linux/workqueue_types.h>
#include <linux/regulator/driver.h>
#include <linux/regulator/machine.h>
-#include <linux/pm.h>
#include <linux/power_supply.h>
#include <linux/mfd/pcf50633/backlight.h>
diff --git a/include/linux/mfd/rc5t583.h b/include/linux/mfd/rc5t583.h
index 4f220146cc02..485668f64dc8 100644
--- a/include/linux/mfd/rc5t583.h
+++ b/include/linux/mfd/rc5t583.h
@@ -12,7 +12,7 @@
#ifndef __LINUX_MFD_RC5T583_H
#define __LINUX_MFD_RC5T583_H
-#include <linux/mutex.h>
+#include <linux/mutex_types.h>
#include <linux/types.h>
#include <linux/regmap.h>
diff --git a/include/linux/mfd/stmpe.h b/include/linux/mfd/stmpe.h
index 87e29d561e22..3f184efc0d5b 100644
--- a/include/linux/mfd/stmpe.h
+++ b/include/linux/mfd/stmpe.h
@@ -8,7 +8,7 @@
#ifndef __LINUX_MFD_STMPE_H
#define __LINUX_MFD_STMPE_H
-#include <linux/mutex.h>
+#include <linux/mutex_types.h>
#define STMPE_SAMPLE_TIME(x) ((x & 0xf) << 4)
#define STMPE_MOD_12B(x) ((x & 0x1) << 3)
diff --git a/include/linux/mfd/ucb1x00.h b/include/linux/mfd/ucb1x00.h
index ede237384723..52fea8405c81 100644
--- a/include/linux/mfd/ucb1x00.h
+++ b/include/linux/mfd/ucb1x00.h
@@ -11,7 +11,7 @@
#include <linux/mfd/mcp.h>
#include <linux/gpio.h>
#include <linux/gpio/driver.h>
-#include <linux/mutex.h>
+#include <linux/mutex_types.h>
#define UCB_IO_DATA 0x00
#define UCB_IO_DIR 0x01
diff --git a/include/linux/mfd/wm8350/core.h b/include/linux/mfd/wm8350/core.h
index a3241e4d7548..dc6ff85cb5b0 100644
--- a/include/linux/mfd/wm8350/core.h
+++ b/include/linux/mfd/wm8350/core.h
@@ -9,7 +9,7 @@
#define __LINUX_MFD_WM8350_CORE_H_
#include <linux/kernel.h>
-#include <linux/mutex.h>
+#include <linux/mutex_types.h>
#include <linux/interrupt.h>
#include <linux/completion.h>
#include <linux/regmap.h>
diff --git a/include/linux/mhi.h b/include/linux/mhi.h
index 474d32cb0520..bd99f47726dc 100644
--- a/include/linux/mhi.h
+++ b/include/linux/mhi.h
@@ -8,12 +8,12 @@
#include <linux/device.h>
#include <linux/dma-direction.h>
-#include <linux/mutex.h>
+#include <linux/mutex_types.h>
#include <linux/skbuff.h>
#include <linux/slab.h>
-#include <linux/spinlock.h>
+#include <linux/spinlock_types.h>
#include <linux/wait.h>
-#include <linux/workqueue.h>
+#include <linux/workqueue_types.h>
#define MHI_MAX_OEM_PK_HASH_SEGMENTS 16
diff --git a/include/linux/mlx5/driver.h b/include/linux/mlx5/driver.h
index 41f03b352401..7d47499ce75a 100644
--- a/include/linux/mlx5/driver.h
+++ b/include/linux/mlx5/driver.h
@@ -42,14 +42,14 @@
#include <linux/slab.h>
#include <linux/vmalloc.h>
#include <linux/xarray.h>
-#include <linux/workqueue.h>
+#include <linux/workqueue_types.h>
#include <linux/mempool.h>
#include <linux/interrupt.h>
#include <linux/idr.h>
#include <linux/notifier.h>
-#include <linux/refcount.h>
+#include <linux/refcount_types.h>
#include <linux/auxiliary_bus.h>
-#include <linux/mutex.h>
+#include <linux/mutex_types.h>
#include <linux/mlx5/device.h>
#include <linux/mlx5/doorbell.h>
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 3a47847b0db4..9338b6217e3c 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -8,7 +8,7 @@
#include <linux/bug.h>
#include <linux/list.h>
#include <linux/mmzone.h>
-#include <linux/rbtree.h>
+#include <linux/rbtree_types.h>
#include <linux/atomic.h>
#include <linux/debug_locks.h>
#include <linux/mm_types.h>
diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
index 05556012321f..81d042c00018 100644
--- a/include/linux/mm_types.h
+++ b/include/linux/mm_types.h
@@ -7,16 +7,16 @@
#include <linux/auxvec.h>
#include <linux/kref.h>
#include <linux/list.h>
-#include <linux/spinlock.h>
-#include <linux/rbtree.h>
+#include <linux/spinlock_types.h>
+#include <linux/rbtree_types.h>
#include <linux/maple_tree.h>
#include <linux/rwsem.h>
#include <linux/cpumask.h>
#include <linux/uprobes.h>
#include <linux/rcupdate.h>
#include <linux/page-flags-layout.h>
-#include <linux/workqueue.h>
-#include <linux/seqlock.h>
+#include <linux/workqueue_types.h>
+#include <linux/seqlock_types.h>
#include <linux/percpu_counter.h>
#include <asm/mmu.h>
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index a497f189d988..ce11c2dab2bc 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -5,7 +5,7 @@
#ifndef __ASSEMBLY__
#ifndef __GENERATING_BOUNDS_H
-#include <linux/spinlock.h>
+#include <linux/spinlock_types.h>
#include <linux/list.h>
#include <linux/list_nulls.h>
#include <linux/wait.h>
@@ -14,7 +14,6 @@
#include <linux/threads.h>
#include <linux/numa.h>
#include <linux/init.h>
-#include <linux/seqlock.h>
#include <linux/nodemask.h>
#include <linux/pageblock-flags.h>
#include <linux/page-flags-layout.h>
@@ -25,6 +24,10 @@
#include <linux/zswap.h>
#include <asm/page.h>
+#ifdef CONFIG_MEMORY_HOTPLUG
+#include <linux/seqlock_types.h>
+#endif
+
/* Free memory management - zoned buddy allocator. */
#ifndef CONFIG_ARCH_FORCE_MAX_ORDER
#define MAX_PAGE_ORDER 10
diff --git a/include/linux/moxtet.h b/include/linux/moxtet.h
index ac577699edfd..ab8112dc4bf9 100644
--- a/include/linux/moxtet.h
+++ b/include/linux/moxtet.h
@@ -11,7 +11,7 @@
#include <linux/device.h>
#include <linux/irq.h>
#include <linux/irqdomain.h>
-#include <linux/mutex.h>
+#include <linux/mutex_types.h>
#define TURRIS_MOX_MAX_MODULES 10
diff --git a/include/linux/mroute_base.h b/include/linux/mroute_base.h
index 9dd4bf157255..f3dc964ae4e9 100644
--- a/include/linux/mroute_base.h
+++ b/include/linux/mroute_base.h
@@ -3,7 +3,7 @@
#include <linux/netdevice.h>
#include <linux/rhashtable-types.h>
-#include <linux/spinlock.h>
+#include <linux/spinlock_types.h>
#include <net/net_namespace.h>
#include <net/sock.h>
#include <net/fib_notifier.h>
diff --git a/include/linux/msi.h b/include/linux/msi.h
index ddace8c34dcf..04fd2c856287 100644
--- a/include/linux/msi.h
+++ b/include/linux/msi.h
@@ -22,7 +22,7 @@
#include <linux/cpumask.h>
#include <linux/msi_api.h>
#include <linux/xarray.h>
-#include <linux/mutex.h>
+#include <linux/mutex_types.h>
#include <linux/list.h>
#include <linux/irq.h>
#include <linux/bits.h>
diff --git a/include/linux/mtd/blktrans.h b/include/linux/mtd/blktrans.h
index 0aa2f072d2a1..7be6117fad23 100644
--- a/include/linux/mtd/blktrans.h
+++ b/include/linux/mtd/blktrans.h
@@ -6,7 +6,7 @@
#ifndef __MTD_TRANS_H__
#define __MTD_TRANS_H__
-#include <linux/mutex.h>
+#include <linux/mutex_types.h>
#include <linux/kref.h>
#include <linux/list.h>
diff --git a/include/linux/mtd/doc2000.h b/include/linux/mtd/doc2000.h
index 1b7b0ee070ca..0bd3fdacec09 100644
--- a/include/linux/mtd/doc2000.h
+++ b/include/linux/mtd/doc2000.h
@@ -12,7 +12,7 @@
#define __MTD_DOC2000_H__
#include <linux/mtd/mtd.h>
-#include <linux/mutex.h>
+#include <linux/mutex_types.h>
#define DoC_Sig1 0
#define DoC_Sig2 1
diff --git a/include/linux/mtd/flashchip.h b/include/linux/mtd/flashchip.h
index c04f690871ca..b8f44f7cda2b 100644
--- a/include/linux/mtd/flashchip.h
+++ b/include/linux/mtd/flashchip.h
@@ -12,7 +12,7 @@
* has asm/spinlock.h, or 2.4, which has linux/spinlock.h
*/
#include <linux/sched.h>
-#include <linux/mutex.h>
+#include <linux/mutex_types.h>
typedef enum {
FL_READY,
diff --git a/include/linux/mtd/onenand.h b/include/linux/mtd/onenand.h
index 1e517961d0ba..7ebd8180c617 100644
--- a/include/linux/mtd/onenand.h
+++ b/include/linux/mtd/onenand.h
@@ -9,7 +9,7 @@
#ifndef __LINUX_MTD_ONENAND_H
#define __LINUX_MTD_ONENAND_H
-#include <linux/spinlock.h>
+#include <linux/spinlock_types.h>
#include <linux/completion.h>
#include <linux/mtd/flashchip.h>
#include <linux/mtd/onenand_regs.h>
diff --git a/include/linux/mtd/spinand.h b/include/linux/mtd/spinand.h
index badb4c1ac079..61af006d8acd 100644
--- a/include/linux/mtd/spinand.h
+++ b/include/linux/mtd/spinand.h
@@ -8,7 +8,7 @@
#ifndef __LINUX_MTD_SPINAND_H
#define __LINUX_MTD_SPINAND_H
-#include <linux/mutex.h>
+#include <linux/mutex_types.h>
#include <linux/bitops.h>
#include <linux/device.h>
#include <linux/mtd/mtd.h>
diff --git a/include/linux/mutex.h b/include/linux/mutex.h
index 7e208d46ba5b..08aac9a432ea 100644
--- a/include/linux/mutex.h
+++ b/include/linux/mutex.h
@@ -14,7 +14,7 @@
#include <asm/current.h>
#include <linux/list.h>
#include <linux/spinlock_types.h>
-#include <linux/lockdep.h>
+#include <linux/lockdep_types.h>
#include <linux/atomic.h>
#include <asm/processor.h>
#include <linux/osq_lock.h>
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index bf5a43616e1d..a50f57b3d1ba 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -21,7 +21,7 @@
#ifndef _LINUX_NETDEVICE_H
#define _LINUX_NETDEVICE_H
-#include <linux/timer.h>
+#include <linux/timer_types.h>
#include <linux/bug.h>
#include <linux/delay.h>
#include <linux/atomic.h>
@@ -47,7 +47,7 @@
#include <uapi/linux/pkt_cls.h>
#include <uapi/linux/netdev.h>
#include <linux/hashtable.h>
-#include <linux/rbtree.h>
+#include <linux/rbtree_types.h>
#include <net/net_trackers.h>
#include <net/net_debug.h>
#include <net/dropreason-core.h>
diff --git a/include/linux/netfs.h b/include/linux/netfs.h
index 100cbb261269..1542bd9dabc8 100644
--- a/include/linux/netfs.h
+++ b/include/linux/netfs.h
@@ -14,7 +14,7 @@
#ifndef _LINUX_NETFS_H
#define _LINUX_NETFS_H
-#include <linux/workqueue.h>
+#include <linux/workqueue_types.h>
#include <linux/fs.h>
#include <linux/pagemap.h>
#include <linux/uio.h>
diff --git a/include/linux/netpoll.h b/include/linux/netpoll.h
index bd19c4b91e31..488695d7480f 100644
--- a/include/linux/netpoll.h
+++ b/include/linux/netpoll.h
@@ -12,7 +12,7 @@
#include <linux/interrupt.h>
#include <linux/rcupdate.h>
#include <linux/list.h>
-#include <linux/refcount.h>
+#include <linux/refcount_types.h>
union inet_addr {
__u32 all[4];
diff --git a/include/linux/nfs4.h b/include/linux/nfs4.h
index ef8d2d618d5b..657d24529fde 100644
--- a/include/linux/nfs4.h
+++ b/include/linux/nfs4.h
@@ -14,7 +14,7 @@
#define _LINUX_NFS4_H
#include <linux/list.h>
-#include <linux/uidgid.h>
+#include <linux/uidgid_types.h>
#include <uapi/linux/nfs4.h>
#include <linux/sunrpc/msg_prot.h>
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h
index a832e18f6347..4511d8a50e15 100644
--- a/include/linux/nfs_fs.h
+++ b/include/linux/nfs_fs.h
@@ -22,8 +22,8 @@
#include <linux/in.h>
#include <linux/mm.h>
#include <linux/pagemap.h>
-#include <linux/rbtree.h>
-#include <linux/refcount.h>
+#include <linux/rbtree_types.h>
+#include <linux/refcount_types.h>
#include <linux/rwsem.h>
#include <linux/sunrpc/debug.h>
diff --git a/include/linux/nfs_fs_sb.h b/include/linux/nfs_fs_sb.h
index cd797e00fe35..08860ceda787 100644
--- a/include/linux/nfs_fs_sb.h
+++ b/include/linux/nfs_fs_sb.h
@@ -10,7 +10,7 @@
#include <linux/sunrpc/xprt.h>
#include <linux/atomic.h>
-#include <linux/refcount.h>
+#include <linux/refcount_types.h>
struct nfs4_session;
struct nfs_iostats;
diff --git a/include/linux/ns_common.h b/include/linux/ns_common.h
index 241cef0bfaed..9767df7d354b 100644
--- a/include/linux/ns_common.h
+++ b/include/linux/ns_common.h
@@ -3,7 +3,7 @@
#define _LINUX_NS_COMMON_H
#include <linux/atomic.h>
-#include <linux/refcount.h>
+#include <linux/refcount_types.h>
struct proc_ns_operations;
diff --git a/include/linux/objpool.h b/include/linux/objpool.h
index 15aff4a17f0c..f0d5ce50753f 100644
--- a/include/linux/objpool.h
+++ b/include/linux/objpool.h
@@ -4,7 +4,7 @@
#define _LINUX_OBJPOOL_H
#include <linux/types.h>
-#include <linux/refcount.h>
+#include <linux/refcount_types.h>
/*
* objpool: ring-array based lockless MPMC queue
diff --git a/include/linux/oom.h b/include/linux/oom.h
index 7d0c9c48a0c5..66d20654c96c 100644
--- a/include/linux/oom.h
+++ b/include/linux/oom.h
@@ -5,7 +5,7 @@
#include <linux/sched/signal.h>
#include <linux/types.h>
-#include <linux/nodemask.h>
+#include <linux/nodemask_types.h>
#include <uapi/linux/oom.h>
#include <linux/sched/coredump.h> /* MMF_* */
#include <linux/mm.h> /* VM_FAULT* */
diff --git a/include/linux/padata.h b/include/linux/padata.h
index 8f418711351b..d00a89e41518 100644
--- a/include/linux/padata.h
+++ b/include/linux/padata.h
@@ -12,10 +12,10 @@
#ifndef PADATA_H
#define PADATA_H
-#include <linux/refcount.h>
+#include <linux/refcount_types.h>
#include <linux/compiler_types.h>
-#include <linux/workqueue.h>
-#include <linux/spinlock.h>
+#include <linux/workqueue_types.h>
+#include <linux/spinlock_types.h>
#include <linux/list.h>
#include <linux/kobject.h>
diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h
index 431b12a23299..186d5a9fb956 100644
--- a/include/linux/pagemap.h
+++ b/include/linux/pagemap.h
@@ -11,7 +11,7 @@
#include <linux/highmem.h>
#include <linux/compiler.h>
#include <linux/uaccess.h>
-#include <linux/gfp.h>
+#include <linux/gfp_types.h>
#include <linux/bitops.h>
#include <linux/hardirq.h> /* for in_interrupt() */
#include <linux/hugetlb_inline.h>
diff --git a/include/linux/parport.h b/include/linux/parport.h
index fff39bc30629..c8e3b71a3b49 100644
--- a/include/linux/parport.h
+++ b/include/linux/parport.h
@@ -9,7 +9,7 @@
#include <linux/jiffies.h>
#include <linux/proc_fs.h>
-#include <linux/spinlock.h>
+#include <linux/spinlock_types.h>
#include <linux/wait.h>
#include <linux/irqreturn.h>
#include <linux/semaphore.h>
diff --git a/include/linux/part_stat.h b/include/linux/part_stat.h
index abeba356bc3f..d4697dc35b02 100644
--- a/include/linux/part_stat.h
+++ b/include/linux/part_stat.h
@@ -2,7 +2,7 @@
#ifndef _LINUX_PART_STAT_H
#define _LINUX_PART_STAT_H
-#include <linux/blkdev.h>
+#include <linux/blk_types.h>
#include <asm/local.h>
struct disk_stats {
diff --git a/include/linux/peci.h b/include/linux/peci.h
index 9b3d36aff431..ad3ea1371680 100644
--- a/include/linux/peci.h
+++ b/include/linux/peci.h
@@ -6,7 +6,7 @@
#include <linux/device.h>
#include <linux/kernel.h>
-#include <linux/mutex.h>
+#include <linux/mutex_types.h>
#include <linux/types.h>
/*
diff --git a/include/linux/percpu-refcount.h b/include/linux/percpu-refcount.h
index d73a1c08c3e3..dd2f19ea08bd 100644
--- a/include/linux/percpu-refcount.h
+++ b/include/linux/percpu-refcount.h
@@ -54,7 +54,7 @@
#include <linux/percpu.h>
#include <linux/rcupdate.h>
#include <linux/types.h>
-#include <linux/gfp.h>
+#include <linux/gfp_types.h>
struct percpu_ref;
typedef void (percpu_ref_func_t)(struct percpu_ref *);
diff --git a/include/linux/percpu_counter.h b/include/linux/percpu_counter.h
index 231e75ec1d83..8d45785b3448 100644
--- a/include/linux/percpu_counter.h
+++ b/include/linux/percpu_counter.h
@@ -7,7 +7,7 @@
* WARNING: these things are HUGE. 4 kbytes per counter on 32-way P4.
*/
-#include <linux/spinlock.h>
+#include <linux/spinlock_types.h>
#include <linux/list.h>
#include <linux/threads.h>
#include <linux/percpu.h>
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index d2a15c0c6f8a..eaf5d5f76e0e 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -41,14 +41,14 @@ struct perf_guest_info_callbacks {
#endif
#include <linux/list.h>
-#include <linux/mutex.h>
+#include <linux/mutex_types.h>
#include <linux/rculist.h>
#include <linux/rcupdate.h>
-#include <linux/spinlock.h>
-#include <linux/hrtimer.h>
+#include <linux/spinlock_types.h>
+#include <linux/hrtimer_types.h>
#include <linux/fs.h>
#include <linux/pid_namespace.h>
-#include <linux/workqueue.h>
+#include <linux/workqueue_types.h>
#include <linux/ftrace.h>
#include <linux/cpu.h>
#include <linux/irq_work.h>
@@ -58,7 +58,7 @@ struct perf_guest_info_callbacks {
#include <linux/sysfs.h>
#include <linux/perf_regs.h>
#include <linux/cgroup.h>
-#include <linux/refcount.h>
+#include <linux/refcount_types.h>
#include <linux/security.h>
#include <linux/static_call.h>
#include <linux/lockdep.h>
diff --git a/include/linux/phy.h b/include/linux/phy.h
index 468371b1f508..053037f62157 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -20,12 +20,12 @@
#include <linux/mii.h>
#include <linux/mii_timestamper.h>
#include <linux/module.h>
-#include <linux/workqueue.h>
+#include <linux/workqueue_types.h>
#include <linux/mod_devicetable.h>
#include <linux/u64_stats_sync.h>
#include <linux/irqreturn.h>
#include <linux/iopoll.h>
-#include <linux/refcount.h>
+#include <linux/refcount_types.h>
#include <linux/atomic.h>
diff --git a/include/linux/pktcdvd.h b/include/linux/pktcdvd.h
index 00141d9ca4b9..4167503eb54c 100644
--- a/include/linux/pktcdvd.h
+++ b/include/linux/pktcdvd.h
@@ -12,7 +12,7 @@
#ifndef __PKTCDVD_H
#define __PKTCDVD_H
-#include <linux/blkdev.h>
+#include <linux/blk_types.h>
#include <linux/cdrom.h>
#include <linux/mempool.h>
#include <uapi/linux/pktcdvd.h>
diff --git a/include/linux/platform_data/cros_ec_proto.h b/include/linux/platform_data/cros_ec_proto.h
index 8865e350c12a..dec873a7d38e 100644
--- a/include/linux/platform_data/cros_ec_proto.h
+++ b/include/linux/platform_data/cros_ec_proto.h
@@ -10,7 +10,7 @@
#include <linux/device.h>
#include <linux/lockdep_types.h>
-#include <linux/mutex.h>
+#include <linux/mutex_types.h>
#include <linux/notifier.h>
#include <linux/platform_data/cros_ec_commands.h>
diff --git a/include/linux/platform_data/cros_ec_sensorhub.h b/include/linux/platform_data/cros_ec_sensorhub.h
index 0ecce6aa69d5..693337bd4d27 100644
--- a/include/linux/platform_data/cros_ec_sensorhub.h
+++ b/include/linux/platform_data/cros_ec_sensorhub.h
@@ -9,7 +9,7 @@
#define __LINUX_PLATFORM_DATA_CROS_EC_SENSORHUB_H
#include <linux/ktime.h>
-#include <linux/mutex.h>
+#include <linux/mutex_types.h>
#include <linux/notifier.h>
#include <linux/platform_data/cros_ec_commands.h>
diff --git a/include/linux/platform_data/wilco-ec.h b/include/linux/platform_data/wilco-ec.h
index 3e268e636b5b..40651d9d099f 100644
--- a/include/linux/platform_data/wilco-ec.h
+++ b/include/linux/platform_data/wilco-ec.h
@@ -8,7 +8,7 @@
#ifndef WILCO_EC_H
#define WILCO_EC_H
-#include <linux/mutex.h>
+#include <linux/mutex_types.h>
#include <linux/types.h>
/* Message flags for using the mailbox() interface */
diff --git a/include/linux/platform_data/xilinx-ll-temac.h b/include/linux/platform_data/xilinx-ll-temac.h
index f4a68136afa6..2ca6792821c7 100644
--- a/include/linux/platform_data/xilinx-ll-temac.h
+++ b/include/linux/platform_data/xilinx-ll-temac.h
@@ -4,7 +4,7 @@
#include <linux/if_ether.h>
#include <linux/phy.h>
-#include <linux/spinlock.h>
+#include <linux/spinlock_types.h>
struct ll_temac_platform_data {
bool txcsum; /* Enable/disable TX checksum */
diff --git a/include/linux/pm.h b/include/linux/pm.h
index abad6899e642..f94a78728f1e 100644
--- a/include/linux/pm.h
+++ b/include/linux/pm.h
@@ -10,10 +10,10 @@
#include <linux/export.h>
#include <linux/list.h>
-#include <linux/workqueue.h>
-#include <linux/spinlock.h>
+#include <linux/workqueue_types.h>
+#include <linux/spinlock_types.h>
#include <linux/wait.h>
-#include <linux/hrtimer.h>
+#include <linux/hrtimer_types.h>
#include <linux/completion.h>
#ifdef CONFIG_PM_CLK
diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h
index b97c5e9820f9..5b01ebf9c254 100644
--- a/include/linux/pm_domain.h
+++ b/include/linux/pm_domain.h
@@ -10,12 +10,12 @@
#include <linux/device.h>
#include <linux/ktime.h>
-#include <linux/mutex.h>
+#include <linux/mutex_types.h>
#include <linux/pm.h>
#include <linux/err.h>
#include <linux/of.h>
#include <linux/notifier.h>
-#include <linux/spinlock.h>
+#include <linux/spinlock_types.h>
#include <linux/cpumask.h>
#include <linux/time64.h>
diff --git a/include/linux/posix-timers.h b/include/linux/posix-timers.h
index c88ceca7cb6e..b6b0231ddf44 100644
--- a/include/linux/posix-timers.h
+++ b/include/linux/posix-timers.h
@@ -5,7 +5,7 @@
#include <linux/alarmtimer.h>
#include <linux/list.h>
#include <linux/posix-timers_types.h>
-#include <linux/spinlock.h>
+#include <linux/spinlock_types.h>
#include <linux/timerqueue.h>
struct kernel_siginfo;
diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h
index c0992a77feea..2bcf998da2a7 100644
--- a/include/linux/power_supply.h
+++ b/include/linux/power_supply.h
@@ -13,9 +13,9 @@
#define __LINUX_POWER_SUPPLY_H__
#include <linux/device.h>
-#include <linux/workqueue.h>
+#include <linux/workqueue_types.h>
#include <linux/leds.h>
-#include <linux/spinlock.h>
+#include <linux/spinlock_types.h>
#include <linux/notifier.h>
/*
diff --git a/include/linux/pruss_driver.h b/include/linux/pruss_driver.h
index c9a31c567e85..954c713fbf44 100644
--- a/include/linux/pruss_driver.h
+++ b/include/linux/pruss_driver.h
@@ -9,7 +9,7 @@
#ifndef _PRUSS_DRIVER_H_
#define _PRUSS_DRIVER_H_
-#include <linux/mutex.h>
+#include <linux/mutex_types.h>
#include <linux/remoteproc/pruss.h>
#include <linux/types.h>
#include <linux/err.h>
diff --git a/include/linux/psi_types.h b/include/linux/psi_types.h
index 7b1c9167f756..8af6452b36e2 100644
--- a/include/linux/psi_types.h
+++ b/include/linux/psi_types.h
@@ -3,7 +3,7 @@
#define _LINUX_PSI_TYPES_H
#include <linux/kthread.h>
-#include <linux/seqlock.h>
+#include <linux/seqlock_types.h>
#include <linux/types.h>
#include <linux/wait.h>
diff --git a/include/linux/pstore.h b/include/linux/pstore.h
index 638507a3c8ff..cc64b4df980f 100644
--- a/include/linux/pstore.h
+++ b/include/linux/pstore.h
@@ -13,8 +13,8 @@
#include <linux/compiler.h>
#include <linux/errno.h>
#include <linux/kmsg_dump.h>
-#include <linux/mutex.h>
-#include <linux/spinlock.h>
+#include <linux/mutex_types.h>
+#include <linux/spinlock_types.h>
#include <linux/time.h>
#include <linux/types.h>
diff --git a/include/linux/qed/qede_rdma.h b/include/linux/qed/qede_rdma.h
index 0d5564a59a59..4daca0b20edc 100644
--- a/include/linux/qed/qede_rdma.h
+++ b/include/linux/qed/qede_rdma.h
@@ -10,7 +10,7 @@
#include <linux/pci.h>
#include <linux/netdevice.h>
#include <linux/types.h>
-#include <linux/workqueue.h>
+#include <linux/workqueue_types.h>
struct qedr_dev;
struct qed_dev;
diff --git a/include/linux/quota.h b/include/linux/quota.h
index 72a2efc77fb5..bf16d9d2866c 100644
--- a/include/linux/quota.h
+++ b/include/linux/quota.h
@@ -33,9 +33,9 @@
#define _LINUX_QUOTA_
#include <linux/list.h>
-#include <linux/mutex.h>
+#include <linux/mutex_types.h>
#include <linux/rwsem.h>
-#include <linux/spinlock.h>
+#include <linux/spinlock_types.h>
#include <linux/percpu_counter.h>
#include <linux/dqblk_xfs.h>
@@ -43,7 +43,7 @@
#include <linux/dqblk_v2.h>
#include <linux/atomic.h>
-#include <linux/uidgid.h>
+#include <linux/uidgid_types.h>
#include <linux/projid.h>
#include <uapi/linux/quota.h>
diff --git a/include/linux/radix-tree.h b/include/linux/radix-tree.h
index eae67015ce51..231c526ec9b8 100644
--- a/include/linux/radix-tree.h
+++ b/include/linux/radix-tree.h
@@ -16,7 +16,6 @@
#include <linux/percpu.h>
#include <linux/preempt.h>
#include <linux/rcupdate.h>
-#include <linux/spinlock.h>
#include <linux/types.h>
#include <linux/xarray.h>
#include <linux/local_lock.h>
diff --git a/include/linux/raid/pq.h b/include/linux/raid/pq.h
index 98030accf641..58d2f9e8726e 100644
--- a/include/linux/raid/pq.h
+++ b/include/linux/raid/pq.h
@@ -10,7 +10,7 @@
#ifdef __KERNEL__
-#include <linux/blkdev.h>
+#include <linux/blk_types.h>
extern const char raid6_empty_zero_page[PAGE_SIZE];
diff --git a/include/linux/regmap.h b/include/linux/regmap.h
index f0938b59600a..e2fbb34bb33a 100644
--- a/include/linux/regmap.h
+++ b/include/linux/regmap.h
@@ -15,7 +15,7 @@
#include <linux/delay.h>
#include <linux/err.h>
#include <linux/bug.h>
-#include <linux/lockdep.h>
+#include <linux/lockdep_types.h>
#include <linux/iopoll.h>
#include <linux/fwnode.h>
diff --git a/include/linux/remoteproc.h b/include/linux/remoteproc.h
index a924a7d5b44a..b9576d956584 100644
--- a/include/linux/remoteproc.h
+++ b/include/linux/remoteproc.h
@@ -36,7 +36,7 @@
#define REMOTEPROC_H
#include <linux/types.h>
-#include <linux/mutex.h>
+#include <linux/mutex_types.h>
#include <linux/virtio.h>
#include <linux/cdev.h>
#include <linux/idr.h>
diff --git a/include/linux/resctrl.h b/include/linux/resctrl.h
index 66942d7fba7f..c62f0be16fa2 100644
--- a/include/linux/resctrl.h
+++ b/include/linux/resctrl.h
@@ -4,10 +4,13 @@
#include <linux/kernel.h>
#include <linux/list.h>
-#include <linux/pid.h>
#ifdef CONFIG_PROC_CPU_RESCTRL
+#include <linux/pid_types.h>
+
+struct pid;
+
int proc_resctrl_show(struct seq_file *m,
struct pid_namespace *ns,
struct pid *pid,
diff --git a/include/linux/reset/reset-simple.h b/include/linux/reset/reset-simple.h
index c3e44f45b0f7..9524a673707a 100644
--- a/include/linux/reset/reset-simple.h
+++ b/include/linux/reset/reset-simple.h
@@ -14,7 +14,7 @@
#include <linux/io.h>
#include <linux/reset-controller.h>
-#include <linux/spinlock.h>
+#include <linux/spinlock_types.h>
/**
* struct reset_simple_data - driver data for simple reset controllers
diff --git a/include/linux/rhashtable-types.h b/include/linux/rhashtable-types.h
index b6f3797277ff..154dfe4f0508 100644
--- a/include/linux/rhashtable-types.h
+++ b/include/linux/rhashtable-types.h
@@ -11,7 +11,7 @@
#include <linux/atomic.h>
#include <linux/compiler.h>
-#include <linux/mutex.h>
+#include <linux/mutex_types.h>
#include <linux/workqueue_types.h>
struct rhash_head {
diff --git a/include/linux/rpmsg.h b/include/linux/rpmsg.h
index 90d8e4475f80..cdc3574fd712 100644
--- a/include/linux/rpmsg.h
+++ b/include/linux/rpmsg.h
@@ -15,7 +15,7 @@
#include <linux/err.h>
#include <linux/mod_devicetable.h>
#include <linux/kref.h>
-#include <linux/mutex.h>
+#include <linux/mutex_types.h>
#include <linux/poll.h>
#include <linux/rpmsg/byteorder.h>
#include <uapi/linux/rpmsg.h>
diff --git a/include/linux/rslib.h b/include/linux/rslib.h
index a04dacbdc8ae..8278223e606f 100644
--- a/include/linux/rslib.h
+++ b/include/linux/rslib.h
@@ -11,7 +11,7 @@
#define _RSLIB_H_
#include <linux/types.h> /* for gfp_t */
-#include <linux/gfp.h> /* for GFP_KERNEL */
+#include <linux/gfp_types.h> /* for GFP_KERNEL */
/**
* struct rs_codec - rs codec data
diff --git a/include/linux/rtc.h b/include/linux/rtc.h
index 5f8e438a0312..98401e771e75 100644
--- a/include/linux/rtc.h
+++ b/include/linux/rtc.h
@@ -40,7 +40,7 @@ static inline time64_t rtc_tm_sub(struct rtc_time *lhs, struct rtc_time *rhs)
#include <linux/poll.h>
#include <linux/mutex.h>
#include <linux/timerqueue.h>
-#include <linux/workqueue.h>
+#include <linux/workqueue_types.h>
extern struct class *rtc_class;
diff --git a/include/linux/sched/signal.h b/include/linux/sched/signal.h
index 8a2d65337c48..0fe856628e60 100644
--- a/include/linux/sched/signal.h
+++ b/include/linux/sched/signal.h
@@ -11,7 +11,7 @@
#include <linux/cred.h>
#include <linux/refcount.h>
#include <linux/pid.h>
-#include <linux/posix-timers.h>
+#include <linux/posix-timers_types.h>
#include <linux/mm_types.h>
#include <asm/ptrace.h>
diff --git a/include/linux/sched/user.h b/include/linux/sched/user.h
index 4cc52698e214..671ecee08d23 100644
--- a/include/linux/sched/user.h
+++ b/include/linux/sched/user.h
@@ -2,11 +2,11 @@
#ifndef _LINUX_SCHED_USER_H
#define _LINUX_SCHED_USER_H
-#include <linux/uidgid.h>
+#include <linux/uidgid_types.h>
#include <linux/atomic.h>
#include <linux/percpu_counter.h>
#include <linux/refcount.h>
-#include <linux/ratelimit.h>
+#include <linux/ratelimit_types.h>
/*
* Some day this will be a full-fledged user tracking system..
diff --git a/include/linux/scs.h b/include/linux/scs.h
index 4ab5bdc898cf..3917d6919c99 100644
--- a/include/linux/scs.h
+++ b/include/linux/scs.h
@@ -8,7 +8,7 @@
#ifndef _LINUX_SCS_H
#define _LINUX_SCS_H
-#include <linux/gfp.h>
+#include <linux/gfp_types.h>
#include <linux/poison.h>
#include <linux/sched.h>
#include <linux/sizes.h>
diff --git a/include/linux/seq_file.h b/include/linux/seq_file.h
index 96d595cd7659..9e2e0076327d 100644
--- a/include/linux/seq_file.h
+++ b/include/linux/seq_file.h
@@ -6,7 +6,7 @@
#include <linux/string.h>
#include <linux/string_helpers.h>
#include <linux/bug.h>
-#include <linux/mutex.h>
+#include <linux/mutex_types.h>
#include <linux/cpumask.h>
#include <linux/fs.h>
#include <linux/cred.h>
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
index 536b2581d3e2..8246c0aae3be 100644
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -15,7 +15,6 @@
#include <linux/spinlock.h>
#include <linux/sched.h>
#include <linux/tty.h>
-#include <linux/mutex.h>
#include <linux/sysrq.h>
#include <uapi/linux/serial_core.h>
diff --git a/include/linux/serio.h b/include/linux/serio.h
index 6c27d413da92..c7b0bed2242e 100644
--- a/include/linux/serio.h
+++ b/include/linux/serio.h
@@ -10,7 +10,7 @@
#include <linux/interrupt.h>
#include <linux/list.h>
#include <linux/spinlock.h>
-#include <linux/mutex.h>
+#include <linux/mutex_types.h>
#include <linux/device.h>
#include <linux/mod_devicetable.h>
#include <uapi/linux/serio.h>
diff --git a/include/linux/slab.h b/include/linux/slab.h
index b9716534a678..63c8b1ce6133 100644
--- a/include/linux/slab.h
+++ b/include/linux/slab.h
@@ -13,7 +13,7 @@
#define _LINUX_SLAB_H
#include <linux/cache.h>
-#include <linux/gfp.h>
+#include <linux/gfp_types.h>
#include <linux/overflow.h>
#include <linux/types.h>
#include <linux/percpu-refcount.h>
diff --git a/include/linux/soc/qcom/apr.h b/include/linux/soc/qcom/apr.h
index be98aebcb3e1..5ca38308b088 100644
--- a/include/linux/soc/qcom/apr.h
+++ b/include/linux/soc/qcom/apr.h
@@ -3,7 +3,7 @@
#ifndef __QCOM_APR_H_
#define __QCOM_APR_H_
-#include <linux/spinlock.h>
+#include <linux/spinlock_types.h>
#include <linux/device.h>
#include <linux/mod_devicetable.h>
#include <dt-bindings/soc/qcom,apr.h>
diff --git a/include/linux/soc/qcom/qmi.h b/include/linux/soc/qcom/qmi.h
index 469e02d2aa0d..900c4b3540cc 100644
--- a/include/linux/soc/qcom/qmi.h
+++ b/include/linux/soc/qcom/qmi.h
@@ -11,7 +11,7 @@
#include <linux/list.h>
#include <linux/qrtr.h>
#include <linux/types.h>
-#include <linux/workqueue.h>
+#include <linux/workqueue_types.h>
struct socket;
diff --git a/include/linux/ssb/ssb.h b/include/linux/ssb/ssb.h
index 1f326da289d3..0b68aeed6c7a 100644
--- a/include/linux/ssb/ssb.h
+++ b/include/linux/ssb/ssb.h
@@ -5,7 +5,7 @@
#include <linux/device.h>
#include <linux/list.h>
#include <linux/types.h>
-#include <linux/spinlock.h>
+#include <linux/spinlock_types.h>
#include <linux/pci.h>
#include <linux/gpio/driver.h>
#include <linux/mod_devicetable.h>
diff --git a/include/linux/ssb/ssb_driver_gige.h b/include/linux/ssb/ssb_driver_gige.h
index 28c145a51e57..a45d5ab789b8 100644
--- a/include/linux/ssb/ssb_driver_gige.h
+++ b/include/linux/ssb/ssb_driver_gige.h
@@ -5,7 +5,7 @@
#include <linux/ssb/ssb.h>
#include <linux/bug.h>
#include <linux/pci.h>
-#include <linux/spinlock.h>
+#include <linux/spinlock_types.h>
#ifdef CONFIG_SSB_DRIVER_GIGE
diff --git a/include/linux/stackdepot.h b/include/linux/stackdepot.h
index a6aa21393755..13948903a8b1 100644
--- a/include/linux/stackdepot.h
+++ b/include/linux/stackdepot.h
@@ -20,7 +20,7 @@
#ifndef _LINUX_STACKDEPOT_H
#define _LINUX_STACKDEPOT_H
-#include <linux/gfp.h>
+#include <linux/gfp_types.h>
#include <linux/init.h>
typedef u32 depot_stack_handle_t;
diff --git a/include/linux/stat.h b/include/linux/stat.h
index 52150570d37a..a446d65f1082 100644
--- a/include/linux/stat.h
+++ b/include/linux/stat.h
@@ -17,7 +17,7 @@
#include <linux/types.h>
#include <linux/time.h>
-#include <linux/uidgid.h>
+#include <linux/uidgid_types.h>
struct kstat {
u32 result_mask; /* What fields the user got */
diff --git a/include/linux/sunrpc/auth_gss.h b/include/linux/sunrpc/auth_gss.h
index 43e481aa347a..4cb7ccf9a622 100644
--- a/include/linux/sunrpc/auth_gss.h
+++ b/include/linux/sunrpc/auth_gss.h
@@ -13,7 +13,7 @@
#ifndef _LINUX_SUNRPC_AUTH_GSS_H
#define _LINUX_SUNRPC_AUTH_GSS_H
-#include <linux/refcount.h>
+#include <linux/refcount_types.h>
#include <linux/sunrpc/auth.h>
#include <linux/sunrpc/svc.h>
#include <linux/sunrpc/gss_api.h>
diff --git a/include/linux/sunrpc/clnt.h b/include/linux/sunrpc/clnt.h
index 5e9d1469c6fa..182fa9c4f805 100644
--- a/include/linux/sunrpc/clnt.h
+++ b/include/linux/sunrpc/clnt.h
@@ -14,7 +14,7 @@
#include <linux/socket.h>
#include <linux/in.h>
#include <linux/in6.h>
-#include <linux/refcount.h>
+#include <linux/refcount_types.h>
#include <linux/sunrpc/msg_prot.h>
#include <linux/sunrpc/sched.h>
diff --git a/include/linux/sunrpc/metrics.h b/include/linux/sunrpc/metrics.h
index 6bfed383ed63..d4bc7fa5f5c1 100644
--- a/include/linux/sunrpc/metrics.h
+++ b/include/linux/sunrpc/metrics.h
@@ -27,7 +27,7 @@
#define _LINUX_SUNRPC_METRICS_H
#include <linux/ktime.h>
-#include <linux/spinlock.h>
+#include <linux/spinlock_types.h>
#define RPC_IOSTATS_VERS "1.1"
diff --git a/include/linux/sunrpc/sched.h b/include/linux/sunrpc/sched.h
index b568e439c6cf..17ffc4e981ff 100644
--- a/include/linux/sunrpc/sched.h
+++ b/include/linux/sunrpc/sched.h
@@ -12,9 +12,9 @@
#include <linux/ktime.h>
#include <linux/sunrpc/types.h>
-#include <linux/spinlock.h>
+#include <linux/spinlock_types.h>
#include <linux/wait_bit.h>
-#include <linux/workqueue.h>
+#include <linux/workqueue_types.h>
#include <linux/sunrpc/xdr.h>
/*
diff --git a/include/linux/sunrpc/types.h b/include/linux/sunrpc/types.h
index bd3c8e05632b..aedb29de774a 100644
--- a/include/linux/sunrpc/types.h
+++ b/include/linux/sunrpc/types.h
@@ -10,9 +10,9 @@
#ifndef _LINUX_SUNRPC_TYPES_H_
#define _LINUX_SUNRPC_TYPES_H_
-#include <linux/timer.h>
+#include <linux/timer_types.h>
#include <linux/sched/signal.h>
-#include <linux/workqueue.h>
+#include <linux/workqueue_types.h>
#include <linux/sunrpc/debug.h>
#include <linux/list.h>
diff --git a/include/linux/swait.h b/include/linux/swait.h
index 535637f3bf32..988ff0f0f84d 100644
--- a/include/linux/swait.h
+++ b/include/linux/swait.h
@@ -4,7 +4,7 @@
#include <linux/list.h>
#include <linux/stddef.h>
-#include <linux/spinlock.h>
+#include <linux/spinlock_types.h>
#include <asm/current.h>
/*
diff --git a/include/linux/swap.h b/include/linux/swap.h
index 41e4b484bc34..79528ac76492 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -2,7 +2,7 @@
#ifndef _LINUX_SWAP_H
#define _LINUX_SWAP_H
-#include <linux/spinlock.h>
+#include <linux/spinlock_types.h>
#include <linux/linkage.h>
#include <linux/mmzone.h>
#include <linux/list.h>
diff --git a/include/linux/swap_slots.h b/include/linux/swap_slots.h
index 15adfb8c813a..c17594871e29 100644
--- a/include/linux/swap_slots.h
+++ b/include/linux/swap_slots.h
@@ -3,8 +3,8 @@
#define _LINUX_SWAP_SLOTS_H
#include <linux/swap.h>
-#include <linux/spinlock.h>
-#include <linux/mutex.h>
+#include <linux/spinlock_types.h>
+#include <linux/mutex_types.h>
#define SWAP_SLOTS_CACHE_SIZE SWAP_BATCH
#define THRESHOLD_ACTIVATE_SWAP_SLOTS_CACHE (5*SWAP_SLOTS_CACHE_SIZE)
diff --git a/include/linux/swiotlb.h b/include/linux/swiotlb.h
index ecde0312dd52..c37473373649 100644
--- a/include/linux/swiotlb.h
+++ b/include/linux/swiotlb.h
@@ -7,8 +7,8 @@
#include <linux/init.h>
#include <linux/types.h>
#include <linux/limits.h>
-#include <linux/spinlock.h>
-#include <linux/workqueue.h>
+#include <linux/spinlock_types.h>
+#include <linux/workqueue_types.h>
struct device;
struct page;
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
index ee7d33b89e9e..4eb7751d485c 100644
--- a/include/linux/sysctl.h
+++ b/include/linux/sysctl.h
@@ -25,8 +25,8 @@
#include <linux/list.h>
#include <linux/rcupdate.h>
#include <linux/wait.h>
-#include <linux/rbtree.h>
-#include <linux/uidgid.h>
+#include <linux/rbtree_types.h>
+#include <linux/uidgid_types.h>
#include <uapi/linux/sysctl.h>
/* For the /proc/sys support */
diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h
index 601ff20acc20..34e29761d125 100644
--- a/include/linux/sysfs.h
+++ b/include/linux/sysfs.h
@@ -16,7 +16,7 @@
#include <linux/kernfs.h>
#include <linux/compiler.h>
#include <linux/list.h>
-#include <linux/lockdep.h>
+#include <linux/lockdep_types.h>
struct kobject;
struct module;
diff --git a/include/linux/thermal.h b/include/linux/thermal.h
index b7a3deb372fd..db474472e982 100644
--- a/include/linux/thermal.h
+++ b/include/linux/thermal.h
@@ -14,7 +14,7 @@
#include <linux/idr.h>
#include <linux/device.h>
#include <linux/sysfs.h>
-#include <linux/workqueue.h>
+#include <linux/workqueue_types.h>
#include <uapi/linux/thermal.h>
/* invalid cooling state */
diff --git a/include/linux/thunderbolt.h b/include/linux/thunderbolt.h
index 2c835e5c41f6..a001233b9359 100644
--- a/include/linux/thunderbolt.h
+++ b/include/linux/thunderbolt.h
@@ -18,7 +18,7 @@
#include <linux/mod_devicetable.h>
#include <linux/pci.h>
#include <linux/uuid.h>
-#include <linux/workqueue.h>
+#include <linux/workqueue_types.h>
enum tb_cfg_pkg_type {
TB_CFG_PKG_READ = 1,
diff --git a/include/linux/tifm.h b/include/linux/tifm.h
index 44073d06710f..7679cef63b5a 100644
--- a/include/linux/tifm.h
+++ b/include/linux/tifm.h
@@ -8,11 +8,11 @@
#ifndef _TIFM_H
#define _TIFM_H
-#include <linux/spinlock.h>
+#include <linux/spinlock_types.h>
#include <linux/interrupt.h>
#include <linux/delay.h>
#include <linux/pci.h>
-#include <linux/workqueue.h>
+#include <linux/workqueue_types.h>
/* Host registers (relative to pci base address): */
enum {
diff --git a/include/linux/tty.h b/include/linux/tty.h
index 8c76fd97d4ad..5a3815e7d73d 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -5,12 +5,12 @@
#include <linux/fs.h>
#include <linux/major.h>
#include <linux/termios.h>
-#include <linux/workqueue.h>
+#include <linux/workqueue_types.h>
#include <linux/tty_buffer.h>
#include <linux/tty_driver.h>
#include <linux/tty_ldisc.h>
#include <linux/tty_port.h>
-#include <linux/mutex.h>
+#include <linux/mutex_types.h>
#include <linux/tty_flags.h>
#include <uapi/linux/tty.h>
#include <linux/rwsem.h>
diff --git a/include/linux/tty_buffer.h b/include/linux/tty_buffer.h
index 31125e3be3c5..752bad9367b8 100644
--- a/include/linux/tty_buffer.h
+++ b/include/linux/tty_buffer.h
@@ -4,8 +4,8 @@
#include <linux/atomic.h>
#include <linux/llist.h>
-#include <linux/mutex.h>
-#include <linux/workqueue.h>
+#include <linux/mutex_types.h>
+#include <linux/workqueue_types.h>
struct tty_buffer {
union {
diff --git a/include/linux/tty_ldisc.h b/include/linux/tty_ldisc.h
index 3a6f70f2f41e..df79a9433ddd 100644
--- a/include/linux/tty_ldisc.h
+++ b/include/linux/tty_ldisc.h
@@ -7,7 +7,7 @@ struct tty_struct;
#include <linux/fs.h>
#include <linux/atomic.h>
#include <linux/list.h>
-#include <linux/lockdep.h>
+#include <linux/lockdep_types.h>
/*
* the semaphore definition
diff --git a/include/linux/tty_port.h b/include/linux/tty_port.h
index 1b861f2100b6..a76a5b6a5cf2 100644
--- a/include/linux/tty_port.h
+++ b/include/linux/tty_port.h
@@ -4,7 +4,7 @@
#include <linux/kfifo.h>
#include <linux/kref.h>
-#include <linux/mutex.h>
+#include <linux/mutex_types.h>
#include <linux/tty_buffer.h>
#include <linux/wait.h>
diff --git a/include/linux/umh.h b/include/linux/umh.h
index daa6a7048c11..d3693076b830 100644
--- a/include/linux/umh.h
+++ b/include/linux/umh.h
@@ -1,11 +1,11 @@
#ifndef __LINUX_UMH_H__
#define __LINUX_UMH_H__
-#include <linux/gfp.h>
+#include <linux/gfp_types.h>
#include <linux/stddef.h>
#include <linux/errno.h>
#include <linux/compiler.h>
-#include <linux/workqueue.h>
+#include <linux/workqueue_types.h>
#include <linux/sysctl.h>
struct cred;
diff --git a/include/linux/usb.h b/include/linux/usb.h
index 9e52179872a5..311a30c69a89 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -20,7 +20,7 @@
#include <linux/fs.h> /* for struct file_operations */
#include <linux/completion.h> /* for struct completion */
#include <linux/sched.h> /* for current && schedule_timeout */
-#include <linux/mutex.h> /* for struct mutex */
+#include <linux/mutex_types.h> /* for struct mutex */
#include <linux/pm_runtime.h> /* for runtime PM */
struct usb_device;
diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h
index a771ccc038ac..0d914c49fed3 100644
--- a/include/linux/usb/gadget.h
+++ b/include/linux/usb/gadget.h
@@ -23,7 +23,7 @@
#include <linux/slab.h>
#include <linux/scatterlist.h>
#include <linux/types.h>
-#include <linux/workqueue.h>
+#include <linux/workqueue_types.h>
#include <linux/usb/ch9.h>
#define UDC_TRACE_STR_MAX 512
diff --git a/include/linux/usb/ljca.h b/include/linux/usb/ljca.h
index 47661feda96c..9e6b05962c95 100644
--- a/include/linux/usb/ljca.h
+++ b/include/linux/usb/ljca.h
@@ -7,7 +7,7 @@
#include <linux/auxiliary_bus.h>
#include <linux/list.h>
-#include <linux/spinlock.h>
+#include <linux/spinlock_types.h>
#include <linux/types.h>
#define LJCA_MAX_GPIO_NUM 64
diff --git a/include/linux/usb/otg-fsm.h b/include/linux/usb/otg-fsm.h
index 6135d076c53d..c4adc146d754 100644
--- a/include/linux/usb/otg-fsm.h
+++ b/include/linux/usb/otg-fsm.h
@@ -6,7 +6,7 @@
#ifndef __LINUX_USB_OTG_FSM_H
#define __LINUX_USB_OTG_FSM_H
-#include <linux/mutex.h>
+#include <linux/mutex_types.h>
#include <linux/errno.h>
#define PROTO_UNDEF (0)
diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h
index 1a0a4dc87980..2d47c0ae9d64 100644
--- a/include/linux/usb/serial.h
+++ b/include/linux/usb/serial.h
@@ -10,7 +10,7 @@
#define __LINUX_USB_SERIAL_H
#include <linux/kref.h>
-#include <linux/mutex.h>
+#include <linux/mutex_types.h>
#include <linux/serial.h>
#include <linux/kfifo.h>
diff --git a/include/linux/user_namespace.h b/include/linux/user_namespace.h
index a9cee5a7b8af..7d0e3418d497 100644
--- a/include/linux/user_namespace.h
+++ b/include/linux/user_namespace.h
@@ -5,7 +5,7 @@
#include <linux/nsproxy.h>
#include <linux/ns_common.h>
#include <linux/sched.h>
-#include <linux/workqueue.h>
+#include <linux/workqueue_types.h>
#include <linux/rwsem.h>
#include <linux/sysctl.h>
#include <linux/err.h>
diff --git a/include/linux/vfio.h b/include/linux/vfio.h
index 89b265bc6ec3..e8959e50d44b 100644
--- a/include/linux/vfio.h
+++ b/include/linux/vfio.h
@@ -11,7 +11,7 @@
#include <linux/iommu.h>
#include <linux/mm.h>
-#include <linux/workqueue.h>
+#include <linux/workqueue_types.h>
#include <linux/poll.h>
#include <linux/cdev.h>
#include <uapi/linux/vfio.h>
diff --git a/include/linux/vfio_pci_core.h b/include/linux/vfio_pci_core.h
index a3075d00675a..92b00a151e5c 100644
--- a/include/linux/vfio_pci_core.h
+++ b/include/linux/vfio_pci_core.h
@@ -8,7 +8,7 @@
* Author: Tom Lyon, [email protected]
*/
-#include <linux/mutex.h>
+#include <linux/mutex_types.h>
#include <linux/pci.h>
#include <linux/vfio.h>
#include <linux/irqbypass.h>
diff --git a/include/linux/via-core.h b/include/linux/via-core.h
index 8737599b9148..0cb35d8f2527 100644
--- a/include/linux/via-core.h
+++ b/include/linux/via-core.h
@@ -10,7 +10,7 @@
#define __VIA_CORE_H__
#include <linux/types.h>
#include <linux/io.h>
-#include <linux/spinlock.h>
+#include <linux/spinlock_types.h>
#include <linux/pci.h>
/*
diff --git a/include/linux/virtio.h b/include/linux/virtio.h
index b0201747a263..a677e86a6305 100644
--- a/include/linux/virtio.h
+++ b/include/linux/virtio.h
@@ -5,10 +5,10 @@
* implementation. */
#include <linux/types.h>
#include <linux/scatterlist.h>
-#include <linux/spinlock.h>
+#include <linux/spinlock_types.h>
#include <linux/device.h>
#include <linux/mod_devicetable.h>
-#include <linux/gfp.h>
+#include <linux/gfp_types.h>
#include <linux/dma-mapping.h>
/**
diff --git a/include/linux/vmalloc.h b/include/linux/vmalloc.h
index 77054ddd7eac..7a76c86cca60 100644
--- a/include/linux/vmalloc.h
+++ b/include/linux/vmalloc.h
@@ -6,7 +6,7 @@
#include <linux/list.h>
#include <linux/llist.h>
#include <asm/page.h> /* pgprot_t */
-#include <linux/rbtree.h>
+#include <linux/rbtree_types.h>
#include <linux/overflow.h>
#include <asm/vmalloc.h>
diff --git a/include/linux/vmpressure.h b/include/linux/vmpressure.h
index 6a2f51ebbfd3..62e144fcce72 100644
--- a/include/linux/vmpressure.h
+++ b/include/linux/vmpressure.h
@@ -2,10 +2,10 @@
#ifndef __LINUX_VMPRESSURE_H
#define __LINUX_VMPRESSURE_H
-#include <linux/mutex.h>
+#include <linux/mutex_types.h>
#include <linux/list.h>
-#include <linux/workqueue.h>
-#include <linux/gfp.h>
+#include <linux/workqueue_types.h>
+#include <linux/gfp_types.h>
#include <linux/types.h>
#include <linux/cgroup.h>
#include <linux/eventfd.h>
diff --git a/include/linux/vmw_vmci_api.h b/include/linux/vmw_vmci_api.h
index f28907345c80..3a9112f68735 100644
--- a/include/linux/vmw_vmci_api.h
+++ b/include/linux/vmw_vmci_api.h
@@ -8,7 +8,7 @@
#ifndef __VMW_VMCI_API_H__
#define __VMW_VMCI_API_H__
-#include <linux/uidgid.h>
+#include <linux/uidgid_types.h>
#include <linux/vmw_vmci_defs.h>
#undef VMCI_KERNEL_API_VERSION
diff --git a/include/linux/xarray.h b/include/linux/xarray.h
index cb571dfcf4b1..0983c697648a 100644
--- a/include/linux/xarray.h
+++ b/include/linux/xarray.h
@@ -12,7 +12,7 @@
#include <linux/bitmap.h>
#include <linux/bug.h>
#include <linux/compiler.h>
-#include <linux/gfp.h>
+#include <linux/gfp_types.h>
#include <linux/kconfig.h>
#include <linux/kernel.h>
#include <linux/rcupdate.h>
diff --git a/include/media/dmxdev.h b/include/media/dmxdev.h
index 4f48ed5ceda7..f64a4ecb48ed 100644
--- a/include/media/dmxdev.h
+++ b/include/media/dmxdev.h
@@ -20,12 +20,12 @@
#define _DMXDEV_H_
#include <linux/types.h>
-#include <linux/spinlock.h>
+#include <linux/spinlock_types.h>
#include <linux/time.h>
-#include <linux/timer.h>
+#include <linux/timer_types.h>
#include <linux/fs.h>
#include <linux/string.h>
-#include <linux/mutex.h>
+#include <linux/mutex_types.h>
#include <linux/slab.h>
#include <linux/dvb/dmx.h>
diff --git a/include/media/drv-intf/saa7146.h b/include/media/drv-intf/saa7146.h
index 71ce63c99cb4..0e150676ec2e 100644
--- a/include/media/drv-intf/saa7146.h
+++ b/include/media/drv-intf/saa7146.h
@@ -11,7 +11,7 @@
#include <linux/i2c.h> /* for i2c subsystem */
#include <asm/io.h> /* for accessing devices */
#include <linux/stringify.h>
-#include <linux/mutex.h>
+#include <linux/mutex_types.h>
#include <linux/scatterlist.h>
#include <media/v4l2-device.h>
#include <media/v4l2-ctrls.h>
diff --git a/include/media/dvb_demux.h b/include/media/dvb_demux.h
index 8f90330274d5..c091699c70bc 100644
--- a/include/media/dvb_demux.h
+++ b/include/media/dvb_demux.h
@@ -20,8 +20,8 @@
#define _DVB_DEMUX_H_
#include <linux/time.h>
-#include <linux/spinlock.h>
-#include <linux/mutex.h>
+#include <linux/spinlock_types.h>
+#include <linux/mutex_types.h>
#include <media/demux.h>
diff --git a/include/media/dvb_frontend.h b/include/media/dvb_frontend.h
index e7c44870f20d..5f03e0ad04b8 100644
--- a/include/media/dvb_frontend.h
+++ b/include/media/dvb_frontend.h
@@ -39,7 +39,7 @@
#include <linux/module.h>
#include <linux/errno.h>
#include <linux/delay.h>
-#include <linux/mutex.h>
+#include <linux/mutex_types.h>
#include <linux/slab.h>
#include <linux/bitops.h>
diff --git a/include/media/dvb_ringbuffer.h b/include/media/dvb_ringbuffer.h
index 029c8b615e49..131997d1f131 100644
--- a/include/media/dvb_ringbuffer.h
+++ b/include/media/dvb_ringbuffer.h
@@ -23,7 +23,7 @@
#ifndef _DVB_RINGBUFFER_H_
#define _DVB_RINGBUFFER_H_
-#include <linux/spinlock.h>
+#include <linux/spinlock_types.h>
#include <linux/wait.h>
/**
diff --git a/include/media/dvb_vb2.h b/include/media/dvb_vb2.h
index 8cb88452cd6c..d9e6cf91521d 100644
--- a/include/media/dvb_vb2.h
+++ b/include/media/dvb_vb2.h
@@ -15,7 +15,7 @@
#ifndef _DVB_VB2_H
#define _DVB_VB2_H
-#include <linux/mutex.h>
+#include <linux/mutex_types.h>
#include <linux/poll.h>
#include <linux/dvb/dmx.h>
#include <media/videobuf2-core.h>
diff --git a/include/media/i2c/adp1653.h b/include/media/i2c/adp1653.h
index 096de9130da8..6b2542da4162 100644
--- a/include/media/i2c/adp1653.h
+++ b/include/media/i2c/adp1653.h
@@ -15,7 +15,7 @@
#define ADP1653_H
#include <linux/i2c.h>
-#include <linux/mutex.h>
+#include <linux/mutex_types.h>
#include <linux/videodev2.h>
#include <media/v4l2-ctrls.h>
#include <media/v4l2-subdev.h>
diff --git a/include/media/media-device.h b/include/media/media-device.h
index b1b5b6dac4ff..0866de60e5b5 100644
--- a/include/media/media-device.h
+++ b/include/media/media-device.h
@@ -13,7 +13,7 @@
#include <linux/idr.h> // for struct ida
#include <linux/list.h>
-#include <linux/mutex.h>
+#include <linux/mutex_types.h>
#include <linux/pci.h>
#include <linux/platform_device.h>
diff --git a/include/media/rc-core.h b/include/media/rc-core.h
index eabb19016fec..106fe85ee777 100644
--- a/include/media/rc-core.h
+++ b/include/media/rc-core.h
@@ -8,7 +8,7 @@
#ifndef _RC_CORE
#define _RC_CORE
-#include <linux/spinlock.h>
+#include <linux/spinlock_types.h>
#include <linux/cdev.h>
#include <linux/kfifo.h>
#include <linux/time.h>
diff --git a/include/media/v4l2-dev.h b/include/media/v4l2-dev.h
index d82dfdbf6e58..cd9f633bf351 100644
--- a/include/media/v4l2-dev.h
+++ b/include/media/v4l2-dev.h
@@ -14,7 +14,7 @@
#include <linux/fs.h>
#include <linux/device.h>
#include <linux/cdev.h>
-#include <linux/mutex.h>
+#include <linux/mutex_types.h>
#include <linux/videodev2.h>
#include <media/media-entity.h>
diff --git a/include/media/videobuf2-core.h b/include/media/videobuf2-core.h
index 56719a26a46c..81005326d480 100644
--- a/include/media/videobuf2-core.h
+++ b/include/media/videobuf2-core.h
@@ -13,7 +13,7 @@
#define _MEDIA_VIDEOBUF2_CORE_H
#include <linux/mm_types.h>
-#include <linux/mutex.h>
+#include <linux/mutex_types.h>
#include <linux/poll.h>
#include <linux/dma-buf.h>
#include <linux/bitops.h>
diff --git a/include/net/af_unix.h b/include/net/af_unix.h
index f045bbd9017d..5b29b3d44614 100644
--- a/include/net/af_unix.h
+++ b/include/net/af_unix.h
@@ -4,8 +4,8 @@
#include <linux/socket.h>
#include <linux/un.h>
-#include <linux/mutex.h>
-#include <linux/refcount.h>
+#include <linux/mutex_types.h>
+#include <linux/refcount_types.h>
#include <net/sock.h>
#if IS_ENABLED(CONFIG_UNIX)
diff --git a/include/net/af_vsock.h b/include/net/af_vsock.h
index 535701efc1e5..7eca98931e25 100644
--- a/include/net/af_vsock.h
+++ b/include/net/af_vsock.h
@@ -9,7 +9,7 @@
#define __AF_VSOCK_H__
#include <linux/kernel.h>
-#include <linux/workqueue.h>
+#include <linux/workqueue_types.h>
#include <net/sock.h>
#include <uapi/linux/vm_sockets.h>
diff --git a/include/net/atmclip.h b/include/net/atmclip.h
index 70e350e0db3d..e2549b61f707 100644
--- a/include/net/atmclip.h
+++ b/include/net/atmclip.h
@@ -11,7 +11,7 @@
#include <linux/atm.h>
#include <linux/atmdev.h>
#include <linux/atmarp.h>
-#include <linux/spinlock.h>
+#include <linux/spinlock_types.h>
#include <net/neighbour.h>
diff --git a/include/net/ax25.h b/include/net/ax25.h
index 8c5d4698cf29..a57271b1ba7b 100644
--- a/include/net/ax25.h
+++ b/include/net/ax25.h
@@ -8,8 +8,8 @@
#define _AX25_H
#include <linux/ax25.h>
-#include <linux/spinlock.h>
-#include <linux/timer.h>
+#include <linux/spinlock_types.h>
+#include <linux/timer_types.h>
#include <linux/list.h>
#include <linux/slab.h>
#include <linux/refcount.h>
diff --git a/include/net/cfg802154.h b/include/net/cfg802154.h
index cd95711b12b8..7d5fb857ce96 100644
--- a/include/net/cfg802154.h
+++ b/include/net/cfg802154.h
@@ -11,7 +11,7 @@
#include <linux/ieee802154.h>
#include <linux/netdevice.h>
-#include <linux/spinlock.h>
+#include <linux/spinlock_types.h>
#include <linux/bug.h>
#include <net/nl802154.h>
diff --git a/include/net/devlink.h b/include/net/devlink.h
index 7905d55ed0d4..2a41f07cf84c 100644
--- a/include/net/devlink.h
+++ b/include/net/devlink.h
@@ -8,12 +8,12 @@
#define _NET_DEVLINK_H_
#include <linux/slab.h>
-#include <linux/gfp.h>
+#include <linux/gfp_types.h>
#include <linux/list.h>
#include <linux/netdevice.h>
-#include <linux/spinlock.h>
-#include <linux/workqueue.h>
-#include <linux/refcount.h>
+#include <linux/spinlock_types.h>
+#include <linux/workqueue_types.h>
+#include <linux/refcount_types.h>
#include <net/net_namespace.h>
#include <net/flow_offload.h>
#include <uapi/linux/devlink.h>
diff --git a/include/net/dst.h b/include/net/dst.h
index f5dfc8fb7b37..dadabbd7d087 100644
--- a/include/net/dst.h
+++ b/include/net/dst.h
@@ -15,7 +15,7 @@
#include <linux/rcupdate.h>
#include <linux/bug.h>
#include <linux/jiffies.h>
-#include <linux/refcount.h>
+#include <linux/refcount_types.h>
#include <linux/rcuref.h>
#include <net/neighbour.h>
#include <asm/processor.h>
diff --git a/include/net/flow.h b/include/net/flow.h
index 335bbc52171c..836ef37c85de 100644
--- a/include/net/flow.h
+++ b/include/net/flow.h
@@ -11,7 +11,7 @@
#include <linux/in6.h>
#include <linux/atomic.h>
#include <linux/container_of.h>
-#include <linux/uidgid.h>
+#include <linux/uidgid_types.h>
struct flow_keys;
diff --git a/include/net/fq.h b/include/net/fq.h
index 99fbe4127b95..c8d44ae1cb65 100644
--- a/include/net/fq.h
+++ b/include/net/fq.h
@@ -8,7 +8,7 @@
#define __NET_SCHED_FQ_H
#include <linux/skbuff.h>
-#include <linux/spinlock.h>
+#include <linux/spinlock_types.h>
#include <linux/types.h>
struct fq_tin;
diff --git a/include/net/hwbm.h b/include/net/hwbm.h
index aa495decec35..7352b01c100d 100644
--- a/include/net/hwbm.h
+++ b/include/net/hwbm.h
@@ -2,7 +2,7 @@
#ifndef _HWBM_H
#define _HWBM_H
-#include <linux/mutex.h>
+#include <linux/mutex_types.h>
struct hwbm_pool {
/* Capacity of the pool */
diff --git a/include/net/inet_connection_sock.h b/include/net/inet_connection_sock.h
index 9ab4bf704e86..4e62121e1cb6 100644
--- a/include/net/inet_connection_sock.h
+++ b/include/net/inet_connection_sock.h
@@ -13,7 +13,7 @@
#include <linux/compiler.h>
#include <linux/string.h>
-#include <linux/timer.h>
+#include <linux/timer_types.h>
#include <linux/poll.h>
#include <linux/kernel.h>
#include <linux/sockptr.h>
diff --git a/include/net/inet_hashtables.h b/include/net/inet_hashtables.h
index 5c69fcd3e80e..63fb7bcbda92 100644
--- a/include/net/inet_hashtables.h
+++ b/include/net/inet_hashtables.h
@@ -17,7 +17,7 @@
#include <linux/list.h>
#include <linux/slab.h>
#include <linux/socket.h>
-#include <linux/spinlock.h>
+#include <linux/spinlock_types.h>
#include <linux/types.h>
#include <net/inet_connection_sock.h>
diff --git a/include/net/inet_timewait_sock.h b/include/net/inet_timewait_sock.h
index b7f313b277ea..b2fb3a0851c9 100644
--- a/include/net/inet_timewait_sock.h
+++ b/include/net/inet_timewait_sock.h
@@ -12,7 +12,7 @@
#define _INET_TIMEWAIT_SOCK_
#include <linux/list.h>
-#include <linux/timer.h>
+#include <linux/timer_types.h>
#include <linux/types.h>
#include <net/inet_sock.h>
diff --git a/include/net/ip6_fib.h b/include/net/ip6_fib.h
index 360b12e61850..c961bab02f02 100644
--- a/include/net/ip6_fib.h
+++ b/include/net/ip6_fib.h
@@ -11,7 +11,7 @@
#include <linux/ipv6_route.h>
#include <linux/rtnetlink.h>
-#include <linux/spinlock.h>
+#include <linux/spinlock_types.h>
#include <linux/notifier.h>
#include <net/dst.h>
#include <net/flow.h>
diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h
index ff406ef4fd4a..516586a7eeea 100644
--- a/include/net/ip_vs.h
+++ b/include/net/ip_vs.h
@@ -11,13 +11,13 @@
#include <asm/types.h> /* for __uXX types */
#include <linux/list.h> /* for struct list_head */
-#include <linux/spinlock.h> /* for struct rwlock_t */
+#include <linux/spinlock_types.h> /* for struct rwlock_t */
#include <linux/atomic.h> /* for struct atomic_t */
-#include <linux/refcount.h> /* for struct refcount_t */
+#include <linux/refcount_types.h> /* for struct refcount_t */
#include <linux/workqueue.h>
#include <linux/compiler.h>
-#include <linux/timer.h>
+#include <linux/timer_types.h>
#include <linux/bug.h>
#include <net/checksum.h>
diff --git a/include/net/lib80211.h b/include/net/lib80211.h
index 973049cb0453..308a352be51f 100644
--- a/include/net/lib80211.h
+++ b/include/net/lib80211.h
@@ -30,7 +30,7 @@
#include <linux/if.h>
#include <linux/skbuff.h>
#include <linux/ieee80211.h>
-#include <linux/timer.h>
+#include <linux/timer_types.h>
struct seq_file;
diff --git a/include/net/llc.h b/include/net/llc.h
index e250dca03963..3fc0c5ac053f 100644
--- a/include/net/llc.h
+++ b/include/net/llc.h
@@ -15,7 +15,7 @@
#include <linux/if.h>
#include <linux/if_ether.h>
#include <linux/list.h>
-#include <linux/spinlock.h>
+#include <linux/spinlock_types.h>
#include <linux/rculist_nulls.h>
#include <linux/hash.h>
#include <linux/jhash.h>
diff --git a/include/net/llc_conn.h b/include/net/llc_conn.h
index 374411b3066c..03843a4738bf 100644
--- a/include/net/llc_conn.h
+++ b/include/net/llc_conn.h
@@ -11,7 +11,7 @@
*
* See the GNU General Public License for more details.
*/
-#include <linux/timer.h>
+#include <linux/timer_types.h>
#include <net/llc_if.h>
#include <net/sock.h>
#include <linux/llc.h>
diff --git a/include/net/neighbour.h b/include/net/neighbour.h
index 1197433b3315..2f712abacb09 100644
--- a/include/net/neighbour.h
+++ b/include/net/neighbour.h
@@ -26,7 +26,7 @@
#include <linux/err.h>
#include <linux/sysctl.h>
-#include <linux/workqueue.h>
+#include <linux/workqueue_types.h>
#include <net/rtnetlink.h>
struct seq_file;
diff --git a/include/net/netfilter/nf_conntrack_count.h b/include/net/netfilter/nf_conntrack_count.h
index e227d997fc71..5dab047e14b2 100644
--- a/include/net/netfilter/nf_conntrack_count.h
+++ b/include/net/netfilter/nf_conntrack_count.h
@@ -2,7 +2,7 @@
#define _NF_CONNTRACK_COUNT_H
#include <linux/list.h>
-#include <linux/spinlock.h>
+#include <linux/spinlock_types.h>
#include <net/netfilter/nf_conntrack_tuple.h>
#include <net/netfilter/nf_conntrack_zones.h>
diff --git a/include/net/netns/can.h b/include/net/netns/can.h
index 48b79f7e6236..f734fe7d5a1c 100644
--- a/include/net/netns/can.h
+++ b/include/net/netns/can.h
@@ -6,8 +6,8 @@
#ifndef __NETNS_CAN_H__
#define __NETNS_CAN_H__
-#include <linux/spinlock.h>
-#include <linux/timer.h>
+#include <linux/spinlock_types.h>
+#include <linux/timer_types.h>
struct can_dev_rcv_lists;
struct can_pkg_stats;
diff --git a/include/net/netns/conntrack.h b/include/net/netns/conntrack.h
index e2caf55de629..337381866371 100644
--- a/include/net/netns/conntrack.h
+++ b/include/net/netns/conntrack.h
@@ -12,7 +12,6 @@
#ifdef CONFIG_NF_CT_PROTO_SCTP
#include <linux/netfilter/nf_conntrack_sctp.h>
#endif
-#include <linux/seqlock.h>
struct ctl_table_header;
struct nf_conntrack_ecache;
diff --git a/include/net/netns/ipv4.h b/include/net/netns/ipv4.h
index c356c458b340..1794406d0b84 100644
--- a/include/net/netns/ipv4.h
+++ b/include/net/netns/ipv4.h
@@ -6,10 +6,10 @@
#ifndef __NETNS_IPV4_H__
#define __NETNS_IPV4_H__
-#include <linux/uidgid.h>
+#include <linux/uidgid_types.h>
#include <net/inet_frag.h>
#include <linux/rcupdate.h>
-#include <linux/seqlock.h>
+#include <linux/seqlock_types.h>
#include <linux/siphash.h>
struct ctl_table_header;
diff --git a/include/net/netns/mctp.h b/include/net/netns/mctp.h
index 6c5039374021..553a610bc29d 100644
--- a/include/net/netns/mctp.h
+++ b/include/net/netns/mctp.h
@@ -7,7 +7,7 @@
#define __NETNS_MCTP_H__
#include <linux/list.h>
-#include <linux/mutex.h>
+#include <linux/mutex_types.h>
#include <linux/types.h>
struct netns_mctp {
diff --git a/include/net/netns/nexthop.h b/include/net/netns/nexthop.h
index 434239b37014..a1b4587af203 100644
--- a/include/net/netns/nexthop.h
+++ b/include/net/netns/nexthop.h
@@ -7,7 +7,7 @@
#define __NETNS_NEXTHOP_H__
#include <linux/notifier.h>
-#include <linux/rbtree.h>
+#include <linux/rbtree_types.h>
struct netns_nexthop {
struct rb_root rb_root; /* tree of nexthops by id */
diff --git a/include/net/netns/packet.h b/include/net/netns/packet.h
index aae69bb43cde..babbcff61771 100644
--- a/include/net/netns/packet.h
+++ b/include/net/netns/packet.h
@@ -6,7 +6,7 @@
#define __NETNS_PACKET_H__
#include <linux/rculist.h>
-#include <linux/mutex.h>
+#include <linux/mutex_types.h>
struct netns_packet {
struct mutex sklist_lock;
diff --git a/include/net/netns/sctp.h b/include/net/netns/sctp.h
index 7eff3d981b89..5f23768e26e5 100644
--- a/include/net/netns/sctp.h
+++ b/include/net/netns/sctp.h
@@ -2,7 +2,7 @@
#ifndef __NETNS_SCTP_H__
#define __NETNS_SCTP_H__
-#include <linux/timer.h>
+#include <linux/timer_types.h>
#include <net/snmp.h>
struct sock;
diff --git a/include/net/netns/smc.h b/include/net/netns/smc.h
index fc752a50f91b..ef019b1c3b8b 100644
--- a/include/net/netns/smc.h
+++ b/include/net/netns/smc.h
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0 */
#ifndef __NETNS_SMC_H__
#define __NETNS_SMC_H__
-#include <linux/mutex.h>
+#include <linux/mutex_types.h>
#include <linux/percpu.h>
struct smc_stats_rsn;
diff --git a/include/net/netns/unix.h b/include/net/netns/unix.h
index 9859d134d5a8..d5f85c9d7dc7 100644
--- a/include/net/netns/unix.h
+++ b/include/net/netns/unix.h
@@ -5,7 +5,7 @@
#ifndef __NETNS_UNIX_H__
#define __NETNS_UNIX_H__
-#include <linux/spinlock.h>
+#include <linux/spinlock_types.h>
struct unix_table {
spinlock_t *locks;
diff --git a/include/net/netns/xdp.h b/include/net/netns/xdp.h
index 06d06cf2b966..412312dbb2fb 100644
--- a/include/net/netns/xdp.h
+++ b/include/net/netns/xdp.h
@@ -3,7 +3,7 @@
#define __NETNS_XDP_H__
#include <linux/list.h>
-#include <linux/mutex.h>
+#include <linux/mutex_types.h>
#include <linux/types.h>
struct netns_xdp {
diff --git a/include/net/netns/xfrm.h b/include/net/netns/xfrm.h
index 79d382d72ede..8229a19f678c 100644
--- a/include/net/netns/xfrm.h
+++ b/include/net/netns/xfrm.h
@@ -3,7 +3,7 @@
#define __NETNS_XFRM_H
#include <linux/list.h>
-#include <linux/workqueue.h>
+#include <linux/workqueue_types.h>
#include <linux/rhashtable-types.h>
#include <linux/xfrm.h>
#include <net/dst_ops.h>
diff --git a/include/net/phonet/pn_dev.h b/include/net/phonet/pn_dev.h
index e9dc8dca5817..0539fe45207a 100644
--- a/include/net/phonet/pn_dev.h
+++ b/include/net/phonet/pn_dev.h
@@ -11,7 +11,7 @@
#define PN_DEV_H
#include <linux/list.h>
-#include <linux/mutex.h>
+#include <linux/mutex_types.h>
struct net;
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
index da96e966c807..bab44a435a62 100644
--- a/include/net/sch_generic.h
+++ b/include/net/sch_generic.h
@@ -11,7 +11,7 @@
#include <linux/dynamic_queue_limits.h>
#include <linux/list.h>
#include <linux/refcount.h>
-#include <linux/mutex.h>
+#include <linux/mutex_types.h>
#include <linux/rwsem.h>
#include <linux/atomic.h>
#include <linux/hashtable.h>
diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h
index a2310fa995f6..fa4e4861ba8b 100644
--- a/include/net/sctp/sctp.h
+++ b/include/net/sctp/sctp.h
@@ -45,7 +45,7 @@
#include <linux/in.h>
#include <linux/tty.h>
#include <linux/proc_fs.h>
-#include <linux/spinlock.h>
+#include <linux/spinlock_types.h>
#include <linux/jiffies.h>
#include <linux/idr.h>
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h
index 5a24d6d8522a..5ce02259dfd9 100644
--- a/include/net/sctp/structs.h
+++ b/include/net/sctp/structs.h
@@ -42,7 +42,7 @@
#include <asm/param.h> /* We get MAXHOSTNAMELEN. */
#include <linux/atomic.h> /* This gets us atomic counters. */
#include <linux/skbuff.h> /* We need sk_buff_head. */
-#include <linux/workqueue.h> /* We need tq_struct. */
+#include <linux/workqueue_types.h> /* We need tq_struct. */
#include <linux/sctp.h> /* We need sctp* header structs. */
#include <net/sctp/auth.h> /* We need auth specific structs */
#include <net/ip.h> /* For inet_skb_parm */
diff --git a/include/net/smc.h b/include/net/smc.h
index da590f95811e..44a01bd3da10 100644
--- a/include/net/smc.h
+++ b/include/net/smc.h
@@ -11,7 +11,7 @@
#ifndef _SMC_H
#define _SMC_H
-#include <linux/spinlock.h>
+#include <linux/spinlock_types.h>
#include <linux/types.h>
#include <linux/wait.h>
#include "linux/ism.h"
diff --git a/include/net/sock.h b/include/net/sock.h
index a9d99a9c583f..bebdc45cf622 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -39,7 +39,7 @@
#include <linux/kernel.h>
#include <linux/list.h>
#include <linux/list_nulls.h>
-#include <linux/timer.h>
+#include <linux/timer_types.h>
#include <linux/cache.h>
#include <linux/bitops.h>
#include <linux/lockdep.h>
@@ -55,7 +55,7 @@
#include <linux/sched.h>
#include <linux/wait.h>
#include <linux/cgroup-defs.h>
-#include <linux/rbtree.h>
+#include <linux/rbtree_types.h>
#include <linux/rculist_nulls.h>
#include <linux/poll.h>
#include <linux/sockptr.h>
diff --git a/include/net/sock_reuseport.h b/include/net/sock_reuseport.h
index 6ec140b0a61b..f7e324bdbb1b 100644
--- a/include/net/sock_reuseport.h
+++ b/include/net/sock_reuseport.h
@@ -5,7 +5,7 @@
#include <linux/filter.h>
#include <linux/skbuff.h>
#include <linux/types.h>
-#include <linux/spinlock.h>
+#include <linux/spinlock_types.h>
#include <net/sock.h>
extern spinlock_t reuseport_lock;
diff --git a/include/net/tls.h b/include/net/tls.h
index 962f0c501111..816b9978bcdc 100644
--- a/include/net/tls.h
+++ b/include/net/tls.h
@@ -39,7 +39,7 @@
#include <linux/crypto.h>
#include <linux/socket.h>
#include <linux/tcp.h>
-#include <linux/mutex.h>
+#include <linux/mutex_types.h>
#include <linux/netdevice.h>
#include <linux/rcupdate.h>
diff --git a/include/net/xdp_sock.h b/include/net/xdp_sock.h
index 3cb4dc9bd70e..cdb0fcce3b89 100644
--- a/include/net/xdp_sock.h
+++ b/include/net/xdp_sock.h
@@ -7,10 +7,10 @@
#define _LINUX_XDP_SOCK_H
#include <linux/bpf.h>
-#include <linux/workqueue.h>
+#include <linux/workqueue_types.h>
#include <linux/if_xdp.h>
-#include <linux/mutex.h>
-#include <linux/spinlock.h>
+#include <linux/mutex_types.h>
+#include <linux/spinlock_types.h>
#include <linux/mm.h>
#include <net/sock.h>
diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index 21d4f49cd83f..21beecf0d281 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -4,7 +4,7 @@
#include <linux/compiler.h>
#include <linux/xfrm.h>
-#include <linux/spinlock.h>
+#include <linux/spinlock_types.h>
#include <linux/list.h>
#include <linux/skbuff.h>
#include <linux/socket.h>
diff --git a/include/pcmcia/ss.h b/include/pcmcia/ss.h
index 7cf7dbbfa131..694e5ae0f245 100644
--- a/include/pcmcia/ss.h
+++ b/include/pcmcia/ss.h
@@ -14,7 +14,7 @@
#include <linux/device.h>
#include <linux/sched.h> /* task_struct, completion */
-#include <linux/mutex.h>
+#include <linux/mutex_types.h>
#ifdef CONFIG_CARDBUS
#include <linux/pci.h>
diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
index b7b6b58dd348..3800bb8b9c14 100644
--- a/include/rdma/ib_verbs.h
+++ b/include/rdma/ib_verbs.h
@@ -19,7 +19,7 @@
#include <linux/kref.h>
#include <linux/list.h>
#include <linux/rwsem.h>
-#include <linux/workqueue.h>
+#include <linux/workqueue_types.h>
#include <linux/irq_poll.h>
#include <uapi/linux/if_ether.h>
#include <net/ipv6.h>
diff --git a/include/rdma/rdma_counter.h b/include/rdma/rdma_counter.h
index 45d5481a7846..5da9a9918d62 100644
--- a/include/rdma/rdma_counter.h
+++ b/include/rdma/rdma_counter.h
@@ -6,7 +6,7 @@
#ifndef _RDMA_COUNTER_H_
#define _RDMA_COUNTER_H_
-#include <linux/mutex.h>
+#include <linux/mutex_types.h>
#include <linux/pid_namespace.h>
#include <rdma/restrack.h>
diff --git a/include/rdma/rdma_vt.h b/include/rdma/rdma_vt.h
index c429d6ddb129..5f8ec8cafa90 100644
--- a/include/rdma/rdma_vt.h
+++ b/include/rdma/rdma_vt.h
@@ -11,7 +11,7 @@
* rdmavt layer.
*/
-#include <linux/spinlock.h>
+#include <linux/spinlock_types.h>
#include <linux/list.h>
#include <linux/hash.h>
#include <rdma/ib_verbs.h>
diff --git a/include/scsi/libfc.h b/include/scsi/libfc.h
index eca6fd42d7f7..f0ba69c853ee 100644
--- a/include/scsi/libfc.h
+++ b/include/scsi/libfc.h
@@ -8,7 +8,7 @@
#ifndef _LIBFC_H_
#define _LIBFC_H_
-#include <linux/timer.h>
+#include <linux/timer_types.h>
#include <linux/if.h>
#include <linux/percpu.h>
#include <linux/refcount.h>
diff --git a/include/scsi/libfcoe.h b/include/scsi/libfcoe.h
index 8300ef1a982e..f62c686ab43c 100644
--- a/include/scsi/libfcoe.h
+++ b/include/scsi/libfcoe.h
@@ -13,7 +13,7 @@
#include <linux/if_ether.h>
#include <linux/netdevice.h>
#include <linux/skbuff.h>
-#include <linux/workqueue.h>
+#include <linux/workqueue_types.h>
#include <linux/local_lock.h>
#include <linux/random.h>
#include <scsi/fc/fc_fcoe.h>
diff --git a/include/scsi/libiscsi.h b/include/scsi/libiscsi.h
index 7282555adfd5..01f13729ad24 100644
--- a/include/scsi/libiscsi.h
+++ b/include/scsi/libiscsi.h
@@ -12,9 +12,9 @@
#include <linux/types.h>
#include <linux/wait.h>
-#include <linux/mutex.h>
-#include <linux/timer.h>
-#include <linux/workqueue.h>
+#include <linux/mutex_types.h>
+#include <linux/timer_types.h>
+#include <linux/workqueue_types.h>
#include <linux/kfifo.h>
#include <linux/refcount.h>
#include <scsi/iscsi_proto.h>
diff --git a/include/scsi/libsas.h b/include/scsi/libsas.h
index f5257103fdb6..943b850a5981 100644
--- a/include/scsi/libsas.h
+++ b/include/scsi/libsas.h
@@ -10,7 +10,7 @@
#define _LIBSAS_H_
-#include <linux/timer.h>
+#include <linux/timer_types.h>
#include <linux/pci.h>
#include <scsi/sas.h>
#include <linux/libata.h>
diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h
index b1569693da53..810bd80b4f2c 100644
--- a/include/scsi/scsi_cmnd.h
+++ b/include/scsi/scsi_cmnd.h
@@ -3,7 +3,7 @@
#define _SCSI_SCSI_CMND_H
#include <linux/dma-mapping.h>
-#include <linux/blkdev.h>
+#include <linux/blk_types.h>
#include <linux/t10-pi.h>
#include <linux/list.h>
#include <linux/types.h>
diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h
index 4dceabb9dbe1..c70aafd415b5 100644
--- a/include/scsi/scsi_device.h
+++ b/include/scsi/scsi_device.h
@@ -3,8 +3,8 @@
#define _SCSI_SCSI_DEVICE_H
#include <linux/list.h>
-#include <linux/spinlock.h>
-#include <linux/workqueue.h>
+#include <linux/spinlock_types.h>
+#include <linux/workqueue_types.h>
#include <linux/blk-mq.h>
#include <scsi/scsi.h>
#include <linux/atomic.h>
diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h
index 2e6aaee6042d..7a05536ea238 100644
--- a/include/scsi/scsi_host.h
+++ b/include/scsi/scsi_host.h
@@ -5,8 +5,8 @@
#include <linux/device.h>
#include <linux/list.h>
#include <linux/types.h>
-#include <linux/workqueue.h>
-#include <linux/mutex.h>
+#include <linux/workqueue_types.h>
+#include <linux/mutex_types.h>
#include <linux/seq_file.h>
#include <linux/blk-mq.h>
#include <scsi/scsi.h>
diff --git a/include/scsi/scsi_tcq.h b/include/scsi/scsi_tcq.h
index ea7848e74d25..ad7ba7fa465f 100644
--- a/include/scsi/scsi_tcq.h
+++ b/include/scsi/scsi_tcq.h
@@ -2,7 +2,7 @@
#ifndef _SCSI_SCSI_TCQ_H
#define _SCSI_SCSI_TCQ_H
-#include <linux/blkdev.h>
+#include <linux/blk_types.h>
#include <scsi/scsi_cmnd.h>
#include <scsi/scsi_device.h>
#include <scsi/scsi_host.h>
diff --git a/include/scsi/scsi_transport.h b/include/scsi/scsi_transport.h
index a0458bda3148..f417e402cfa7 100644
--- a/include/scsi/scsi_transport.h
+++ b/include/scsi/scsi_transport.h
@@ -8,7 +8,7 @@
#define SCSI_TRANSPORT_H
#include <linux/transport_class.h>
-#include <linux/blkdev.h>
+#include <linux/blk_types.h>
#include <linux/bug.h>
#include <scsi/scsi_host.h>
#include <scsi/scsi_device.h>
diff --git a/include/scsi/scsi_transport_iscsi.h b/include/scsi/scsi_transport_iscsi.h
index fb3399e4cd29..ea2c9da4c05e 100644
--- a/include/scsi/scsi_transport_iscsi.h
+++ b/include/scsi/scsi_transport_iscsi.h
@@ -12,7 +12,7 @@
#include <linux/device.h>
#include <linux/list.h>
-#include <linux/mutex.h>
+#include <linux/mutex_types.h>
#include <scsi/iscsi_if.h>
struct scsi_transport_template;
diff --git a/include/scsi/scsi_transport_sas.h b/include/scsi/scsi_transport_sas.h
index 0e75b9277c8c..32c73326d34b 100644
--- a/include/scsi/scsi_transport_sas.h
+++ b/include/scsi/scsi_transport_sas.h
@@ -4,7 +4,7 @@
#include <linux/transport_class.h>
#include <linux/types.h>
-#include <linux/mutex.h>
+#include <linux/mutex_types.h>
#include <scsi/sas.h>
#include <linux/bsg-lib.h>
diff --git a/include/scsi/scsi_transport_spi.h b/include/scsi/scsi_transport_spi.h
index 78324502b1c9..a5689b9423e8 100644
--- a/include/scsi/scsi_transport_spi.h
+++ b/include/scsi/scsi_transport_spi.h
@@ -8,7 +8,7 @@
#define SCSI_TRANSPORT_SPI_H
#include <linux/transport_class.h>
-#include <linux/mutex.h>
+#include <linux/mutex_types.h>
struct scsi_transport_template;
struct scsi_target;
diff --git a/include/scsi/scsi_transport_srp.h b/include/scsi/scsi_transport_srp.h
index dfc78aa112ad..b3619dcb795b 100644
--- a/include/scsi/scsi_transport_srp.h
+++ b/include/scsi/scsi_transport_srp.h
@@ -4,7 +4,7 @@
#include <linux/transport_class.h>
#include <linux/types.h>
-#include <linux/mutex.h>
+#include <linux/mutex_types.h>
#define SRP_RPORT_ROLE_INITIATOR 0
#define SRP_RPORT_ROLE_TARGET 1
diff --git a/include/soc/fsl/qe/qe.h b/include/soc/fsl/qe/qe.h
index af793f2a0ec4..768caf98b023 100644
--- a/include/soc/fsl/qe/qe.h
+++ b/include/soc/fsl/qe/qe.h
@@ -14,7 +14,7 @@
#include <linux/compiler.h>
#include <linux/genalloc.h>
-#include <linux/spinlock.h>
+#include <linux/spinlock_types.h>
#include <linux/errno.h>
#include <linux/err.h>
#include <soc/fsl/cpm.h>
diff --git a/include/sound/ac97_codec.h b/include/sound/ac97_codec.h
index 4bd3be3a3192..9891d4ec33ee 100644
--- a/include/sound/ac97_codec.h
+++ b/include/sound/ac97_codec.h
@@ -12,7 +12,7 @@
#include <linux/bitops.h>
#include <linux/device.h>
-#include <linux/workqueue.h>
+#include <linux/workqueue_types.h>
#include <sound/ac97/regs.h>
#include <sound/pcm.h>
#include <sound/control.h>
diff --git a/include/sound/core.h b/include/sound/core.h
index a4d06410638b..0c512acac050 100644
--- a/include/sound/core.h
+++ b/include/sound/core.h
@@ -9,7 +9,7 @@
#include <linux/device.h>
#include <linux/sched.h> /* wake_up() */
-#include <linux/mutex.h> /* struct mutex */
+#include <linux/mutex_types.h> /* struct mutex */
#include <linux/rwsem.h> /* struct rw_semaphore */
#include <linux/stringify.h>
#include <linux/printk.h>
diff --git a/include/sound/emu10k1.h b/include/sound/emu10k1.h
index 1af9e6819392..96fb32cbeb7b 100644
--- a/include/sound/emu10k1.h
+++ b/include/sound/emu10k1.h
@@ -16,7 +16,7 @@
#include <sound/pcm-indirect.h>
#include <sound/timer.h>
#include <linux/interrupt.h>
-#include <linux/mutex.h>
+#include <linux/mutex_types.h>
#include <linux/firmware.h>
#include <linux/io.h>
diff --git a/include/sound/rawmidi.h b/include/sound/rawmidi.h
index f31cabf0158c..46678a38dbb9 100644
--- a/include/sound/rawmidi.h
+++ b/include/sound/rawmidi.h
@@ -9,10 +9,10 @@
#include <sound/asound.h>
#include <linux/interrupt.h>
-#include <linux/spinlock.h>
+#include <linux/spinlock_types.h>
#include <linux/wait.h>
-#include <linux/mutex.h>
-#include <linux/workqueue.h>
+#include <linux/mutex_types.h>
+#include <linux/workqueue_types.h>
#include <linux/device.h>
#if IS_ENABLED(CONFIG_SND_SEQUENCER)
diff --git a/include/sound/util_mem.h b/include/sound/util_mem.h
index 3403b8f4dc86..ad9858a16c0e 100644
--- a/include/sound/util_mem.h
+++ b/include/sound/util_mem.h
@@ -3,7 +3,7 @@
#define __SOUND_UTIL_MEM_H
#include <linux/list.h>
-#include <linux/mutex.h>
+#include <linux/mutex_types.h>
/*
* Copyright (C) 2000 Takashi Iwai <[email protected]>
*
diff --git a/include/target/iscsi/iscsi_target_stat.h b/include/target/iscsi/iscsi_target_stat.h
index ff6a47209313..007a0364281e 100644
--- a/include/target/iscsi/iscsi_target_stat.h
+++ b/include/target/iscsi/iscsi_target_stat.h
@@ -3,7 +3,7 @@
#define ISCSI_TARGET_STAT_H
#include <linux/types.h>
-#include <linux/spinlock.h>
+#include <linux/spinlock_types.h>
#include <linux/socket.h>
/*
diff --git a/include/trace/events/block.h b/include/trace/events/block.h
index 0e128ad51460..6d50561a8422 100644
--- a/include/trace/events/block.h
+++ b/include/trace/events/block.h
@@ -6,7 +6,7 @@
#define _TRACE_BLOCK_H
#include <linux/blktrace_api.h>
-#include <linux/blkdev.h>
+#include <linux/blk_types.h>
#include <linux/buffer_head.h>
#include <linux/tracepoint.h>
diff --git a/include/trace/events/kyber.h b/include/trace/events/kyber.h
index 9d44781efc1c..d5aca7d40514 100644
--- a/include/trace/events/kyber.h
+++ b/include/trace/events/kyber.h
@@ -5,7 +5,7 @@
#if !defined(_TRACE_KYBER_H) || defined(TRACE_HEADER_MULTI_READ)
#define _TRACE_KYBER_H
-#include <linux/blkdev.h>
+#include <linux/blk_types.h>
#include <linux/tracepoint.h>
#define DOMAIN_LEN 16
diff --git a/include/trace/events/lock.h b/include/trace/events/lock.h
index 9ebd081e057e..734c28f009a5 100644
--- a/include/trace/events/lock.h
+++ b/include/trace/events/lock.h
@@ -19,7 +19,7 @@
#ifdef CONFIG_LOCKDEP
-#include <linux/lockdep.h>
+#include <linux/lockdep_types.h>
TRACE_EVENT(lock_acquire,
diff --git a/include/trace/events/mmc.h b/include/trace/events/mmc.h
index 7b706ff21335..0bef571ed465 100644
--- a/include/trace/events/mmc.h
+++ b/include/trace/events/mmc.h
@@ -5,7 +5,7 @@
#if !defined(_TRACE_MMC_H) || defined(TRACE_HEADER_MULTI_READ)
#define _TRACE_MMC_H
-#include <linux/blkdev.h>
+#include <linux/blk_types.h>
#include <linux/mmc/core.h>
#include <linux/mmc/host.h>
#include <linux/tracepoint.h>
diff --git a/include/trace/events/workqueue.h b/include/trace/events/workqueue.h
index 262d52021c23..39632ee71773 100644
--- a/include/trace/events/workqueue.h
+++ b/include/trace/events/workqueue.h
@@ -6,7 +6,7 @@
#define _TRACE_WORKQUEUE_H
#include <linux/tracepoint.h>
-#include <linux/workqueue.h>
+#include <linux/workqueue_types.h>
struct pool_workqueue;
--
2.39.2
By providing declarations in a lean header, we can reduce header
dependencies.
Signed-off-by: Max Kellermann <[email protected]>
---
include/linux/swait.h | 13 +------------
include/linux/swait_types.h | 20 ++++++++++++++++++++
2 files changed, 21 insertions(+), 12 deletions(-)
create mode 100644 include/linux/swait_types.h
diff --git a/include/linux/swait.h b/include/linux/swait.h
index 988ff0f0f84d..7fadcd30e505 100644
--- a/include/linux/swait.h
+++ b/include/linux/swait.h
@@ -2,6 +2,7 @@
#ifndef _LINUX_SWAIT_H
#define _LINUX_SWAIT_H
+#include <linux/swait_types.h>
#include <linux/list.h>
#include <linux/stddef.h>
#include <linux/spinlock_types.h>
@@ -37,18 +38,6 @@
* wait queues in most cases.
*/
-struct task_struct;
-
-struct swait_queue_head {
- raw_spinlock_t lock;
- struct list_head task_list;
-};
-
-struct swait_queue {
- struct task_struct *task;
- struct list_head task_list;
-};
-
#define __SWAITQUEUE_INITIALIZER(name) { \
.task = current, \
.task_list = LIST_HEAD_INIT((name).task_list), \
diff --git a/include/linux/swait_types.h b/include/linux/swait_types.h
new file mode 100644
index 000000000000..316038879a37
--- /dev/null
+++ b/include/linux/swait_types.h
@@ -0,0 +1,20 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef _LINUX_SWAIT_TYPES_H
+#define _LINUX_SWAIT_TYPES_H
+
+#include <linux/list.h>
+#include <linux/spinlock_types.h>
+
+struct task_struct;
+
+struct swait_queue_head {
+ raw_spinlock_t lock;
+ struct list_head task_list;
+};
+
+struct swait_queue {
+ struct task_struct *task;
+ struct list_head task_list;
+};
+
+#endif /* _LINUX_SWAIT_TYPES_H */
--
2.39.2
"struct bio" has nothing to do with "bio.h", the naming is just
confusing. This move will allow narrowing other dependencies later.
Signed-off-by: Max Kellermann <[email protected]>
---
include/linux/bio.h | 22 ----------------------
include/linux/blk_types.h | 23 +++++++++++++++++++++++
2 files changed, 23 insertions(+), 22 deletions(-)
diff --git a/include/linux/bio.h b/include/linux/bio.h
index afae5a73b7cd..b8562d4b57b2 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -49,28 +49,6 @@ static inline unsigned int bio_max_segs(unsigned int nr_segs)
#define bio_data_dir(bio) \
(op_is_write(bio_op(bio)) ? WRITE : READ)
-/*
- * Check whether this bio carries any data or not. A NULL bio is allowed.
- */
-static inline bool bio_has_data(struct bio *bio)
-{
- if (bio &&
- bio->bi_iter.bi_size &&
- bio_op(bio) != REQ_OP_DISCARD &&
- bio_op(bio) != REQ_OP_SECURE_ERASE &&
- bio_op(bio) != REQ_OP_WRITE_ZEROES)
- return true;
-
- return false;
-}
-
-static inline bool bio_no_advance_iter(const struct bio *bio)
-{
- return bio_op(bio) == REQ_OP_DISCARD ||
- bio_op(bio) == REQ_OP_SECURE_ERASE ||
- bio_op(bio) == REQ_OP_WRITE_ZEROES;
-}
-
static inline void *bio_data(struct bio *bio)
{
if (bio_has_data(bio))
diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h
index ad48c3f5ddd6..313db4b9b49e 100644
--- a/include/linux/blk_types.h
+++ b/include/linux/blk_types.h
@@ -284,6 +284,7 @@ struct bio {
#define BIO_RESET_BYTES offsetof(struct bio, bi_max_vecs)
#define BIO_MAX_SECTORS (UINT_MAX >> SECTOR_SHIFT)
+
/*
* bio flags
*/
@@ -434,6 +435,28 @@ static inline enum req_op bio_op(const struct bio *bio)
return bio->bi_opf & REQ_OP_MASK;
}
+/*
+ * Check whether this bio carries any data or not. A NULL bio is allowed.
+ */
+static inline bool bio_has_data(struct bio *bio)
+{
+ if (bio &&
+ bio->bi_iter.bi_size &&
+ bio_op(bio) != REQ_OP_DISCARD &&
+ bio_op(bio) != REQ_OP_SECURE_ERASE &&
+ bio_op(bio) != REQ_OP_WRITE_ZEROES)
+ return true;
+
+ return false;
+}
+
+static inline bool bio_no_advance_iter(const struct bio *bio)
+{
+ return bio_op(bio) == REQ_OP_DISCARD ||
+ bio_op(bio) == REQ_OP_SECURE_ERASE ||
+ bio_op(bio) == REQ_OP_WRITE_ZEROES;
+}
+
static inline bool blk_op_is_passthrough(blk_opf_t op)
{
op &= REQ_OP_MASK;
--
2.39.2
This adds `#include` directives that are necessary, but missing, which
previously went unnnoticed because the missing headers were included
indirectly by other headers somewhere.
Signed-off-by: Max Kellermann <[email protected]>
---
arch/arm64/kernel/cpufeature.c | 1 +
arch/arm64/kernel/cpuinfo.c | 1 +
arch/arm64/kernel/ftrace.c | 1 +
arch/arm64/kernel/mte.c | 2 ++
arch/arm64/kvm/arch_timer.c | 2 ++
arch/arm64/kvm/hypercalls.c | 1 +
arch/arm64/kvm/vgic/vgic-mmio-v3.c | 1 +
arch/arm64/kvm/vgic/vgic-mmio.c | 1 +
arch/arm64/kvm/vgic/vgic-v2.c | 1 +
arch/arm64/kvm/vgic/vgic-v3.c | 1 +
arch/arm64/kvm/vgic/vgic-v4.c | 1 +
arch/x86/events/amd/uncore.c | 1 +
arch/x86/events/intel/uncore.c | 1 +
arch/x86/events/rapl.c | 1 +
arch/x86/kernel/cpu/intel.c | 1 +
arch/x86/kernel/cpu/umwait.c | 1 +
arch/x86/kvm/vmx/nested.c | 1 +
arch/x86/kvm/xen.c | 1 +
arch/x86/platform/efi/runtime-map.c | 1 +
block/blk-cgroup.c | 1 +
block/blk-crypto-sysfs.c | 1 +
block/blk-ia-ranges.c | 1 +
block/blk-iocost.c | 1 +
block/bsg.c | 1 +
block/elevator.h | 1 +
block/holder.c | 1 +
block/kyber-iosched.c | 1 +
block/mq-deadline.c | 1 +
drivers/accel/ivpu/ivpu_pm.c | 1 +
drivers/acpi/pfr_telemetry.c | 1 +
drivers/acpi/sbs.c | 1 +
drivers/ata/pata_parport/pata_parport.c | 1 +
drivers/base/base.h | 5 +++++
drivers/base/container.c | 1 +
drivers/base/firmware_loader/builtin/main.c | 1 +
drivers/base/soc.c | 1 +
drivers/base/swnode.c | 1 +
drivers/base/topology.c | 2 ++
drivers/base/transport_class.c | 3 +++
drivers/block/null_blk/main.c | 1 +
drivers/block/virtio_blk.c | 1 +
drivers/block/xen-blkback/blkback.c | 2 ++
drivers/block/zram/zcomp.c | 1 +
drivers/bus/mhi/ep/main.c | 1 +
drivers/char/hw_random/virtio-rng.c | 1 +
drivers/char/ipmi/ipmi_msghandler.c | 1 +
drivers/char/misc.c | 1 +
drivers/char/ppdev.c | 1 +
drivers/char/tpm/tpm-chip.c | 1 +
drivers/clk/qcom/clk-regmap-mux-div.h | 1 +
drivers/clk/qcom/gdsc.c | 1 +
drivers/clk/samsung/clk-cpu.h | 2 ++
drivers/clk/sunxi-ng/ccu_common.h | 1 +
drivers/cpufreq/apple-soc-cpufreq.c | 1 +
drivers/cpufreq/cpufreq_governor.h | 1 +
drivers/cpufreq/freq_table.c | 1 +
drivers/cxl/cxl.h | 3 +++
drivers/cxl/cxlmem.h | 1 +
drivers/devfreq/event/rockchip-dfi.c | 1 +
drivers/dma-buf/st-dma-fence.c | 1 +
drivers/dma/ioat/sysfs.c | 1 +
drivers/eisa/eisa-bus.c | 1 +
drivers/extcon/devres.c | 1 +
drivers/extcon/extcon.h | 1 +
drivers/firmware/arm_ffa/bus.c | 1 +
drivers/firmware/arm_scmi/bus.c | 1 +
drivers/firmware/edd.c | 1 +
drivers/firmware/efi/libstub/efi-stub-helper.c | 1 +
drivers/firmware/google/gsmi.c | 1 +
drivers/fpga/dfl.c | 2 ++
drivers/gpio/gpio-tegra.c | 1 +
drivers/gpio/gpio-tegra186.c | 1 +
drivers/gpio/gpio-thunderx.c | 1 +
drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.h | 1 +
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 1 +
drivers/gpu/drm/amd/amdgpu/amdgpu_ih.h | 3 +++
drivers/gpu/drm/arm/display/komeda/komeda_color_mgmt.c | 2 ++
drivers/gpu/drm/i915/i915_perf.c | 1 +
drivers/gpu/drm/i915/i915_perf_types.h | 1 +
drivers/gpu/drm/i915/i915_scatterlist.h | 1 +
drivers/gpu/drm/msm/msm_drv.h | 1 +
drivers/gpu/drm/nouveau/dispnv50/disp.c | 1 +
drivers/gpu/drm/xe/xe_gpu_scheduler.c | 2 ++
drivers/gpu/drm/xe/xe_guc_ct.h | 2 ++
drivers/hid/intel-ish-hid/ishtp/bus.c | 1 +
drivers/hwmon/coretemp.c | 1 +
drivers/hwmon/nct6775-core.c | 1 +
drivers/iio/adc/ti-tsc2046.c | 1 +
drivers/infiniband/hw/hfi1/rc.c | 1 +
drivers/infiniband/hw/qib/qib_file_ops.c | 1 +
drivers/infiniband/hw/usnic/usnic_ib_main.c | 1 +
drivers/infiniband/hw/usnic/usnic_ib_sysfs.c | 1 +
drivers/infiniband/sw/rdmavt/cq.c | 1 +
drivers/infiniband/sw/rdmavt/qp.c | 1 +
drivers/infiniband/ulp/srp/ib_srp.c | 1 +
drivers/iommu/virtio-iommu.c | 1 +
drivers/mailbox/mailbox.c | 1 +
drivers/md/bcache/bset.c | 1 +
drivers/md/bcache/sysfs.h | 2 ++
drivers/media/cec/core/cec-pin.c | 1 +
drivers/media/pci/pt3/pt3.c | 1 +
drivers/memory/tegra/tegra234.c | 1 +
drivers/mfd/abx500-core.c | 1 +
drivers/misc/cardreader/alcor_pci.c | 1 +
drivers/misc/dw-xdata-pcie.c | 1 +
drivers/misc/lkdtm/heap.c | 1 +
drivers/misc/mei/bus.c | 1 +
drivers/misc/mei/client.c | 1 +
drivers/misc/mei/debugfs.c | 1 +
drivers/misc/mei/main.c | 1 +
drivers/misc/pci_endpoint_test.c | 1 +
drivers/misc/vcpu_stall_detector.c | 1 +
drivers/misc/xilinx_sdfec.c | 1 +
drivers/mtd/mtd_blkdevs.c | 1 +
drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c | 1 +
drivers/net/can/spi/mcp251xfd/mcp251xfd-ring.c | 2 ++
drivers/net/can/spi/mcp251xfd/mcp251xfd-rx.c | 1 +
drivers/net/can/spi/mcp251xfd/mcp251xfd-tef.c | 1 +
drivers/net/ethernet/cortina/gemini.c | 1 +
drivers/net/ethernet/freescale/fec_ptp.c | 1 +
drivers/net/ethernet/hisilicon/hip04_eth.c | 1 +
drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c | 1 +
drivers/net/ethernet/ti/am65-cpsw-nuss.c | 1 +
drivers/net/mdio/mdio-mux-meson-gxl.c | 1 +
drivers/net/mdio/mdio-mux-multiplexer.c | 1 +
drivers/net/wireless/mediatek/mt76/mt76x02_usb_core.c | 2 ++
drivers/net/wireless/virtual/mac80211_hwsim.c | 1 +
drivers/net/wwan/iosm/iosm_ipc_imem.c | 1 +
drivers/nvme/host/nvme.h | 1 +
drivers/nvme/target/fc.c | 1 +
drivers/nvme/target/nvmet.h | 1 +
drivers/of/of_numa.c | 1 +
drivers/pci/controller/vmd.c | 1 +
drivers/pci/pci.c | 1 +
drivers/pci/switch/switchtec.c | 1 +
drivers/perf/thunderx2_pmu.c | 1 +
drivers/platform/chrome/wilco_ec/telemetry.c | 1 +
drivers/platform/x86/amd/pmf/tee-if.c | 1 +
.../platform/x86/dell/dell-wmi-sysman/biosattr-interface.c | 1 +
drivers/platform/x86/dell/dell-wmi-sysman/enum-attributes.c | 2 ++
drivers/platform/x86/dell/dell-wmi-sysman/int-attributes.c | 2 ++
.../platform/x86/dell/dell-wmi-sysman/passobj-attributes.c | 3 +++
.../x86/dell/dell-wmi-sysman/passwordattr-interface.c | 1 +
.../platform/x86/dell/dell-wmi-sysman/string-attributes.c | 2 ++
drivers/platform/x86/dell/dell-wmi-sysman/sysman.c | 1 +
drivers/platform/x86/hp/hp-bioscfg/bioscfg.c | 1 +
drivers/platform/x86/hp/hp-bioscfg/enum-attributes.c | 3 +++
drivers/platform/x86/hp/hp-bioscfg/int-attributes.c | 3 +++
drivers/platform/x86/hp/hp-bioscfg/order-list-attributes.c | 2 ++
drivers/platform/x86/hp/hp-bioscfg/passwdobj-attributes.c | 3 +++
drivers/platform/x86/hp/hp-bioscfg/spmobj-attributes.c | 2 ++
drivers/platform/x86/hp/hp-bioscfg/string-attributes.c | 3 +++
drivers/platform/x86/hp/hp-bioscfg/surestart-attributes.c | 2 ++
drivers/platform/x86/intel/pmt/telemetry.c | 1 +
.../x86/intel/uncore-frequency/uncore-frequency-common.c | 1 +
.../x86/intel/uncore-frequency/uncore-frequency-common.h | 1 +
drivers/platform/x86/think-lmi.c | 1 +
drivers/platform/x86/wmi.c | 1 +
drivers/pmdomain/governor.c | 1 +
drivers/power/reset/ltc2952-poweroff.c | 1 +
drivers/powercap/dtpm.c | 1 +
drivers/pps/clients/pps-ktimer.c | 1 +
drivers/pps/clients/pps-ldisc.c | 1 +
drivers/pps/clients/pps_parport.c | 1 +
drivers/pps/kapi.c | 1 +
drivers/pps/pps.c | 1 +
drivers/rtc/class.c | 1 +
drivers/rtc/interface.c | 1 +
drivers/scsi/isci/isci.h | 1 +
drivers/scsi/lpfc/lpfc_init.c | 1 +
drivers/slimbus/slimbus.h | 1 +
drivers/soc/nuvoton/wpcm450-soc.c | 1 +
drivers/soundwire/bus.c | 1 +
drivers/soundwire/intel_auxdevice.c | 1 +
drivers/spi/spi-stm32.c | 1 +
drivers/staging/fbtft/fb_ssd1351.c | 1 +
drivers/target/target_core_fabric_configfs.c | 1 +
drivers/target/target_core_file.c | 1 +
drivers/thermal/devfreq_cooling.c | 1 +
drivers/thermal/intel/intel_powerclamp.c | 1 +
drivers/thermal/intel/therm_throt.c | 1 +
drivers/tty/rpmsg_tty.c | 1 +
drivers/tty/serial/8250/8250_bcm7271.c | 1 +
drivers/tty/serial/8250/8250_port.c | 1 +
drivers/tty/serial/imx.c | 1 +
drivers/tty/serial/serial_base.h | 2 ++
drivers/tty/serial/sh-sci.c | 1 +
drivers/tty/serial/xilinx_uartps.c | 1 +
drivers/usb/chipidea/otg_fsm.c | 1 +
drivers/usb/dwc2/hcd_queue.c | 1 +
drivers/usb/gadget/function/f_ncm.c | 1 +
drivers/usb/gadget/udc/max3420_udc.c | 1 +
drivers/usb/typec/class.h | 1 +
drivers/usb/typec/pd.c | 1 +
drivers/vfio/group.c | 1 +
drivers/video/fbdev/omap2/omapfb/dss/dsi.c | 1 +
drivers/video/fbdev/omap2/omapfb/dss/pll.c | 1 +
drivers/virt/coco/tsm.c | 1 +
fs/aio.c | 1 +
fs/bcachefs/chardev.c | 1 +
fs/bcachefs/fs.c | 1 +
fs/btrfs/qgroup.c | 1 +
fs/btrfs/sysfs.c | 1 +
fs/buffer.c | 1 +
fs/ceph/metric.h | 2 ++
fs/ceph/super.h | 1 +
fs/configfs/mount.c | 1 +
fs/crypto/bio.c | 1 +
fs/debugfs/inode.c | 1 +
fs/erofs/data.c | 1 +
fs/erofs/internal.h | 1 +
fs/erofs/super.c | 1 +
fs/eventpoll.c | 1 +
fs/exec.c | 1 +
fs/ext4/sysfs.c | 1 +
fs/f2fs/f2fs.h | 1 +
fs/gfs2/recovery.c | 1 +
fs/gfs2/sys.c | 1 +
fs/hfsplus/wrapper.c | 1 +
fs/iomap/buffered-io.c | 1 +
fs/iomap/direct-io.c | 1 +
fs/namespace.c | 1 +
fs/nfs/nfs42xattr.c | 1 +
fs/ntfs3/fsntfs.c | 3 ++-
fs/ntfs3/super.c | 1 +
fs/pnode.c | 1 +
fs/proc/uptime.c | 1 +
fs/pstore/inode.c | 1 +
fs/reiserfs/reiserfs.h | 1 +
fs/sysctls.c | 1 +
fs/sysfs/mount.c | 1 +
fs/tracefs/inode.c | 1 +
fs/ubifs/io.c | 1 +
fs/ubifs/super.c | 1 +
fs/xfs/xfs_error.c | 1 +
fs/xfs/xfs_sysfs.c | 1 +
fs/zonefs/sysfs.c | 1 +
include/drm/drm_color_mgmt.h | 1 +
include/drm/drm_modeset_lock.h | 1 +
include/drm/gpu_scheduler.h | 1 +
include/linux/backing-dev-defs.h | 5 +++++
include/linux/bio.h | 1 +
include/linux/blk-integrity.h | 1 +
include/linux/blk-mq.h | 1 +
include/linux/blkdev.h | 2 ++
include/linux/can/dev.h | 1 +
include/linux/dev_printk.h | 1 +
include/linux/device.h | 1 +
include/linux/device/bus.h | 1 +
include/linux/device/class.h | 1 +
include/linux/dmaengine.h | 1 +
include/linux/dtpm.h | 2 ++
include/linux/extcon.h | 3 +++
include/linux/firmware.h | 1 +
include/linux/flex_proportions.h | 1 +
include/linux/framer/framer-provider.h | 1 +
include/linux/futex.h | 1 +
include/linux/hisi_acc_qm.h | 1 +
include/linux/hrtimer.h | 2 ++
include/linux/iio/iio.h | 1 +
include/linux/ipc.h | 2 ++
include/linux/memory_hotplug.h | 1 +
include/linux/mm.h | 3 +++
include/linux/module.h | 1 +
include/linux/mtd/blktrans.h | 1 +
include/linux/ndctl.h | 2 ++
include/linux/node.h | 2 ++
include/linux/notifier.h | 1 +
include/linux/ns_common.h | 1 +
include/linux/pm.h | 4 ++++
include/linux/quotaops.h | 1 +
include/linux/raid_class.h | 2 ++
include/linux/slab.h | 1 +
include/linux/socket.h | 2 +-
include/linux/soundwire/sdw.h | 1 +
include/linux/spi/spi_bitbang.h | 2 ++
include/linux/srcutree.h | 2 ++
include/linux/stackdepot.h | 1 +
include/linux/sunrpc/rpc_pipe_fs.h | 3 +++
include/linux/trace_recursion.h | 1 +
include/linux/tty_port.h | 2 +-
include/linux/u64_stats_sync.h | 2 ++
include/linux/wait_bit.h | 3 +++
include/linux/writeback.h | 1 +
include/linux/ww_mutex.h | 1 +
include/media/media-device.h | 1 +
include/net/netns/ipv6.h | 4 ++++
include/net/netns/mctp.h | 1 +
include/net/netns/xdp.h | 1 +
include/net/tcp.h | 1 +
include/sound/core.h | 1 +
include/sound/util_mem.h | 1 +
include/trace/events/iommu.h | 3 +--
include/trace/events/power.h | 1 +
init/init_task.c | 1 +
init/main.c | 1 +
io_uring/cancel.c | 1 +
io_uring/io_uring.c | 1 +
io_uring/timeout.h | 2 ++
ipc/mq_sysctl.c | 1 +
ipc/mqueue.c | 1 +
ipc/namespace.c | 1 +
ipc/sem.c | 1 +
kernel/bpf/helpers.c | 1 +
kernel/cpu.c | 1 +
kernel/events/core.c | 1 +
kernel/exit.c | 1 +
kernel/fork.c | 1 +
kernel/futex/core.c | 1 +
kernel/futex/pi.c | 1 +
kernel/futex/requeue.c | 1 +
kernel/futex/syscalls.c | 1 +
kernel/futex/waitwake.c | 1 +
kernel/livepatch/core.c | 2 ++
kernel/livepatch/transition.c | 1 +
kernel/locking/rtmutex.c | 1 +
kernel/locking/rtmutex_common.h | 1 +
kernel/padata.c | 1 +
kernel/panic.c | 1 +
kernel/power/energy_model.c | 1 +
kernel/reboot.c | 1 +
kernel/signal.c | 1 +
kernel/smpboot.c | 1 +
kernel/time/hrtimer.c | 1 +
kernel/time/namespace.c | 1 +
kernel/time/posix-timers.c | 1 +
kernel/time/timer_list.c | 1 +
kernel/trace/trace_osnoise.c | 1 +
kernel/tsacct.c | 1 +
kernel/ucount.c | 1 +
kernel/user.c | 2 ++
kernel/watchdog.c | 1 +
kernel/workqueue.c | 1 +
lib/cpu_rmap.c | 2 ++
lib/flex_proportions.c | 2 ++
lib/group_cpus.c | 1 +
lib/kobject.c | 2 ++
lib/lockref.c | 2 ++
lib/objpool.c | 2 ++
lib/test_lockup.c | 1 +
mm/damon/sysfs-common.c | 1 +
mm/damon/sysfs-schemes.c | 1 +
mm/damon/sysfs.c | 1 +
mm/folio-compat.c | 1 +
mm/khugepaged.c | 1 +
mm/ksm.c | 2 ++
mm/memory-tiers.c | 1 +
mm/memory_hotplug.c | 1 +
mm/mempolicy.c | 1 +
mm/workingset.c | 1 +
net/can/j1939/bus.c | 2 ++
net/can/j1939/transport.c | 1 +
net/ceph/string_table.c | 1 +
net/sched/act_gate.c | 1 +
net/xfrm/xfrm_state.c | 1 +
samples/vfio-mdev/mtty.c | 1 +
security/integrity/ima/ima_mok.c | 1 +
security/keys/proc.c | 1 +
sound/soc/intel/avs/avs.h | 1 +
sound/soc/qcom/qdsp6/q6apm.h | 1 +
sound/soc/sof/sof-audio.h | 1 +
361 files changed, 440 insertions(+), 5 deletions(-)
diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c
index 8d1a634a403e..dc0642d35f5e 100644
--- a/arch/arm64/kernel/cpufeature.c
+++ b/arch/arm64/kernel/cpufeature.c
@@ -65,6 +65,7 @@
#include <linux/bsearch.h>
#include <linux/cpumask.h>
#include <linux/crash_dump.h>
+#include <linux/device.h>
#include <linux/kstrtox.h>
#include <linux/sort.h>
#include <linux/stop_machine.h>
diff --git a/arch/arm64/kernel/cpuinfo.c b/arch/arm64/kernel/cpuinfo.c
index 47043c0d95ec..d30ad1215ab8 100644
--- a/arch/arm64/kernel/cpuinfo.c
+++ b/arch/arm64/kernel/cpuinfo.c
@@ -23,6 +23,7 @@
#include <linux/seq_file.h>
#include <linux/sched.h>
#include <linux/smp.h>
+#include <linux/sysfs.h> // for __ATTR_RO()
#include <linux/delay.h>
/*
diff --git a/arch/arm64/kernel/ftrace.c b/arch/arm64/kernel/ftrace.c
index a650f5e11fc5..f6c271405c12 100644
--- a/arch/arm64/kernel/ftrace.c
+++ b/arch/arm64/kernel/ftrace.c
@@ -10,6 +10,7 @@
#include <linux/module.h>
#include <linux/swab.h>
#include <linux/uaccess.h>
+#include <linux/ratelimit.h>
#include <asm/cacheflush.h>
#include <asm/debug-monitors.h>
diff --git a/arch/arm64/kernel/mte.c b/arch/arm64/kernel/mte.c
index a41ef3213e1e..2b8abe086445 100644
--- a/arch/arm64/kernel/mte.c
+++ b/arch/arm64/kernel/mte.c
@@ -5,6 +5,7 @@
#include <linux/bitops.h>
#include <linux/cpu.h>
+#include <linux/device.h>
#include <linux/kernel.h>
#include <linux/mm.h>
#include <linux/prctl.h>
@@ -13,6 +14,7 @@
#include <linux/string.h>
#include <linux/swap.h>
#include <linux/swapops.h>
+#include <linux/sysfs.h>
#include <linux/thread_info.h>
#include <linux/types.h>
#include <linux/uaccess.h>
diff --git a/arch/arm64/kvm/arch_timer.c b/arch/arm64/kvm/arch_timer.c
index 9dec8c419bf4..a5b47b400dfc 100644
--- a/arch/arm64/kvm/arch_timer.c
+++ b/arch/arm64/kvm/arch_timer.c
@@ -11,6 +11,8 @@
#include <linux/irq.h>
#include <linux/irqdomain.h>
#include <linux/uaccess.h>
+#include <linux/hrtimer.h>
+#include <linux/ratelimit.h>
#include <clocksource/arm_arch_timer.h>
#include <asm/arch_timer.h>
diff --git a/arch/arm64/kvm/hypercalls.c b/arch/arm64/kvm/hypercalls.c
index 5763d979d8ca..5aa0b3c106fd 100644
--- a/arch/arm64/kvm/hypercalls.c
+++ b/arch/arm64/kvm/hypercalls.c
@@ -3,6 +3,7 @@
#include <linux/arm-smccc.h>
#include <linux/kvm_host.h>
+#include <linux/ratelimit.h>
#include <asm/kvm_emulate.h>
diff --git a/arch/arm64/kvm/vgic/vgic-mmio-v3.c b/arch/arm64/kvm/vgic/vgic-mmio-v3.c
index c15ee1df036a..1dacc5612804 100644
--- a/arch/arm64/kvm/vgic/vgic-mmio-v3.c
+++ b/arch/arm64/kvm/vgic/vgic-mmio-v3.c
@@ -8,6 +8,7 @@
#include <linux/kvm.h>
#include <linux/kvm_host.h>
#include <linux/interrupt.h>
+#include <linux/ratelimit.h>
#include <kvm/iodev.h>
#include <kvm/arm_vgic.h>
diff --git a/arch/arm64/kvm/vgic/vgic-mmio.c b/arch/arm64/kvm/vgic/vgic-mmio.c
index cf76523a2194..bde2110e140f 100644
--- a/arch/arm64/kvm/vgic/vgic-mmio.c
+++ b/arch/arm64/kvm/vgic/vgic-mmio.c
@@ -9,6 +9,7 @@
#include <linux/irq.h>
#include <linux/kvm.h>
#include <linux/kvm_host.h>
+#include <linux/ratelimit.h>
#include <kvm/iodev.h>
#include <kvm/arm_arch_timer.h>
#include <kvm/arm_vgic.h>
diff --git a/arch/arm64/kvm/vgic/vgic-v2.c b/arch/arm64/kvm/vgic/vgic-v2.c
index 7e9cdb78f7ce..28adaf9ddf34 100644
--- a/arch/arm64/kvm/vgic/vgic-v2.c
+++ b/arch/arm64/kvm/vgic/vgic-v2.c
@@ -6,6 +6,7 @@
#include <linux/irqchip/arm-gic.h>
#include <linux/kvm.h>
#include <linux/kvm_host.h>
+#include <linux/ratelimit.h>
#include <kvm/arm_vgic.h>
#include <asm/kvm_mmu.h>
diff --git a/arch/arm64/kvm/vgic/vgic-v3.c b/arch/arm64/kvm/vgic/vgic-v3.c
index 9465d3706ab9..dc6b5f5008fb 100644
--- a/arch/arm64/kvm/vgic/vgic-v3.c
+++ b/arch/arm64/kvm/vgic/vgic-v3.c
@@ -6,6 +6,7 @@
#include <linux/kstrtox.h>
#include <linux/kvm.h>
#include <linux/kvm_host.h>
+#include <linux/ratelimit.h>
#include <kvm/arm_vgic.h>
#include <asm/kvm_hyp.h>
#include <asm/kvm_mmu.h>
diff --git a/arch/arm64/kvm/vgic/vgic-v4.c b/arch/arm64/kvm/vgic/vgic-v4.c
index 74a67ad87f29..40ff8cc2b659 100644
--- a/arch/arm64/kvm/vgic/vgic-v4.c
+++ b/arch/arm64/kvm/vgic/vgic-v4.c
@@ -9,6 +9,7 @@
#include <linux/irqdomain.h>
#include <linux/kvm_host.h>
#include <linux/irqchip/arm-gic-v3.h>
+#include <linux/ratelimit.h>
#include "vgic.h"
diff --git a/arch/x86/events/amd/uncore.c b/arch/x86/events/amd/uncore.c
index 5bf03c575812..5c7af7dcff2c 100644
--- a/arch/x86/events/amd/uncore.c
+++ b/arch/x86/events/amd/uncore.c
@@ -13,6 +13,7 @@
#include <linux/cpu.h>
#include <linux/cpumask.h>
#include <linux/cpufeature.h>
+#include <linux/device.h>
#include <linux/smp.h>
#include <asm/perf_event.h>
diff --git a/arch/x86/events/intel/uncore.c b/arch/x86/events/intel/uncore.c
index 7927c0b832fa..e1f6a2f3840d 100644
--- a/arch/x86/events/intel/uncore.c
+++ b/arch/x86/events/intel/uncore.c
@@ -1,4 +1,5 @@
// SPDX-License-Identifier: GPL-2.0-only
+#include <linux/hrtimer.h>
#include <linux/module.h>
#include <asm/cpu_device_id.h>
diff --git a/arch/x86/events/rapl.c b/arch/x86/events/rapl.c
index 8d98d468b976..030629d12298 100644
--- a/arch/x86/events/rapl.c
+++ b/arch/x86/events/rapl.c
@@ -55,6 +55,7 @@
#define pr_fmt(fmt) "RAPL PMU: " fmt
+#include <linux/hrtimer.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/perf_event.h>
diff --git a/arch/x86/kernel/cpu/intel.c b/arch/x86/kernel/cpu/intel.c
index a927a8fc9624..7c43587e56a4 100644
--- a/arch/x86/kernel/cpu/intel.c
+++ b/arch/x86/kernel/cpu/intel.c
@@ -11,6 +11,7 @@
#include <linux/thread_info.h>
#include <linux/init.h>
#include <linux/uaccess.h>
+#include <linux/ratelimit.h>
#include <linux/workqueue.h>
#include <linux/delay.h>
#include <linux/cpuhotplug.h>
diff --git a/arch/x86/kernel/cpu/umwait.c b/arch/x86/kernel/cpu/umwait.c
index 2293efd6ffa6..39bba722a42b 100644
--- a/arch/x86/kernel/cpu/umwait.c
+++ b/arch/x86/kernel/cpu/umwait.c
@@ -2,6 +2,7 @@
#include <linux/syscore_ops.h>
#include <linux/suspend.h>
#include <linux/cpu.h>
+#include <linux/device.h>
#include <asm/msr.h>
#include <asm/mwait.h>
diff --git a/arch/x86/kvm/vmx/nested.c b/arch/x86/kvm/vmx/nested.c
index 6329a306856b..035fca6e5ee0 100644
--- a/arch/x86/kvm/vmx/nested.c
+++ b/arch/x86/kvm/vmx/nested.c
@@ -1,6 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+#include <linux/hrtimer.h>
#include <linux/objtool.h>
#include <linux/percpu.h>
diff --git a/arch/x86/kvm/xen.c b/arch/x86/kvm/xen.c
index 4b4e738c6f1b..d2056ae8f34d 100644
--- a/arch/x86/kvm/xen.c
+++ b/arch/x86/kvm/xen.c
@@ -13,6 +13,7 @@
#include "lapic.h"
#include <linux/eventfd.h>
+#include <linux/hrtimer.h>
#include <linux/kvm_host.h>
#include <linux/sched/stat.h>
diff --git a/arch/x86/platform/efi/runtime-map.c b/arch/x86/platform/efi/runtime-map.c
index a6f02cef3ca2..a6c7a3480d1a 100644
--- a/arch/x86/platform/efi/runtime-map.c
+++ b/arch/x86/platform/efi/runtime-map.c
@@ -5,6 +5,7 @@
#include <linux/string.h>
#include <linux/kernel.h>
+#include <linux/kobject.h>
#include <linux/module.h>
#include <linux/types.h>
#include <linux/efi.h>
diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c
index bdbb557feb5a..2e99ac6d0c21 100644
--- a/block/blk-cgroup.c
+++ b/block/blk-cgroup.c
@@ -29,6 +29,7 @@
#include <linux/resume_user_mode.h>
#include <linux/psi.h>
#include <linux/part_stat.h>
+#include <linux/hrtimer.h>
#include "blk.h"
#include "blk-cgroup.h"
#include "blk-ioprio.h"
diff --git a/block/blk-crypto-sysfs.c b/block/blk-crypto-sysfs.c
index a304434489ba..233d04b9116b 100644
--- a/block/blk-crypto-sysfs.c
+++ b/block/blk-crypto-sysfs.c
@@ -7,6 +7,7 @@
*/
#include <linux/blk-crypto-profile.h>
+#include <linux/sysfs.h>
#include "blk-crypto-internal.h"
diff --git a/block/blk-ia-ranges.c b/block/blk-ia-ranges.c
index c9eb4241e048..4a6bb87a0143 100644
--- a/block/blk-ia-ranges.c
+++ b/block/blk-ia-ranges.c
@@ -7,6 +7,7 @@
#include <linux/kernel.h>
#include <linux/blkdev.h>
#include <linux/slab.h>
+#include <linux/sysfs.h>
#include <linux/init.h>
#include "blk.h"
diff --git a/block/blk-iocost.c b/block/blk-iocost.c
index 4b0b483a9693..d154161b906a 100644
--- a/block/blk-iocost.c
+++ b/block/blk-iocost.c
@@ -178,6 +178,7 @@
#include <linux/time64.h>
#include <linux/parser.h>
#include <linux/sched/signal.h>
+#include <linux/hrtimer.h>
#include <asm/local.h>
#include <asm/local64.h>
#include "blk-rq-qos.h"
diff --git a/block/bsg.c b/block/bsg.c
index 72157a59b788..9e6635f423a0 100644
--- a/block/bsg.c
+++ b/block/bsg.c
@@ -7,6 +7,7 @@
#include <linux/file.h>
#include <linux/blkdev.h>
#include <linux/cdev.h>
+#include <linux/device.h>
#include <linux/jiffies.h>
#include <linux/percpu.h>
#include <linux/idr.h>
diff --git a/block/elevator.h b/block/elevator.h
index 7ca3d7b6ed82..6c107132d536 100644
--- a/block/elevator.h
+++ b/block/elevator.h
@@ -4,6 +4,7 @@
#include <linux/percpu.h>
#include <linux/hashtable.h>
+#include <linux/module.h>
#include "blk-mq.h"
struct io_cq;
diff --git a/block/holder.c b/block/holder.c
index 37d18c13d958..a9affd4757cd 100644
--- a/block/holder.c
+++ b/block/holder.c
@@ -1,6 +1,7 @@
// SPDX-License-Identifier: GPL-2.0-only
#include <linux/blkdev.h>
#include <linux/slab.h>
+#include <linux/sysfs.h>
struct bd_holder_disk {
struct list_head list;
diff --git a/block/kyber-iosched.c b/block/kyber-iosched.c
index 4155594aefc6..68fe2b6c12de 100644
--- a/block/kyber-iosched.c
+++ b/block/kyber-iosched.c
@@ -10,6 +10,7 @@
#include <linux/blkdev.h>
#include <linux/module.h>
#include <linux/sbitmap.h>
+#include <linux/sysfs.h>
#include <trace/events/block.h>
diff --git a/block/mq-deadline.c b/block/mq-deadline.c
index 1b0de4fc3958..25dee768d2ba 100644
--- a/block/mq-deadline.c
+++ b/block/mq-deadline.c
@@ -15,6 +15,7 @@
#include <linux/compiler.h>
#include <linux/rbtree.h>
#include <linux/sbitmap.h>
+#include <linux/sysfs.h>
#include <trace/events/block.h>
diff --git a/drivers/accel/ivpu/ivpu_pm.c b/drivers/accel/ivpu/ivpu_pm.c
index f501f27ebafd..8484f7d3bb4d 100644
--- a/drivers/accel/ivpu/ivpu_pm.c
+++ b/drivers/accel/ivpu/ivpu_pm.c
@@ -4,6 +4,7 @@
*/
#include <linux/highmem.h>
+#include <linux/kobject.h>
#include <linux/moduleparam.h>
#include <linux/pci.h>
#include <linux/pm_runtime.h>
diff --git a/drivers/acpi/pfr_telemetry.c b/drivers/acpi/pfr_telemetry.c
index 843f678ade0c..c7d9208e78c0 100644
--- a/drivers/acpi/pfr_telemetry.c
+++ b/drivers/acpi/pfr_telemetry.c
@@ -15,6 +15,7 @@
#include <linux/errno.h>
#include <linux/file.h>
#include <linux/fs.h>
+#include <linux/idr.h>
#include <linux/miscdevice.h>
#include <linux/module.h>
#include <linux/mm.h>
diff --git a/drivers/acpi/sbs.c b/drivers/acpi/sbs.c
index 94e3c000df2e..003faea3ad4d 100644
--- a/drivers/acpi/sbs.c
+++ b/drivers/acpi/sbs.c
@@ -14,6 +14,7 @@
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/kernel.h>
+#include <linux/kobject.h>
#include <linux/acpi.h>
#include <linux/timer.h>
diff --git a/drivers/ata/pata_parport/pata_parport.c b/drivers/ata/pata_parport/pata_parport.c
index a7adfdcb5e27..b21ced9e0a3c 100644
--- a/drivers/ata/pata_parport/pata_parport.c
+++ b/drivers/ata/pata_parport/pata_parport.c
@@ -3,6 +3,7 @@
* Copyright 2023 Ondrej Zary
* based on paride.c by Grant R. Guenther <[email protected]>
*/
+#include <linux/idr.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/parport.h>
diff --git a/drivers/base/base.h b/drivers/base/base.h
index eb4c0ace9242..344e7e4012ab 100644
--- a/drivers/base/base.h
+++ b/drivers/base/base.h
@@ -10,7 +10,12 @@
* shared outside of the drivers/base/ directory.
*
*/
+
+#include <linux/klist.h>
+#include <linux/kobject.h>
#include <linux/notifier.h>
+#include <linux/device/bus.h>
+#include <linux/device/driver.h>
/**
* struct subsys_private - structure to hold the private to the driver core portions of the bus_type/class structure.
diff --git a/drivers/base/container.c b/drivers/base/container.c
index f40588ebc3f5..8ef783dfd76d 100644
--- a/drivers/base/container.c
+++ b/drivers/base/container.c
@@ -7,6 +7,7 @@
*/
#include <linux/container.h>
+#include <linux/device.h>
#include "base.h"
diff --git a/drivers/base/firmware_loader/builtin/main.c b/drivers/base/firmware_loader/builtin/main.c
index a065c3150897..13bb529ddadf 100644
--- a/drivers/base/firmware_loader/builtin/main.c
+++ b/drivers/base/firmware_loader/builtin/main.c
@@ -2,6 +2,7 @@
/* Builtin firmware support */
#include <linux/firmware.h>
+#include <linux/string.h> // for memcpy()
#include "../firmware.h"
/* Only if FW_LOADER=y */
diff --git a/drivers/base/soc.c b/drivers/base/soc.c
index 282c38aece0d..45365cf04fcd 100644
--- a/drivers/base/soc.c
+++ b/drivers/base/soc.c
@@ -13,6 +13,7 @@
#include <linux/idr.h>
#include <linux/spinlock.h>
#include <linux/sys_soc.h>
+#include <linux/device.h>
#include <linux/err.h>
#include <linux/glob.h>
diff --git a/drivers/base/swnode.c b/drivers/base/swnode.c
index 36512fb75a20..9ee5b270affc 100644
--- a/drivers/base/swnode.c
+++ b/drivers/base/swnode.c
@@ -7,6 +7,7 @@
*/
#include <linux/device.h>
+#include <linux/idr.h>
#include <linux/kernel.h>
#include <linux/property.h>
#include <linux/slab.h>
diff --git a/drivers/base/topology.c b/drivers/base/topology.c
index 89f98be5c5b9..0526c0ee6640 100644
--- a/drivers/base/topology.c
+++ b/drivers/base/topology.c
@@ -10,8 +10,10 @@
*/
#include <linux/mm.h>
#include <linux/cpu.h>
+#include <linux/device.h>
#include <linux/module.h>
#include <linux/hardirq.h>
+#include <linux/sysfs.h>
#include <linux/topology.h>
#define define_id_show_func(name, fmt) \
diff --git a/drivers/base/transport_class.c b/drivers/base/transport_class.c
index 09ee2a1e35bb..902b2d74cad8 100644
--- a/drivers/base/transport_class.c
+++ b/drivers/base/transport_class.c
@@ -26,9 +26,12 @@
* transport class is framed entirely in terms of generic devices to
* allow it to be used by any physical HBA in the system.
*/
+
+#include <linux/device.h>
#include <linux/export.h>
#include <linux/attribute_container.h>
#include <linux/transport_class.h>
+#include <linux/sysfs.h>
static int transport_remove_classdev(struct attribute_container *cont,
struct device *dev,
diff --git a/drivers/block/null_blk/main.c b/drivers/block/null_blk/main.c
index 293f24cc4122..6de94c111f72 100644
--- a/drivers/block/null_blk/main.c
+++ b/drivers/block/null_blk/main.c
@@ -8,6 +8,7 @@
#include <linux/moduleparam.h>
#include <linux/sched.h>
#include <linux/fs.h>
+#include <linux/idr.h>
#include <linux/init.h>
#include "null_blk.h"
diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c
index 5bf98fd6a651..64df47bbe6f2 100644
--- a/drivers/block/virtio_blk.c
+++ b/drivers/block/virtio_blk.c
@@ -3,6 +3,7 @@
#include <linux/spinlock.h>
#include <linux/slab.h>
#include <linux/blkdev.h>
+#include <linux/bvec.h>
#include <linux/hdreg.h>
#include <linux/module.h>
#include <linux/mutex.h>
diff --git a/drivers/block/xen-blkback/blkback.c b/drivers/block/xen-blkback/blkback.c
index 4defd7f387c7..cd4b4819825b 100644
--- a/drivers/block/xen-blkback/blkback.c
+++ b/drivers/block/xen-blkback/blkback.c
@@ -37,11 +37,13 @@
#define pr_fmt(fmt) "xen-blkback: " fmt
#include <linux/spinlock.h>
+#include <linux/highmem.h>
#include <linux/kthread.h>
#include <linux/list.h>
#include <linux/delay.h>
#include <linux/freezer.h>
#include <linux/bitmap.h>
+#include <linux/bio.h>
#include <xen/events.h>
#include <xen/page.h>
diff --git a/drivers/block/zram/zcomp.c b/drivers/block/zram/zcomp.c
index 55af4efd7983..bc1dcf40fd93 100644
--- a/drivers/block/zram/zcomp.c
+++ b/drivers/block/zram/zcomp.c
@@ -11,6 +11,7 @@
#include <linux/sched.h>
#include <linux/cpu.h>
#include <linux/crypto.h>
+#include <linux/gfp.h> // for free_pages()
#include "zcomp.h"
diff --git a/drivers/bus/mhi/ep/main.c b/drivers/bus/mhi/ep/main.c
index 65fc1d738bec..e358d192f0d8 100644
--- a/drivers/bus/mhi/ep/main.c
+++ b/drivers/bus/mhi/ep/main.c
@@ -9,6 +9,7 @@
#include <linux/bitfield.h>
#include <linux/delay.h>
#include <linux/dma-direction.h>
+#include <linux/idr.h>
#include <linux/interrupt.h>
#include <linux/io.h>
#include <linux/irq.h>
diff --git a/drivers/char/hw_random/virtio-rng.c b/drivers/char/hw_random/virtio-rng.c
index 7a4b45393acb..8a1bf80b5259 100644
--- a/drivers/char/hw_random/virtio-rng.c
+++ b/drivers/char/hw_random/virtio-rng.c
@@ -6,6 +6,7 @@
#include <asm/barrier.h>
#include <linux/err.h>
+#include <linux/idr.h> // for DEFINE_IDA
#include <linux/hw_random.h>
#include <linux/scatterlist.h>
#include <linux/spinlock.h>
diff --git a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c
index b0eedc4595b3..a35d6487867c 100644
--- a/drivers/char/ipmi/ipmi_msghandler.c
+++ b/drivers/char/ipmi/ipmi_msghandler.c
@@ -23,6 +23,7 @@
#include <linux/spinlock.h>
#include <linux/mutex.h>
#include <linux/slab.h>
+#include <linux/idr.h> // for DEFINE_IDA
#include <linux/ipmi.h>
#include <linux/ipmi_smi.h>
#include <linux/notifier.h>
diff --git a/drivers/char/misc.c b/drivers/char/misc.c
index 541edc26ec89..d141e0d4dc94 100644
--- a/drivers/char/misc.c
+++ b/drivers/char/misc.c
@@ -45,6 +45,7 @@
#include <linux/proc_fs.h>
#include <linux/seq_file.h>
#include <linux/stat.h>
+#include <linux/idr.h>
#include <linux/init.h>
#include <linux/device.h>
#include <linux/tty.h>
diff --git a/drivers/char/ppdev.c b/drivers/char/ppdev.c
index ee951b265213..cb9546eac6cc 100644
--- a/drivers/char/ppdev.c
+++ b/drivers/char/ppdev.c
@@ -53,6 +53,7 @@
*/
#include <linux/module.h>
+#include <linux/idr.h>
#include <linux/init.h>
#include <linux/sched/signal.h>
#include <linux/device.h>
diff --git a/drivers/char/tpm/tpm-chip.c b/drivers/char/tpm/tpm-chip.c
index 42b1062e33cd..9fab186d60ef 100644
--- a/drivers/char/tpm/tpm-chip.c
+++ b/drivers/char/tpm/tpm-chip.c
@@ -20,6 +20,7 @@
#include <linux/mutex.h>
#include <linux/spinlock.h>
#include <linux/freezer.h>
+#include <linux/idr.h>
#include <linux/major.h>
#include <linux/tpm_eventlog.h>
#include <linux/hw_random.h>
diff --git a/drivers/clk/qcom/clk-regmap-mux-div.h b/drivers/clk/qcom/clk-regmap-mux-div.h
index 4df6c8d24c24..49417def20de 100644
--- a/drivers/clk/qcom/clk-regmap-mux-div.h
+++ b/drivers/clk/qcom/clk-regmap-mux-div.h
@@ -8,6 +8,7 @@
#define __QCOM_CLK_REGMAP_MUX_DIV_H__
#include <linux/clk-provider.h>
+#include <linux/notifier.h>
#include "clk-regmap.h"
/**
diff --git a/drivers/clk/qcom/gdsc.c b/drivers/clk/qcom/gdsc.c
index 5358e28122ab..8860d7726fdc 100644
--- a/drivers/clk/qcom/gdsc.c
+++ b/drivers/clk/qcom/gdsc.c
@@ -5,6 +5,7 @@
#include <linux/bitops.h>
#include <linux/delay.h>
+#include <linux/device.h>
#include <linux/err.h>
#include <linux/export.h>
#include <linux/jiffies.h>
diff --git a/drivers/clk/samsung/clk-cpu.h b/drivers/clk/samsung/clk-cpu.h
index 0164bd9ad021..39ddf58a0172 100644
--- a/drivers/clk/samsung/clk-cpu.h
+++ b/drivers/clk/samsung/clk-cpu.h
@@ -10,6 +10,8 @@
#include "clk.h"
+#include <linux/notifier.h>
+
/**
* struct exynos_cpuclk_cfg_data - config data to setup cpu clocks
* @prate: frequency of the primary parent clock (in KHz)
diff --git a/drivers/clk/sunxi-ng/ccu_common.h b/drivers/clk/sunxi-ng/ccu_common.h
index 942a72c09437..2edb4a23283c 100644
--- a/drivers/clk/sunxi-ng/ccu_common.h
+++ b/drivers/clk/sunxi-ng/ccu_common.h
@@ -8,6 +8,7 @@
#include <linux/compiler.h>
#include <linux/clk-provider.h>
+#include <linux/notifier.h>
#define CCU_FEATURE_FRACTIONAL BIT(0)
#define CCU_FEATURE_VARIABLE_PREDIV BIT(1)
diff --git a/drivers/cpufreq/apple-soc-cpufreq.c b/drivers/cpufreq/apple-soc-cpufreq.c
index 021f423705e1..f1bb29fc6182 100644
--- a/drivers/cpufreq/apple-soc-cpufreq.c
+++ b/drivers/cpufreq/apple-soc-cpufreq.c
@@ -13,6 +13,7 @@
#include <linux/cpufreq.h>
#include <linux/cpumask.h>
#include <linux/delay.h>
+#include <linux/device.h>
#include <linux/err.h>
#include <linux/io.h>
#include <linux/iopoll.h>
diff --git a/drivers/cpufreq/cpufreq_governor.h b/drivers/cpufreq/cpufreq_governor.h
index 168c23fd7fca..e67d33d3acb7 100644
--- a/drivers/cpufreq/cpufreq_governor.h
+++ b/drivers/cpufreq/cpufreq_governor.h
@@ -18,6 +18,7 @@
#include <linux/irq_work.h>
#include <linux/cpufreq.h>
#include <linux/sched/cpufreq.h>
+#include <linux/sysfs.h>
#include <linux/kernel_stat.h>
#include <linux/module.h>
#include <linux/mutex.h>
diff --git a/drivers/cpufreq/freq_table.c b/drivers/cpufreq/freq_table.c
index c4d4643b6ca6..d5f140c2b95e 100644
--- a/drivers/cpufreq/freq_table.c
+++ b/drivers/cpufreq/freq_table.c
@@ -9,6 +9,7 @@
#include <linux/cpufreq.h>
#include <linux/module.h>
+#include <linux/sysfs.h>
/*********************************************************************
* FREQUENCY TABLE HELPERS *
diff --git a/drivers/cxl/cxl.h b/drivers/cxl/cxl.h
index b6017c0c57b4..784bcd943215 100644
--- a/drivers/cxl/cxl.h
+++ b/drivers/cxl/cxl.h
@@ -7,9 +7,12 @@
#include <linux/libnvdimm.h>
#include <linux/bitfield.h>
#include <linux/bitops.h>
+#include <linux/device/driver.h>
#include <linux/log2.h>
#include <linux/node.h>
+#include <linux/idr.h>
#include <linux/io.h>
+#include <linux/range.h>
/**
* DOC: cxl objects
diff --git a/drivers/cxl/cxlmem.h b/drivers/cxl/cxlmem.h
index 5303d6942b88..25081f2cf5c4 100644
--- a/drivers/cxl/cxlmem.h
+++ b/drivers/cxl/cxlmem.h
@@ -7,6 +7,7 @@
#include <linux/uuid.h>
#include <linux/rcuwait.h>
#include <linux/cxl-event.h>
+#include <linux/ioport.h>
#include <linux/node.h>
#include "cxl.h"
diff --git a/drivers/devfreq/event/rockchip-dfi.c b/drivers/devfreq/event/rockchip-dfi.c
index e2a1e4463b6f..35eeb63180f7 100644
--- a/drivers/devfreq/event/rockchip-dfi.c
+++ b/drivers/devfreq/event/rockchip-dfi.c
@@ -22,6 +22,7 @@
#include <linux/bitfield.h>
#include <linux/bits.h>
#include <linux/perf_event.h>
+#include <linux/hrtimer.h>
#include <soc/rockchip/rockchip_grf.h>
#include <soc/rockchip/rk3399_grf.h>
diff --git a/drivers/dma-buf/st-dma-fence.c b/drivers/dma-buf/st-dma-fence.c
index b7c6f7ea9e0c..28e5f4cebf5c 100644
--- a/drivers/dma-buf/st-dma-fence.c
+++ b/drivers/dma-buf/st-dma-fence.c
@@ -11,6 +11,7 @@
#include <linux/sched/signal.h>
#include <linux/slab.h>
#include <linux/spinlock.h>
+#include <linux/timer.h>
#include "selftest.h"
diff --git a/drivers/dma/ioat/sysfs.c b/drivers/dma/ioat/sysfs.c
index 168adf28c5b1..32a0be07b034 100644
--- a/drivers/dma/ioat/sysfs.c
+++ b/drivers/dma/ioat/sysfs.c
@@ -5,6 +5,7 @@
*/
#include <linux/init.h>
+#include <linux/kobject.h>
#include <linux/module.h>
#include <linux/dmaengine.h>
#include <linux/pci.h>
diff --git a/drivers/eisa/eisa-bus.c b/drivers/eisa/eisa-bus.c
index 33f0ba11c6ad..40c5f7cecd6b 100644
--- a/drivers/eisa/eisa-bus.c
+++ b/drivers/eisa/eisa-bus.c
@@ -8,6 +8,7 @@
#include <linux/kernel.h>
#include <linux/device.h>
#include <linux/eisa.h>
+#include <linux/kobject.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/init.h>
diff --git a/drivers/extcon/devres.c b/drivers/extcon/devres.c
index f9d52e8ec5cf..a22c2374fd7a 100644
--- a/drivers/extcon/devres.c
+++ b/drivers/extcon/devres.c
@@ -7,6 +7,7 @@
*/
#include "extcon.h"
+#include <linux/device.h>
static int devm_extcon_dev_match(struct device *dev, void *res, void *data)
{
diff --git a/drivers/extcon/extcon.h b/drivers/extcon/extcon.h
index 946182687786..b2e0f715d81c 100644
--- a/drivers/extcon/extcon.h
+++ b/drivers/extcon/extcon.h
@@ -2,6 +2,7 @@
#ifndef __LINUX_EXTCON_INTERNAL_H__
#define __LINUX_EXTCON_INTERNAL_H__
+#include <linux/device.h>
#include <linux/extcon-provider.h>
/**
diff --git a/drivers/firmware/arm_ffa/bus.c b/drivers/firmware/arm_ffa/bus.c
index 1c7940ba5539..50914dd5afd6 100644
--- a/drivers/firmware/arm_ffa/bus.c
+++ b/drivers/firmware/arm_ffa/bus.c
@@ -8,6 +8,7 @@
#include <linux/arm_ffa.h>
#include <linux/device.h>
#include <linux/fs.h>
+#include <linux/idr.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/slab.h>
diff --git a/drivers/firmware/arm_scmi/bus.c b/drivers/firmware/arm_scmi/bus.c
index c15928b8c5cc..4e63209e35de 100644
--- a/drivers/firmware/arm_scmi/bus.c
+++ b/drivers/firmware/arm_scmi/bus.c
@@ -8,6 +8,7 @@
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/atomic.h>
+#include <linux/idr.h>
#include <linux/types.h>
#include <linux/module.h>
#include <linux/of.h>
diff --git a/drivers/firmware/edd.c b/drivers/firmware/edd.c
index 55dec4eb2c00..1971ff720078 100644
--- a/drivers/firmware/edd.c
+++ b/drivers/firmware/edd.c
@@ -20,6 +20,7 @@
* the list of BIOSs which have been reported to implement EDD.
*/
+#include <linux/kobject.h>
#include <linux/module.h>
#include <linux/string.h>
#include <linux/types.h>
diff --git a/drivers/firmware/efi/libstub/efi-stub-helper.c b/drivers/firmware/efi/libstub/efi-stub-helper.c
index bfa30625f5d0..944c69ab4683 100644
--- a/drivers/firmware/efi/libstub/efi-stub-helper.c
+++ b/drivers/firmware/efi/libstub/efi-stub-helper.c
@@ -9,6 +9,7 @@
#include <linux/stdarg.h>
+#include <linux/ctype.h>
#include <linux/efi.h>
#include <linux/kernel.h>
#include <asm/efi.h>
diff --git a/drivers/firmware/google/gsmi.c b/drivers/firmware/google/gsmi.c
index 96ea1fa76d35..ef6168516236 100644
--- a/drivers/firmware/google/gsmi.c
+++ b/drivers/firmware/google/gsmi.c
@@ -26,6 +26,7 @@
#include <linux/uaccess.h>
#include <linux/dmi.h>
#include <linux/kdebug.h>
+#include <linux/kobject.h>
#include <linux/reboot.h>
#include <linux/efi.h>
#include <linux/module.h>
diff --git a/drivers/fpga/dfl.c b/drivers/fpga/dfl.c
index e6d12fbab653..ad5b11ac54df 100644
--- a/drivers/fpga/dfl.c
+++ b/drivers/fpga/dfl.c
@@ -12,6 +12,8 @@
*/
#include <linux/dfl.h>
#include <linux/fpga-dfl.h>
+#include <linux/idr.h>
+#include <linux/kobject.h>
#include <linux/module.h>
#include <linux/overflow.h>
#include <linux/uaccess.h>
diff --git a/drivers/gpio/gpio-tegra.c b/drivers/gpio/gpio-tegra.c
index ea5f9cc14bc4..c632bd6d1adf 100644
--- a/drivers/gpio/gpio-tegra.c
+++ b/drivers/gpio/gpio-tegra.c
@@ -23,6 +23,7 @@
#include <linux/irqchip/chained_irq.h>
#include <linux/pinctrl/consumer.h>
#include <linux/pm.h>
+#include <linux/ratelimit.h>
#define GPIO_BANK(x) ((x) >> 5)
#define GPIO_PORT(x) (((x) >> 3) & 0x3)
diff --git a/drivers/gpio/gpio-tegra186.c b/drivers/gpio/gpio-tegra186.c
index d87dd06db40d..02d138cf9e59 100644
--- a/drivers/gpio/gpio-tegra186.c
+++ b/drivers/gpio/gpio-tegra186.c
@@ -13,6 +13,7 @@
#include <linux/module.h>
#include <linux/of.h>
#include <linux/platform_device.h>
+#include <linux/ratelimit.h>
#include <linux/seq_file.h>
#include <dt-bindings/gpio/tegra186-gpio.h>
diff --git a/drivers/gpio/gpio-thunderx.c b/drivers/gpio/gpio-thunderx.c
index 8521c6aacace..cd439802a552 100644
--- a/drivers/gpio/gpio-thunderx.c
+++ b/drivers/gpio/gpio-thunderx.c
@@ -15,6 +15,7 @@
#include <linux/module.h>
#include <linux/pci.h>
#include <linux/spinlock.h>
+#include <linux/ratelimit.h>
#define GPIO_RX_DAT 0x0
#define GPIO_TX_SET 0x8
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.h
index 85376baaa92f..441cf05fcd6a 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.h
@@ -23,6 +23,7 @@
#ifndef __AMDGPU_CTX_H__
#define __AMDGPU_CTX_H__
+#include <linux/idr.h>
#include <linux/ktime.h>
#include <linux/types.h>
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index 6a930c98387f..c195166a923b 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -34,6 +34,7 @@
#include <linux/pci.h>
#include <linux/pci-p2pdma.h>
#include <linux/apple-gmux.h>
+#include <linux/ratelimit.h>
#include <drm/drm_aperture.h>
#include <drm/drm_atomic_helper.h>
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ih.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_ih.h
index 508f02eb0cf8..59a5bc9b1120 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ih.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ih.h
@@ -24,6 +24,9 @@
#ifndef __AMDGPU_IH_H__
#define __AMDGPU_IH_H__
+#include <linux/types.h>
+#include <linux/wait.h>
+
/* Maximum number of IVs processed at once */
#define AMDGPU_IH_MAX_NUM_IVS 32
diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_color_mgmt.c b/drivers/gpu/drm/arm/display/komeda/komeda_color_mgmt.c
index d8e449e6ebda..28df5859897c 100644
--- a/drivers/gpu/drm/arm/display/komeda/komeda_color_mgmt.c
+++ b/drivers/gpu/drm/arm/display/komeda/komeda_color_mgmt.c
@@ -7,6 +7,8 @@
#include "komeda_color_mgmt.h"
+#include <linux/array_size.h> // for ARRAY_SIZE()
+
/* 10bit precision YUV2RGB matrix */
static const s32 yuv2rgb_bt601_narrow[KOMEDA_N_YUV2RGB_COEFFS] = {
1192, 0, 1634,
diff --git a/drivers/gpu/drm/i915/i915_perf.c b/drivers/gpu/drm/i915/i915_perf.c
index 2d695818f006..27f9be67514f 100644
--- a/drivers/gpu/drm/i915/i915_perf.c
+++ b/drivers/gpu/drm/i915/i915_perf.c
@@ -193,6 +193,7 @@
#include <linux/anon_inodes.h>
#include <linux/nospec.h>
+#include <linux/ratelimit.h>
#include <linux/sizes.h>
#include <linux/uuid.h>
diff --git a/drivers/gpu/drm/i915/i915_perf_types.h b/drivers/gpu/drm/i915/i915_perf_types.h
index 46445248d193..403caa12cc86 100644
--- a/drivers/gpu/drm/i915/i915_perf_types.h
+++ b/drivers/gpu/drm/i915/i915_perf_types.h
@@ -9,6 +9,7 @@
#include <linux/atomic.h>
#include <linux/device.h>
#include <linux/hrtimer.h>
+#include <linux/kobject.h>
#include <linux/llist.h>
#include <linux/poll.h>
#include <linux/sysfs.h>
diff --git a/drivers/gpu/drm/i915/i915_scatterlist.h b/drivers/gpu/drm/i915/i915_scatterlist.h
index 6cf8a298849f..716e5ab11ce3 100644
--- a/drivers/gpu/drm/i915/i915_scatterlist.h
+++ b/drivers/gpu/drm/i915/i915_scatterlist.h
@@ -7,6 +7,7 @@
#ifndef I915_SCATTERLIST_H
#define I915_SCATTERLIST_H
+#include <linux/kref.h>
#include <linux/pfn.h>
#include <linux/scatterlist.h>
#include <linux/dma-mapping.h>
diff --git a/drivers/gpu/drm/msm/msm_drv.h b/drivers/gpu/drm/msm/msm_drv.h
index 16a7cbc0b7dd..e7a2d2c3145a 100644
--- a/drivers/gpu/drm/msm/msm_drv.h
+++ b/drivers/gpu/drm/msm/msm_drv.h
@@ -25,6 +25,7 @@
#include <linux/of_device.h>
#include <linux/sizes.h>
#include <linux/kthread.h>
+#include <linux/hrtimer.h>
#include <drm/drm_atomic.h>
#include <drm/drm_atomic_helper.h>
diff --git a/drivers/gpu/drm/nouveau/dispnv50/disp.c b/drivers/gpu/drm/nouveau/dispnv50/disp.c
index 8d37a694b772..0c3d88ad0b0e 100644
--- a/drivers/gpu/drm/nouveau/dispnv50/disp.c
+++ b/drivers/gpu/drm/nouveau/dispnv50/disp.c
@@ -28,6 +28,7 @@
#include "wndw.h"
#include "handles.h"
+#include <linux/backlight.h>
#include <linux/dma-mapping.h>
#include <linux/hdmi.h>
#include <linux/component.h>
diff --git a/drivers/gpu/drm/xe/xe_gpu_scheduler.c b/drivers/gpu/drm/xe/xe_gpu_scheduler.c
index e4ad1d6ce1d5..0f263dc0dc19 100644
--- a/drivers/gpu/drm/xe/xe_gpu_scheduler.c
+++ b/drivers/gpu/drm/xe/xe_gpu_scheduler.c
@@ -5,6 +5,8 @@
#include "xe_gpu_scheduler.h"
+#include <linux/workqueue.h>
+
static void xe_sched_process_msg_queue(struct xe_gpu_scheduler *sched)
{
if (!READ_ONCE(sched->base.pause_submit))
diff --git a/drivers/gpu/drm/xe/xe_guc_ct.h b/drivers/gpu/drm/xe/xe_guc_ct.h
index f15f8a4857e0..31b2fbe4c264 100644
--- a/drivers/gpu/drm/xe/xe_guc_ct.h
+++ b/drivers/gpu/drm/xe/xe_guc_ct.h
@@ -8,6 +8,8 @@
#include "xe_guc_ct_types.h"
+#include <linux/workqueue.h>
+
struct drm_printer;
int xe_guc_ct_init(struct xe_guc_ct *ct);
diff --git a/drivers/hid/intel-ish-hid/ishtp/bus.c b/drivers/hid/intel-ish-hid/ishtp/bus.c
index aa6cb033bb06..4ca13f42e44f 100644
--- a/drivers/hid/intel-ish-hid/ishtp/bus.c
+++ b/drivers/hid/intel-ish-hid/ishtp/bus.c
@@ -8,6 +8,7 @@
#include <linux/module.h>
#include <linux/init.h>
#include <linux/kernel.h>
+#include <linux/kobject.h>
#include <linux/device.h>
#include <linux/sched.h>
#include <linux/slab.h>
diff --git a/drivers/hwmon/coretemp.c b/drivers/hwmon/coretemp.c
index ba82d1e79c13..457994a41b13 100644
--- a/drivers/hwmon/coretemp.c
+++ b/drivers/hwmon/coretemp.c
@@ -10,6 +10,7 @@
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/module.h>
+#include <linux/idr.h>
#include <linux/init.h>
#include <linux/slab.h>
#include <linux/jiffies.h>
diff --git a/drivers/hwmon/nct6775-core.c b/drivers/hwmon/nct6775-core.c
index 8d2ef3145bca..36f7efa05085 100644
--- a/drivers/hwmon/nct6775-core.c
+++ b/drivers/hwmon/nct6775-core.c
@@ -51,6 +51,7 @@
#include <linux/err.h>
#include <linux/mutex.h>
#include <linux/bitops.h>
+#include <linux/device.h>
#include <linux/nospec.h>
#include <linux/regmap.h>
#include "lm75.h"
diff --git a/drivers/iio/adc/ti-tsc2046.c b/drivers/iio/adc/ti-tsc2046.c
index 1bbb51a6683c..d388673500a1 100644
--- a/drivers/iio/adc/ti-tsc2046.c
+++ b/drivers/iio/adc/ti-tsc2046.c
@@ -11,6 +11,7 @@
#include <linux/regulator/consumer.h>
#include <linux/spi/spi.h>
#include <linux/units.h>
+#include <linux/hrtimer.h>
#include <asm/unaligned.h>
diff --git a/drivers/infiniband/hw/hfi1/rc.c b/drivers/infiniband/hw/hfi1/rc.c
index b36242c9d42c..d5a94a2d144f 100644
--- a/drivers/infiniband/hw/hfi1/rc.c
+++ b/drivers/infiniband/hw/hfi1/rc.c
@@ -3,6 +3,7 @@
* Copyright(c) 2015 - 2018 Intel Corporation.
*/
+#include <linux/hrtimer.h>
#include <linux/io.h>
#include <rdma/rdma_vt.h>
#include <rdma/rdmavt_qp.h>
diff --git a/drivers/infiniband/hw/qib/qib_file_ops.c b/drivers/infiniband/hw/qib/qib_file_ops.c
index 29e4c59aa23b..dfa4ab446427 100644
--- a/drivers/infiniband/hw/qib/qib_file_ops.c
+++ b/drivers/infiniband/hw/qib/qib_file_ops.c
@@ -40,6 +40,7 @@
#include <linux/highmem.h>
#include <linux/io.h>
#include <linux/jiffies.h>
+#include <linux/kobject.h>
#include <linux/delay.h>
#include <linux/export.h>
#include <linux/uio.h>
diff --git a/drivers/infiniband/hw/usnic/usnic_ib_main.c b/drivers/infiniband/hw/usnic/usnic_ib_main.c
index 13b654ddd3cc..632f2a171f60 100644
--- a/drivers/infiniband/hw/usnic/usnic_ib_main.c
+++ b/drivers/infiniband/hw/usnic/usnic_ib_main.c
@@ -39,6 +39,7 @@
*
*/
+#include <linux/kref.h>
#include <linux/module.h>
#include <linux/inetdevice.h>
#include <linux/init.h>
diff --git a/drivers/infiniband/hw/usnic/usnic_ib_sysfs.c b/drivers/infiniband/hw/usnic/usnic_ib_sysfs.c
index fdb63a8fb997..82e761bff7d5 100644
--- a/drivers/infiniband/hw/usnic/usnic_ib_sysfs.c
+++ b/drivers/infiniband/hw/usnic/usnic_ib_sysfs.c
@@ -33,6 +33,7 @@
#include <linux/init.h>
#include <linux/errno.h>
+#include <linux/kref.h>
#include <rdma/ib_user_verbs.h>
#include <rdma/ib_addr.h>
diff --git a/drivers/infiniband/sw/rdmavt/cq.c b/drivers/infiniband/sw/rdmavt/cq.c
index 82c3f5932249..ba136ac88abc 100644
--- a/drivers/infiniband/sw/rdmavt/cq.c
+++ b/drivers/infiniband/sw/rdmavt/cq.c
@@ -3,6 +3,7 @@
* Copyright(c) 2016 - 2018 Intel Corporation.
*/
+#include <linux/kref.h>
#include <linux/slab.h>
#include <linux/vmalloc.h>
#include "cq.h"
diff --git a/drivers/infiniband/sw/rdmavt/qp.c b/drivers/infiniband/sw/rdmavt/qp.c
index e6203e26cc06..49f74b7c6de8 100644
--- a/drivers/infiniband/sw/rdmavt/qp.c
+++ b/drivers/infiniband/sw/rdmavt/qp.c
@@ -5,6 +5,7 @@
#include <linux/hash.h>
#include <linux/bitops.h>
+#include <linux/hrtimer.h>
#include <linux/lockdep.h>
#include <linux/vmalloc.h>
#include <linux/slab.h>
diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c
index 2916e77f589b..8a9b99ad671f 100644
--- a/drivers/infiniband/ulp/srp/ib_srp.c
+++ b/drivers/infiniband/ulp/srp/ib_srp.c
@@ -39,6 +39,7 @@
#include <linux/string.h>
#include <linux/parser.h>
#include <linux/random.h>
+#include <linux/kobject_ns.h>
#include <linux/jiffies.h>
#include <linux/lockdep.h>
#include <linux/inet.h>
diff --git a/drivers/iommu/virtio-iommu.c b/drivers/iommu/virtio-iommu.c
index 34db37fd9675..6e782f9a29ec 100644
--- a/drivers/iommu/virtio-iommu.c
+++ b/drivers/iommu/virtio-iommu.c
@@ -10,6 +10,7 @@
#include <linux/delay.h>
#include <linux/dma-map-ops.h>
#include <linux/freezer.h>
+#include <linux/idr.h>
#include <linux/interval_tree.h>
#include <linux/iommu.h>
#include <linux/module.h>
diff --git a/drivers/mailbox/mailbox.c b/drivers/mailbox/mailbox.c
index ebff3baf3045..3452fa6784ae 100644
--- a/drivers/mailbox/mailbox.c
+++ b/drivers/mailbox/mailbox.c
@@ -18,6 +18,7 @@
#include <linux/mailbox_client.h>
#include <linux/mailbox_controller.h>
#include <linux/of.h>
+#include <linux/hrtimer.h>
#include "mailbox.h"
diff --git a/drivers/md/bcache/bset.c b/drivers/md/bcache/bset.c
index 2bba4d6aaaa2..8460b8d543d8 100644
--- a/drivers/md/bcache/bset.c
+++ b/drivers/md/bcache/bset.c
@@ -13,6 +13,7 @@
#include <linux/console.h>
#include <linux/sched/clock.h>
+#include <linux/mm.h> // for page_address()
#include <linux/random.h>
#include <linux/prefetch.h>
diff --git a/drivers/md/bcache/sysfs.h b/drivers/md/bcache/sysfs.h
index 65b8bd975ab1..2e06366b7b0b 100644
--- a/drivers/md/bcache/sysfs.h
+++ b/drivers/md/bcache/sysfs.h
@@ -2,6 +2,8 @@
#ifndef _BCACHE_SYSFS_H_
#define _BCACHE_SYSFS_H_
+#include <linux/sysfs.h>
+
#define KTYPE(type) \
const struct kobj_type type ## _ktype = { \
.release = type ## _release, \
diff --git a/drivers/media/cec/core/cec-pin.c b/drivers/media/cec/core/cec-pin.c
index 330d5d5d86ab..262870863e0a 100644
--- a/drivers/media/cec/core/cec-pin.c
+++ b/drivers/media/cec/core/cec-pin.c
@@ -6,6 +6,7 @@
#include <linux/delay.h>
#include <linux/slab.h>
#include <linux/sched/types.h>
+#include <linux/hrtimer.h>
#include <media/cec-pin.h>
#include "cec-pin-priv.h"
diff --git a/drivers/media/pci/pt3/pt3.c b/drivers/media/pci/pt3/pt3.c
index 246f73b8a9e7..e47d8fa88d5e 100644
--- a/drivers/media/pci/pt3/pt3.c
+++ b/drivers/media/pci/pt3/pt3.c
@@ -13,6 +13,7 @@
#include <linux/pci.h>
#include <linux/string.h>
#include <linux/sched/signal.h>
+#include <linux/hrtimer.h>
#include <media/dmxdev.h>
#include <media/dvbdev.h>
diff --git a/drivers/memory/tegra/tegra234.c b/drivers/memory/tegra/tegra234.c
index abff87f917cb..cf595c6460ed 100644
--- a/drivers/memory/tegra/tegra234.c
+++ b/drivers/memory/tegra/tegra234.c
@@ -6,6 +6,7 @@
#include <soc/tegra/mc.h>
#include <dt-bindings/memory/tegra234-mc.h>
+#include <linux/device.h>
#include <linux/interconnect.h>
#include <linux/tegra-icc.h>
diff --git a/drivers/mfd/abx500-core.c b/drivers/mfd/abx500-core.c
index e896531d0354..db2e1706d987 100644
--- a/drivers/mfd/abx500-core.c
+++ b/drivers/mfd/abx500-core.c
@@ -7,6 +7,7 @@
#include <linux/list.h>
#include <linux/slab.h>
+#include <linux/device.h> // for devm_kzalloc()
#include <linux/err.h>
#include <linux/init.h>
#include <linux/export.h>
diff --git a/drivers/misc/cardreader/alcor_pci.c b/drivers/misc/cardreader/alcor_pci.c
index 0142c4bf4f42..d10a81756fe9 100644
--- a/drivers/misc/cardreader/alcor_pci.c
+++ b/drivers/misc/cardreader/alcor_pci.c
@@ -6,6 +6,7 @@
*/
#include <linux/delay.h>
+#include <linux/idr.h>
#include <linux/interrupt.h>
#include <linux/io.h>
#include <linux/irq.h>
diff --git a/drivers/misc/dw-xdata-pcie.c b/drivers/misc/dw-xdata-pcie.c
index efd0ca8cc925..fb9b65d7730b 100644
--- a/drivers/misc/dw-xdata-pcie.c
+++ b/drivers/misc/dw-xdata-pcie.c
@@ -9,6 +9,7 @@
#include <linux/miscdevice.h>
#include <linux/bitfield.h>
#include <linux/pci-epf.h>
+#include <linux/idr.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/device.h>
diff --git a/drivers/misc/lkdtm/heap.c b/drivers/misc/lkdtm/heap.c
index b1b316f99703..2ea3574de879 100644
--- a/drivers/misc/lkdtm/heap.c
+++ b/drivers/misc/lkdtm/heap.c
@@ -8,6 +8,7 @@
#include <linux/slab.h>
#include <linux/vmalloc.h>
#include <linux/sched.h>
+#include <linux/jiffies.h>
static struct kmem_cache *double_free_cache;
static struct kmem_cache *a_cache;
diff --git a/drivers/misc/mei/bus.c b/drivers/misc/mei/bus.c
index f9bcff197615..71251ee2ffdc 100644
--- a/drivers/misc/mei/bus.c
+++ b/drivers/misc/mei/bus.c
@@ -7,6 +7,7 @@
#include <linux/module.h>
#include <linux/device.h>
#include <linux/kernel.h>
+#include <linux/kobject.h>
#include <linux/sched/signal.h>
#include <linux/init.h>
#include <linux/errno.h>
diff --git a/drivers/misc/mei/client.c b/drivers/misc/mei/client.c
index 9d090fa07516..e7886e1816da 100644
--- a/drivers/misc/mei/client.c
+++ b/drivers/misc/mei/client.c
@@ -7,6 +7,7 @@
#include <linux/sched/signal.h>
#include <linux/wait.h>
#include <linux/delay.h>
+#include <linux/kref.h>
#include <linux/slab.h>
#include <linux/pm_runtime.h>
#include <linux/dma-mapping.h>
diff --git a/drivers/misc/mei/debugfs.c b/drivers/misc/mei/debugfs.c
index 3b098d4c8e3d..f7a3ea46561a 100644
--- a/drivers/misc/mei/debugfs.c
+++ b/drivers/misc/mei/debugfs.c
@@ -6,6 +6,7 @@
#include <linux/slab.h>
#include <linux/kernel.h>
+#include <linux/kref.h>
#include <linux/device.h>
#include <linux/debugfs.h>
#include <linux/seq_file.h>
diff --git a/drivers/misc/mei/main.c b/drivers/misc/mei/main.c
index 79e6f3c1341f..36707eaf7be0 100644
--- a/drivers/misc/mei/main.c
+++ b/drivers/misc/mei/main.c
@@ -14,6 +14,7 @@
#include <linux/types.h>
#include <linux/fcntl.h>
#include <linux/poll.h>
+#include <linux/idr.h>
#include <linux/init.h>
#include <linux/ioctl.h>
#include <linux/cdev.h>
diff --git a/drivers/misc/pci_endpoint_test.c b/drivers/misc/pci_endpoint_test.c
index c38a6083f0a7..fe65f26da400 100644
--- a/drivers/misc/pci_endpoint_test.c
+++ b/drivers/misc/pci_endpoint_test.c
@@ -9,6 +9,7 @@
#include <linux/crc32.h>
#include <linux/delay.h>
#include <linux/fs.h>
+#include <linux/idr.h>
#include <linux/io.h>
#include <linux/interrupt.h>
#include <linux/irq.h>
diff --git a/drivers/misc/vcpu_stall_detector.c b/drivers/misc/vcpu_stall_detector.c
index 6479c962da1a..be69d9c4a993 100644
--- a/drivers/misc/vcpu_stall_detector.c
+++ b/drivers/misc/vcpu_stall_detector.c
@@ -17,6 +17,7 @@
#include <linux/percpu.h>
#include <linux/platform_device.h>
#include <linux/slab.h>
+#include <linux/hrtimer.h>
#define VCPU_STALL_REG_STATUS (0x00)
#define VCPU_STALL_REG_LOAD_CNT (0x04)
diff --git a/drivers/misc/xilinx_sdfec.c b/drivers/misc/xilinx_sdfec.c
index 94a0ee19bf20..03d0abf740c8 100644
--- a/drivers/misc/xilinx_sdfec.c
+++ b/drivers/misc/xilinx_sdfec.c
@@ -11,6 +11,7 @@
*/
#include <linux/miscdevice.h>
+#include <linux/idr.h>
#include <linux/io.h>
#include <linux/interrupt.h>
#include <linux/kernel.h>
diff --git a/drivers/mtd/mtd_blkdevs.c b/drivers/mtd/mtd_blkdevs.c
index f0526dcc2162..7e52f6cd0cc2 100644
--- a/drivers/mtd/mtd_blkdevs.c
+++ b/drivers/mtd/mtd_blkdevs.c
@@ -5,6 +5,7 @@
* Copyright © 2003-2010 David Woodhouse <[email protected]>
*/
+#include <linux/highmem.h>
#include <linux/kernel.h>
#include <linux/slab.h>
#include <linux/module.h>
diff --git a/drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c b/drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c
index eebf967f4711..230d14500ae7 100644
--- a/drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c
+++ b/drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c
@@ -20,6 +20,7 @@
#include <linux/module.h>
#include <linux/pm_runtime.h>
#include <linux/property.h>
+#include <linux/hrtimer.h>
#include "mcp251xfd.h"
diff --git a/drivers/net/can/spi/mcp251xfd/mcp251xfd-ring.c b/drivers/net/can/spi/mcp251xfd/mcp251xfd-ring.c
index bfe4caa0c99d..1182bc8dd529 100644
--- a/drivers/net/can/spi/mcp251xfd/mcp251xfd-ring.c
+++ b/drivers/net/can/spi/mcp251xfd/mcp251xfd-ring.c
@@ -17,6 +17,8 @@
#include "mcp251xfd.h"
#include "mcp251xfd-ram.h"
+#include <linux/hrtimer.h>
+
static inline u8
mcp251xfd_cmd_prepare_write_reg(const struct mcp251xfd_priv *priv,
union mcp251xfd_write_reg_buf *write_reg_buf,
diff --git a/drivers/net/can/spi/mcp251xfd/mcp251xfd-rx.c b/drivers/net/can/spi/mcp251xfd/mcp251xfd-rx.c
index ced8d9c81f8c..1cfdd6ec3a12 100644
--- a/drivers/net/can/spi/mcp251xfd/mcp251xfd-rx.c
+++ b/drivers/net/can/spi/mcp251xfd/mcp251xfd-rx.c
@@ -13,6 +13,7 @@
//
#include <linux/bitfield.h>
+#include <linux/hrtimer.h>
#include "mcp251xfd.h"
diff --git a/drivers/net/can/spi/mcp251xfd/mcp251xfd-tef.c b/drivers/net/can/spi/mcp251xfd/mcp251xfd-tef.c
index e5bd57b65aaf..75b226a868be 100644
--- a/drivers/net/can/spi/mcp251xfd/mcp251xfd-tef.c
+++ b/drivers/net/can/spi/mcp251xfd/mcp251xfd-tef.c
@@ -13,6 +13,7 @@
//
#include <linux/bitfield.h>
+#include <linux/hrtimer.h>
#include "mcp251xfd.h"
diff --git a/drivers/net/ethernet/cortina/gemini.c b/drivers/net/ethernet/cortina/gemini.c
index 705c3eb19cd3..6ae699443a1b 100644
--- a/drivers/net/ethernet/cortina/gemini.c
+++ b/drivers/net/ethernet/cortina/gemini.c
@@ -36,6 +36,7 @@
#include <linux/ethtool.h>
#include <linux/tcp.h>
#include <linux/u64_stats_sync.h>
+#include <linux/hrtimer.h>
#include <linux/in.h>
#include <linux/ip.h>
diff --git a/drivers/net/ethernet/freescale/fec_ptp.c b/drivers/net/ethernet/freescale/fec_ptp.c
index 181d9bfbee22..6f36d1ffbc61 100644
--- a/drivers/net/ethernet/freescale/fec_ptp.c
+++ b/drivers/net/ethernet/freescale/fec_ptp.c
@@ -32,6 +32,7 @@
#include <linux/of.h>
#include <linux/of_gpio.h>
#include <linux/of_net.h>
+#include <linux/hrtimer.h>
#include "fec.h"
diff --git a/drivers/net/ethernet/hisilicon/hip04_eth.c b/drivers/net/ethernet/hisilicon/hip04_eth.c
index b91e7a06b97f..4b75a40daa7f 100644
--- a/drivers/net/ethernet/hisilicon/hip04_eth.c
+++ b/drivers/net/ethernet/hisilicon/hip04_eth.c
@@ -15,6 +15,7 @@
#include <linux/of_net.h>
#include <linux/mfd/syscon.h>
#include <linux/regmap.h>
+#include <linux/hrtimer.h>
#define SC_PPE_RESET_DREQ 0x026C
diff --git a/drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c b/drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c
index a5e3d1a88305..1c06334a38db 100644
--- a/drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c
+++ b/drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c
@@ -9,6 +9,7 @@
#include <linux/ipv6.h>
#include <net/ip6_checksum.h>
#include <linux/bitfield.h>
+#include <linux/hrtimer.h>
#include "rmnet_config.h"
#include "rmnet_map.h"
#include "rmnet_private.h"
diff --git a/drivers/net/ethernet/ti/am65-cpsw-nuss.c b/drivers/net/ethernet/ti/am65-cpsw-nuss.c
index 9d2f4ac783e4..45e4d70ad021 100644
--- a/drivers/net/ethernet/ti/am65-cpsw-nuss.c
+++ b/drivers/net/ethernet/ti/am65-cpsw-nuss.c
@@ -30,6 +30,7 @@
#include <linux/sys_soc.h>
#include <linux/dma/ti-cppi5.h>
#include <linux/dma/k3-udma-glue.h>
+#include <linux/hrtimer.h>
#include <net/switchdev.h>
#include "cpsw_ale.h"
diff --git a/drivers/net/mdio/mdio-mux-meson-gxl.c b/drivers/net/mdio/mdio-mux-meson-gxl.c
index 89554021b5cc..b3e680d27e2b 100644
--- a/drivers/net/mdio/mdio-mux-meson-gxl.c
+++ b/drivers/net/mdio/mdio-mux-meson-gxl.c
@@ -9,6 +9,7 @@
#include <linux/io.h>
#include <linux/mdio-mux.h>
#include <linux/module.h>
+#include <linux/mod_devicetable.h>
#include <linux/platform_device.h>
#define ETH_REG2 0x0
diff --git a/drivers/net/mdio/mdio-mux-multiplexer.c b/drivers/net/mdio/mdio-mux-multiplexer.c
index 569b13383191..97e307d946a8 100644
--- a/drivers/net/mdio/mdio-mux-multiplexer.c
+++ b/drivers/net/mdio/mdio-mux-multiplexer.c
@@ -6,6 +6,7 @@
#include <linux/mdio-mux.h>
#include <linux/module.h>
+#include <linux/mod_devicetable.h>
#include <linux/mux/consumer.h>
#include <linux/platform_device.h>
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02_usb_core.c b/drivers/net/wireless/mediatek/mt76/mt76x02_usb_core.c
index 85a78dea4085..b11bc7ab80a8 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x02_usb_core.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x02_usb_core.c
@@ -5,6 +5,8 @@
#include "mt76x02_usb.h"
+#include <linux/hrtimer.h>
+
static void mt76x02u_remove_dma_hdr(struct sk_buff *skb)
{
int hdr_len;
diff --git a/drivers/net/wireless/virtual/mac80211_hwsim.c b/drivers/net/wireless/virtual/mac80211_hwsim.c
index a84340c2075f..914c3b63430f 100644
--- a/drivers/net/wireless/virtual/mac80211_hwsim.c
+++ b/drivers/net/wireless/virtual/mac80211_hwsim.c
@@ -23,6 +23,7 @@
#include <net/ieee80211_radiotap.h>
#include <linux/if_arp.h>
#include <linux/rtnetlink.h>
+#include <linux/hrtimer.h>
#include <linux/etherdevice.h>
#include <linux/platform_device.h>
#include <linux/debugfs.h>
diff --git a/drivers/net/wwan/iosm/iosm_ipc_imem.c b/drivers/net/wwan/iosm/iosm_ipc_imem.c
index 829515a601b3..d11ca25b07bd 100644
--- a/drivers/net/wwan/iosm/iosm_ipc_imem.c
+++ b/drivers/net/wwan/iosm/iosm_ipc_imem.c
@@ -4,6 +4,7 @@
*/
#include <linux/delay.h>
+#include <linux/hrtimer.h>
#include "iosm_ipc_chnl_cfg.h"
#include "iosm_ipc_devlink.h"
diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h
index 030c80818240..0256c21a9243 100644
--- a/drivers/nvme/host/nvme.h
+++ b/drivers/nvme/host/nvme.h
@@ -13,6 +13,7 @@
#include <linux/blk-mq.h>
#include <linux/sed-opal.h>
#include <linux/fault-inject.h>
+#include <linux/idr.h>
#include <linux/rcupdate.h>
#include <linux/wait.h>
#include <linux/t10-pi.h>
diff --git a/drivers/nvme/target/fc.c b/drivers/nvme/target/fc.c
index bda7a3009e85..5fcd8e9619f1 100644
--- a/drivers/nvme/target/fc.c
+++ b/drivers/nvme/target/fc.c
@@ -6,6 +6,7 @@
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/blk-mq.h>
+#include <linux/idr.h>
#include <linux/parser.h>
#include <linux/random.h>
#include <uapi/scsi/fc/fc_fs.h>
diff --git a/drivers/nvme/target/nvmet.h b/drivers/nvme/target/nvmet.h
index 6c8acebe1a1a..cd1b2ae40656 100644
--- a/drivers/nvme/target/nvmet.h
+++ b/drivers/nvme/target/nvmet.h
@@ -8,6 +8,7 @@
#include <linux/dma-mapping.h>
#include <linux/types.h>
+#include <linux/bio.h>
#include <linux/device.h>
#include <linux/kref.h>
#include <linux/percpu-refcount.h>
diff --git a/drivers/of/of_numa.c b/drivers/of/of_numa.c
index 5949829a1b00..9681c4dd5d82 100644
--- a/drivers/of/of_numa.c
+++ b/drivers/of/of_numa.c
@@ -10,6 +10,7 @@
#include <linux/of.h>
#include <linux/of_address.h>
#include <linux/nodemask.h>
+#include <linux/topology.h> // for LOCAL_DISTANCE
#include <asm/numa.h>
diff --git a/drivers/pci/controller/vmd.c b/drivers/pci/controller/vmd.c
index 87b7856f375a..59291addaeb3 100644
--- a/drivers/pci/controller/vmd.c
+++ b/drivers/pci/controller/vmd.c
@@ -7,6 +7,7 @@
#include <linux/device.h>
#include <linux/interrupt.h>
#include <linux/irq.h>
+#include <linux/idr.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/msi.h>
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 9ab9b1008d8b..ad0d6194f074 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -24,6 +24,7 @@
#include <linux/log2.h>
#include <linux/logic_pio.h>
#include <linux/pm_wakeup.h>
+#include <linux/idr.h> // for DEFINE_IDA
#include <linux/interrupt.h>
#include <linux/device.h>
#include <linux/pm_runtime.h>
diff --git a/drivers/pci/switch/switchtec.c b/drivers/pci/switch/switchtec.c
index 1804794d0e68..eea031b3f0ef 100644
--- a/drivers/pci/switch/switchtec.c
+++ b/drivers/pci/switch/switchtec.c
@@ -7,6 +7,7 @@
#include <linux/switchtec.h>
#include <linux/switchtec_ioctl.h>
+#include <linux/idr.h>
#include <linux/interrupt.h>
#include <linux/module.h>
#include <linux/fs.h>
diff --git a/drivers/perf/thunderx2_pmu.c b/drivers/perf/thunderx2_pmu.c
index 1edb9c03704f..64a06867616d 100644
--- a/drivers/perf/thunderx2_pmu.c
+++ b/drivers/perf/thunderx2_pmu.c
@@ -9,6 +9,7 @@
#include <linux/cpuhotplug.h>
#include <linux/perf_event.h>
#include <linux/platform_device.h>
+#include <linux/hrtimer.h>
/* Each ThunderX2(TX2) Socket has a L3C and DMC UNCORE PMU device.
* Each UNCORE PMU device consists of 4 independent programmable counters.
diff --git a/drivers/platform/chrome/wilco_ec/telemetry.c b/drivers/platform/chrome/wilco_ec/telemetry.c
index b7c616f3d179..4031fc6dd4ad 100644
--- a/drivers/platform/chrome/wilco_ec/telemetry.c
+++ b/drivers/platform/chrome/wilco_ec/telemetry.c
@@ -30,6 +30,7 @@
#include <linux/cdev.h>
#include <linux/device.h>
#include <linux/fs.h>
+#include <linux/idr.h>
#include <linux/module.h>
#include <linux/platform_data/wilco-ec.h>
#include <linux/platform_device.h>
diff --git a/drivers/platform/x86/amd/pmf/tee-if.c b/drivers/platform/x86/amd/pmf/tee-if.c
index f8c0177afb0d..c74eed457982 100644
--- a/drivers/platform/x86/amd/pmf/tee-if.c
+++ b/drivers/platform/x86/amd/pmf/tee-if.c
@@ -9,6 +9,7 @@
*/
#include <linux/debugfs.h>
+#include <linux/kobject.h>
#include <linux/tee_drv.h>
#include <linux/uuid.h>
#include "pmf.h"
diff --git a/drivers/platform/x86/dell/dell-wmi-sysman/biosattr-interface.c b/drivers/platform/x86/dell/dell-wmi-sysman/biosattr-interface.c
index c2dd2de6bc20..3114a7f5b5ee 100644
--- a/drivers/platform/x86/dell/dell-wmi-sysman/biosattr-interface.c
+++ b/drivers/platform/x86/dell/dell-wmi-sysman/biosattr-interface.c
@@ -6,6 +6,7 @@
* Copyright (c) 2020 Dell Inc.
*/
+#include <linux/kobject.h>
#include <linux/wmi.h>
#include "dell-wmi-sysman.h"
diff --git a/drivers/platform/x86/dell/dell-wmi-sysman/enum-attributes.c b/drivers/platform/x86/dell/dell-wmi-sysman/enum-attributes.c
index 8cc212c85266..388844b02777 100644
--- a/drivers/platform/x86/dell/dell-wmi-sysman/enum-attributes.c
+++ b/drivers/platform/x86/dell/dell-wmi-sysman/enum-attributes.c
@@ -8,6 +8,8 @@
#include "dell-wmi-sysman.h"
+#include <linux/kobject.h>
+
get_instance_id(enumeration);
static ssize_t current_value_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf)
diff --git a/drivers/platform/x86/dell/dell-wmi-sysman/int-attributes.c b/drivers/platform/x86/dell/dell-wmi-sysman/int-attributes.c
index 951e75b538fa..3adb2e17d786 100644
--- a/drivers/platform/x86/dell/dell-wmi-sysman/int-attributes.c
+++ b/drivers/platform/x86/dell/dell-wmi-sysman/int-attributes.c
@@ -8,6 +8,8 @@
#include "dell-wmi-sysman.h"
+#include <linux/kobject.h>
+
enum int_properties {MIN_VALUE = 6, MAX_VALUE, SCALAR_INCR};
get_instance_id(integer);
diff --git a/drivers/platform/x86/dell/dell-wmi-sysman/passobj-attributes.c b/drivers/platform/x86/dell/dell-wmi-sysman/passobj-attributes.c
index 230e6ee96636..1b2dfc8abbaa 100644
--- a/drivers/platform/x86/dell/dell-wmi-sysman/passobj-attributes.c
+++ b/drivers/platform/x86/dell/dell-wmi-sysman/passobj-attributes.c
@@ -8,6 +8,9 @@
#include "dell-wmi-sysman.h"
+#include <linux/kobject.h>
+#include <linux/sysfs.h>
+
enum po_properties {IS_PASS_SET = 1, MIN_PASS_LEN, MAX_PASS_LEN};
get_instance_id(po);
diff --git a/drivers/platform/x86/dell/dell-wmi-sysman/passwordattr-interface.c b/drivers/platform/x86/dell/dell-wmi-sysman/passwordattr-interface.c
index 86ec962aace9..c6ea8dbbded3 100644
--- a/drivers/platform/x86/dell/dell-wmi-sysman/passwordattr-interface.c
+++ b/drivers/platform/x86/dell/dell-wmi-sysman/passwordattr-interface.c
@@ -5,6 +5,7 @@
* Copyright (c) 2020 Dell Inc.
*/
+#include <linux/kobject.h>
#include <linux/wmi.h>
#include "dell-wmi-sysman.h"
diff --git a/drivers/platform/x86/dell/dell-wmi-sysman/string-attributes.c b/drivers/platform/x86/dell/dell-wmi-sysman/string-attributes.c
index c392f0ecf8b5..a331f9433db5 100644
--- a/drivers/platform/x86/dell/dell-wmi-sysman/string-attributes.c
+++ b/drivers/platform/x86/dell/dell-wmi-sysman/string-attributes.c
@@ -8,6 +8,8 @@
#include "dell-wmi-sysman.h"
+#include <linux/kobject.h>
+
enum string_properties {MIN_LEN = 6, MAX_LEN};
get_instance_id(str);
diff --git a/drivers/platform/x86/dell/dell-wmi-sysman/sysman.c b/drivers/platform/x86/dell/dell-wmi-sysman/sysman.c
index b929b4f82420..02041b2dd7fa 100644
--- a/drivers/platform/x86/dell/dell-wmi-sysman/sysman.c
+++ b/drivers/platform/x86/dell/dell-wmi-sysman/sysman.c
@@ -11,6 +11,7 @@
#include <linux/dmi.h>
#include <linux/module.h>
#include <linux/kernel.h>
+#include <linux/kobject.h>
#include <linux/wmi.h>
#include "dell-wmi-sysman.h"
#include "../../firmware_attributes_class.h"
diff --git a/drivers/platform/x86/hp/hp-bioscfg/bioscfg.c b/drivers/platform/x86/hp/hp-bioscfg/bioscfg.c
index 8c9f4f3227fc..c5c73c8aac9f 100644
--- a/drivers/platform/x86/hp/hp-bioscfg/bioscfg.c
+++ b/drivers/platform/x86/hp/hp-bioscfg/bioscfg.c
@@ -10,6 +10,7 @@
#include <linux/fs.h>
#include <linux/module.h>
#include <linux/kernel.h>
+#include <linux/kobject.h>
#include <linux/wmi.h>
#include "bioscfg.h"
#include "../../firmware_attributes_class.h"
diff --git a/drivers/platform/x86/hp/hp-bioscfg/enum-attributes.c b/drivers/platform/x86/hp/hp-bioscfg/enum-attributes.c
index a2402d31c146..b6288aec7b1d 100644
--- a/drivers/platform/x86/hp/hp-bioscfg/enum-attributes.c
+++ b/drivers/platform/x86/hp/hp-bioscfg/enum-attributes.c
@@ -8,6 +8,9 @@
#include "bioscfg.h"
+#include <linux/kobject.h>
+#include <linux/sysfs.h>
+
GET_INSTANCE_ID(enumeration);
static ssize_t current_value_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf)
diff --git a/drivers/platform/x86/hp/hp-bioscfg/int-attributes.c b/drivers/platform/x86/hp/hp-bioscfg/int-attributes.c
index 86b7ac63fec2..5aa009b396d7 100644
--- a/drivers/platform/x86/hp/hp-bioscfg/int-attributes.c
+++ b/drivers/platform/x86/hp/hp-bioscfg/int-attributes.c
@@ -8,6 +8,9 @@
#include "bioscfg.h"
+#include <linux/kobject.h>
+#include <linux/sysfs.h>
+
GET_INSTANCE_ID(integer);
static ssize_t current_value_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf)
diff --git a/drivers/platform/x86/hp/hp-bioscfg/order-list-attributes.c b/drivers/platform/x86/hp/hp-bioscfg/order-list-attributes.c
index 1ff09dfb7d7e..e8b8ccc1cf7c 100644
--- a/drivers/platform/x86/hp/hp-bioscfg/order-list-attributes.c
+++ b/drivers/platform/x86/hp/hp-bioscfg/order-list-attributes.c
@@ -8,6 +8,8 @@
#include "bioscfg.h"
+#include <linux/kobject.h>
+
GET_INSTANCE_ID(ordered_list);
static ssize_t current_value_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf)
diff --git a/drivers/platform/x86/hp/hp-bioscfg/passwdobj-attributes.c b/drivers/platform/x86/hp/hp-bioscfg/passwdobj-attributes.c
index f7efe217a4bb..2e05200eb595 100644
--- a/drivers/platform/x86/hp/hp-bioscfg/passwdobj-attributes.c
+++ b/drivers/platform/x86/hp/hp-bioscfg/passwdobj-attributes.c
@@ -8,6 +8,9 @@
#include "bioscfg.h"
+#include <linux/kobject.h>
+#include <linux/sysfs.h>
+
GET_INSTANCE_ID(password);
/*
* Clear all passwords copied to memory for a particular
diff --git a/drivers/platform/x86/hp/hp-bioscfg/spmobj-attributes.c b/drivers/platform/x86/hp/hp-bioscfg/spmobj-attributes.c
index 86f90238750c..0ace0adaabf0 100644
--- a/drivers/platform/x86/hp/hp-bioscfg/spmobj-attributes.c
+++ b/drivers/platform/x86/hp/hp-bioscfg/spmobj-attributes.c
@@ -8,6 +8,8 @@
#include "bioscfg.h"
+#include <linux/kobject.h>
+
static const char * const spm_state_types[] = {
"not provisioned",
"provisioned",
diff --git a/drivers/platform/x86/hp/hp-bioscfg/string-attributes.c b/drivers/platform/x86/hp/hp-bioscfg/string-attributes.c
index f0c20070094d..038e6e9deddf 100644
--- a/drivers/platform/x86/hp/hp-bioscfg/string-attributes.c
+++ b/drivers/platform/x86/hp/hp-bioscfg/string-attributes.c
@@ -8,6 +8,9 @@
#include "bioscfg.h"
+#include <linux/kobject.h>
+#include <linux/sysfs.h>
+
#define WMI_STRING_TYPE "HPBIOS_BIOSString"
GET_INSTANCE_ID(string);
diff --git a/drivers/platform/x86/hp/hp-bioscfg/surestart-attributes.c b/drivers/platform/x86/hp/hp-bioscfg/surestart-attributes.c
index b57e42f29282..3195365be1de 100644
--- a/drivers/platform/x86/hp/hp-bioscfg/surestart-attributes.c
+++ b/drivers/platform/x86/hp/hp-bioscfg/surestart-attributes.c
@@ -7,6 +7,8 @@
*/
#include "bioscfg.h"
+
+#include <linux/kobject.h>
#include <linux/types.h>
/* Maximum number of log entries supported when log entry size is 16
diff --git a/drivers/platform/x86/intel/pmt/telemetry.c b/drivers/platform/x86/intel/pmt/telemetry.c
index 09258564dfc4..4c16360ed2af 100644
--- a/drivers/platform/x86/intel/pmt/telemetry.c
+++ b/drivers/platform/x86/intel/pmt/telemetry.c
@@ -10,6 +10,7 @@
#include <linux/auxiliary_bus.h>
#include <linux/kernel.h>
+#include <linux/kref.h>
#include <linux/module.h>
#include <linux/pci.h>
#include <linux/slab.h>
diff --git a/drivers/platform/x86/intel/uncore-frequency/uncore-frequency-common.c b/drivers/platform/x86/intel/uncore-frequency/uncore-frequency-common.c
index 33bb58dc3f78..e9f18a868911 100644
--- a/drivers/platform/x86/intel/uncore-frequency/uncore-frequency-common.c
+++ b/drivers/platform/x86/intel/uncore-frequency/uncore-frequency-common.c
@@ -6,6 +6,7 @@
*
*/
#include <linux/cpu.h>
+#include <linux/idr.h>
#include <linux/module.h>
#include "uncore-frequency-common.h"
diff --git a/drivers/platform/x86/intel/uncore-frequency/uncore-frequency-common.h b/drivers/platform/x86/intel/uncore-frequency/uncore-frequency-common.h
index 0e5bf507e555..fe37efcf0801 100644
--- a/drivers/platform/x86/intel/uncore-frequency/uncore-frequency-common.h
+++ b/drivers/platform/x86/intel/uncore-frequency/uncore-frequency-common.h
@@ -10,6 +10,7 @@
#define __INTEL_UNCORE_FREQ_COMMON_H
#include <linux/device.h>
+#include <linux/kobject.h>
/**
* struct uncore_data - Encapsulate all uncore data
diff --git a/drivers/platform/x86/think-lmi.c b/drivers/platform/x86/think-lmi.c
index 3a396b763c49..77c35f1b0a81 100644
--- a/drivers/platform/x86/think-lmi.c
+++ b/drivers/platform/x86/think-lmi.c
@@ -14,6 +14,7 @@
#include <linux/acpi.h>
#include <linux/errno.h>
#include <linux/fs.h>
+#include <linux/kobject.h>
#include <linux/mutex.h>
#include <linux/string_helpers.h>
#include <linux/types.h>
diff --git a/drivers/platform/x86/wmi.c b/drivers/platform/x86/wmi.c
index 885a16bc059e..b87f397730b9 100644
--- a/drivers/platform/x86/wmi.c
+++ b/drivers/platform/x86/wmi.c
@@ -22,6 +22,7 @@
#include <linux/device.h>
#include <linux/init.h>
#include <linux/kernel.h>
+#include <linux/kobject.h>
#include <linux/list.h>
#include <linux/module.h>
#include <linux/platform_device.h>
diff --git a/drivers/pmdomain/governor.c b/drivers/pmdomain/governor.c
index d1a10eeebd16..8e37c65f5084 100644
--- a/drivers/pmdomain/governor.c
+++ b/drivers/pmdomain/governor.c
@@ -10,6 +10,7 @@
#include <linux/hrtimer.h>
#include <linux/cpuidle.h>
#include <linux/cpumask.h>
+#include <linux/device.h>
#include <linux/ktime.h>
static int dev_update_qos_constraint(struct device *dev, void *data)
diff --git a/drivers/power/reset/ltc2952-poweroff.c b/drivers/power/reset/ltc2952-poweroff.c
index fa25fbd53934..f94401ed1539 100644
--- a/drivers/power/reset/ltc2952-poweroff.c
+++ b/drivers/power/reset/ltc2952-poweroff.c
@@ -57,6 +57,7 @@
#include <linux/gpio/consumer.h>
#include <linux/reboot.h>
#include <linux/property.h>
+#include <linux/hrtimer.h>
struct ltc2952_poweroff {
struct hrtimer timer_trigger;
diff --git a/drivers/powercap/dtpm.c b/drivers/powercap/dtpm.c
index ce920f17f45f..bd8127edd8a8 100644
--- a/drivers/powercap/dtpm.c
+++ b/drivers/powercap/dtpm.c
@@ -18,6 +18,7 @@
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/dtpm.h>
+#include <linux/export.h>
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/powercap.h>
diff --git a/drivers/pps/clients/pps-ktimer.c b/drivers/pps/clients/pps-ktimer.c
index d33106bd7a29..7bb83872bb87 100644
--- a/drivers/pps/clients/pps-ktimer.c
+++ b/drivers/pps/clients/pps-ktimer.c
@@ -7,6 +7,7 @@
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+#include <linux/device.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/init.h>
diff --git a/drivers/pps/clients/pps-ldisc.c b/drivers/pps/clients/pps-ldisc.c
index 443d6bae19d1..4c2bd74399bc 100644
--- a/drivers/pps/clients/pps-ldisc.c
+++ b/drivers/pps/clients/pps-ldisc.c
@@ -7,6 +7,7 @@
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+#include <linux/device.h>
#include <linux/module.h>
#include <linux/serial_core.h>
#include <linux/tty.h>
diff --git a/drivers/pps/clients/pps_parport.c b/drivers/pps/clients/pps_parport.c
index 42f93d4c6ee3..9f9389158042 100644
--- a/drivers/pps/clients/pps_parport.c
+++ b/drivers/pps/clients/pps_parport.c
@@ -15,6 +15,7 @@
#include <linux/kernel.h>
#include <linux/module.h>
+#include <linux/idr.h>
#include <linux/init.h>
#include <linux/irqnr.h>
#include <linux/time.h>
diff --git a/drivers/pps/kapi.c b/drivers/pps/kapi.c
index d9d566f70ed1..1df337bf5e7b 100644
--- a/drivers/pps/kapi.c
+++ b/drivers/pps/kapi.c
@@ -7,6 +7,7 @@
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+#include <linux/device.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/init.h>
diff --git a/drivers/pps/pps.c b/drivers/pps/pps.c
index 5d19baae6a38..a689fd42ccaa 100644
--- a/drivers/pps/pps.c
+++ b/drivers/pps/pps.c
@@ -15,6 +15,7 @@
#include <linux/idr.h>
#include <linux/mutex.h>
#include <linux/cdev.h>
+#include <linux/device.h>
#include <linux/poll.h>
#include <linux/pps_kernel.h>
#include <linux/slab.h>
diff --git a/drivers/rtc/class.c b/drivers/rtc/class.c
index 921ee1827974..0a4853d45ec0 100644
--- a/drivers/rtc/class.c
+++ b/drivers/rtc/class.c
@@ -14,6 +14,7 @@
#include <linux/of.h>
#include <linux/rtc.h>
#include <linux/kdev_t.h>
+#include <linux/hrtimer.h>
#include <linux/idr.h>
#include <linux/slab.h>
#include <linux/workqueue.h>
diff --git a/drivers/rtc/interface.c b/drivers/rtc/interface.c
index 1b63111cdda2..58f7d3a19dfe 100644
--- a/drivers/rtc/interface.c
+++ b/drivers/rtc/interface.c
@@ -9,6 +9,7 @@
*/
#include <linux/rtc.h>
+#include <linux/hrtimer.h>
#include <linux/sched.h>
#include <linux/module.h>
#include <linux/log2.h>
diff --git a/drivers/scsi/isci/isci.h b/drivers/scsi/isci/isci.h
index 4e6b1decbca7..4b9d92bff598 100644
--- a/drivers/scsi/isci/isci.h
+++ b/drivers/scsi/isci/isci.h
@@ -57,6 +57,7 @@
#define __ISCI_H__
#include <linux/interrupt.h>
+#include <linux/timer.h>
#include <linux/types.h>
#define DRV_NAME "isci"
diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
index 70bcee64bc8c..ee966d95b470 100644
--- a/drivers/scsi/lpfc/lpfc_init.c
+++ b/drivers/scsi/lpfc/lpfc_init.c
@@ -41,6 +41,7 @@
#include <linux/crash_dump.h>
#include <linux/cpu.h>
#include <linux/cpuhotplug.h>
+#include <linux/hrtimer.h>
#include <scsi/scsi.h>
#include <scsi/scsi_device.h>
diff --git a/drivers/slimbus/slimbus.h b/drivers/slimbus/slimbus.h
index 00a7f112574b..29e9229a683c 100644
--- a/drivers/slimbus/slimbus.h
+++ b/drivers/slimbus/slimbus.h
@@ -7,6 +7,7 @@
#define _DRIVERS_SLIMBUS_H
#include <linux/module.h>
#include <linux/device.h>
+#include <linux/idr.h>
#include <linux/mutex.h>
#include <linux/completion.h>
#include <linux/slimbus.h>
diff --git a/drivers/soc/nuvoton/wpcm450-soc.c b/drivers/soc/nuvoton/wpcm450-soc.c
index c5e0d11c383b..d4a0cd4b406d 100644
--- a/drivers/soc/nuvoton/wpcm450-soc.c
+++ b/drivers/soc/nuvoton/wpcm450-soc.c
@@ -6,6 +6,7 @@
*/
#include <linux/mfd/syscon.h>
+#include <linux/module.h>
#include <linux/of.h>
#include <linux/regmap.h>
#include <linux/slab.h>
diff --git a/drivers/soundwire/bus.c b/drivers/soundwire/bus.c
index f3fec15c3112..4165f8b52804 100644
--- a/drivers/soundwire/bus.c
+++ b/drivers/soundwire/bus.c
@@ -3,6 +3,7 @@
#include <linux/acpi.h>
#include <linux/delay.h>
+#include <linux/idr.h>
#include <linux/mod_devicetable.h>
#include <linux/pm_runtime.h>
#include <linux/soundwire/sdw_registers.h>
diff --git a/drivers/soundwire/intel_auxdevice.c b/drivers/soundwire/intel_auxdevice.c
index 93698532deac..724e9ed2f537 100644
--- a/drivers/soundwire/intel_auxdevice.c
+++ b/drivers/soundwire/intel_auxdevice.c
@@ -9,6 +9,7 @@
#include <linux/debugfs.h>
#include <linux/delay.h>
#include <linux/module.h>
+#include <linux/idr.h>
#include <linux/interrupt.h>
#include <linux/io.h>
#include <linux/auxiliary_bus.h>
diff --git a/drivers/spi/spi-stm32.c b/drivers/spi/spi-stm32.c
index e61302ef3c21..aeb009a79ba6 100644
--- a/drivers/spi/spi-stm32.c
+++ b/drivers/spi/spi-stm32.c
@@ -17,6 +17,7 @@
#include <linux/platform_device.h>
#include <linux/pinctrl/consumer.h>
#include <linux/pm_runtime.h>
+#include <linux/ratelimit.h>
#include <linux/reset.h>
#include <linux/spi/spi.h>
diff --git a/drivers/staging/fbtft/fb_ssd1351.c b/drivers/staging/fbtft/fb_ssd1351.c
index b8d55aa8c5c7..ca4145ee1f67 100644
--- a/drivers/staging/fbtft/fb_ssd1351.c
+++ b/drivers/staging/fbtft/fb_ssd1351.c
@@ -1,4 +1,5 @@
// SPDX-License-Identifier: GPL-2.0
+#include <linux/backlight.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/init.h>
diff --git a/drivers/target/target_core_fabric_configfs.c b/drivers/target/target_core_fabric_configfs.c
index 7156a4dc1ca7..2d208da07163 100644
--- a/drivers/target/target_core_fabric_configfs.c
+++ b/drivers/target/target_core_fabric_configfs.c
@@ -24,6 +24,7 @@
#include <linux/unistd.h>
#include <linux/string.h>
#include <linux/syscalls.h>
+#include <linux/sysfs.h>
#include <linux/configfs.h>
#include <target/target_core_base.h>
diff --git a/drivers/target/target_core_file.c b/drivers/target/target_core_file.c
index 4d447520bab8..a907e646f45c 100644
--- a/drivers/target/target_core_file.c
+++ b/drivers/target/target_core_file.c
@@ -14,6 +14,7 @@
#include <linux/parser.h>
#include <linux/timer.h>
#include <linux/blkdev.h>
+#include <linux/bvec.h>
#include <linux/slab.h>
#include <linux/spinlock.h>
#include <linux/module.h>
diff --git a/drivers/thermal/devfreq_cooling.c b/drivers/thermal/devfreq_cooling.c
index 262e62ab6cf2..6593679a7304 100644
--- a/drivers/thermal/devfreq_cooling.c
+++ b/drivers/thermal/devfreq_cooling.c
@@ -10,6 +10,7 @@
* registered, the devfreq cooling won't react to it.
*/
+#include <linux/device.h>
#include <linux/devfreq.h>
#include <linux/devfreq_cooling.h>
#include <linux/energy_model.h>
diff --git a/drivers/thermal/intel/intel_powerclamp.c b/drivers/thermal/intel/intel_powerclamp.c
index bc6eb0dd66a4..9266874463b4 100644
--- a/drivers/thermal/intel/intel_powerclamp.c
+++ b/drivers/thermal/intel/intel_powerclamp.c
@@ -31,6 +31,7 @@
#include <linux/thermal.h>
#include <linux/debugfs.h>
#include <linux/seq_file.h>
+#include <linux/sysfs.h>
#include <linux/idle_inject.h>
#include <asm/msr.h>
diff --git a/drivers/thermal/intel/therm_throt.c b/drivers/thermal/intel/therm_throt.c
index e69868e868eb..62e13a1b2dea 100644
--- a/drivers/thermal/intel/therm_throt.c
+++ b/drivers/thermal/intel/therm_throt.c
@@ -14,6 +14,7 @@
* Credits: Adapted from Zwane Mwaikambo's original code in mce_intel.c.
* Inspired by Ross Biro's and Al Borchers' counter code.
*/
+#include <linux/device.h>
#include <linux/interrupt.h>
#include <linux/notifier.h>
#include <linux/jiffies.h>
diff --git a/drivers/tty/rpmsg_tty.c b/drivers/tty/rpmsg_tty.c
index 60a2915f5cfe..8a936c72ecd6 100644
--- a/drivers/tty/rpmsg_tty.c
+++ b/drivers/tty/rpmsg_tty.c
@@ -12,6 +12,7 @@
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+#include <linux/idr.h>
#include <linux/module.h>
#include <linux/rpmsg.h>
#include <linux/slab.h>
diff --git a/drivers/tty/serial/8250/8250_bcm7271.c b/drivers/tty/serial/8250/8250_bcm7271.c
index 504c4c020857..f4af9373ff05 100644
--- a/drivers/tty/serial/8250/8250_bcm7271.c
+++ b/drivers/tty/serial/8250/8250_bcm7271.c
@@ -22,6 +22,7 @@
#include <linux/delay.h>
#include <linux/clk.h>
#include <linux/debugfs.h>
+#include <linux/hrtimer.h>
#include "8250.h"
diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c
index c37905ea3cae..16c483d4ecf1 100644
--- a/drivers/tty/serial/8250/8250_port.c
+++ b/drivers/tty/serial/8250/8250_port.c
@@ -32,6 +32,7 @@
#include <linux/uaccess.h>
#include <linux/pm_runtime.h>
#include <linux/ktime.h>
+#include <linux/hrtimer.h>
#include <asm/io.h>
#include <asm/irq.h>
diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
index 4aa72d5aeafb..87100d28fc92 100644
--- a/drivers/tty/serial/imx.c
+++ b/drivers/tty/serial/imx.c
@@ -27,6 +27,7 @@
#include <linux/of.h>
#include <linux/io.h>
#include <linux/dma-mapping.h>
+#include <linux/hrtimer.h>
#include <asm/irq.h>
#include <linux/dma/imx-dma.h>
diff --git a/drivers/tty/serial/serial_base.h b/drivers/tty/serial/serial_base.h
index c74c548f0db6..27c260e08205 100644
--- a/drivers/tty/serial/serial_base.h
+++ b/drivers/tty/serial/serial_base.h
@@ -6,6 +6,8 @@
* Author: Tony Lindgren <[email protected]>
*/
+#include <linux/idr.h>
+
#define to_serial_base_ctrl_device(d) container_of((d), struct serial_ctrl_device, dev)
#define to_serial_base_port_device(d) container_of((d), struct serial_port_device, dev)
diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
index a85e7b9a2e49..1398cef67446 100644
--- a/drivers/tty/serial/sh-sci.c
+++ b/drivers/tty/serial/sh-sci.c
@@ -48,6 +48,7 @@
#include <linux/timer.h>
#include <linux/tty.h>
#include <linux/tty_flip.h>
+#include <linux/hrtimer.h>
#ifdef CONFIG_SUPERH
#include <asm/sh_bios.h>
diff --git a/drivers/tty/serial/xilinx_uartps.c b/drivers/tty/serial/xilinx_uartps.c
index 5f48ec37cb25..1f07145e5a68 100644
--- a/drivers/tty/serial/xilinx_uartps.c
+++ b/drivers/tty/serial/xilinx_uartps.c
@@ -25,6 +25,7 @@
#include <linux/gpio.h>
#include <linux/gpio/consumer.h>
#include <linux/delay.h>
+#include <linux/hrtimer.h>
#define CDNS_UART_TTY_NAME "ttyPS"
#define CDNS_UART_NAME "xuartps"
diff --git a/drivers/usb/chipidea/otg_fsm.c b/drivers/usb/chipidea/otg_fsm.c
index c17516c29b63..522a5f3c0eb9 100644
--- a/drivers/usb/chipidea/otg_fsm.c
+++ b/drivers/usb/chipidea/otg_fsm.c
@@ -21,6 +21,7 @@
#include <linux/usb/hcd.h>
#include <linux/usb/chipidea.h>
#include <linux/regulator/consumer.h>
+#include <linux/hrtimer.h>
#include "ci.h"
#include "bits.h"
diff --git a/drivers/usb/dwc2/hcd_queue.c b/drivers/usb/dwc2/hcd_queue.c
index 0d4495c6b9f7..e539dcce7b55 100644
--- a/drivers/usb/dwc2/hcd_queue.c
+++ b/drivers/usb/dwc2/hcd_queue.c
@@ -18,6 +18,7 @@
#include <linux/io.h>
#include <linux/slab.h>
#include <linux/usb.h>
+#include <linux/hrtimer.h>
#include <linux/usb/hcd.h>
#include <linux/usb/ch11.h>
diff --git a/drivers/usb/gadget/function/f_ncm.c b/drivers/usb/gadget/function/f_ncm.c
index ca5d5f564998..96a5084a0a4f 100644
--- a/drivers/usb/gadget/function/f_ncm.c
+++ b/drivers/usb/gadget/function/f_ncm.c
@@ -17,6 +17,7 @@
#include <linux/device.h>
#include <linux/etherdevice.h>
#include <linux/crc32.h>
+#include <linux/hrtimer.h>
#include <linux/usb/cdc.h>
diff --git a/drivers/usb/gadget/udc/max3420_udc.c b/drivers/usb/gadget/udc/max3420_udc.c
index 89e8cf2a2a7d..f92b914a5c04 100644
--- a/drivers/usb/gadget/udc/max3420_udc.c
+++ b/drivers/usb/gadget/udc/max3420_udc.c
@@ -26,6 +26,7 @@
#include <linux/usb/gadget.h>
#include <linux/spi/spi.h>
#include <linux/gpio/consumer.h>
+#include <linux/hrtimer.h>
#define MAX3420_MAX_EPS 4
#define MAX3420_EP_MAX_PACKET 64 /* Same for all Endpoints */
diff --git a/drivers/usb/typec/class.h b/drivers/usb/typec/class.h
index 759b98355eeb..f57abf701dc5 100644
--- a/drivers/usb/typec/class.h
+++ b/drivers/usb/typec/class.h
@@ -4,6 +4,7 @@
#define __USB_TYPEC_CLASS__
#include <linux/device.h>
+#include <linux/idr.h>
#include <linux/usb/typec.h>
struct typec_mux;
diff --git a/drivers/usb/typec/pd.c b/drivers/usb/typec/pd.c
index b9cca2be76fc..aa73642e104c 100644
--- a/drivers/usb/typec/pd.c
+++ b/drivers/usb/typec/pd.c
@@ -6,6 +6,7 @@
* Author: Heikki Krogerus <[email protected]>
*/
+#include <linux/idr.h>
#include <linux/slab.h>
#include <linux/usb/pd.h>
diff --git a/drivers/vfio/group.c b/drivers/vfio/group.c
index 610a429c6191..2fc062fc13c7 100644
--- a/drivers/vfio/group.c
+++ b/drivers/vfio/group.c
@@ -11,6 +11,7 @@
*/
#include <linux/vfio.h>
+#include <linux/idr.h>
#include <linux/iommufd.h>
#include <linux/anon_inodes.h>
#include "vfio.h"
diff --git a/drivers/video/fbdev/omap2/omapfb/dss/dsi.c b/drivers/video/fbdev/omap2/omapfb/dss/dsi.c
index b7eb17a16ec4..c20a184acb1a 100644
--- a/drivers/video/fbdev/omap2/omapfb/dss/dsi.c
+++ b/drivers/video/fbdev/omap2/omapfb/dss/dsi.c
@@ -30,6 +30,7 @@
#include <linux/of.h>
#include <linux/of_platform.h>
#include <linux/component.h>
+#include <linux/hrtimer.h>
#include <video/omapfb_dss.h>
#include <video/mipi_display.h>
diff --git a/drivers/video/fbdev/omap2/omapfb/dss/pll.c b/drivers/video/fbdev/omap2/omapfb/dss/pll.c
index 725194d52445..1fc0ebe2622f 100644
--- a/drivers/video/fbdev/omap2/omapfb/dss/pll.c
+++ b/drivers/video/fbdev/omap2/omapfb/dss/pll.c
@@ -10,6 +10,7 @@
#include <linux/kernel.h>
#include <linux/regulator/consumer.h>
#include <linux/sched.h>
+#include <linux/hrtimer.h>
#include <video/omapfb_dss.h>
diff --git a/drivers/virt/coco/tsm.c b/drivers/virt/coco/tsm.c
index d1c2db83a8ca..69ab9595c9f3 100644
--- a/drivers/virt/coco/tsm.c
+++ b/drivers/virt/coco/tsm.c
@@ -8,6 +8,7 @@
#include <linux/slab.h>
#include <linux/rwsem.h>
#include <linux/string.h>
+#include <linux/sysfs.h>
#include <linux/module.h>
#include <linux/cleanup.h>
#include <linux/configfs.h>
diff --git a/fs/aio.c b/fs/aio.c
index bb2ff48991f3..c347a2660c2b 100644
--- a/fs/aio.c
+++ b/fs/aio.c
@@ -45,6 +45,7 @@
#include <linux/uaccess.h>
#include <linux/nospec.h>
+#include <linux/hrtimer.h>
#include "internal.h"
diff --git a/fs/bcachefs/chardev.c b/fs/bcachefs/chardev.c
index 226b39c17667..a2aa142a8b15 100644
--- a/fs/bcachefs/chardev.c
+++ b/fs/bcachefs/chardev.c
@@ -16,6 +16,7 @@
#include <linux/cdev.h>
#include <linux/device.h>
#include <linux/fs.h>
+#include <linux/idr.h>
#include <linux/ioctl.h>
#include <linux/major.h>
#include <linux/sched/task.h>
diff --git a/fs/bcachefs/fs.c b/fs/bcachefs/fs.c
index ec419b8e2c43..1eee24840245 100644
--- a/fs/bcachefs/fs.c
+++ b/fs/bcachefs/fs.c
@@ -34,6 +34,7 @@
#include <linux/module.h>
#include <linux/pagemap.h>
#include <linux/posix_acl.h>
+#include <linux/quota.h>
#include <linux/random.h>
#include <linux/seq_file.h>
#include <linux/statfs.h>
diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c
index 63b426cc7798..c72f5246430a 100644
--- a/fs/btrfs/qgroup.c
+++ b/fs/btrfs/qgroup.c
@@ -11,6 +11,7 @@
#include <linux/slab.h>
#include <linux/workqueue.h>
#include <linux/btrfs.h>
+#include <linux/ratelimit.h>
#include <linux/sched/mm.h>
#include "ctree.h"
diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c
index 84c05246ffd8..dcae20d156ef 100644
--- a/fs/btrfs/sysfs.c
+++ b/fs/btrfs/sysfs.c
@@ -7,6 +7,7 @@
#include <linux/sched/mm.h>
#include <linux/slab.h>
#include <linux/spinlock.h>
+#include <linux/sysfs.h>
#include <linux/completion.h>
#include <linux/bug.h>
#include <linux/list.h>
diff --git a/fs/buffer.c b/fs/buffer.c
index b55dea034a5d..f32a7da32c7b 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -50,6 +50,7 @@
#include <linux/fscrypt.h>
#include <linux/fsverity.h>
#include <linux/sched/isolation.h>
+#include <linux/ratelimit.h>
#include "internal.h"
diff --git a/fs/ceph/metric.h b/fs/ceph/metric.h
index 0d0c44bd3332..37cc17f667bc 100644
--- a/fs/ceph/metric.h
+++ b/fs/ceph/metric.h
@@ -5,6 +5,8 @@
#include <linux/ceph/types.h>
#include <linux/percpu_counter.h>
#include <linux/ktime.h>
+#include <linux/timer.h> // for round_jiffies_relative()
+#include <linux/workqueue.h> // for struct delayed_work
extern bool disable_send_metrics;
diff --git a/fs/ceph/super.h b/fs/ceph/super.h
index b06e2bc86221..8793926ed89d 100644
--- a/fs/ceph/super.h
+++ b/fs/ceph/super.h
@@ -21,6 +21,7 @@
#include <linux/netfs.h>
#include <linux/fscache.h>
#include <linux/hashtable.h>
+#include <linux/ratelimit.h>
#include <linux/ceph/libceph.h>
#include "crypto.h"
diff --git a/fs/configfs/mount.c b/fs/configfs/mount.c
index c2d820063ec4..57a6ab996950 100644
--- a/fs/configfs/mount.c
+++ b/fs/configfs/mount.c
@@ -15,6 +15,7 @@
#include <linux/pagemap.h>
#include <linux/init.h>
#include <linux/slab.h>
+#include <linux/sysfs.h>
#include <linux/configfs.h>
#include "configfs_internal.h"
diff --git a/fs/crypto/bio.c b/fs/crypto/bio.c
index 0ad8c30b8fa5..27216aa18ad4 100644
--- a/fs/crypto/bio.c
+++ b/fs/crypto/bio.c
@@ -11,6 +11,7 @@
#include <linux/module.h>
#include <linux/bio.h>
#include <linux/namei.h>
+#include <linux/blkdev.h> // errno_to_blk_status()
#include "fscrypt_private.h"
/**
diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c
index 034a617cb1a5..54123210b6c4 100644
--- a/fs/debugfs/inode.c
+++ b/fs/debugfs/inode.c
@@ -27,6 +27,7 @@
#include <linux/magic.h>
#include <linux/slab.h>
#include <linux/security.h>
+#include <linux/sysfs.h>
#include "internal.h"
diff --git a/fs/erofs/data.c b/fs/erofs/data.c
index c98aeda8abb2..193967a686aa 100644
--- a/fs/erofs/data.c
+++ b/fs/erofs/data.c
@@ -5,6 +5,7 @@
* Copyright (C) 2021, Alibaba Cloud
*/
#include "internal.h"
+#include <linux/blkdev.h>
#include <linux/sched/mm.h>
#include <trace/events/erofs.h>
diff --git a/fs/erofs/internal.h b/fs/erofs/internal.h
index b0409badb017..c1138b2bd6ec 100644
--- a/fs/erofs/internal.h
+++ b/fs/erofs/internal.h
@@ -10,6 +10,7 @@
#include <linux/fs.h>
#include <linux/dax.h>
#include <linux/dcache.h>
+#include <linux/idr.h>
#include <linux/mm.h>
#include <linux/module.h>
#include <linux/pagemap.h>
diff --git a/fs/erofs/super.c b/fs/erofs/super.c
index 5f60f163bd56..31bd221b72a2 100644
--- a/fs/erofs/super.c
+++ b/fs/erofs/super.c
@@ -10,6 +10,7 @@
#include <linux/fs_context.h>
#include <linux/fs_parser.h>
#include <linux/exportfs.h>
+#include <linux/blkdev.h>
#include "xattr.h"
#define CREATE_TRACE_POINTS
diff --git a/fs/eventpoll.c b/fs/eventpoll.c
index 3534d36a1474..4918d180b4a1 100644
--- a/fs/eventpoll.c
+++ b/fs/eventpoll.c
@@ -37,6 +37,7 @@
#include <linux/seq_file.h>
#include <linux/compat.h>
#include <linux/rculist.h>
+#include <linux/hrtimer.h>
#include <net/busy_poll.h>
/*
diff --git a/fs/exec.c b/fs/exec.c
index af4fbb61cd53..64cf1dc62696 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -67,6 +67,7 @@
#include <linux/time_namespace.h>
#include <linux/user_events.h>
#include <linux/rseq.h>
+#include <linux/posix-timers.h> // for posix_cpu_timers_exit()
#include <linux/uaccess.h>
#include <asm/mmu_context.h>
diff --git a/fs/ext4/sysfs.c b/fs/ext4/sysfs.c
index 6d332dff79dd..a982ea569b9d 100644
--- a/fs/ext4/sysfs.c
+++ b/fs/ext4/sysfs.c
@@ -12,6 +12,7 @@
#include <linux/fs.h>
#include <linux/seq_file.h>
#include <linux/slab.h>
+#include <linux/sysfs.h>
#include <linux/proc_fs.h>
#include <linux/part_stat.h>
diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
index 84c9fead3ad4..3f59adf156a3 100644
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -16,6 +16,7 @@
#include <linux/crc32.h>
#include <linux/magic.h>
#include <linux/kobject.h>
+#include <linux/radix-tree.h>
#include <linux/sched.h>
#include <linux/cred.h>
#include <linux/sched/mm.h>
diff --git a/fs/gfs2/recovery.c b/fs/gfs2/recovery.c
index 4db3ca9c3b02..8d8bdf892b8d 100644
--- a/fs/gfs2/recovery.c
+++ b/fs/gfs2/recovery.c
@@ -5,6 +5,7 @@
*/
#include <linux/module.h>
+#include <linux/blkdev.h> // for bdev_read_only()
#include <linux/slab.h>
#include <linux/spinlock.h>
#include <linux/completion.h>
diff --git a/fs/gfs2/sys.c b/fs/gfs2/sys.c
index 250f340cb44d..15e89ab6acbd 100644
--- a/fs/gfs2/sys.c
+++ b/fs/gfs2/sys.c
@@ -9,6 +9,7 @@
#include <linux/sched.h>
#include <linux/cred.h>
#include <linux/spinlock.h>
+#include <linux/sysfs.h>
#include <linux/completion.h>
#include <linux/buffer_head.h>
#include <linux/module.h>
diff --git a/fs/hfsplus/wrapper.c b/fs/hfsplus/wrapper.c
index b0cb70400996..89f880abf598 100644
--- a/fs/hfsplus/wrapper.c
+++ b/fs/hfsplus/wrapper.c
@@ -10,6 +10,7 @@
*/
#include <linux/fs.h>
+#include <linux/bio.h>
#include <linux/blkdev.h>
#include <linux/cdrom.h>
#include <asm/unaligned.h>
diff --git a/fs/iomap/buffered-io.c b/fs/iomap/buffered-io.c
index 093c4515b22a..cd0d007ba4a1 100644
--- a/fs/iomap/buffered-io.c
+++ b/fs/iomap/buffered-io.c
@@ -17,6 +17,7 @@
#include <linux/bio.h>
#include <linux/sched/signal.h>
#include <linux/migrate.h>
+#include <linux/blkdev.h>
#include "trace.h"
#include "../internal.h"
diff --git a/fs/iomap/direct-io.c b/fs/iomap/direct-io.c
index bcd3f8cf5ea4..c7d017953468 100644
--- a/fs/iomap/direct-io.c
+++ b/fs/iomap/direct-io.c
@@ -12,6 +12,7 @@
#include <linux/backing-dev.h>
#include <linux/uio.h>
#include <linux/task_io_accounting_ops.h>
+#include <linux/blkdev.h>
#include "trace.h"
#include "../internal.h"
diff --git a/fs/namespace.c b/fs/namespace.c
index 437f60e96d40..d80479bcf76c 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -31,6 +31,7 @@
#include <uapi/linux/mount.h>
#include <linux/fs_context.h>
#include <linux/shmem_fs.h>
+#include <linux/sysfs.h>
#include <linux/mnt_idmapping.h>
#include <linux/nospec.h>
diff --git a/fs/nfs/nfs42xattr.c b/fs/nfs/nfs42xattr.c
index 49aaf28a6950..94fd57d7d930 100644
--- a/fs/nfs/nfs42xattr.c
+++ b/fs/nfs/nfs42xattr.c
@@ -10,6 +10,7 @@
#include <linux/errno.h>
#include <linux/nfs_fs.h>
#include <linux/hashtable.h>
+#include <linux/list_lru.h>
#include <linux/refcount.h>
#include <uapi/linux/xattr.h>
diff --git a/fs/ntfs3/fsntfs.c b/fs/ntfs3/fsntfs.c
index ae2ef5c11868..a2cb4532f7e3 100644
--- a/fs/ntfs3/fsntfs.c
+++ b/fs/ntfs3/fsntfs.c
@@ -5,6 +5,7 @@
*
*/
+#include <linux/bio.h>
#include <linux/blkdev.h>
#include <linux/buffer_head.h>
#include <linux/fs.h>
@@ -2698,4 +2699,4 @@ int ntfs_set_label(struct ntfs_sb_info *sbi, u8 *label, int len)
out:
__putname(uni);
return err;
-}
\ No newline at end of file
+}
diff --git a/fs/ntfs3/super.c b/fs/ntfs3/super.c
index cef5467fd928..e0fc4805e21a 100644
--- a/fs/ntfs3/super.c
+++ b/fs/ntfs3/super.c
@@ -60,6 +60,7 @@
#include <linux/proc_fs.h>
#include <linux/seq_file.h>
#include <linux/statfs.h>
+#include <linux/ratelimit.h>
#include "debug.h"
#include "ntfs.h"
diff --git a/fs/pnode.c b/fs/pnode.c
index a799e0315cc9..c2f92e5a28fa 100644
--- a/fs/pnode.c
+++ b/fs/pnode.c
@@ -9,6 +9,7 @@
#include <linux/mount.h>
#include <linux/fs.h>
#include <linux/nsproxy.h>
+#include <linux/seqlock.h>
#include <uapi/linux/mount.h>
#include "internal.h"
#include "pnode.h"
diff --git a/fs/proc/uptime.c b/fs/proc/uptime.c
index b5343d209381..59ff141a3d4b 100644
--- a/fs/proc/uptime.c
+++ b/fs/proc/uptime.c
@@ -7,6 +7,7 @@
#include <linux/time.h>
#include <linux/time_namespace.h>
#include <linux/kernel_stat.h>
+#include <linux/timekeeping.h> // for ktime_get_boottime_ts64()
#include "internal.h"
static int uptime_proc_show(struct seq_file *m, void *v)
diff --git a/fs/pstore/inode.c b/fs/pstore/inode.c
index d0d9bfdad30c..98a136f26d4c 100644
--- a/fs/pstore/inode.c
+++ b/fs/pstore/inode.c
@@ -22,6 +22,7 @@
#include <linux/magic.h>
#include <linux/pstore.h>
#include <linux/slab.h>
+#include <linux/sysfs.h>
#include <linux/uaccess.h>
#include <linux/cleanup.h>
diff --git a/fs/reiserfs/reiserfs.h b/fs/reiserfs/reiserfs.h
index 725667880e62..335758395ee4 100644
--- a/fs/reiserfs/reiserfs.h
+++ b/fs/reiserfs/reiserfs.h
@@ -14,6 +14,7 @@
#include <asm/unaligned.h>
#include <linux/bitops.h>
#include <linux/proc_fs.h>
+#include <linux/quota.h>
#include <linux/buffer_head.h>
/* the 32 bit compat definitions with int argument */
diff --git a/fs/sysctls.c b/fs/sysctls.c
index 8dbde9a802fa..90894bb067dd 100644
--- a/fs/sysctls.c
+++ b/fs/sysctls.c
@@ -6,6 +6,7 @@
*/
#include <linux/init.h>
#include <linux/sysctl.h>
+#include <linux/highuid.h>
static struct ctl_table fs_shared_sysctls[] = {
{
diff --git a/fs/sysfs/mount.c b/fs/sysfs/mount.c
index 98467bb76737..2380a3f6f328 100644
--- a/fs/sysfs/mount.c
+++ b/fs/sysfs/mount.c
@@ -10,6 +10,7 @@
*/
#include <linux/fs.h>
+#include <linux/kobject_ns.h>
#include <linux/magic.h>
#include <linux/mount.h>
#include <linux/init.h>
diff --git a/fs/tracefs/inode.c b/fs/tracefs/inode.c
index e1b172c0e091..1b46d6a7d3e9 100644
--- a/fs/tracefs/inode.c
+++ b/fs/tracefs/inode.c
@@ -21,6 +21,7 @@
#include <linux/parser.h>
#include <linux/magic.h>
#include <linux/slab.h>
+#include <linux/sysfs.h>
#include "internal.h"
#define TRACEFS_DEFAULT_MODE 0700
diff --git a/fs/ubifs/io.c b/fs/ubifs/io.c
index 01d8eb170382..56e95da4f7ef 100644
--- a/fs/ubifs/io.c
+++ b/fs/ubifs/io.c
@@ -60,6 +60,7 @@
#include <linux/crc32.h>
#include <linux/slab.h>
+#include <linux/hrtimer.h>
#include "ubifs.h"
/**
diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c
index 09e270d6ed02..a9c286b8c373 100644
--- a/fs/ubifs/super.c
+++ b/fs/ubifs/super.c
@@ -24,6 +24,7 @@
#include <linux/mount.h>
#include <linux/math64.h>
#include <linux/writeback.h>
+#include <linux/hrtimer.h>
#include "ubifs.h"
static int ubifs_default_version_set(const char *val, const struct kernel_param *kp)
diff --git a/fs/xfs/xfs_error.c b/fs/xfs/xfs_error.c
index b2cbbba3e15a..c64fb632718d 100644
--- a/fs/xfs/xfs_error.c
+++ b/fs/xfs/xfs_error.c
@@ -14,6 +14,7 @@
#include "xfs_error.h"
#include "xfs_sysfs.h"
#include "xfs_inode.h"
+#include <linux/sysfs.h>
#ifdef DEBUG
diff --git a/fs/xfs/xfs_sysfs.c b/fs/xfs/xfs_sysfs.c
index 17485666b672..09b2a05c802f 100644
--- a/fs/xfs/xfs_sysfs.c
+++ b/fs/xfs/xfs_sysfs.c
@@ -13,6 +13,7 @@
#include "xfs_log.h"
#include "xfs_log_priv.h"
#include "xfs_mount.h"
+#include <linux/sysfs.h>
struct xfs_sysfs_attr {
struct attribute attr;
diff --git a/fs/zonefs/sysfs.c b/fs/zonefs/sysfs.c
index 8ccb65c2b419..49f79f338550 100644
--- a/fs/zonefs/sysfs.c
+++ b/fs/zonefs/sysfs.c
@@ -6,6 +6,7 @@
*/
#include <linux/fs.h>
#include <linux/seq_file.h>
+#include <linux/sysfs.h>
#include <linux/blkdev.h>
#include "zonefs.h"
diff --git a/include/drm/drm_color_mgmt.h b/include/drm/drm_color_mgmt.h
index ed81741036d7..b5e183358bee 100644
--- a/include/drm/drm_color_mgmt.h
+++ b/include/drm/drm_color_mgmt.h
@@ -23,6 +23,7 @@
#ifndef __DRM_COLOR_MGMT_H__
#define __DRM_COLOR_MGMT_H__
+#include <linux/bits.h>
#include <linux/ctype.h>
#include <linux/math64.h>
#include <drm/drm_property.h>
diff --git a/include/drm/drm_modeset_lock.h b/include/drm/drm_modeset_lock.h
index ec4f543c3d95..f901d4ad0c54 100644
--- a/include/drm/drm_modeset_lock.h
+++ b/include/drm/drm_modeset_lock.h
@@ -27,6 +27,7 @@
#include <linux/types.h> /* stackdepot.h is not self-contained */
#include <linux/stackdepot.h>
#include <linux/ww_mutex.h>
+#include <linux/lockdep.h>
struct drm_modeset_lock;
diff --git a/include/drm/gpu_scheduler.h b/include/drm/gpu_scheduler.h
index 5acc64954a88..4c598cfc2af3 100644
--- a/include/drm/gpu_scheduler.h
+++ b/include/drm/gpu_scheduler.h
@@ -28,6 +28,7 @@
#include <linux/dma-fence.h>
#include <linux/completion.h>
#include <linux/xarray.h>
+#include <linux/wait.h>
#include <linux/workqueue.h>
#define MAX_WAIT_SCHED_ENTITY_Q_EMPTY msecs_to_jiffies(1000)
diff --git a/include/linux/backing-dev-defs.h b/include/linux/backing-dev-defs.h
index ae12696ec492..721659b4edd7 100644
--- a/include/linux/backing-dev-defs.h
+++ b/include/linux/backing-dev-defs.h
@@ -10,10 +10,15 @@
#include <linux/percpu-refcount.h>
#include <linux/flex_proportions.h>
#include <linux/timer.h>
+#include <linux/wait.h>
#include <linux/workqueue.h>
#include <linux/kref.h>
#include <linux/refcount.h>
+#ifdef CONFIG_CGROUP_WRITEBACK
+#include <linux/rwsem.h>
+#endif
+
struct page;
struct device;
struct dentry;
diff --git a/include/linux/bio.h b/include/linux/bio.h
index 875d792bffff..afae5a73b7cd 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -8,6 +8,7 @@
#include <linux/mempool.h>
/* struct bio, bio_vec and BIO_* flags are defined in blk_types.h */
#include <linux/blk_types.h>
+#include <linux/bvec.h>
#include <linux/uio.h>
#define BIO_MAX_VECS 256U
diff --git a/include/linux/blk-integrity.h b/include/linux/blk-integrity.h
index 378b2459efe2..d91d3363d8b3 100644
--- a/include/linux/blk-integrity.h
+++ b/include/linux/blk-integrity.h
@@ -3,6 +3,7 @@
#define _LINUX_BLK_INTEGRITY_H
#include <linux/blk-mq.h>
+#include <linux/bio.h>
struct request;
diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h
index 7a8150a5f051..d3e9e69aaa3c 100644
--- a/include/linux/blk-mq.h
+++ b/include/linux/blk-mq.h
@@ -2,6 +2,7 @@
#ifndef BLK_MQ_H
#define BLK_MQ_H
+#include <linux/bio.h>
#include <linux/blkdev.h>
#include <linux/sbitmap.h>
#include <linux/lockdep.h>
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index d7cac3de65b3..09e7268bc590 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -6,6 +6,7 @@
#define _LINUX_BLKDEV_H
#include <linux/types.h>
+#include <linux/fs.h> // for inode_unhashed()
#include <linux/blk_types.h>
#include <linux/device.h>
#include <linux/list.h>
@@ -22,6 +23,7 @@
#include <linux/blkzoned.h>
#include <linux/sched.h>
#include <linux/sbitmap.h>
+#include <linux/uio.h> // for iov_iter_is_aligned()
#include <linux/uuid.h>
#include <linux/xarray.h>
diff --git a/include/linux/can/dev.h b/include/linux/can/dev.h
index 1b92aed49363..332ece824fde 100644
--- a/include/linux/can/dev.h
+++ b/include/linux/can/dev.h
@@ -22,6 +22,7 @@
#include <linux/can/skb.h>
#include <linux/ethtool.h>
#include <linux/netdevice.h>
+#include <linux/workqueue.h> // for struct delayed_work
/*
* CAN mode
diff --git a/include/linux/dev_printk.h b/include/linux/dev_printk.h
index 6bfe70decc9f..a5151e4b9bde 100644
--- a/include/linux/dev_printk.h
+++ b/include/linux/dev_printk.h
@@ -12,6 +12,7 @@
#define _DEVICE_PRINTK_H_
#include <linux/compiler.h>
+#include <linux/stdarg.h>
#include <linux/types.h>
#include <linux/ratelimit.h>
diff --git a/include/linux/device.h b/include/linux/device.h
index 97c4b046c09d..ddba2d30c541 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -31,6 +31,7 @@
#include <linux/device/class.h>
#include <linux/device/driver.h>
#include <linux/cleanup.h>
+#include <linux/sysfs.h> // for __ATTR_*
#include <asm/device.h>
struct device;
diff --git a/include/linux/device/bus.h b/include/linux/device/bus.h
index 5ef4ec1c36c3..76826d165298 100644
--- a/include/linux/device/bus.h
+++ b/include/linux/device/bus.h
@@ -17,6 +17,7 @@
#include <linux/kobject.h>
#include <linux/klist.h>
#include <linux/pm.h>
+#include <linux/sysfs.h> // for struct attribute
struct device_driver;
struct fwnode_handle;
diff --git a/include/linux/device/class.h b/include/linux/device/class.h
index c576b49c55c2..6b1cebe43f8e 100644
--- a/include/linux/device/class.h
+++ b/include/linux/device/class.h
@@ -17,6 +17,7 @@
#include <linux/kobject.h>
#include <linux/klist.h>
#include <linux/pm.h>
+#include <linux/uidgid_types.h>
#include <linux/device/bus.h>
struct device;
diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h
index 752dbde4cec1..1a202761599a 100644
--- a/include/linux/dmaengine.h
+++ b/include/linux/dmaengine.h
@@ -7,6 +7,7 @@
#include <linux/device.h>
#include <linux/err.h>
+#include <linux/idr.h> // for struct ida
#include <linux/uio.h>
#include <linux/bug.h>
#include <linux/scatterlist.h>
diff --git a/include/linux/dtpm.h b/include/linux/dtpm.h
index a4a13514b730..eae69f6e4042 100644
--- a/include/linux/dtpm.h
+++ b/include/linux/dtpm.h
@@ -12,6 +12,8 @@
#define MAX_DTPM_DESCR 8
#define MAX_DTPM_CONSTRAINTS 1
+struct of_device_id;
+
struct dtpm {
struct powercap_zone zone;
struct dtpm *parent;
diff --git a/include/linux/extcon.h b/include/linux/extcon.h
index e596a0abcb27..0fd2ca917549 100644
--- a/include/linux/extcon.h
+++ b/include/linux/extcon.h
@@ -19,6 +19,9 @@
#define __LINUX_EXTCON_H__
#include <linux/device.h>
+#include <linux/errno.h>
+#include <linux/notifier.h>
+#include <linux/types.h>
/*
* Define the type of supported external connectors
diff --git a/include/linux/firmware.h b/include/linux/firmware.h
index 0311858b46ce..d45acd8c1e84 100644
--- a/include/linux/firmware.h
+++ b/include/linux/firmware.h
@@ -2,6 +2,7 @@
#ifndef _LINUX_FIRMWARE_H
#define _LINUX_FIRMWARE_H
+#include <linux/err.h>
#include <linux/types.h>
#include <linux/compiler.h>
#include <linux/gfp.h>
diff --git a/include/linux/flex_proportions.h b/include/linux/flex_proportions.h
index e9a72fd0bfe7..b5d8c1a1b2a9 100644
--- a/include/linux/flex_proportions.h
+++ b/include/linux/flex_proportions.h
@@ -12,6 +12,7 @@
#include <linux/spinlock.h>
#include <linux/seqlock.h>
#include <linux/gfp.h>
+#include <linux/irqflags.h> // for local_irq_save()
/*
* When maximum proportion of some event type is specified, this is the
diff --git a/include/linux/framer/framer-provider.h b/include/linux/framer/framer-provider.h
index 782cd5fc83d5..0519dfe6f61c 100644
--- a/include/linux/framer/framer-provider.h
+++ b/include/linux/framer/framer-provider.h
@@ -10,6 +10,7 @@
#ifndef __DRIVERS_PROVIDER_FRAMER_H
#define __DRIVERS_PROVIDER_FRAMER_H
+#include <linux/device.h>
#include <linux/export.h>
#include <linux/framer/framer.h>
#include <linux/types.h>
diff --git a/include/linux/futex.h b/include/linux/futex.h
index b70df27d7e85..9fe23f0681ca 100644
--- a/include/linux/futex.h
+++ b/include/linux/futex.h
@@ -4,6 +4,7 @@
#include <linux/sched.h>
#include <linux/ktime.h>
+#include <linux/mutex.h>
#include <uapi/linux/futex.h>
diff --git a/include/linux/hisi_acc_qm.h b/include/linux/hisi_acc_qm.h
index 5f4c74facf6a..33e3caa400de 100644
--- a/include/linux/hisi_acc_qm.h
+++ b/include/linux/hisi_acc_qm.h
@@ -5,6 +5,7 @@
#include <linux/bitfield.h>
#include <linux/debugfs.h>
+#include <linux/idr.h>
#include <linux/iopoll.h>
#include <linux/module.h>
#include <linux/pci.h>
diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h
index 991c83e929b4..ba795d668766 100644
--- a/include/linux/hrtimer.h
+++ b/include/linux/hrtimer.h
@@ -20,7 +20,9 @@
#include <linux/rbtree.h>
#include <linux/seqlock.h>
#include <linux/timer.h>
+#include <asm/processor.h> /* for cpu_relax() */
+struct restart_block;
struct hrtimer_clock_base;
struct hrtimer_cpu_base;
diff --git a/include/linux/iio/iio.h b/include/linux/iio/iio.h
index c5b36d2c1e73..6dafef342e91 100644
--- a/include/linux/iio/iio.h
+++ b/include/linux/iio/iio.h
@@ -9,6 +9,7 @@
#include <linux/device.h>
#include <linux/cdev.h>
+#include <linux/device.h>
#include <linux/slab.h>
#include <linux/iio/types.h>
/* IIO TODO LIST */
diff --git a/include/linux/ipc.h b/include/linux/ipc.h
index 9b1434247aab..12f6839fad5b 100644
--- a/include/linux/ipc.h
+++ b/include/linux/ipc.h
@@ -7,6 +7,8 @@
#include <linux/rhashtable-types.h>
#include <uapi/linux/ipc.h>
#include <linux/refcount.h>
+#include <linux/cache.h> // for ____cacheline_aligned_in_smp
+#include <linux/compiler_types.h> // for __randomize_layout
/* used by in-kernel data structures */
struct kern_ipc_perm {
diff --git a/include/linux/memory_hotplug.h b/include/linux/memory_hotplug.h
index 7a9ff464608d..ace4e4e48315 100644
--- a/include/linux/memory_hotplug.h
+++ b/include/linux/memory_hotplug.h
@@ -3,6 +3,7 @@
#define __LINUX_MEMORY_HOTPLUG_H
#include <linux/mmzone.h>
+#include <linux/seqlock.h>
#include <linux/spinlock.h>
#include <linux/notifier.h>
#include <linux/bug.h>
diff --git a/include/linux/mm.h b/include/linux/mm.h
index e442fd0efdd9..b111daecd173 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -23,6 +23,8 @@
#include <linux/err.h>
#include <linux/page-flags.h>
#include <linux/page_ref.h>
+#include <linux/percpu_counter.h>
+#include <linux/rwsem.h>
#include <linux/overflow.h>
#include <linux/sizes.h>
#include <linux/sched.h>
@@ -30,6 +32,7 @@
#include <linux/kasan.h>
#include <linux/memremap.h>
#include <linux/slab.h>
+#include <linux/seqlock.h>
struct mempolicy;
struct anon_vma;
diff --git a/include/linux/module.h b/include/linux/module.h
index 1153b0d99a80..fd3c85e4d95f 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -27,6 +27,7 @@
#include <linux/tracepoint-defs.h>
#include <linux/srcu.h>
#include <linux/static_call_types.h>
+#include <linux/sysfs.h> // for struct attribute
#include <linux/dynamic_debug.h>
#include <linux/percpu.h>
diff --git a/include/linux/mtd/blktrans.h b/include/linux/mtd/blktrans.h
index 6e471436bba5..92a7c94777b7 100644
--- a/include/linux/mtd/blktrans.h
+++ b/include/linux/mtd/blktrans.h
@@ -8,6 +8,7 @@
#include <linux/mutex.h>
#include <linux/kref.h>
+#include <linux/list.h>
#include <linux/sysfs.h>
struct hd_geometry;
diff --git a/include/linux/ndctl.h b/include/linux/ndctl.h
index cd5a293ce3ae..4f21118ae7b1 100644
--- a/include/linux/ndctl.h
+++ b/include/linux/ndctl.h
@@ -13,6 +13,8 @@
#ifndef _LINUX_NDCTL_H
#define _LINUX_NDCTL_H
+#include <asm/page.h> // for PAGE_SIZE
+
#include <uapi/linux/ndctl.h>
enum {
diff --git a/include/linux/node.h b/include/linux/node.h
index 25b66d705ee2..c4c17037c954 100644
--- a/include/linux/node.h
+++ b/include/linux/node.h
@@ -18,6 +18,8 @@
#include <linux/device.h>
#include <linux/cpumask.h>
#include <linux/list.h>
+#include <linux/mmzone.h> // for enum meminit_context
+#include <linux/nodemask.h> // for node_online()
/**
* struct access_coordinate - generic performance coordinates container
diff --git a/include/linux/notifier.h b/include/linux/notifier.h
index 45702bdcbceb..96fb0b489d8a 100644
--- a/include/linux/notifier.h
+++ b/include/linux/notifier.h
@@ -13,6 +13,7 @@
#include <linux/errno.h>
#include <linux/mutex.h>
#include <linux/rwsem.h>
+#include <linux/spinlock.h>
#include <linux/srcu.h>
/*
diff --git a/include/linux/ns_common.h b/include/linux/ns_common.h
index 0f1d024bd958..241cef0bfaed 100644
--- a/include/linux/ns_common.h
+++ b/include/linux/ns_common.h
@@ -2,6 +2,7 @@
#ifndef _LINUX_NS_COMMON_H
#define _LINUX_NS_COMMON_H
+#include <linux/atomic.h>
#include <linux/refcount.h>
struct proc_ns_operations;
diff --git a/include/linux/pm.h b/include/linux/pm.h
index 97b0e23363c8..e0014edba850 100644
--- a/include/linux/pm.h
+++ b/include/linux/pm.h
@@ -17,6 +17,10 @@
#include <linux/hrtimer.h>
#include <linux/completion.h>
+#ifdef CONFIG_PM_CLK
+#include <linux/mutex_types.h>
+#endif
+
/*
* Callbacks for platform drivers to implement.
*/
diff --git a/include/linux/quotaops.h b/include/linux/quotaops.h
index 06cc8888199e..96ea5444b4a3 100644
--- a/include/linux/quotaops.h
+++ b/include/linux/quotaops.h
@@ -9,6 +9,7 @@
#define _LINUX_QUOTAOPS_
#include <linux/fs.h>
+#include <linux/quota.h>
#define DQUOT_SPACE_WARN 0x1
#define DQUOT_SPACE_RESERVE 0x2
diff --git a/include/linux/raid_class.h b/include/linux/raid_class.h
index e50416ba9cd9..095e1c91edb4 100644
--- a/include/linux/raid_class.h
+++ b/include/linux/raid_class.h
@@ -4,6 +4,8 @@
*
* Copyright (c) 2005 - James Bottomley <[email protected]>
*/
+
+#include <linux/device.h>
#include <linux/transport_class.h>
struct raid_template {
diff --git a/include/linux/slab.h b/include/linux/slab.h
index b5f5ee8308d0..12a62a17e893 100644
--- a/include/linux/slab.h
+++ b/include/linux/slab.h
@@ -20,6 +20,7 @@
#include <linux/percpu-refcount.h>
#include <linux/cleanup.h>
#include <linux/hash.h>
+#include <linux/mmzone.h>
/*
diff --git a/include/linux/socket.h b/include/linux/socket.h
index cfcb7e2c3813..681bd2626f1e 100644
--- a/include/linux/socket.h
+++ b/include/linux/socket.h
@@ -8,6 +8,7 @@
#include <linux/uio.h> /* iovec support */
#include <linux/types.h> /* pid_t */
#include <linux/compiler.h> /* __user */
+#include <linux/time64.h> /* timespec64 */
#include <uapi/linux/socket.h>
struct file;
@@ -391,7 +392,6 @@ struct ucred {
extern int move_addr_to_kernel(void __user *uaddr, int ulen, struct sockaddr_storage *kaddr);
extern int put_cmsg(struct msghdr*, int level, int type, int len, void *data);
-struct timespec64;
struct __kernel_timespec;
struct old_timespec32;
diff --git a/include/linux/soundwire/sdw.h b/include/linux/soundwire/sdw.h
index 66f814b63a43..4546af80247d 100644
--- a/include/linux/soundwire/sdw.h
+++ b/include/linux/soundwire/sdw.h
@@ -5,6 +5,7 @@
#define __SOUNDWIRE_H
#include <linux/bug.h>
+#include <linux/device.h>
#include <linux/lockdep_types.h>
#include <linux/irq.h>
#include <linux/irqdomain.h>
diff --git a/include/linux/spi/spi_bitbang.h b/include/linux/spi/spi_bitbang.h
index 4444c2a992cb..0bd120e2c701 100644
--- a/include/linux/spi/spi_bitbang.h
+++ b/include/linux/spi/spi_bitbang.h
@@ -2,6 +2,8 @@
#ifndef __SPI_BITBANG_H
#define __SPI_BITBANG_H
+#include <linux/mutex.h>
+#include <linux/types.h>
#include <linux/workqueue.h>
struct spi_bitbang {
diff --git a/include/linux/srcutree.h b/include/linux/srcutree.h
index 8f3f72480e78..74edc15cfcf3 100644
--- a/include/linux/srcutree.h
+++ b/include/linux/srcutree.h
@@ -13,6 +13,8 @@
#include <linux/rcu_node_tree.h>
#include <linux/completion.h>
+#include <linux/mutex_types.h>
+#include <linux/workqueue.h>
struct srcu_node;
struct srcu_struct;
diff --git a/include/linux/stackdepot.h b/include/linux/stackdepot.h
index adcbb8f23600..a6aa21393755 100644
--- a/include/linux/stackdepot.h
+++ b/include/linux/stackdepot.h
@@ -21,6 +21,7 @@
#define _LINUX_STACKDEPOT_H
#include <linux/gfp.h>
+#include <linux/init.h>
typedef u32 depot_stack_handle_t;
diff --git a/include/linux/sunrpc/rpc_pipe_fs.h b/include/linux/sunrpc/rpc_pipe_fs.h
index 3b35b6f6533a..5438de45300d 100644
--- a/include/linux/sunrpc/rpc_pipe_fs.h
+++ b/include/linux/sunrpc/rpc_pipe_fs.h
@@ -2,6 +2,9 @@
#ifndef _LINUX_SUNRPC_RPC_PIPE_FS_H
#define _LINUX_SUNRPC_RPC_PIPE_FS_H
+#include <linux/list.h>
+#include <linux/spinlock_types.h>
+#include <linux/wait.h>
#include <linux/workqueue.h>
struct rpc_pipe_dir_head {
diff --git a/include/linux/trace_recursion.h b/include/linux/trace_recursion.h
index d48cd92d2364..19bf980b039f 100644
--- a/include/linux/trace_recursion.h
+++ b/include/linux/trace_recursion.h
@@ -136,6 +136,7 @@ extern void ftrace_record_recursion(unsigned long ip, unsigned long parent_ip);
#endif
#ifdef CONFIG_ARCH_WANTS_NO_INSTR
+#include <linux/rcutree.h> // for rcu_is_watching()
# define trace_warn_on_no_rcu(ip) \
({ \
bool __ret = !rcu_is_watching(); \
diff --git a/include/linux/tty_port.h b/include/linux/tty_port.h
index 1b861f2100b6..2de08c8d2584 100644
--- a/include/linux/tty_port.h
+++ b/include/linux/tty_port.h
@@ -6,7 +6,7 @@
#include <linux/kref.h>
#include <linux/mutex.h>
#include <linux/tty_buffer.h>
-#include <linux/wait.h>
+#include <linux/wait_types.h>
struct attribute_group;
struct tty_driver;
diff --git a/include/linux/u64_stats_sync.h b/include/linux/u64_stats_sync.h
index ffe48e69b3f3..cf4b090e799a 100644
--- a/include/linux/u64_stats_sync.h
+++ b/include/linux/u64_stats_sync.h
@@ -59,6 +59,8 @@
* Example of use in drivers/net/loopback.c, using per_cpu containers,
* in BH disabled context.
*/
+
+#include <asm/bitsperlong.h>
#include <linux/seqlock.h>
struct u64_stats_sync {
diff --git a/include/linux/wait_bit.h b/include/linux/wait_bit.h
index 7725b7579b78..96c90fbcf652 100644
--- a/include/linux/wait_bit.h
+++ b/include/linux/wait_bit.h
@@ -5,6 +5,9 @@
/*
* Linux wait-bit related types and methods:
*/
+#include <linux/bitops.h>
+#include <linux/init.h> // for __init
+#include <linux/kernel.h> // for might_sleep()
#include <linux/wait.h>
struct wait_bit_key {
diff --git a/include/linux/writeback.h b/include/linux/writeback.h
index 453736fd1d23..9a7a3d2b543f 100644
--- a/include/linux/writeback.h
+++ b/include/linux/writeback.h
@@ -11,6 +11,7 @@
#include <linux/flex_proportions.h>
#include <linux/backing-dev-defs.h>
#include <linux/blk_types.h>
+#include <linux/wait_bit.h>
struct bio;
diff --git a/include/linux/ww_mutex.h b/include/linux/ww_mutex.h
index bb763085479a..f5b141b085ba 100644
--- a/include/linux/ww_mutex.h
+++ b/include/linux/ww_mutex.h
@@ -19,6 +19,7 @@
#include <linux/mutex.h>
#include <linux/rtmutex.h>
+#include <linux/lockdep.h>
#if defined(CONFIG_DEBUG_MUTEXES) || \
(defined(CONFIG_PREEMPT_RT) && defined(CONFIG_DEBUG_RT_MUTEXES))
diff --git a/include/media/media-device.h b/include/media/media-device.h
index 2c146d0b2b1c..b1b5b6dac4ff 100644
--- a/include/media/media-device.h
+++ b/include/media/media-device.h
@@ -11,6 +11,7 @@
#ifndef _MEDIA_DEVICE_H
#define _MEDIA_DEVICE_H
+#include <linux/idr.h> // for struct ida
#include <linux/list.h>
#include <linux/mutex.h>
#include <linux/pci.h>
diff --git a/include/net/netns/ipv6.h b/include/net/netns/ipv6.h
index 5f2cfd84570a..858ee28e73f9 100644
--- a/include/net/netns/ipv6.h
+++ b/include/net/netns/ipv6.h
@@ -3,6 +3,10 @@
* ipv6 in net namespaces
*/
+#include <linux/list.h>
+#include <linux/spinlock_types.h>
+#include <linux/rwlock_types.h>
+#include <linux/workqueue.h> // for struct delayed_work
#include <net/inet_frag.h>
#ifndef __NETNS_IPV6_H__
diff --git a/include/net/netns/mctp.h b/include/net/netns/mctp.h
index 1db8f9aaddb4..6c5039374021 100644
--- a/include/net/netns/mctp.h
+++ b/include/net/netns/mctp.h
@@ -6,6 +6,7 @@
#ifndef __NETNS_MCTP_H__
#define __NETNS_MCTP_H__
+#include <linux/list.h>
#include <linux/mutex.h>
#include <linux/types.h>
diff --git a/include/net/netns/xdp.h b/include/net/netns/xdp.h
index 21a4f25a187a..06d06cf2b966 100644
--- a/include/net/netns/xdp.h
+++ b/include/net/netns/xdp.h
@@ -2,6 +2,7 @@
#ifndef __NETNS_XDP_H__
#define __NETNS_XDP_H__
+#include <linux/list.h>
#include <linux/mutex.h>
#include <linux/types.h>
diff --git a/include/net/tcp.h b/include/net/tcp.h
index 58e65af74ad1..140e012260a8 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -26,6 +26,7 @@
#include <linux/kref.h>
#include <linux/ktime.h>
#include <linux/indirect_call_wrapper.h>
+#include <linux/hrtimer.h> // for hrtimer_try_to_cancel()
#include <net/inet_connection_sock.h>
#include <net/inet_timewait_sock.h>
diff --git a/include/sound/core.h b/include/sound/core.h
index dfef0c9d4b9f..eaae6da1e0b0 100644
--- a/include/sound/core.h
+++ b/include/sound/core.h
@@ -14,6 +14,7 @@
#include <linux/pm.h> /* pm_message_t */
#include <linux/stringify.h>
#include <linux/printk.h>
+#include <linux/wait.h>
#include <linux/xarray.h>
/* number of supported soundcards */
diff --git a/include/sound/util_mem.h b/include/sound/util_mem.h
index 01310e089143..3403b8f4dc86 100644
--- a/include/sound/util_mem.h
+++ b/include/sound/util_mem.h
@@ -2,6 +2,7 @@
#ifndef __SOUND_UTIL_MEM_H
#define __SOUND_UTIL_MEM_H
+#include <linux/list.h>
#include <linux/mutex.h>
/*
* Copyright (C) 2000 Takashi Iwai <[email protected]>
diff --git a/include/trace/events/iommu.h b/include/trace/events/iommu.h
index 70743db1fb75..4a438395759c 100644
--- a/include/trace/events/iommu.h
+++ b/include/trace/events/iommu.h
@@ -11,10 +11,9 @@
#if !defined(_TRACE_IOMMU_H) || defined(TRACE_HEADER_MULTI_READ)
#define _TRACE_IOMMU_H
+#include <linux/device.h> // for dev_driver_string()
#include <linux/tracepoint.h>
-struct device;
-
DECLARE_EVENT_CLASS(iommu_group_event,
TP_PROTO(int group_id, struct device *dev),
diff --git a/include/trace/events/power.h b/include/trace/events/power.h
index 77f14f7a11d4..db197c8e93d9 100644
--- a/include/trace/events/power.h
+++ b/include/trace/events/power.h
@@ -6,6 +6,7 @@
#define _TRACE_POWER_H
#include <linux/cpufreq.h>
+#include <linux/device.h>
#include <linux/ktime.h>
#include <linux/pm_qos.h>
#include <linux/tracepoint.h>
diff --git a/init/init_task.c b/init/init_task.c
index 4daee6d761c8..28aa0031f42b 100644
--- a/init/init_task.c
+++ b/init/init_task.c
@@ -13,6 +13,7 @@
#include <linux/numa.h>
#include <linux/scs.h>
#include <linux/plist.h>
+#include <linux/posix-timers.h> // for INIT_CPU_TIMERS()
#include <linux/uaccess.h>
diff --git a/init/main.c b/init/main.c
index 521f40770e67..67af889b2f70 100644
--- a/init/main.c
+++ b/init/main.c
@@ -99,6 +99,7 @@
#include <linux/init_syscalls.h>
#include <linux/stackdepot.h>
#include <linux/randomize_kstack.h>
+#include <linux/hrtimer.h>
#include <net/net_namespace.h>
#include <asm/io.h>
diff --git a/io_uring/cancel.c b/io_uring/cancel.c
index 8a8b07dfc444..0288bf4d015b 100644
--- a/io_uring/cancel.c
+++ b/io_uring/cancel.c
@@ -8,6 +8,7 @@
#include <linux/namei.h>
#include <linux/nospec.h>
#include <linux/io_uring.h>
+#include <linux/hrtimer.h>
#include <uapi/linux/io_uring.h>
diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c
index cd9a137ad6ce..49db7fa2cebd 100644
--- a/io_uring/io_uring.c
+++ b/io_uring/io_uring.c
@@ -72,6 +72,7 @@
#include <linux/io_uring/cmd.h>
#include <linux/audit.h>
#include <linux/security.h>
+#include <linux/hrtimer.h>
#include <asm/shmparam.h>
#define CREATE_TRACE_POINTS
diff --git a/io_uring/timeout.h b/io_uring/timeout.h
index a6939f18313e..1421625053da 100644
--- a/io_uring/timeout.h
+++ b/io_uring/timeout.h
@@ -1,5 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
+#include <linux/hrtimer.h>
+
struct io_timeout_data {
struct io_kiocb *req;
struct hrtimer timer;
diff --git a/ipc/mq_sysctl.c b/ipc/mq_sysctl.c
index 21fba3a6edaf..2486dd36af57 100644
--- a/ipc/mq_sysctl.c
+++ b/ipc/mq_sysctl.c
@@ -13,6 +13,7 @@
#include <linux/capability.h>
#include <linux/slab.h>
#include <linux/cred.h>
+#include <linux/uidgid.h>
static int msg_max_limit_min = MIN_MSGMAX;
static int msg_max_limit_max = HARD_MSGMAX;
diff --git a/ipc/mqueue.c b/ipc/mqueue.c
index 5eea4dc0509e..e27c7512e7b1 100644
--- a/ipc/mqueue.c
+++ b/ipc/mqueue.c
@@ -39,6 +39,7 @@
#include <linux/sched/wake_q.h>
#include <linux/sched/signal.h>
#include <linux/sched/user.h>
+#include <linux/hrtimer.h>
#include <net/sock.h>
#include "util.h"
diff --git a/ipc/namespace.c b/ipc/namespace.c
index 6ecc30effd3e..8df3cda0b6ee 100644
--- a/ipc/namespace.c
+++ b/ipc/namespace.c
@@ -16,6 +16,7 @@
#include <linux/user_namespace.h>
#include <linux/proc_ns.h>
#include <linux/sched/task.h>
+#include <linux/workqueue.h>
#include "util.h"
diff --git a/ipc/sem.c b/ipc/sem.c
index a39cdc7bf88f..a2cdd57ab140 100644
--- a/ipc/sem.c
+++ b/ipc/sem.c
@@ -87,6 +87,7 @@
#include <linux/sched/wake_q.h>
#include <linux/nospec.h>
#include <linux/rhashtable.h>
+#include <linux/hrtimer.h>
#include <linux/uaccess.h>
#include "util.h"
diff --git a/kernel/bpf/helpers.c b/kernel/bpf/helpers.c
index bcb951a2ecf4..ee230f61b6de 100644
--- a/kernel/bpf/helpers.c
+++ b/kernel/bpf/helpers.c
@@ -23,6 +23,7 @@
#include <linux/btf_ids.h>
#include <linux/bpf_mem_alloc.h>
#include <linux/kasan.h>
+#include <linux/hrtimer.h>
#include "../../lib/kstrtox.h"
diff --git a/kernel/cpu.c b/kernel/cpu.c
index ad7d0b00bce9..5b8319c849a7 100644
--- a/kernel/cpu.c
+++ b/kernel/cpu.c
@@ -37,6 +37,7 @@
#include <linux/cpuset.h>
#include <linux/random.h>
#include <linux/cc_platform.h>
+#include <linux/hrtimer.h>
#include <trace/events/power.h>
#define CREATE_TRACE_POINTS
diff --git a/kernel/events/core.c b/kernel/events/core.c
index 5ecfa57e3b97..1814755cf94f 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -55,6 +55,7 @@
#include <linux/pgtable.h>
#include <linux/buildid.h>
#include <linux/task_work.h>
+#include <linux/hrtimer.h>
#include "internal.h"
diff --git a/kernel/exit.c b/kernel/exit.c
index dfb963d2f862..9b4f638322b0 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -70,6 +70,7 @@
#include <linux/sysfs.h>
#include <linux/user_events.h>
#include <linux/uaccess.h>
+#include <linux/hrtimer.h>
#include <uapi/linux/wait.h>
diff --git a/kernel/fork.c b/kernel/fork.c
index 83613bb3e66f..b7389080795e 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -49,6 +49,7 @@
#include <linux/cpu.h>
#include <linux/cgroup.h>
#include <linux/security.h>
+#include <linux/hrtimer.h>
#include <linux/hugetlb.h>
#include <linux/seccomp.h>
#include <linux/swap.h>
diff --git a/kernel/futex/core.c b/kernel/futex/core.c
index 1e78ef24321e..fce9cabf8c98 100644
--- a/kernel/futex/core.c
+++ b/kernel/futex/core.c
@@ -38,6 +38,7 @@
#include <linux/memblock.h>
#include <linux/fault-inject.h>
#include <linux/slab.h>
+#include <linux/hrtimer.h>
#include "futex.h"
#include "../locking/rtmutex_common.h"
diff --git a/kernel/futex/pi.c b/kernel/futex/pi.c
index 5722467f2737..3247e11341b3 100644
--- a/kernel/futex/pi.c
+++ b/kernel/futex/pi.c
@@ -3,6 +3,7 @@
#include <linux/slab.h>
#include <linux/sched/rt.h>
#include <linux/sched/task.h>
+#include <linux/hrtimer.h>
#include "futex.h"
#include "../locking/rtmutex_common.h"
diff --git a/kernel/futex/requeue.c b/kernel/futex/requeue.c
index b47bb764b352..cc8bfc20d6a2 100644
--- a/kernel/futex/requeue.c
+++ b/kernel/futex/requeue.c
@@ -2,6 +2,7 @@
#include <linux/plist.h>
#include <linux/sched/signal.h>
+#include <linux/hrtimer.h>
#include "futex.h"
#include "../locking/rtmutex_common.h"
diff --git a/kernel/futex/syscalls.c b/kernel/futex/syscalls.c
index 4b6da9116aa6..3841d40a7928 100644
--- a/kernel/futex/syscalls.c
+++ b/kernel/futex/syscalls.c
@@ -2,6 +2,7 @@
#include <linux/syscalls.h>
#include <linux/time_namespace.h>
+#include <linux/hrtimer.h>
#include "futex.h"
diff --git a/kernel/futex/waitwake.c b/kernel/futex/waitwake.c
index 3a10375d9521..2ec8b7403ef3 100644
--- a/kernel/futex/waitwake.c
+++ b/kernel/futex/waitwake.c
@@ -4,6 +4,7 @@
#include <linux/sched/task.h>
#include <linux/sched/signal.h>
#include <linux/freezer.h>
+#include <linux/hrtimer.h>
#include "futex.h"
diff --git a/kernel/livepatch/core.c b/kernel/livepatch/core.c
index ecbc9b6aba3a..0bf5c70e1cde 100644
--- a/kernel/livepatch/core.c
+++ b/kernel/livepatch/core.c
@@ -10,8 +10,10 @@
#include <linux/module.h>
#include <linux/kernel.h>
+#include <linux/kobject.h>
#include <linux/mutex.h>
#include <linux/slab.h>
+#include <linux/sysfs.h>
#include <linux/list.h>
#include <linux/kallsyms.h>
#include <linux/livepatch.h>
diff --git a/kernel/livepatch/transition.c b/kernel/livepatch/transition.c
index e54c3d60a904..b60b6dc439c1 100644
--- a/kernel/livepatch/transition.c
+++ b/kernel/livepatch/transition.c
@@ -8,6 +8,7 @@
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/cpu.h>
+#include <linux/sched/idle.h>
#include <linux/stacktrace.h>
#include <linux/static_call.h>
#include "core.h"
diff --git a/kernel/locking/rtmutex.c b/kernel/locking/rtmutex.c
index 4a10e8c16fd2..4038acd3cf71 100644
--- a/kernel/locking/rtmutex.c
+++ b/kernel/locking/rtmutex.c
@@ -23,6 +23,7 @@
#include <linux/sched/rt.h>
#include <linux/sched/wake_q.h>
#include <linux/ww_mutex.h>
+#include <linux/hrtimer.h>
#include <trace/events/lock.h>
diff --git a/kernel/locking/rtmutex_common.h b/kernel/locking/rtmutex_common.h
index 1162e07cdaea..5ecdef2d8383 100644
--- a/kernel/locking/rtmutex_common.h
+++ b/kernel/locking/rtmutex_common.h
@@ -14,6 +14,7 @@
#define __KERNEL_RTMUTEX_COMMON_H
#include <linux/debug_locks.h>
+#include <linux/rbtree.h>
#include <linux/rtmutex.h>
#include <linux/sched/wake_q.h>
diff --git a/kernel/padata.c b/kernel/padata.c
index e3f639ff1670..9d051ab75dad 100644
--- a/kernel/padata.c
+++ b/kernel/padata.c
@@ -22,6 +22,7 @@
#include <linux/slab.h>
#include <linux/sysfs.h>
#include <linux/rcupdate.h>
+#include <linux/refcount.h>
#define PADATA_WORK_ONSTACK 1 /* Work's memory is on stack */
diff --git a/kernel/panic.c b/kernel/panic.c
index d49b68184c56..29b49d03b73e 100644
--- a/kernel/panic.c
+++ b/kernel/panic.c
@@ -34,6 +34,7 @@
#include <linux/ratelimit.h>
#include <linux/debugfs.h>
#include <linux/sysfs.h>
+#include <linux/hrtimer.h> //for sysrq_timer_list_show()
#include <linux/context_tracking.h>
#include <trace/events/error_report.h>
#include <asm/sections.h>
diff --git a/kernel/power/energy_model.c b/kernel/power/energy_model.c
index 7b44f5b89fa1..af6fb88f69dc 100644
--- a/kernel/power/energy_model.c
+++ b/kernel/power/energy_model.c
@@ -13,6 +13,7 @@
#include <linux/cpufreq.h>
#include <linux/cpumask.h>
#include <linux/debugfs.h>
+#include <linux/device.h>
#include <linux/energy_model.h>
#include <linux/sched/topology.h>
#include <linux/slab.h>
diff --git a/kernel/reboot.c b/kernel/reboot.c
index 22c16e2564cc..ec96587c78cd 100644
--- a/kernel/reboot.c
+++ b/kernel/reboot.c
@@ -9,6 +9,7 @@
#include <linux/atomic.h>
#include <linux/ctype.h>
+#include <linux/device.h>
#include <linux/export.h>
#include <linux/kexec.h>
#include <linux/kmod.h>
diff --git a/kernel/signal.c b/kernel/signal.c
index 9561a3962ca6..bcab6ee3cd26 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -47,6 +47,7 @@
#include <linux/cgroup.h>
#include <linux/audit.h>
#include <linux/sysctl.h>
+#include <linux/hrtimer.h>
#define CREATE_TRACE_POINTS
#include <trace/events/signal.h>
diff --git a/kernel/smpboot.c b/kernel/smpboot.c
index 1992b62e980b..19f25456254b 100644
--- a/kernel/smpboot.c
+++ b/kernel/smpboot.c
@@ -15,6 +15,7 @@
#include <linux/percpu.h>
#include <linux/kthread.h>
#include <linux/smpboot.h>
+#include <linux/topology.h> // for cpu_to_node()
#include "smpboot.h"
diff --git a/kernel/time/hrtimer.c b/kernel/time/hrtimer.c
index edb0f821dcea..8ae50f900e4c 100644
--- a/kernel/time/hrtimer.c
+++ b/kernel/time/hrtimer.c
@@ -39,6 +39,7 @@
#include <linux/sched/nohz.h>
#include <linux/sched/debug.h>
#include <linux/timer.h>
+#include <linux/timerqueue.h>
#include <linux/freezer.h>
#include <linux/compat.h>
diff --git a/kernel/time/namespace.c b/kernel/time/namespace.c
index 0775b9ec952a..b37f8e91323d 100644
--- a/kernel/time/namespace.c
+++ b/kernel/time/namespace.c
@@ -17,6 +17,7 @@
#include <linux/cred.h>
#include <linux/err.h>
#include <linux/mm.h>
+#include <linux/ktime.h> //for timespec64_to_ktime()
#include <vdso/datapage.h>
diff --git a/kernel/time/posix-timers.c b/kernel/time/posix-timers.c
index b924f0f096fa..9b138586cd29 100644
--- a/kernel/time/posix-timers.c
+++ b/kernel/time/posix-timers.c
@@ -31,6 +31,7 @@
#include <linux/compat.h>
#include <linux/nospec.h>
#include <linux/time_namespace.h>
+#include <linux/hrtimer.h>
#include "timekeeping.h"
#include "posix-timers.h"
diff --git a/kernel/time/timer_list.c b/kernel/time/timer_list.c
index ed7d6ad694fb..99ae83f3f646 100644
--- a/kernel/time/timer_list.c
+++ b/kernel/time/timer_list.c
@@ -10,6 +10,7 @@
#include <linux/spinlock.h>
#include <linux/sched.h>
#include <linux/seq_file.h>
+#include <linux/timerqueue.h>
#include <linux/kallsyms.h>
#include <linux/nmi.h>
diff --git a/kernel/trace/trace_osnoise.c b/kernel/trace/trace_osnoise.c
index bd0d01d00fb9..e9ca204afd28 100644
--- a/kernel/trace/trace_osnoise.c
+++ b/kernel/trace/trace_osnoise.c
@@ -21,6 +21,7 @@
#include <linux/uaccess.h>
#include <linux/cpumask.h>
#include <linux/delay.h>
+#include <linux/hrtimer.h>
#include <linux/sched/clock.h>
#include <uapi/linux/sched/types.h>
#include <linux/sched.h>
diff --git a/kernel/tsacct.c b/kernel/tsacct.c
index 4252f0645b9e..6b80f9db0c23 100644
--- a/kernel/tsacct.c
+++ b/kernel/tsacct.c
@@ -13,6 +13,7 @@
#include <linux/acct.h>
#include <linux/jiffies.h>
#include <linux/mm.h>
+#include <linux/timekeeping.h> // for ktime_get_ns()
/*
* fill in basic accounting fields
diff --git a/kernel/ucount.c b/kernel/ucount.c
index 4aa6166cb856..74fb8c0c5126 100644
--- a/kernel/ucount.c
+++ b/kernel/ucount.c
@@ -7,6 +7,7 @@
#include <linux/hash.h>
#include <linux/kmemleak.h>
#include <linux/user_namespace.h>
+#include <linux/uidgid.h>
struct ucounts init_ucounts = {
.ns = &init_user_ns,
diff --git a/kernel/user.c b/kernel/user.c
index 03cedc366dc9..28da71ea1e74 100644
--- a/kernel/user.c
+++ b/kernel/user.c
@@ -20,6 +20,8 @@
#include <linux/user_namespace.h>
#include <linux/binfmts.h>
#include <linux/proc_ns.h>
+#include <linux/ratelimit.h>
+#include <linux/uidgid.h>
#if IS_ENABLED(CONFIG_BINFMT_MISC)
struct binfmt_misc init_binfmt_misc = {
diff --git a/kernel/watchdog.c b/kernel/watchdog.c
index 81a8862295d6..984a954808b0 100644
--- a/kernel/watchdog.c
+++ b/kernel/watchdog.c
@@ -23,6 +23,7 @@
#include <linux/sched/debug.h>
#include <linux/sched/isolation.h>
#include <linux/stop_machine.h>
+#include <linux/hrtimer.h>
#include <asm/irq_regs.h>
#include <linux/kvm_para.h>
diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index 9221a4c57ae1..8d3781af4396 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -40,6 +40,7 @@
#include <linux/mempolicy.h>
#include <linux/freezer.h>
#include <linux/debug_locks.h>
+#include <linux/device.h>
#include <linux/lockdep.h>
#include <linux/idr.h>
#include <linux/jhash.h>
diff --git a/lib/cpu_rmap.c b/lib/cpu_rmap.c
index 4c348670da31..6beb8632304e 100644
--- a/lib/cpu_rmap.c
+++ b/lib/cpu_rmap.c
@@ -7,6 +7,8 @@
#include <linux/cpu_rmap.h>
#include <linux/interrupt.h>
#include <linux/export.h>
+#include <linux/kref.h>
+#include <linux/topology.h>
/*
* These functions maintain a mapping from CPUs to some ordered set of
diff --git a/lib/flex_proportions.c b/lib/flex_proportions.c
index 84ecccddc771..35784f94f0a7 100644
--- a/lib/flex_proportions.c
+++ b/lib/flex_proportions.c
@@ -34,6 +34,8 @@
* which something happened with proportion of type j.
*/
#include <linux/flex_proportions.h>
+#include <linux/math64.h>
+#include <linux/seqlock.h>
int fprop_global_init(struct fprop_global *p, gfp_t gfp)
{
diff --git a/lib/group_cpus.c b/lib/group_cpus.c
index ee272c4cefcc..27e49db5cfa2 100644
--- a/lib/group_cpus.c
+++ b/lib/group_cpus.c
@@ -8,6 +8,7 @@
#include <linux/cpu.h>
#include <linux/sort.h>
#include <linux/group_cpus.h>
+#include <linux/topology.h> // for cpu_to_node()
#ifdef CONFIG_SMP
diff --git a/lib/kobject.c b/lib/kobject.c
index 59dbcbdb1c91..3375f5b92baf 100644
--- a/lib/kobject.c
+++ b/lib/kobject.c
@@ -18,6 +18,8 @@
#include <linux/stat.h>
#include <linux/slab.h>
#include <linux/random.h>
+#include <linux/uidgid.h>
+#include <linux/workqueue.h>
/**
* kobject_namespace() - Return @kobj's namespace tag.
diff --git a/lib/lockref.c b/lib/lockref.c
index 2afe4c5d8919..cf8795d78540 100644
--- a/lib/lockref.c
+++ b/lib/lockref.c
@@ -1,6 +1,8 @@
// SPDX-License-Identifier: GPL-2.0
#include <linux/export.h>
#include <linux/lockref.h>
+#include <linux/build_bug.h>
+#include <linux/spinlock.h>
#if USE_CMPXCHG_LOCKREF
diff --git a/lib/objpool.c b/lib/objpool.c
index cfdc02420884..bce25547f931 100644
--- a/lib/objpool.c
+++ b/lib/objpool.c
@@ -7,6 +7,8 @@
#include <linux/irqflags.h>
#include <linux/cpumask.h>
#include <linux/log2.h>
+#include <linux/refcount.h>
+#include <linux/topology.h>
/*
* objpool: ring-array based lockless MPMC/FIFO queues
diff --git a/lib/test_lockup.c b/lib/test_lockup.c
index c3fd87d6c2dd..3e41fc7174be 100644
--- a/lib/test_lockup.c
+++ b/lib/test_lockup.c
@@ -15,6 +15,7 @@
#include <linux/mm.h>
#include <linux/uaccess.h>
#include <linux/file.h>
+#include <linux/hrtimer.h>
static unsigned int time_secs;
module_param(time_secs, uint, 0600);
diff --git a/mm/damon/sysfs-common.c b/mm/damon/sysfs-common.c
index 70edf45c2174..9217de9eb813 100644
--- a/mm/damon/sysfs-common.c
+++ b/mm/damon/sysfs-common.c
@@ -6,6 +6,7 @@
*/
#include <linux/slab.h>
+#include <linux/sysfs.h>
#include "sysfs-common.h"
diff --git a/mm/damon/sysfs-schemes.c b/mm/damon/sysfs-schemes.c
index 8dbaac6e5c2d..17dfd8cf7a36 100644
--- a/mm/damon/sysfs-schemes.c
+++ b/mm/damon/sysfs-schemes.c
@@ -6,6 +6,7 @@
*/
#include <linux/slab.h>
+#include <linux/sysfs.h>
#include "sysfs-common.h"
diff --git a/mm/damon/sysfs.c b/mm/damon/sysfs.c
index 1f891e18b4ee..05962d593810 100644
--- a/mm/damon/sysfs.c
+++ b/mm/damon/sysfs.c
@@ -8,6 +8,7 @@
#include <linux/pid.h>
#include <linux/sched.h>
#include <linux/slab.h>
+#include <linux/sysfs.h>
#include "sysfs-common.h"
diff --git a/mm/folio-compat.c b/mm/folio-compat.c
index 50412014f16f..97bcd7ea5423 100644
--- a/mm/folio-compat.c
+++ b/mm/folio-compat.c
@@ -6,6 +6,7 @@
#include <linux/migrate.h>
#include <linux/pagemap.h>
+#include <linux/ratelimit.h>
#include <linux/rmap.h>
#include <linux/swap.h>
#include "internal.h"
diff --git a/mm/khugepaged.c b/mm/khugepaged.c
index fe43fbc44525..d61fcca99c02 100644
--- a/mm/khugepaged.c
+++ b/mm/khugepaged.c
@@ -2,6 +2,7 @@
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/mm.h>
+#include <linux/device.h>
#include <linux/sched.h>
#include <linux/sched/mm.h>
#include <linux/sched/coredump.h>
diff --git a/mm/ksm.c b/mm/ksm.c
index 8c001819cf10..0ba82b05dd3f 100644
--- a/mm/ksm.c
+++ b/mm/ksm.c
@@ -35,6 +35,8 @@
#include <linux/memory.h>
#include <linux/mmu_notifier.h>
#include <linux/swap.h>
+#include <linux/sysfs.h>
+#include <linux/kobject.h>
#include <linux/ksm.h>
#include <linux/hashtable.h>
#include <linux/freezer.h>
diff --git a/mm/memory-tiers.c b/mm/memory-tiers.c
index 5462d9e3c84c..58636ccd0494 100644
--- a/mm/memory-tiers.c
+++ b/mm/memory-tiers.c
@@ -6,6 +6,7 @@
#include <linux/memory.h>
#include <linux/memory-tiers.h>
#include <linux/notifier.h>
+#include <linux/device.h>
#include "internal.h"
diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
index a444e2d7dd2b..eb5098ea86c4 100644
--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -23,6 +23,7 @@
#include <linux/vmalloc.h>
#include <linux/ioport.h>
#include <linux/delay.h>
+#include <linux/device.h>
#include <linux/migrate.h>
#include <linux/page-isolation.h>
#include <linux/pfn.h>
diff --git a/mm/mempolicy.c b/mm/mempolicy.c
index d11dea7c5536..2bfa7f1dd9a3 100644
--- a/mm/mempolicy.c
+++ b/mm/mempolicy.c
@@ -97,6 +97,7 @@
#include <linux/compat.h>
#include <linux/ptrace.h>
#include <linux/swap.h>
+#include <linux/sysfs.h>
#include <linux/seq_file.h>
#include <linux/proc_fs.h>
#include <linux/migrate.h>
diff --git a/mm/workingset.c b/mm/workingset.c
index 226012974328..b1f6a8ad85ec 100644
--- a/mm/workingset.c
+++ b/mm/workingset.c
@@ -11,6 +11,7 @@
#include <linux/shmem_fs.h>
#include <linux/pagemap.h>
#include <linux/atomic.h>
+#include <linux/list_lru.h>
#include <linux/module.h>
#include <linux/swap.h>
#include <linux/dax.h>
diff --git a/net/can/j1939/bus.c b/net/can/j1939/bus.c
index 486687901602..da77a8940325 100644
--- a/net/can/j1939/bus.c
+++ b/net/can/j1939/bus.c
@@ -11,6 +11,8 @@
*/
#include <net/sock.h>
+#include <linux/hrtimer.h>
+#include <linux/kref.h>
#include "j1939-priv.h"
diff --git a/net/can/j1939/transport.c b/net/can/j1939/transport.c
index fe3df23a2595..fba7d1a0bd5c 100644
--- a/net/can/j1939/transport.c
+++ b/net/can/j1939/transport.c
@@ -9,6 +9,7 @@
// Oleksij Rempel <[email protected]>
#include <linux/can/skb.h>
+#include <linux/hrtimer.h>
#include "j1939-priv.h"
diff --git a/net/ceph/string_table.c b/net/ceph/string_table.c
index 3191d9d160a2..ebdd605bb940 100644
--- a/net/ceph/string_table.c
+++ b/net/ceph/string_table.c
@@ -4,6 +4,7 @@
#include <linux/string.h>
#include <linux/spinlock.h>
#include <linux/ceph/string_table.h>
+#include <linux/rbtree.h>
static DEFINE_SPINLOCK(string_tree_lock);
static struct rb_root string_tree = RB_ROOT;
diff --git a/net/sched/act_gate.c b/net/sched/act_gate.c
index c681cd011afd..08cf6001286a 100644
--- a/net/sched/act_gate.c
+++ b/net/sched/act_gate.c
@@ -10,6 +10,7 @@
#include <linux/rtnetlink.h>
#include <linux/init.h>
#include <linux/slab.h>
+#include <linux/hrtimer.h>
#include <net/act_api.h>
#include <net/netlink.h>
#include <net/pkt_cls.h>
diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c
index bda5327bf34d..209a82d8f1cc 100644
--- a/net/xfrm/xfrm_state.c
+++ b/net/xfrm/xfrm_state.c
@@ -27,6 +27,7 @@
#include <linux/slab.h>
#include <linux/interrupt.h>
#include <linux/kernel.h>
+#include <linux/hrtimer.h>
#include <crypto/aead.h>
diff --git a/samples/vfio-mdev/mtty.c b/samples/vfio-mdev/mtty.c
index 2284b3751240..c2c9b09b0cf9 100644
--- a/samples/vfio-mdev/mtty.c
+++ b/samples/vfio-mdev/mtty.c
@@ -20,6 +20,7 @@
#include <linux/sched.h>
#include <linux/wait.h>
#include <linux/vfio.h>
+#include <linux/idr.h>
#include <linux/iommu.h>
#include <linux/sysfs.h>
#include <linux/ctype.h>
diff --git a/security/integrity/ima/ima_mok.c b/security/integrity/ima/ima_mok.c
index 95cc31525c57..2d770de15b62 100644
--- a/security/integrity/ima/ima_mok.c
+++ b/security/integrity/ima/ima_mok.c
@@ -13,6 +13,7 @@
#include <linux/err.h>
#include <linux/init.h>
#include <linux/slab.h>
+#include <linux/uidgid.h>
#include <keys/system_keyring.h>
diff --git a/security/keys/proc.c b/security/keys/proc.c
index 4f4e2c1824f1..fc605b959656 100644
--- a/security/keys/proc.c
+++ b/security/keys/proc.c
@@ -10,6 +10,7 @@
#include <linux/fs.h>
#include <linux/proc_fs.h>
#include <linux/seq_file.h>
+#include <linux/timekeeping.h> // for ktime_get_real_seconds()
#include <asm/errno.h>
#include "internal.h"
diff --git a/sound/soc/intel/avs/avs.h b/sound/soc/intel/avs/avs.h
index d694e08e44e1..2bbe43eb4cdd 100644
--- a/sound/soc/intel/avs/avs.h
+++ b/sound/soc/intel/avs/avs.h
@@ -12,6 +12,7 @@
#include <linux/debugfs.h>
#include <linux/device.h>
#include <linux/firmware.h>
+#include <linux/idr.h>
#include <linux/kfifo.h>
#include <sound/hda_codec.h>
#include <sound/hda_register.h>
diff --git a/sound/soc/qcom/qdsp6/q6apm.h b/sound/soc/qcom/qdsp6/q6apm.h
index c248c8d2b1ab..5aa572a04a63 100644
--- a/sound/soc/qcom/qdsp6/q6apm.h
+++ b/sound/soc/qcom/qdsp6/q6apm.h
@@ -4,6 +4,7 @@
#include <linux/types.h>
#include <linux/slab.h>
#include <linux/wait.h>
+#include <linux/idr.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/sched.h>
diff --git a/sound/soc/sof/sof-audio.h b/sound/soc/sof/sof-audio.h
index 8874ee5f557f..436c95eee19c 100644
--- a/sound/soc/sof/sof-audio.h
+++ b/sound/soc/sof/sof-audio.h
@@ -11,6 +11,7 @@
#ifndef __SOUND_SOC_SOF_AUDIO_H
#define __SOUND_SOC_SOF_AUDIO_H
+#include <linux/idr.h>
#include <linux/workqueue.h>
#include <sound/soc.h>
--
2.39.2
By providing declarations in a lean header, we can reduce header
dependencies.
Signed-off-by: Max Kellermann <[email protected]>
---
include/linux/blkdev.h | 444 +------------------------------
include/linux/blkdev_types.h | 461 +++++++++++++++++++++++++++++++++
include/linux/cdrom.h | 2 +-
include/linux/io_uring_types.h | 2 +-
io_uring/io_uring.c | 1 +
5 files changed, 465 insertions(+), 445 deletions(-)
create mode 100644 include/linux/blkdev_types.h
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index bc108e5fcec0..c8b172c92004 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -5,11 +5,9 @@
#ifndef _LINUX_BLKDEV_H
#define _LINUX_BLKDEV_H
-#include <linux/types.h>
+#include <linux/blkdev_types.h>
#include <linux/fs.h> // for inode_unhashed()
#include <linux/blk_types.h>
-#include <linux/device_types.h>
-#include <linux/list.h>
#include <linux/minmax.h>
#include <linux/timer_types.h>
#include <linux/workqueue_types.h>
@@ -44,173 +42,6 @@ extern const struct device_type disk_type;
extern const struct device_type part_type;
extern struct class block_class;
-/*
- * Maximum number of blkcg policies allowed to be registered concurrently.
- * Defined here to simplify include dependency.
- */
-#define BLKCG_MAX_POLS 6
-
-#define DISK_MAX_PARTS 256
-#define DISK_NAME_LEN 32
-
-#define PARTITION_META_INFO_VOLNAMELTH 64
-/*
- * Enough for the string representation of any kind of UUID plus NULL.
- * EFI UUID is 36 characters. MSDOS UUID is 11 characters.
- */
-#define PARTITION_META_INFO_UUIDLTH (UUID_STRING_LEN + 1)
-
-struct partition_meta_info {
- char uuid[PARTITION_META_INFO_UUIDLTH];
- u8 volname[PARTITION_META_INFO_VOLNAMELTH];
-};
-
-/**
- * DOC: genhd capability flags
- *
- * ``GENHD_FL_REMOVABLE``: indicates that the block device gives access to
- * removable media. When set, the device remains present even when media is not
- * inserted. Shall not be set for devices which are removed entirely when the
- * media is removed.
- *
- * ``GENHD_FL_HIDDEN``: the block device is hidden; it doesn't produce events,
- * doesn't appear in sysfs, and can't be opened from userspace or using
- * blkdev_get*. Used for the underlying components of multipath devices.
- *
- * ``GENHD_FL_NO_PART``: partition support is disabled. The kernel will not
- * scan for partitions from add_disk, and users can't add partitions manually.
- *
- */
-enum {
- GENHD_FL_REMOVABLE = 1 << 0,
- GENHD_FL_HIDDEN = 1 << 1,
- GENHD_FL_NO_PART = 1 << 2,
-};
-
-enum {
- DISK_EVENT_MEDIA_CHANGE = 1 << 0, /* media changed */
- DISK_EVENT_EJECT_REQUEST = 1 << 1, /* eject requested */
-};
-
-enum {
- /* Poll even if events_poll_msecs is unset */
- DISK_EVENT_FLAG_POLL = 1 << 0,
- /* Forward events to udev */
- DISK_EVENT_FLAG_UEVENT = 1 << 1,
- /* Block event polling when open for exclusive write */
- DISK_EVENT_FLAG_BLOCK_ON_EXCL_WRITE = 1 << 2,
-};
-
-struct disk_events;
-struct badblocks;
-
-struct blk_integrity {
- const struct blk_integrity_profile *profile;
- unsigned char flags;
- unsigned char tuple_size;
- unsigned char interval_exp;
- unsigned char tag_size;
-};
-
-typedef unsigned int __bitwise blk_mode_t;
-
-/* open for reading */
-#define BLK_OPEN_READ ((__force blk_mode_t)(1 << 0))
-/* open for writing */
-#define BLK_OPEN_WRITE ((__force blk_mode_t)(1 << 1))
-/* open exclusively (vs other exclusive openers */
-#define BLK_OPEN_EXCL ((__force blk_mode_t)(1 << 2))
-/* opened with O_NDELAY */
-#define BLK_OPEN_NDELAY ((__force blk_mode_t)(1 << 3))
-/* open for "writes" only for ioctls (specialy hack for floppy.c) */
-#define BLK_OPEN_WRITE_IOCTL ((__force blk_mode_t)(1 << 4))
-/* open is exclusive wrt all other BLK_OPEN_WRITE opens to the device */
-#define BLK_OPEN_RESTRICT_WRITES ((__force blk_mode_t)(1 << 5))
-
-struct gendisk {
- /*
- * major/first_minor/minors should not be set by any new driver, the
- * block core will take care of allocating them automatically.
- */
- int major;
- int first_minor;
- int minors;
-
- char disk_name[DISK_NAME_LEN]; /* name of major driver */
-
- unsigned short events; /* supported events */
- unsigned short event_flags; /* flags related to event processing */
-
- struct xarray part_tbl;
- struct block_device *part0;
-
- const struct block_device_operations *fops;
- struct request_queue *queue;
- void *private_data;
-
- struct bio_set bio_split;
-
- int flags;
- unsigned long state;
-#define GD_NEED_PART_SCAN 0
-#define GD_READ_ONLY 1
-#define GD_DEAD 2
-#define GD_NATIVE_CAPACITY 3
-#define GD_ADDED 4
-#define GD_SUPPRESS_PART_SCAN 5
-#define GD_OWNS_QUEUE 6
-
- struct mutex open_mutex; /* open/close mutex */
- unsigned open_partitions; /* number of open partitions */
-
- struct backing_dev_info *bdi;
- struct kobject queue_kobj; /* the queue/ directory */
- struct kobject *slave_dir;
-#ifdef CONFIG_BLOCK_HOLDER_DEPRECATED
- struct list_head slave_bdevs;
-#endif
- struct timer_rand_state *random;
- atomic_t sync_io; /* RAID */
- struct disk_events *ev;
-
-#ifdef CONFIG_BLK_DEV_ZONED
- /*
- * Zoned block device information for request dispatch control.
- * nr_zones is the total number of zones of the device. This is always
- * 0 for regular block devices. conv_zones_bitmap is a bitmap of nr_zones
- * bits which indicates if a zone is conventional (bit set) or
- * sequential (bit clear). seq_zones_wlock is a bitmap of nr_zones
- * bits which indicates if a zone is write locked, that is, if a write
- * request targeting the zone was dispatched.
- *
- * Reads of this information must be protected with blk_queue_enter() /
- * blk_queue_exit(). Modifying this information is only allowed while
- * no requests are being processed. See also blk_mq_freeze_queue() and
- * blk_mq_unfreeze_queue().
- */
- unsigned int nr_zones;
- unsigned int max_open_zones;
- unsigned int max_active_zones;
- unsigned long *conv_zones_bitmap;
- unsigned long *seq_zones_wlock;
-#endif /* CONFIG_BLK_DEV_ZONED */
-
-#if IS_ENABLED(CONFIG_CDROM)
- struct cdrom_device_info *cdi;
-#endif
- int node_id;
- struct badblocks *bb;
- struct lockdep_map lockdep_map;
- u64 diskseq;
- blk_mode_t open_mode;
-
- /*
- * Independent sector access ranges. This is always NULL for
- * devices that do not have multiple independent access ranges.
- */
- struct blk_independent_access_ranges *ia_ranges;
-};
-
static inline bool disk_live(struct gendisk *disk)
{
return !inode_unhashed(disk->part0->bd_inode);
@@ -259,57 +90,6 @@ static inline int blk_validate_block_size(unsigned long bsize)
return 0;
}
-/*
- * BLK_BOUNCE_NONE: never bounce (default)
- * BLK_BOUNCE_HIGH: bounce all highmem pages
- */
-enum blk_bounce {
- BLK_BOUNCE_NONE,
- BLK_BOUNCE_HIGH,
-};
-
-struct queue_limits {
- enum blk_bounce bounce;
- unsigned long seg_boundary_mask;
- unsigned long virt_boundary_mask;
-
- unsigned int max_hw_sectors;
- unsigned int max_dev_sectors;
- unsigned int chunk_sectors;
- unsigned int max_sectors;
- unsigned int max_user_sectors;
- unsigned int max_segment_size;
- unsigned int physical_block_size;
- unsigned int logical_block_size;
- unsigned int alignment_offset;
- unsigned int io_min;
- unsigned int io_opt;
- unsigned int max_discard_sectors;
- unsigned int max_hw_discard_sectors;
- unsigned int max_secure_erase_sectors;
- unsigned int max_write_zeroes_sectors;
- unsigned int max_zone_append_sectors;
- unsigned int discard_granularity;
- unsigned int discard_alignment;
- unsigned int zone_write_granularity;
-
- unsigned short max_segments;
- unsigned short max_integrity_segments;
- unsigned short max_discard_segments;
-
- unsigned char misaligned;
- unsigned char discard_misaligned;
- unsigned char raid_partial_stripes_expensive;
- bool zoned;
-
- /*
- * Drivers that set dma_alignment to less than 511 must be prepared to
- * handle individual bvec's that are not a multiple of a SECTOR_SIZE
- * due to possible offsets.
- */
- unsigned int dma_alignment;
-};
-
typedef int (*report_zones_cb)(struct blk_zone *zone, unsigned int idx,
void *data);
@@ -350,194 +130,6 @@ struct blk_independent_access_ranges {
struct blk_independent_access_range ia_range[];
};
-struct request_queue {
- /*
- * The queue owner gets to use this for whatever they like.
- * ll_rw_blk doesn't touch it.
- */
- void *queuedata;
-
- struct elevator_queue *elevator;
-
- const struct blk_mq_ops *mq_ops;
-
- /* sw queues */
- struct blk_mq_ctx __percpu *queue_ctx;
-
- /*
- * various queue flags, see QUEUE_* below
- */
- unsigned long queue_flags;
-
- unsigned int rq_timeout;
-
- unsigned int queue_depth;
-
- refcount_t refs;
-
- /* hw dispatch queues */
- unsigned int nr_hw_queues;
- struct xarray hctx_table;
-
- struct percpu_ref q_usage_counter;
-
- struct request *last_merge;
-
- spinlock_t queue_lock;
-
- int quiesce_depth;
-
- struct gendisk *disk;
-
- /*
- * mq queue kobject
- */
- struct kobject *mq_kobj;
-
- struct queue_limits limits;
-
-#ifdef CONFIG_BLK_DEV_INTEGRITY
- struct blk_integrity integrity;
-#endif /* CONFIG_BLK_DEV_INTEGRITY */
-
-#ifdef CONFIG_PM
- struct device *dev;
- enum rpm_status rpm_status;
-#endif
-
- /*
- * Number of contexts that have called blk_set_pm_only(). If this
- * counter is above zero then only RQF_PM requests are processed.
- */
- atomic_t pm_only;
-
- struct blk_queue_stats *stats;
- struct rq_qos *rq_qos;
- struct mutex rq_qos_mutex;
-
- /*
- * ida allocated id for this queue. Used to index queues from
- * ioctx.
- */
- int id;
-
- unsigned int dma_pad_mask;
-
- /*
- * queue settings
- */
- unsigned long nr_requests; /* Max # of requests */
-
-#ifdef CONFIG_BLK_INLINE_ENCRYPTION
- struct blk_crypto_profile *crypto_profile;
- struct kobject *crypto_kobject;
-#endif
-
- struct timer_list timeout;
- struct work_struct timeout_work;
-
- atomic_t nr_active_requests_shared_tags;
-
- unsigned int required_elevator_features;
-
- struct blk_mq_tags *sched_shared_tags;
-
- struct list_head icq_list;
-#ifdef CONFIG_BLK_CGROUP
- DECLARE_BITMAP (blkcg_pols, BLKCG_MAX_POLS);
- struct blkcg_gq *root_blkg;
- struct list_head blkg_list;
- struct mutex blkcg_mutex;
-#endif
-
- int node;
-
- spinlock_t requeue_lock;
- struct list_head requeue_list;
- struct delayed_work requeue_work;
-
-#ifdef CONFIG_BLK_DEV_IO_TRACE
- struct blk_trace __rcu *blk_trace;
-#endif
- /*
- * for flush operations
- */
- struct blk_flush_queue *fq;
- struct list_head flush_list;
-
- struct mutex sysfs_lock;
- struct mutex sysfs_dir_lock;
-
- /*
- * for reusing dead hctx instance in case of updating
- * nr_hw_queues
- */
- struct list_head unused_hctx_list;
- spinlock_t unused_hctx_lock;
-
- int mq_freeze_depth;
-
-#ifdef CONFIG_BLK_DEV_THROTTLING
- /* Throttle data */
- struct throtl_data *td;
-#endif
- struct rcu_head rcu_head;
- wait_queue_head_t mq_freeze_wq;
- /*
- * Protect concurrent access to q_usage_counter by
- * percpu_ref_kill() and percpu_ref_reinit().
- */
- struct mutex mq_freeze_lock;
-
- struct blk_mq_tag_set *tag_set;
- struct list_head tag_set_list;
-
- struct dentry *debugfs_dir;
- struct dentry *sched_debugfs_dir;
- struct dentry *rqos_debugfs_dir;
- /*
- * Serializes all debugfs metadata operations using the above dentries.
- */
- struct mutex debugfs_mutex;
-
- bool mq_sysfs_init_done;
-};
-
-/* Keep blk_queue_flag_name[] in sync with the definitions below */
-#define QUEUE_FLAG_STOPPED 0 /* queue is stopped */
-#define QUEUE_FLAG_DYING 1 /* queue being torn down */
-#define QUEUE_FLAG_NOMERGES 3 /* disable merge attempts */
-#define QUEUE_FLAG_SAME_COMP 4 /* complete on same CPU-group */
-#define QUEUE_FLAG_FAIL_IO 5 /* fake timeout */
-#define QUEUE_FLAG_NONROT 6 /* non-rotational device (SSD) */
-#define QUEUE_FLAG_VIRT QUEUE_FLAG_NONROT /* paravirt device */
-#define QUEUE_FLAG_IO_STAT 7 /* do disk/partitions IO accounting */
-#define QUEUE_FLAG_NOXMERGES 9 /* No extended merges */
-#define QUEUE_FLAG_ADD_RANDOM 10 /* Contributes to random pool */
-#define QUEUE_FLAG_SYNCHRONOUS 11 /* always completes in submit context */
-#define QUEUE_FLAG_SAME_FORCE 12 /* force complete on same CPU */
-#define QUEUE_FLAG_HW_WC 13 /* Write back caching supported */
-#define QUEUE_FLAG_INIT_DONE 14 /* queue is initialized */
-#define QUEUE_FLAG_STABLE_WRITES 15 /* don't modify blks until WB is done */
-#define QUEUE_FLAG_POLL 16 /* IO polling enabled if set */
-#define QUEUE_FLAG_WC 17 /* Write back caching */
-#define QUEUE_FLAG_FUA 18 /* device supports FUA writes */
-#define QUEUE_FLAG_DAX 19 /* device supports DAX */
-#define QUEUE_FLAG_STATS 20 /* track IO start and completion times */
-#define QUEUE_FLAG_REGISTERED 22 /* queue has been registered to a disk */
-#define QUEUE_FLAG_QUIESCED 24 /* queue has been quiesced */
-#define QUEUE_FLAG_PCI_P2PDMA 25 /* device supports PCI p2p requests */
-#define QUEUE_FLAG_ZONE_RESETALL 26 /* supports Zone Reset All */
-#define QUEUE_FLAG_RQ_ALLOC_TIME 27 /* record rq->alloc_time_ns */
-#define QUEUE_FLAG_HCTX_ACTIVE 28 /* at least one blk-mq hctx is active */
-#define QUEUE_FLAG_NOWAIT 29 /* device supports NOWAIT */
-#define QUEUE_FLAG_SQ_SCHED 30 /* single queue style io dispatch */
-#define QUEUE_FLAG_SKIP_TAGSET_QUIESCE 31 /* quiesce_tagset skip the queue*/
-
-#define QUEUE_FLAG_MQ_DEFAULT ((1UL << QUEUE_FLAG_IO_STAT) | \
- (1UL << QUEUE_FLAG_SAME_COMP) | \
- (1UL << QUEUE_FLAG_NOWAIT))
-
void blk_queue_flag_set(unsigned int flag, struct request_queue *q);
void blk_queue_flag_clear(unsigned int flag, struct request_queue *q);
bool blk_queue_flag_test_and_set(unsigned int flag, struct request_queue *q);
@@ -920,32 +512,6 @@ extern void blk_put_queue(struct request_queue *);
void blk_mark_disk_dead(struct gendisk *disk);
#ifdef CONFIG_BLOCK
-/*
- * blk_plug permits building a queue of related requests by holding the I/O
- * fragments for a short period. This allows merging of sequential requests
- * into single larger request. As the requests are moved from a per-task list to
- * the device's request_queue in a batch, this results in improved scalability
- * as the lock contention for request_queue lock is reduced.
- *
- * It is ok not to disable preemption when adding the request to the plug list
- * or when attempting a merge. For details, please see schedule() where
- * blk_flush_plug() is called.
- */
-struct blk_plug {
- struct request *mq_list; /* blk-mq requests */
-
- /* if ios_left is > 1, we can batch tag/rq allocations */
- struct request *cached_rq;
- u64 cur_ktime;
- unsigned short nr_ios;
-
- unsigned short rq_count;
-
- bool multiple_queues;
- bool has_elevator;
-
- struct list_head cb_list; /* md requires an unplug callback */
-};
struct blk_plug_cb;
typedef void (*blk_plug_cb_fn)(struct blk_plug_cb *, bool);
@@ -982,8 +548,6 @@ static inline void blk_plug_invalidate_ts(struct task_struct *tsk)
int blkdev_issue_flush(struct block_device *bdev);
long nr_blockdev_pages(void);
#else /* CONFIG_BLOCK */
-struct blk_plug {
-};
static inline void blk_start_plug_nr_ios(struct blk_plug *plug,
unsigned short nr_ios)
@@ -1545,12 +1109,6 @@ static inline int early_lookup_bdev(const char *pathname, dev_t *dev)
int bdev_freeze(struct block_device *bdev);
int bdev_thaw(struct block_device *bdev);
-struct io_comp_batch {
- struct request *req_list;
- bool need_ts;
- void (*complete)(struct io_comp_batch *);
-};
-
#define DEFINE_IO_COMP_BATCH(name) struct io_comp_batch name = { }
#endif /* _LINUX_BLKDEV_H */
diff --git a/include/linux/blkdev_types.h b/include/linux/blkdev_types.h
new file mode 100644
index 000000000000..35a1dcf98bf6
--- /dev/null
+++ b/include/linux/blkdev_types.h
@@ -0,0 +1,461 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef _LINUX_BLKDEV_TYPES_H
+#define _LINUX_BLKDEV_TYPES_H
+
+#include <linux/bio_types.h>
+#include <linux/list.h>
+#include <linux/kobject_types.h>
+#include <linux/percpu-refcount_types.h>
+#include <linux/pm.h>
+#include <linux/uuid.h>
+#include <linux/xarray_types.h>
+
+/*
+ * Maximum number of blkcg policies allowed to be registered concurrently.
+ * Defined here to simplify include dependency.
+ */
+#define BLKCG_MAX_POLS 6
+
+#define DISK_MAX_PARTS 256
+#define DISK_NAME_LEN 32
+
+#define PARTITION_META_INFO_VOLNAMELTH 64
+/*
+ * Enough for the string representation of any kind of UUID plus NULL.
+ * EFI UUID is 36 characters. MSDOS UUID is 11 characters.
+ */
+#define PARTITION_META_INFO_UUIDLTH (UUID_STRING_LEN + 1)
+
+struct partition_meta_info {
+ char uuid[PARTITION_META_INFO_UUIDLTH];
+ u8 volname[PARTITION_META_INFO_VOLNAMELTH];
+};
+
+/**
+ * DOC: genhd capability flags
+ *
+ * ``GENHD_FL_REMOVABLE``: indicates that the block device gives access to
+ * removable media. When set, the device remains present even when media is not
+ * inserted. Shall not be set for devices which are removed entirely when the
+ * media is removed.
+ *
+ * ``GENHD_FL_HIDDEN``: the block device is hidden; it doesn't produce events,
+ * doesn't appear in sysfs, and can't be opened from userspace or using
+ * blkdev_get*. Used for the underlying components of multipath devices.
+ *
+ * ``GENHD_FL_NO_PART``: partition support is disabled. The kernel will not
+ * scan for partitions from add_disk, and users can't add partitions manually.
+ *
+ */
+enum {
+ GENHD_FL_REMOVABLE = 1 << 0,
+ GENHD_FL_HIDDEN = 1 << 1,
+ GENHD_FL_NO_PART = 1 << 2,
+};
+
+enum {
+ DISK_EVENT_MEDIA_CHANGE = 1 << 0, /* media changed */
+ DISK_EVENT_EJECT_REQUEST = 1 << 1, /* eject requested */
+};
+
+enum {
+ /* Poll even if events_poll_msecs is unset */
+ DISK_EVENT_FLAG_POLL = 1 << 0,
+ /* Forward events to udev */
+ DISK_EVENT_FLAG_UEVENT = 1 << 1,
+ /* Block event polling when open for exclusive write */
+ DISK_EVENT_FLAG_BLOCK_ON_EXCL_WRITE = 1 << 2,
+};
+
+struct disk_events;
+struct badblocks;
+
+struct blk_integrity {
+ const struct blk_integrity_profile *profile;
+ unsigned char flags;
+ unsigned char tuple_size;
+ unsigned char interval_exp;
+ unsigned char tag_size;
+};
+
+typedef unsigned int __bitwise blk_mode_t;
+
+/* open for reading */
+#define BLK_OPEN_READ ((__force blk_mode_t)(1 << 0))
+/* open for writing */
+#define BLK_OPEN_WRITE ((__force blk_mode_t)(1 << 1))
+/* open exclusively (vs other exclusive openers */
+#define BLK_OPEN_EXCL ((__force blk_mode_t)(1 << 2))
+/* opened with O_NDELAY */
+#define BLK_OPEN_NDELAY ((__force blk_mode_t)(1 << 3))
+/* open for "writes" only for ioctls (specialy hack for floppy.c) */
+#define BLK_OPEN_WRITE_IOCTL ((__force blk_mode_t)(1 << 4))
+/* open is exclusive wrt all other BLK_OPEN_WRITE opens to the device */
+#define BLK_OPEN_RESTRICT_WRITES ((__force blk_mode_t)(1 << 5))
+
+struct gendisk {
+ /*
+ * major/first_minor/minors should not be set by any new driver, the
+ * block core will take care of allocating them automatically.
+ */
+ int major;
+ int first_minor;
+ int minors;
+
+ char disk_name[DISK_NAME_LEN]; /* name of major driver */
+
+ unsigned short events; /* supported events */
+ unsigned short event_flags; /* flags related to event processing */
+
+ struct xarray part_tbl;
+ struct block_device *part0;
+
+ const struct block_device_operations *fops;
+ struct request_queue *queue;
+ void *private_data;
+
+ struct bio_set bio_split;
+
+ int flags;
+ unsigned long state;
+#define GD_NEED_PART_SCAN 0
+#define GD_READ_ONLY 1
+#define GD_DEAD 2
+#define GD_NATIVE_CAPACITY 3
+#define GD_ADDED 4
+#define GD_SUPPRESS_PART_SCAN 5
+#define GD_OWNS_QUEUE 6
+
+ struct mutex open_mutex; /* open/close mutex */
+ unsigned open_partitions; /* number of open partitions */
+
+ struct backing_dev_info *bdi;
+ struct kobject queue_kobj; /* the queue/ directory */
+ struct kobject *slave_dir;
+#ifdef CONFIG_BLOCK_HOLDER_DEPRECATED
+ struct list_head slave_bdevs;
+#endif
+ struct timer_rand_state *random;
+ atomic_t sync_io; /* RAID */
+ struct disk_events *ev;
+
+#ifdef CONFIG_BLK_DEV_ZONED
+ /*
+ * Zoned block device information for request dispatch control.
+ * nr_zones is the total number of zones of the device. This is always
+ * 0 for regular block devices. conv_zones_bitmap is a bitmap of nr_zones
+ * bits which indicates if a zone is conventional (bit set) or
+ * sequential (bit clear). seq_zones_wlock is a bitmap of nr_zones
+ * bits which indicates if a zone is write locked, that is, if a write
+ * request targeting the zone was dispatched.
+ *
+ * Reads of this information must be protected with blk_queue_enter() /
+ * blk_queue_exit(). Modifying this information is only allowed while
+ * no requests are being processed. See also blk_mq_freeze_queue() and
+ * blk_mq_unfreeze_queue().
+ */
+ unsigned int nr_zones;
+ unsigned int max_open_zones;
+ unsigned int max_active_zones;
+ unsigned long *conv_zones_bitmap;
+ unsigned long *seq_zones_wlock;
+#endif /* CONFIG_BLK_DEV_ZONED */
+
+#if IS_ENABLED(CONFIG_CDROM)
+ struct cdrom_device_info *cdi;
+#endif
+ int node_id;
+ struct badblocks *bb;
+ struct lockdep_map lockdep_map;
+ u64 diskseq;
+ blk_mode_t open_mode;
+
+ /*
+ * Independent sector access ranges. This is always NULL for
+ * devices that do not have multiple independent access ranges.
+ */
+ struct blk_independent_access_ranges *ia_ranges;
+};
+
+/*
+ * BLK_BOUNCE_NONE: never bounce (default)
+ * BLK_BOUNCE_HIGH: bounce all highmem pages
+ */
+enum blk_bounce {
+ BLK_BOUNCE_NONE,
+ BLK_BOUNCE_HIGH,
+};
+
+struct queue_limits {
+ enum blk_bounce bounce;
+ unsigned long seg_boundary_mask;
+ unsigned long virt_boundary_mask;
+
+ unsigned int max_hw_sectors;
+ unsigned int max_dev_sectors;
+ unsigned int chunk_sectors;
+ unsigned int max_sectors;
+ unsigned int max_user_sectors;
+ unsigned int max_segment_size;
+ unsigned int physical_block_size;
+ unsigned int logical_block_size;
+ unsigned int alignment_offset;
+ unsigned int io_min;
+ unsigned int io_opt;
+ unsigned int max_discard_sectors;
+ unsigned int max_hw_discard_sectors;
+ unsigned int max_secure_erase_sectors;
+ unsigned int max_write_zeroes_sectors;
+ unsigned int max_zone_append_sectors;
+ unsigned int discard_granularity;
+ unsigned int discard_alignment;
+ unsigned int zone_write_granularity;
+
+ unsigned short max_segments;
+ unsigned short max_integrity_segments;
+ unsigned short max_discard_segments;
+
+ unsigned char misaligned;
+ unsigned char discard_misaligned;
+ unsigned char raid_partial_stripes_expensive;
+ bool zoned;
+
+ /*
+ * Drivers that set dma_alignment to less than 511 must be prepared to
+ * handle individual bvec's that are not a multiple of a SECTOR_SIZE
+ * due to possible offsets.
+ */
+ unsigned int dma_alignment;
+};
+
+struct request_queue {
+ /*
+ * The queue owner gets to use this for whatever they like.
+ * ll_rw_blk doesn't touch it.
+ */
+ void *queuedata;
+
+ struct elevator_queue *elevator;
+
+ const struct blk_mq_ops *mq_ops;
+
+ /* sw queues */
+ struct blk_mq_ctx __percpu *queue_ctx;
+
+ /*
+ * various queue flags, see QUEUE_* below
+ */
+ unsigned long queue_flags;
+
+ unsigned int rq_timeout;
+
+ unsigned int queue_depth;
+
+ refcount_t refs;
+
+ /* hw dispatch queues */
+ unsigned int nr_hw_queues;
+ struct xarray hctx_table;
+
+ struct percpu_ref q_usage_counter;
+
+ struct request *last_merge;
+
+ spinlock_t queue_lock;
+
+ int quiesce_depth;
+
+ struct gendisk *disk;
+
+ /*
+ * mq queue kobject
+ */
+ struct kobject *mq_kobj;
+
+ struct queue_limits limits;
+
+#ifdef CONFIG_BLK_DEV_INTEGRITY
+ struct blk_integrity integrity;
+#endif /* CONFIG_BLK_DEV_INTEGRITY */
+
+#ifdef CONFIG_PM
+ struct device *dev;
+ enum rpm_status rpm_status;
+#endif
+
+ /*
+ * Number of contexts that have called blk_set_pm_only(). If this
+ * counter is above zero then only RQF_PM requests are processed.
+ */
+ atomic_t pm_only;
+
+ struct blk_queue_stats *stats;
+ struct rq_qos *rq_qos;
+ struct mutex rq_qos_mutex;
+
+ /*
+ * ida allocated id for this queue. Used to index queues from
+ * ioctx.
+ */
+ int id;
+
+ unsigned int dma_pad_mask;
+
+ /*
+ * queue settings
+ */
+ unsigned long nr_requests; /* Max # of requests */
+
+#ifdef CONFIG_BLK_INLINE_ENCRYPTION
+ struct blk_crypto_profile *crypto_profile;
+ struct kobject *crypto_kobject;
+#endif
+
+ struct timer_list timeout;
+ struct work_struct timeout_work;
+
+ atomic_t nr_active_requests_shared_tags;
+
+ unsigned int required_elevator_features;
+
+ struct blk_mq_tags *sched_shared_tags;
+
+ struct list_head icq_list;
+#ifdef CONFIG_BLK_CGROUP
+ DECLARE_BITMAP (blkcg_pols, BLKCG_MAX_POLS);
+ struct blkcg_gq *root_blkg;
+ struct list_head blkg_list;
+ struct mutex blkcg_mutex;
+#endif
+
+ int node;
+
+ spinlock_t requeue_lock;
+ struct list_head requeue_list;
+ struct delayed_work requeue_work;
+
+#ifdef CONFIG_BLK_DEV_IO_TRACE
+ struct blk_trace __rcu *blk_trace;
+#endif
+ /*
+ * for flush operations
+ */
+ struct blk_flush_queue *fq;
+ struct list_head flush_list;
+
+ struct mutex sysfs_lock;
+ struct mutex sysfs_dir_lock;
+
+ /*
+ * for reusing dead hctx instance in case of updating
+ * nr_hw_queues
+ */
+ struct list_head unused_hctx_list;
+ spinlock_t unused_hctx_lock;
+
+ int mq_freeze_depth;
+
+#ifdef CONFIG_BLK_DEV_THROTTLING
+ /* Throttle data */
+ struct throtl_data *td;
+#endif
+ struct rcu_head rcu_head;
+ wait_queue_head_t mq_freeze_wq;
+ /*
+ * Protect concurrent access to q_usage_counter by
+ * percpu_ref_kill() and percpu_ref_reinit().
+ */
+ struct mutex mq_freeze_lock;
+
+ struct blk_mq_tag_set *tag_set;
+ struct list_head tag_set_list;
+
+ struct dentry *debugfs_dir;
+ struct dentry *sched_debugfs_dir;
+ struct dentry *rqos_debugfs_dir;
+ /*
+ * Serializes all debugfs metadata operations using the above dentries.
+ */
+ struct mutex debugfs_mutex;
+
+ bool mq_sysfs_init_done;
+};
+
+/* Keep blk_queue_flag_name[] in sync with the definitions below */
+#define QUEUE_FLAG_STOPPED 0 /* queue is stopped */
+#define QUEUE_FLAG_DYING 1 /* queue being torn down */
+#define QUEUE_FLAG_NOMERGES 3 /* disable merge attempts */
+#define QUEUE_FLAG_SAME_COMP 4 /* complete on same CPU-group */
+#define QUEUE_FLAG_FAIL_IO 5 /* fake timeout */
+#define QUEUE_FLAG_NONROT 6 /* non-rotational device (SSD) */
+#define QUEUE_FLAG_VIRT QUEUE_FLAG_NONROT /* paravirt device */
+#define QUEUE_FLAG_IO_STAT 7 /* do disk/partitions IO accounting */
+#define QUEUE_FLAG_NOXMERGES 9 /* No extended merges */
+#define QUEUE_FLAG_ADD_RANDOM 10 /* Contributes to random pool */
+#define QUEUE_FLAG_SYNCHRONOUS 11 /* always completes in submit context */
+#define QUEUE_FLAG_SAME_FORCE 12 /* force complete on same CPU */
+#define QUEUE_FLAG_HW_WC 13 /* Write back caching supported */
+#define QUEUE_FLAG_INIT_DONE 14 /* queue is initialized */
+#define QUEUE_FLAG_STABLE_WRITES 15 /* don't modify blks until WB is done */
+#define QUEUE_FLAG_POLL 16 /* IO polling enabled if set */
+#define QUEUE_FLAG_WC 17 /* Write back caching */
+#define QUEUE_FLAG_FUA 18 /* device supports FUA writes */
+#define QUEUE_FLAG_DAX 19 /* device supports DAX */
+#define QUEUE_FLAG_STATS 20 /* track IO start and completion times */
+#define QUEUE_FLAG_REGISTERED 22 /* queue has been registered to a disk */
+#define QUEUE_FLAG_QUIESCED 24 /* queue has been quiesced */
+#define QUEUE_FLAG_PCI_P2PDMA 25 /* device supports PCI p2p requests */
+#define QUEUE_FLAG_ZONE_RESETALL 26 /* supports Zone Reset All */
+#define QUEUE_FLAG_RQ_ALLOC_TIME 27 /* record rq->alloc_time_ns */
+#define QUEUE_FLAG_HCTX_ACTIVE 28 /* at least one blk-mq hctx is active */
+#define QUEUE_FLAG_NOWAIT 29 /* device supports NOWAIT */
+#define QUEUE_FLAG_SQ_SCHED 30 /* single queue style io dispatch */
+#define QUEUE_FLAG_SKIP_TAGSET_QUIESCE 31 /* quiesce_tagset skip the queue*/
+
+#define QUEUE_FLAG_MQ_DEFAULT ((1UL << QUEUE_FLAG_IO_STAT) | \
+ (1UL << QUEUE_FLAG_SAME_COMP) | \
+ (1UL << QUEUE_FLAG_NOWAIT))
+
+#ifdef CONFIG_BLOCK
+
+/*
+ * blk_plug permits building a queue of related requests by holding the I/O
+ * fragments for a short period. This allows merging of sequential requests
+ * into single larger request. As the requests are moved from a per-task list to
+ * the device's request_queue in a batch, this results in improved scalability
+ * as the lock contention for request_queue lock is reduced.
+ *
+ * It is ok not to disable preemption when adding the request to the plug list
+ * or when attempting a merge. For details, please see schedule() where
+ * blk_flush_plug() is called.
+ */
+struct blk_plug {
+ struct request *mq_list; /* blk-mq requests */
+
+ /* if ios_left is > 1, we can batch tag/rq allocations */
+ struct request *cached_rq;
+ u64 cur_ktime;
+ unsigned short nr_ios;
+
+ unsigned short rq_count;
+
+ bool multiple_queues;
+ bool has_elevator;
+
+ struct list_head cb_list; /* md requires an unplug callback */
+};
+
+#else /* CONFIG_BLOCK */
+
+struct blk_plug {
+};
+
+#endif /* CONFIG_BLOCK */
+
+struct io_comp_batch {
+ struct request *req_list;
+ bool need_ts;
+ void (*complete)(struct io_comp_batch *);
+};
+
+#endif /* _LINUX_BLKDEV_TYPES_H */
diff --git a/include/linux/cdrom.h b/include/linux/cdrom.h
index 98c6fd0b39b6..d99709e14ecb 100644
--- a/include/linux/cdrom.h
+++ b/include/linux/cdrom.h
@@ -13,7 +13,7 @@
#include <linux/fs.h> /* not really needed, later.. */
#include <linux/list.h>
-#include <linux/blkdev.h>
+#include <linux/blkdev_types.h>
#include <scsi/scsi_common.h>
#include <uapi/linux/cdrom.h>
diff --git a/include/linux/io_uring_types.h b/include/linux/io_uring_types.h
index 854ad67a5f70..fd9e5bafdf85 100644
--- a/include/linux/io_uring_types.h
+++ b/include/linux/io_uring_types.h
@@ -1,7 +1,7 @@
#ifndef IO_URING_TYPES_H
#define IO_URING_TYPES_H
-#include <linux/blkdev.h>
+#include <linux/blkdev_types.h>
#include <linux/task_work.h>
#include <linux/bitmap.h>
#include <linux/llist.h>
diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c
index 49db7fa2cebd..264c295b503c 100644
--- a/io_uring/io_uring.c
+++ b/io_uring/io_uring.c
@@ -47,6 +47,7 @@
#include <linux/refcount.h>
#include <linux/uio.h>
#include <linux/bits.h>
+#include <linux/blkdev.h>
#include <linux/sched/signal.h>
#include <linux/fs.h>
--
2.39.2
By providing declarations in a lean header, we can reduce header
dependencies.
Signed-off-by: Max Kellermann <[email protected]>
---
fs/gfs2/incore.h | 1 +
fs/xfs/xfs_qm.h | 1 +
fs/xfs/xfs_qm_syscalls.c | 2 ++
fs/xfs/xfs_quotaops.c | 1 +
fs/xfs/xfs_super.c | 1 +
fs/xfs/xfs_trans_dquot.c | 2 ++
include/linux/fs.h | 2 +-
include/linux/quota.h | 33 +-----------------
include/linux/quota_types.h | 68 +++++++++++++++++++++++++++++++++++++
9 files changed, 78 insertions(+), 33 deletions(-)
create mode 100644 include/linux/quota_types.h
diff --git a/fs/gfs2/incore.h b/fs/gfs2/incore.h
index e1343fd0a5b1..3cf177dd201c 100644
--- a/fs/gfs2/incore.h
+++ b/fs/gfs2/incore.h
@@ -18,6 +18,7 @@
#include <linux/rbtree.h>
#include <linux/ktime.h>
#include <linux/percpu.h>
+#include <linux/quota.h>
#include <linux/lockref.h>
#include <linux/rhashtable.h>
#include <linux/mutex.h>
diff --git a/fs/xfs/xfs_qm.h b/fs/xfs/xfs_qm.h
index d5c9fc4ba591..bb111cbc3567 100644
--- a/fs/xfs/xfs_qm.h
+++ b/fs/xfs/xfs_qm.h
@@ -9,6 +9,7 @@
#include "xfs_dquot_item.h"
#include "xfs_dquot.h"
+struct qc_dqblk;
struct xfs_inode;
extern struct kmem_cache *xfs_dqtrx_cache;
diff --git a/fs/xfs/xfs_qm_syscalls.c b/fs/xfs/xfs_qm_syscalls.c
index 392cb39cc10c..1de4443bed40 100644
--- a/fs/xfs/xfs_qm_syscalls.c
+++ b/fs/xfs/xfs_qm_syscalls.c
@@ -19,6 +19,8 @@
#include "xfs_qm.h"
#include "xfs_icache.h"
+#include <linux/quota.h>
+
int
xfs_qm_scall_quotaoff(
xfs_mount_t *mp,
diff --git a/fs/xfs/xfs_quotaops.c b/fs/xfs/xfs_quotaops.c
index 9c162e69976b..eda56d032734 100644
--- a/fs/xfs/xfs_quotaops.c
+++ b/fs/xfs/xfs_quotaops.c
@@ -15,6 +15,7 @@
#include "xfs_icache.h"
#include "xfs_qm.h"
+#include <linux/quota.h>
static void
xfs_qm_fill_state(
diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
index 5a2512d20bd0..1f893c99b956 100644
--- a/fs/xfs/xfs_super.c
+++ b/fs/xfs/xfs_super.c
@@ -48,6 +48,7 @@
#include <linux/magic.h>
#include <linux/fs_context.h>
#include <linux/fs_parser.h>
+#include <linux/quota.h>
static const struct super_operations xfs_super_operations;
diff --git a/fs/xfs/xfs_trans_dquot.c b/fs/xfs/xfs_trans_dquot.c
index aa00cf67ad72..94214f0baa2b 100644
--- a/fs/xfs/xfs_trans_dquot.c
+++ b/fs/xfs/xfs_trans_dquot.c
@@ -18,6 +18,8 @@
#include "xfs_trace.h"
#include "xfs_error.h"
+#include <linux/quota.h>
+
STATIC void xfs_trans_alloc_dqinfo(xfs_trans_t *);
/*
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 06eda3a4fb52..abe97d31849b 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -261,7 +261,7 @@ struct iattr {
/*
* Includes for diskquotas.
*/
-#include <linux/quota.h>
+#include <linux/quota_types.h>
/*
* Maximum number of layers of fs stack. Needs to be limited to
diff --git a/include/linux/quota.h b/include/linux/quota.h
index 956281c84850..2a3040e61072 100644
--- a/include/linux/quota.h
+++ b/include/linux/quota.h
@@ -32,9 +32,8 @@
#ifndef _LINUX_QUOTA_
#define _LINUX_QUOTA_
-#include <linux/list.h>
+#include <linux/quota_types.h>
#include <linux/mutex_types.h>
-#include <linux/rwsem_types.h>
#include <linux/spinlock_types.h>
#include <linux/percpu_counter.h>
@@ -45,7 +44,6 @@
#include <linux/atomic.h>
#include <linux/uidgid_types.h>
#include <linux/projid.h>
-#include <uapi/linux/quota.h>
#undef USRQUOTA
#undef GRPQUOTA
@@ -61,9 +59,6 @@ enum quota_type {
#define QTYPE_MASK_GRP (1 << GRPQUOTA)
#define QTYPE_MASK_PRJ (1 << PRJQUOTA)
-typedef __kernel_uid32_t qid_t; /* Type in which we store ids in memory */
-typedef long long qsize_t; /* Type in which we store sizes */
-
struct kqid { /* Type in which we store the quota identifier */
union {
kuid_t uid;
@@ -213,24 +208,6 @@ struct mem_dqblk {
time64_t dqb_itime; /* time limit for excessive inode use */
};
-/*
- * Data for one quotafile kept in memory
- */
-struct quota_format_type;
-
-struct mem_dqinfo {
- struct quota_format_type *dqi_format;
- int dqi_fmt_id; /* Id of the dqi_format - used when turning
- * quotas on after remount RW */
- struct list_head dqi_dirty_list; /* List of dirty dquots [dq_list_lock] */
- unsigned long dqi_flags; /* DFQ_ flags [dq_data_lock] */
- unsigned int dqi_bgrace; /* Space grace time [dq_data_lock] */
- unsigned int dqi_igrace; /* Inode grace time [dq_data_lock] */
- qsize_t dqi_max_spc_limit; /* Maximum space limit [static] */
- qsize_t dqi_max_ino_limit; /* Maximum inode limit [static] */
- void *dqi_priv;
-};
-
struct super_block;
/* Mask for flags passed to userspace */
@@ -517,14 +494,6 @@ static inline void quota_send_warning(struct kqid qid, dev_t dev,
}
#endif /* CONFIG_QUOTA_NETLINK_INTERFACE */
-struct quota_info {
- unsigned int flags; /* Flags for diskquotas on this device */
- struct rw_semaphore dqio_sem; /* Lock quota file while I/O in progress */
- struct inode *files[MAXQUOTAS]; /* inodes of quotafiles */
- struct mem_dqinfo info[MAXQUOTAS]; /* Information for each quota type */
- const struct quota_format_ops *ops[MAXQUOTAS]; /* Operations for each type */
-};
-
int register_quota_format(struct quota_format_type *fmt);
void unregister_quota_format(struct quota_format_type *fmt);
diff --git a/include/linux/quota_types.h b/include/linux/quota_types.h
new file mode 100644
index 000000000000..7f52ee2604bb
--- /dev/null
+++ b/include/linux/quota_types.h
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 1982, 1986 Regents of the University of California.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Robert Elz at The University of Melbourne.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+#ifndef _LINUX_QUOTA_TYPES_
+#define _LINUX_QUOTA_TYPES_
+
+#include <linux/list.h>
+#include <linux/rwsem_types.h>
+#include <uapi/linux/quota.h>
+
+typedef __kernel_uid32_t qid_t; /* Type in which we store ids in memory */
+typedef long long qsize_t; /* Type in which we store sizes */
+
+/*
+ * Data for one quotafile kept in memory
+ */
+struct quota_format_type;
+
+struct mem_dqinfo {
+ struct quota_format_type *dqi_format;
+ int dqi_fmt_id; /* Id of the dqi_format - used when turning
+ * quotas on after remount RW */
+ struct list_head dqi_dirty_list; /* List of dirty dquots [dq_list_lock] */
+ unsigned long dqi_flags; /* DFQ_ flags [dq_data_lock] */
+ unsigned int dqi_bgrace; /* Space grace time [dq_data_lock] */
+ unsigned int dqi_igrace; /* Inode grace time [dq_data_lock] */
+ qsize_t dqi_max_spc_limit; /* Maximum space limit [static] */
+ qsize_t dqi_max_ino_limit; /* Maximum inode limit [static] */
+ void *dqi_priv;
+};
+
+struct quota_info {
+ unsigned int flags; /* Flags for diskquotas on this device */
+ struct rw_semaphore dqio_sem; /* Lock quota file while I/O in progress */
+ struct inode *files[MAXQUOTAS]; /* inodes of quotafiles */
+ struct mem_dqinfo info[MAXQUOTAS]; /* Information for each quota type */
+ const struct quota_format_ops *ops[MAXQUOTAS]; /* Operations for each type */
+};
+
+#endif /* _LINUX_QUOTA_TYPES_ */
--
2.39.2
By providing declarations in a lean header, we can reduce header
dependencies.
Signed-off-by: Max Kellermann <[email protected]>
---
drivers/target/target_core_alua.c | 1 +
drivers/target/target_core_pr.c | 1 +
drivers/target/target_core_xcopy.c | 1 +
include/linux/blkdev.h | 2 +-
include/linux/bpf-cgroup-defs.h | 2 +-
include/linux/bpf.h | 2 +-
include/linux/cgroup-defs.h | 2 +-
include/linux/cgroup.h | 1 +
include/linux/percpu-refcount.h | 64 +-----------------------
include/linux/percpu-refcount_types.h | 71 +++++++++++++++++++++++++++
include/linux/slab.h | 1 -
include/target/target_core_base.h | 2 +-
12 files changed, 81 insertions(+), 69 deletions(-)
create mode 100644 include/linux/percpu-refcount_types.h
diff --git a/drivers/target/target_core_alua.c b/drivers/target/target_core_alua.c
index 01751faad386..f908e5562094 100644
--- a/drivers/target/target_core_alua.c
+++ b/drivers/target/target_core_alua.c
@@ -18,6 +18,7 @@
#include <linux/fcntl.h>
#include <linux/file.h>
#include <linux/fs.h>
+#include <linux/percpu-refcount.h>
#include <scsi/scsi_proto.h>
#include <asm/unaligned.h>
diff --git a/drivers/target/target_core_pr.c b/drivers/target/target_core_pr.c
index a566d4d38192..19057040b7a1 100644
--- a/drivers/target/target_core_pr.c
+++ b/drivers/target/target_core_pr.c
@@ -19,6 +19,7 @@
#include <linux/fcntl.h>
#include <linux/fs.h>
#include <linux/kref.h>
+#include <linux/percpu-refcount.h>
#include <scsi/scsi_proto.h>
#include <asm/unaligned.h>
diff --git a/drivers/target/target_core_xcopy.c b/drivers/target/target_core_xcopy.c
index c822f57daa39..232d84743b89 100644
--- a/drivers/target/target_core_xcopy.c
+++ b/drivers/target/target_core_xcopy.c
@@ -18,6 +18,7 @@
#include <linux/rculist.h>
#include <linux/completion.h>
#include <linux/configfs.h>
+#include <linux/percpu-refcount.h>
#include <linux/ratelimit.h>
#include <scsi/scsi_proto.h>
#include <asm/unaligned.h>
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 09e8f023070c..bc108e5fcec0 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -18,7 +18,7 @@
#include <linux/gfp_types.h>
#include <linux/kdev_t.h>
#include <linux/rcupdate.h>
-#include <linux/percpu-refcount.h>
+#include <linux/percpu-refcount_types.h>
#include <linux/blkzoned.h>
#include <linux/sched.h>
#include <linux/uio.h> // for iov_iter_is_aligned()
diff --git a/include/linux/bpf-cgroup-defs.h b/include/linux/bpf-cgroup-defs.h
index f3b400858129..70b79fd81fee 100644
--- a/include/linux/bpf-cgroup-defs.h
+++ b/include/linux/bpf-cgroup-defs.h
@@ -5,7 +5,7 @@
#ifdef CONFIG_CGROUP_BPF
#include <linux/list.h>
-#include <linux/percpu-refcount.h>
+#include <linux/percpu-refcount_types.h>
#include <linux/workqueue_types.h>
struct bpf_prog_array;
diff --git a/include/linux/bpf.h b/include/linux/bpf.h
index 40fce6ce3de9..b6e38331acfd 100644
--- a/include/linux/bpf.h
+++ b/include/linux/bpf.h
@@ -21,7 +21,7 @@
#include <linux/capability.h>
#include <linux/sched/mm.h>
#include <linux/slab.h>
-#include <linux/percpu-refcount.h>
+#include <linux/percpu-refcount_types.h>
#include <linux/stddef.h>
#include <linux/bpfptr.h>
#include <linux/btf.h>
diff --git a/include/linux/cgroup-defs.h b/include/linux/cgroup-defs.h
index 99e24f3034df..878deefba0e1 100644
--- a/include/linux/cgroup-defs.h
+++ b/include/linux/cgroup-defs.h
@@ -15,7 +15,7 @@
#include <linux/mutex_types.h>
#include <linux/rcupdate.h>
#include <linux/refcount_types.h>
-#include <linux/percpu-refcount.h>
+#include <linux/percpu-refcount_types.h>
#include <linux/percpu-rwsem.h>
#include <linux/u64_stats_sync.h>
#include <linux/workqueue.h>
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
index 24dcff53bd05..19a5e801f77d 100644
--- a/include/linux/cgroup.h
+++ b/include/linux/cgroup.h
@@ -21,6 +21,7 @@
#include <linux/ns_common.h>
#include <linux/nsproxy.h>
#include <linux/user_namespace.h>
+#include <linux/percpu-refcount.h>
#include <linux/refcount.h>
#include <linux/kernel_stat.h>
diff --git a/include/linux/percpu-refcount.h b/include/linux/percpu-refcount.h
index dd2f19ea08bd..ded13def0acd 100644
--- a/include/linux/percpu-refcount.h
+++ b/include/linux/percpu-refcount.h
@@ -50,74 +50,12 @@
#ifndef _LINUX_PERCPU_REFCOUNT_H
#define _LINUX_PERCPU_REFCOUNT_H
-#include <linux/atomic.h>
+#include <linux/percpu-refcount_types.h>
#include <linux/percpu.h>
#include <linux/rcupdate.h>
#include <linux/types.h>
#include <linux/gfp_types.h>
-struct percpu_ref;
-typedef void (percpu_ref_func_t)(struct percpu_ref *);
-
-/* flags set in the lower bits of percpu_ref->percpu_count_ptr */
-enum {
- __PERCPU_REF_ATOMIC = 1LU << 0, /* operating in atomic mode */
- __PERCPU_REF_DEAD = 1LU << 1, /* (being) killed */
- __PERCPU_REF_ATOMIC_DEAD = __PERCPU_REF_ATOMIC | __PERCPU_REF_DEAD,
-
- __PERCPU_REF_FLAG_BITS = 2,
-};
-
-/* @flags for percpu_ref_init() */
-enum {
- /*
- * Start w/ ref == 1 in atomic mode. Can be switched to percpu
- * operation using percpu_ref_switch_to_percpu(). If initialized
- * with this flag, the ref will stay in atomic mode until
- * percpu_ref_switch_to_percpu() is invoked on it.
- * Implies ALLOW_REINIT.
- */
- PERCPU_REF_INIT_ATOMIC = 1 << 0,
-
- /*
- * Start dead w/ ref == 0 in atomic mode. Must be revived with
- * percpu_ref_reinit() before used. Implies INIT_ATOMIC and
- * ALLOW_REINIT.
- */
- PERCPU_REF_INIT_DEAD = 1 << 1,
-
- /*
- * Allow switching from atomic mode to percpu mode.
- */
- PERCPU_REF_ALLOW_REINIT = 1 << 2,
-};
-
-struct percpu_ref_data {
- atomic_long_t count;
- percpu_ref_func_t *release;
- percpu_ref_func_t *confirm_switch;
- bool force_atomic:1;
- bool allow_reinit:1;
- struct rcu_head rcu;
- struct percpu_ref *ref;
-};
-
-struct percpu_ref {
- /*
- * The low bit of the pointer indicates whether the ref is in percpu
- * mode; if set, then get/put will manipulate the atomic_t.
- */
- unsigned long percpu_count_ptr;
-
- /*
- * 'percpu_ref' is often embedded into user structure, and only
- * 'percpu_count_ptr' is required in fast path, move other fields
- * into 'percpu_ref_data', so we can reduce memory footprint in
- * fast path.
- */
- struct percpu_ref_data *data;
-};
-
int __must_check percpu_ref_init(struct percpu_ref *ref,
percpu_ref_func_t *release, unsigned int flags,
gfp_t gfp);
diff --git a/include/linux/percpu-refcount_types.h b/include/linux/percpu-refcount_types.h
new file mode 100644
index 000000000000..9f4f93e8faaf
--- /dev/null
+++ b/include/linux/percpu-refcount_types.h
@@ -0,0 +1,71 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+
+#ifndef _LINUX_PERCPU_REFCOUNT_TYPES_H
+#define _LINUX_PERCPU_REFCOUNT_TYPES_H
+
+#include <linux/atomic.h>
+#include <linux/types.h>
+
+struct percpu_ref;
+typedef void (percpu_ref_func_t)(struct percpu_ref *);
+
+/* flags set in the lower bits of percpu_ref->percpu_count_ptr */
+enum {
+ __PERCPU_REF_ATOMIC = 1LU << 0, /* operating in atomic mode */
+ __PERCPU_REF_DEAD = 1LU << 1, /* (being) killed */
+ __PERCPU_REF_ATOMIC_DEAD = __PERCPU_REF_ATOMIC | __PERCPU_REF_DEAD,
+
+ __PERCPU_REF_FLAG_BITS = 2,
+};
+
+/* @flags for percpu_ref_init() */
+enum {
+ /*
+ * Start w/ ref == 1 in atomic mode. Can be switched to percpu
+ * operation using percpu_ref_switch_to_percpu(). If initialized
+ * with this flag, the ref will stay in atomic mode until
+ * percpu_ref_switch_to_percpu() is invoked on it.
+ * Implies ALLOW_REINIT.
+ */
+ PERCPU_REF_INIT_ATOMIC = 1 << 0,
+
+ /*
+ * Start dead w/ ref == 0 in atomic mode. Must be revived with
+ * percpu_ref_reinit() before used. Implies INIT_ATOMIC and
+ * ALLOW_REINIT.
+ */
+ PERCPU_REF_INIT_DEAD = 1 << 1,
+
+ /*
+ * Allow switching from atomic mode to percpu mode.
+ */
+ PERCPU_REF_ALLOW_REINIT = 1 << 2,
+};
+
+struct percpu_ref_data {
+ atomic_long_t count;
+ percpu_ref_func_t *release;
+ percpu_ref_func_t *confirm_switch;
+ bool force_atomic:1;
+ bool allow_reinit:1;
+ struct rcu_head rcu;
+ struct percpu_ref *ref;
+};
+
+struct percpu_ref {
+ /*
+ * The low bit of the pointer indicates whether the ref is in percpu
+ * mode; if set, then get/put will manipulate the atomic_t.
+ */
+ unsigned long percpu_count_ptr;
+
+ /*
+ * 'percpu_ref' is often embedded into user structure, and only
+ * 'percpu_count_ptr' is required in fast path, move other fields
+ * into 'percpu_ref_data', so we can reduce memory footprint in
+ * fast path.
+ */
+ struct percpu_ref_data *data;
+};
+
+#endif
diff --git a/include/linux/slab.h b/include/linux/slab.h
index 63c8b1ce6133..95439c2e7542 100644
--- a/include/linux/slab.h
+++ b/include/linux/slab.h
@@ -16,7 +16,6 @@
#include <linux/gfp_types.h>
#include <linux/overflow.h>
#include <linux/types.h>
-#include <linux/percpu-refcount.h>
#include <linux/cleanup.h>
#include <linux/hash.h>
#include <linux/mmzone.h>
diff --git a/include/target/target_core_base.h b/include/target/target_core_base.h
index 5b9156adceca..1598a4062398 100644
--- a/include/target/target_core_base.h
+++ b/include/target/target_core_base.h
@@ -5,7 +5,7 @@
#include <linux/configfs.h> /* struct config_group */
#include <linux/dma-direction.h> /* enum dma_data_direction */
#include <linux/sbitmap.h>
-#include <linux/percpu-refcount.h>
+#include <linux/percpu-refcount_types.h>
#include <linux/semaphore.h> /* struct semaphore */
#include <linux/completion_types.h>
--
2.39.2
By providing declarations in a lean header, we can reduce header
dependencies.
Signed-off-by: Max Kellermann <[email protected]>
---
arch/arm64/kvm/vgic/vgic.h | 1 +
block/bsg-lib.c | 1 +
drivers/acpi/acpi_ipmi.c | 1 +
drivers/acpi/ec.c | 1 +
drivers/ata/libata-core.c | 1 +
drivers/base/core.c | 1 +
drivers/char/hw_random/core.c | 1 +
drivers/char/ipmi/ipmi_msghandler.c | 1 +
drivers/char/xillybus/xillyusb.c | 1 +
drivers/clk/clk.c | 1 +
drivers/comedi/comedi_buf.c | 1 +
drivers/comedi/comedi_fops.c | 1 +
drivers/dax/bus.c | 1 +
drivers/gpu/drm/drm_auth.c | 1 +
drivers/gpu/drm/drm_connector.c | 1 +
drivers/gpu/drm/drm_drv.c | 1 +
drivers/gpu/drm/msm/msm_gem.h | 1 +
drivers/gpu/drm/nouveau/nvkm/core/memory.c | 2 ++
drivers/gpu/drm/nouveau/nvkm/engine/fifo/cgrp.c | 1 +
drivers/gpu/drm/nouveau/nvkm/engine/fifo/chid.c | 2 ++
drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmm.c | 1 +
drivers/greybus/connection.c | 1 +
drivers/greybus/operation.c | 1 +
drivers/hid/hid-core.c | 1 +
drivers/hid/hid-cougar.c | 1 +
drivers/hid/hid-debug.c | 1 +
drivers/hid/hid-logitech-dj.c | 1 +
drivers/hid/wacom_sys.c | 1 +
drivers/iio/buffer/industrialio-buffer-dma.c | 1 +
drivers/iio/industrialio-buffer.c | 1 +
drivers/infiniband/core/cache.c | 1 +
drivers/infiniband/core/cm.c | 1 +
drivers/infiniband/core/counters.c | 2 ++
drivers/infiniband/core/device.c | 1 +
drivers/infiniband/core/restrack.c | 1 +
drivers/infiniband/hw/erdma/erdma_cm.c | 1 +
drivers/infiniband/hw/erdma/erdma_qp.c | 2 ++
drivers/infiniband/hw/qedr/qedr_iw_cm.c | 2 ++
drivers/infiniband/sw/rxe/rxe_pool.h | 2 ++
drivers/infiniband/sw/rxe/rxe_queue.c | 1 +
drivers/infiniband/sw/siw/siw.h | 1 +
drivers/infiniband/ulp/isert/ib_isert.c | 1 +
drivers/infiniband/ulp/rtrs/rtrs.c | 1 +
drivers/infiniband/ulp/srpt/ib_srpt.c | 1 +
drivers/media/dvb-core/dvb_ca_en50221.c | 1 +
drivers/media/dvb-core/dvb_frontend.c | 1 +
drivers/media/dvb-core/dvbdev.c | 1 +
drivers/misc/genwqe/card_dev.c | 1 +
drivers/mtd/mtd_blkdevs.c | 1 +
.../net/ethernet/chelsio/inline_crypto/chtls/chtls.h | 1 +
.../ethernet/chelsio/inline_crypto/chtls/chtls_cm.c | 1 +
drivers/net/ethernet/chelsio/libcxgb/libcxgb_ppm.c | 1 +
drivers/net/ethernet/intel/ice/ice_sriov.c | 2 ++
drivers/net/ethernet/intel/ice/ice_vf_lib.c | 2 ++
drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c | 1 +
drivers/net/ethernet/mellanox/mlx5/core/lib/devcom.c | 1 +
drivers/net/ethernet/mellanox/mlx5/core/uar.c | 1 +
.../net/ethernet/netronome/nfp/nfpcore/nfp_cppcore.c | 1 +
drivers/net/ethernet/qlogic/qede/qede_rdma.c | 1 +
drivers/net/pse-pd/pse_core.c | 1 +
drivers/net/wireless/ath/carl9170/tx.c | 1 +
drivers/nvdimm/core.c | 1 +
drivers/nvdimm/dimm.c | 1 +
drivers/nvdimm/dimm_devs.c | 1 +
drivers/of/dynamic.c | 1 +
drivers/of/unittest.c | 1 +
drivers/pci/hotplug/acpiphp_glue.c | 1 +
drivers/pci/slot.c | 1 +
drivers/pci/switch/switchtec.c | 1 +
drivers/rpmsg/mtk_rpmsg.c | 1 +
drivers/rpmsg/qcom_glink_native.c | 1 +
drivers/rpmsg/qcom_smd.c | 1 +
drivers/rpmsg/virtio_rpmsg_bus.c | 1 +
drivers/scsi/bnx2fc/bnx2fc_els.c | 2 ++
drivers/scsi/bnx2fc/bnx2fc_fcoe.c | 1 +
drivers/scsi/bnx2fc/bnx2fc_hwi.c | 2 ++
drivers/scsi/bnx2fc/bnx2fc_io.c | 2 ++
drivers/scsi/bnx2fc/bnx2fc_tgt.c | 3 +++
drivers/scsi/ch.c | 1 +
drivers/scsi/cxgbi/libcxgbi.h | 1 +
drivers/scsi/device_handler/scsi_dh_alua.c | 1 +
drivers/scsi/device_handler/scsi_dh_rdac.c | 1 +
drivers/scsi/elx/efct/efct_hw.c | 2 ++
drivers/scsi/elx/efct/efct_io.c | 2 ++
drivers/scsi/elx/efct/efct_lio.c | 2 ++
drivers/scsi/elx/efct/efct_scsi.c | 2 ++
drivers/scsi/elx/efct/efct_unsol.c | 2 ++
drivers/scsi/elx/libefc/efc_domain.c | 2 ++
drivers/scsi/elx/libefc/efc_els.c | 1 +
drivers/scsi/elx/libefc/efc_node.c | 2 ++
drivers/scsi/elx/libefc/efc_nport.c | 2 ++
drivers/scsi/fcoe/fcoe_ctlr.c | 1 +
drivers/scsi/hosts.c | 1 +
drivers/scsi/libfc/fc_disc.c | 1 +
drivers/scsi/libfc/fc_exch.c | 1 +
drivers/scsi/libfc/fc_lport.c | 1 +
drivers/scsi/libfc/fc_rport.c | 1 +
drivers/scsi/libsas/sas_internal.h | 1 +
drivers/scsi/lpfc/lpfc_bsg.c | 1 +
drivers/scsi/lpfc/lpfc_debugfs.c | 1 +
drivers/scsi/lpfc/lpfc_els.c | 1 +
drivers/scsi/lpfc/lpfc_hbadisc.c | 1 +
drivers/scsi/lpfc/lpfc_init.c | 1 +
drivers/scsi/lpfc/lpfc_nportdisc.c | 1 +
drivers/scsi/lpfc/lpfc_nvme.c | 1 +
drivers/scsi/lpfc/lpfc_nvmet.c | 1 +
drivers/scsi/lpfc/lpfc_sli.c | 1 +
drivers/scsi/mpi3mr/mpi3mr.h | 1 +
drivers/scsi/mpt3sas/mpt3sas_base.h | 1 +
drivers/scsi/qedf/qedf_els.c | 2 ++
drivers/scsi/qedf/qedf_io.c | 1 +
drivers/scsi/qedf/qedf_main.c | 1 +
drivers/scsi/qla2xxx/qla_inline.h | 3 +++
drivers/scsi/qla4xxx/ql4_isr.c | 2 ++
drivers/scsi/qla4xxx/ql4_os.c | 1 +
drivers/scsi/scsi_scan.c | 1 +
drivers/scsi/scsi_sysfs.c | 1 +
drivers/scsi/sg.c | 1 +
drivers/soc/qcom/smem_state.c | 1 +
drivers/staging/greybus/authentication.c | 1 +
drivers/staging/greybus/fw-download.c | 1 +
drivers/staging/greybus/fw-management.c | 1 +
drivers/target/iscsi/iscsi_target.c | 1 +
drivers/target/iscsi/iscsi_target_nego.c | 1 +
drivers/target/iscsi/iscsi_target_tpg.c | 1 +
drivers/target/target_core_device.c | 1 +
drivers/target/target_core_pr.c | 1 +
drivers/target/target_core_tmr.c | 2 ++
drivers/target/target_core_tpg.c | 1 +
drivers/target/target_core_transport.c | 1 +
drivers/target/target_core_user.c | 1 +
drivers/usb/core/config.c | 1 +
drivers/usb/core/hcd.c | 1 +
drivers/usb/core/hub.c | 1 +
drivers/usb/core/message.c | 1 +
drivers/usb/core/urb.c | 1 +
drivers/usb/gadget/function/f_fs.c | 1 +
drivers/usb/host/oxu210hp-hcd.c | 1 +
drivers/usb/misc/usblcd.c | 1 +
drivers/vfio/container.c | 1 +
drivers/vhost/scsi.c | 1 +
drivers/video/fbdev/smscufx.c | 1 +
drivers/xen/xen-scsiback.c | 1 +
drivers/xen/xenbus/xenbus_dev_frontend.c | 1 +
fs/configfs/item.c | 1 +
include/drm/drm_atomic.h | 2 ++
include/drm/drm_auth.h | 2 +-
include/drm/drm_device.h | 2 +-
include/drm/drm_framebuffer.h | 1 +
include/drm/drm_mode_object.h | 2 +-
include/kvm/arm_vgic.h | 2 +-
include/linux/backing-dev-defs.h | 2 +-
include/linux/backing-dev.h | 1 +
include/linux/ceph/messenger.h | 2 +-
include/linux/ceph/mon_client.h | 2 +-
include/linux/ceph/osd_client.h | 2 +-
include/linux/comedi/comedidev.h | 2 +-
include/linux/configfs.h | 2 +-
include/linux/cpu_rmap.h | 2 +-
include/linux/dmaengine.h | 1 +
include/linux/greybus/connection.h | 2 +-
include/linux/greybus/operation.h | 2 +-
include/linux/hugetlb.h | 2 +-
include/linux/hw_random.h | 2 +-
include/linux/iio/buffer-dma.h | 2 +-
include/linux/iio/buffer_impl.h | 2 +-
include/linux/interrupt.h | 2 +-
include/linux/klist.h | 2 +-
include/linux/kobject.h | 2 +-
include/linux/kref.h | 5 +----
include/linux/kref_types.h | 12 ++++++++++++
include/linux/lockd/lockd.h | 2 +-
include/linux/memory-tiers.h | 2 +-
include/linux/mm_inline.h | 4 ++++
include/linux/mm_types.h | 2 +-
include/linux/mtd/blktrans.h | 2 +-
include/linux/nfs_page.h | 2 +-
include/linux/relay.h | 2 +-
include/linux/rpmsg.h | 2 +-
include/linux/sh_clk.h | 2 +-
include/linux/sunrpc/xprt.h | 2 +-
include/linux/surface_aggregator/serial_hub.h | 2 +-
include/linux/tee_drv.h | 2 +-
include/linux/usb.h | 2 +-
include/linux/usb/serial.h | 2 +-
include/linux/watch_queue.h | 2 +-
include/media/media-request.h | 1 +
include/media/v4l2-device.h | 2 ++
include/net/bluetooth/hci_core.h | 1 +
include/net/tls_toe.h | 2 +-
include/rdma/ib_verbs.h | 2 +-
include/rdma/restrack.h | 2 +-
include/rdma/uverbs_types.h | 1 +
kernel/irq/manage.c | 1 +
kernel/relay.c | 1 +
kernel/watch_queue.c | 1 +
lib/klist.c | 1 +
lib/kobject.c | 1 +
mm/memory-tiers.c | 1 +
mm/z3fold.c | 1 +
mm/zswap.c | 1 +
net/can/j1939/main.c | 1 +
net/can/j1939/transport.c | 1 +
net/dsa/dsa.c | 1 +
net/nfc/llcp_core.c | 1 +
net/qrtr/af_qrtr.c | 1 +
net/rds/message.c | 1 +
net/rds/rdma.c | 1 +
net/tipc/node.c | 2 ++
net/tipc/subscr.c | 2 ++
net/tipc/topsrv.c | 1 +
net/tls/tls_toe.c | 1 +
sound/soc/qcom/qdsp6/q6apm.c | 1 +
213 files changed, 257 insertions(+), 41 deletions(-)
create mode 100644 include/linux/kref_types.h
diff --git a/arch/arm64/kvm/vgic/vgic.h b/arch/arm64/kvm/vgic/vgic.h
index 8d134569d0a1..6aeffbe017c0 100644
--- a/arch/arm64/kvm/vgic/vgic.h
+++ b/arch/arm64/kvm/vgic/vgic.h
@@ -6,6 +6,7 @@
#define __KVM_ARM_VGIC_NEW_H__
#include <linux/irqchip/arm-gic-common.h>
+#include <linux/kref.h>
#include <asm/kvm_mmu.h>
#define PRODUCT_ID_KVM 0x4b /* ASCII code K */
diff --git a/block/bsg-lib.c b/block/bsg-lib.c
index b3acdbdb6e7e..15d31c179ad7 100644
--- a/block/bsg-lib.c
+++ b/block/bsg-lib.c
@@ -9,6 +9,7 @@
#include <linux/bsg.h>
#include <linux/slab.h>
#include <linux/blk-mq.h>
+#include <linux/kref.h>
#include <linux/delay.h>
#include <linux/scatterlist.h>
#include <linux/bsg-lib.h>
diff --git a/drivers/acpi/acpi_ipmi.c b/drivers/acpi/acpi_ipmi.c
index 0555f68c2dfd..447260a44019 100644
--- a/drivers/acpi/acpi_ipmi.c
+++ b/drivers/acpi/acpi_ipmi.c
@@ -11,6 +11,7 @@
#include <linux/acpi.h>
#include <linux/ipmi.h>
#include <linux/spinlock.h>
+#include <linux/kref.h>
MODULE_AUTHOR("Zhao Yakui");
MODULE_DESCRIPTION("ACPI IPMI Opregion driver");
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c
index dbdee2924594..6d8678f80a5a 100644
--- a/drivers/acpi/ec.c
+++ b/drivers/acpi/ec.c
@@ -28,6 +28,7 @@
#include <linux/suspend.h>
#include <linux/acpi.h>
#include <linux/dmi.h>
+#include <linux/kref.h>
#include <asm/io.h>
#include "internal.h"
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 09ed67772fae..490d71e7dccb 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -45,6 +45,7 @@
#include <linux/log2.h>
#include <linux/slab.h>
#include <linux/glob.h>
+#include <linux/kref.h>
#include <scsi/scsi.h>
#include <scsi/scsi_cmnd.h>
#include <scsi/scsi_host.h>
diff --git a/drivers/base/core.c b/drivers/base/core.c
index 14d46af40f9a..03a6375a150c 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -14,6 +14,7 @@
#include <linux/err.h>
#include <linux/fwnode.h>
#include <linux/init.h>
+#include <linux/kref.h>
#include <linux/kstrtox.h>
#include <linux/module.h>
#include <linux/slab.h>
diff --git a/drivers/char/hw_random/core.c b/drivers/char/hw_random/core.c
index a3bbdd6e60fc..3f0e9121ed28 100644
--- a/drivers/char/hw_random/core.c
+++ b/drivers/char/hw_random/core.c
@@ -25,6 +25,7 @@
#include <linux/slab.h>
#include <linux/string.h>
#include <linux/uaccess.h>
+#include <linux/kref.h>
#define RNG_MODULE_NAME "hw_random"
diff --git a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c
index a35d6487867c..fbb21189f396 100644
--- a/drivers/char/ipmi/ipmi_msghandler.c
+++ b/drivers/char/ipmi/ipmi_msghandler.c
@@ -37,6 +37,7 @@
#include <linux/nospec.h>
#include <linux/vmalloc.h>
#include <linux/delay.h>
+#include <linux/kref.h>
#define IPMI_DRIVER_VERSION "39.2"
diff --git a/drivers/char/xillybus/xillyusb.c b/drivers/char/xillybus/xillyusb.c
index 5a5afa14ca8c..37994b7b30d7 100644
--- a/drivers/char/xillybus/xillyusb.c
+++ b/drivers/char/xillybus/xillyusb.c
@@ -28,6 +28,7 @@
#include <linux/poll.h>
#include <linux/delay.h>
#include <linux/usb.h>
+#include <linux/kref.h>
#include "xillybus_class.h"
diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index 2253c154a824..bf9131940cb1 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -9,6 +9,7 @@
#include <linux/clk.h>
#include <linux/clk-provider.h>
#include <linux/clk/clk-conf.h>
+#include <linux/kref.h>
#include <linux/module.h>
#include <linux/mutex.h>
#include <linux/spinlock.h>
diff --git a/drivers/comedi/comedi_buf.c b/drivers/comedi/comedi_buf.c
index 393966c09740..ac9e8b2c58a3 100644
--- a/drivers/comedi/comedi_buf.c
+++ b/drivers/comedi/comedi_buf.c
@@ -9,6 +9,7 @@
#include <linux/vmalloc.h>
#include <linux/slab.h>
+#include <linux/kref.h>
#include <linux/comedi/comedidev.h>
#include "comedi_internal.h"
diff --git a/drivers/comedi/comedi_fops.c b/drivers/comedi/comedi_fops.c
index 1b481731df96..469560b7aba6 100644
--- a/drivers/comedi/comedi_fops.c
+++ b/drivers/comedi/comedi_fops.c
@@ -25,6 +25,7 @@
#include <linux/fs.h>
#include <linux/comedi/comedidev.h>
#include <linux/cdev.h>
+#include <linux/kref.h>
#include <linux/io.h>
#include <linux/uaccess.h>
diff --git a/drivers/dax/bus.c b/drivers/dax/bus.c
index 27c86d0ca711..7a54bca555c4 100644
--- a/drivers/dax/bus.c
+++ b/drivers/dax/bus.c
@@ -7,6 +7,7 @@
#include <linux/slab.h>
#include <linux/dax.h>
#include <linux/io.h>
+#include <linux/kref.h>
#include "dax-private.h"
#include "bus.h"
diff --git a/drivers/gpu/drm/drm_auth.c b/drivers/gpu/drm/drm_auth.c
index 22aa015df387..5b1481720007 100644
--- a/drivers/gpu/drm/drm_auth.c
+++ b/drivers/gpu/drm/drm_auth.c
@@ -29,6 +29,7 @@
*/
#include <linux/slab.h>
+#include <linux/kref.h>
#include <drm/drm_auth.h>
#include <drm/drm_drv.h>
diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c
index b0516505f7ae..2dbd3963fca5 100644
--- a/drivers/gpu/drm/drm_connector.c
+++ b/drivers/gpu/drm/drm_connector.c
@@ -35,6 +35,7 @@
#include <linux/property.h>
#include <linux/uaccess.h>
+#include <linux/kref.h>
#include <video/cmdline.h>
diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
index 243cacb3575c..f74a65d74f1e 100644
--- a/drivers/gpu/drm/drm_drv.c
+++ b/drivers/gpu/drm/drm_drv.c
@@ -34,6 +34,7 @@
#include <linux/pseudo_fs.h>
#include <linux/slab.h>
#include <linux/srcu.h>
+#include <linux/kref.h>
#include <drm/drm_accel.h>
#include <drm/drm_cache.h>
diff --git a/drivers/gpu/drm/msm/msm_gem.h b/drivers/gpu/drm/msm/msm_gem.h
index 8d414b072c29..735963ce4e6e 100644
--- a/drivers/gpu/drm/msm/msm_gem.h
+++ b/drivers/gpu/drm/msm/msm_gem.h
@@ -9,6 +9,7 @@
#include <linux/kref.h>
#include <linux/dma-resv.h>
+#include <linux/ratelimit.h>
#include "drm/drm_exec.h"
#include "drm/gpu_scheduler.h"
#include "msm_drv.h"
diff --git a/drivers/gpu/drm/nouveau/nvkm/core/memory.c b/drivers/gpu/drm/nouveau/nvkm/core/memory.c
index a705c2dfca80..a40cd36d0d7d 100644
--- a/drivers/gpu/drm/nouveau/nvkm/core/memory.c
+++ b/drivers/gpu/drm/nouveau/nvkm/core/memory.c
@@ -26,6 +26,8 @@
#include <subdev/fb.h>
#include <subdev/instmem.h>
+#include <linux/kref.h>
+
void
nvkm_memory_tags_put(struct nvkm_memory *memory, struct nvkm_device *device,
struct nvkm_tags **ptags)
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/cgrp.c b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/cgrp.c
index 814db9daa194..190e1227c342 100644
--- a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/cgrp.c
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/cgrp.c
@@ -27,6 +27,7 @@
#include <core/gpuobj.h>
#include <subdev/mmu.h>
+#include <linux/kref.h>
static void
nvkm_cgrp_ectx_put(struct nvkm_cgrp *cgrp, struct nvkm_ectx **pectx)
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/chid.c b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/chid.c
index 23944d95efd5..f7b4da9d231e 100644
--- a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/chid.c
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/chid.c
@@ -21,6 +21,8 @@
*/
#include "chid.h"
+#include <linux/kref.h>
+
void
nvkm_chid_put(struct nvkm_chid *chid, int id, spinlock_t *data_lock)
{
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmm.c b/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmm.c
index 9c97800fe037..5efb47168315 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmm.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmm.c
@@ -23,6 +23,7 @@
#include "vmm.h"
#include <subdev/fb.h>
+#include <linux/kref.h>
static void
nvkm_vmm_pt_del(struct nvkm_vmm_pt **ppgt)
diff --git a/drivers/greybus/connection.c b/drivers/greybus/connection.c
index 9c88861986c8..0fdfaa815429 100644
--- a/drivers/greybus/connection.c
+++ b/drivers/greybus/connection.c
@@ -7,6 +7,7 @@
*/
#include <linux/workqueue.h>
+#include <linux/kref.h>
#include <linux/greybus.h>
#include "greybus_trace.h"
diff --git a/drivers/greybus/operation.c b/drivers/greybus/operation.c
index 8459e9bc0749..008a56a07473 100644
--- a/drivers/greybus/operation.c
+++ b/drivers/greybus/operation.c
@@ -13,6 +13,7 @@
#include <linux/wait.h>
#include <linux/workqueue.h>
#include <linux/greybus.h>
+#include <linux/kref.h>
#include "greybus_trace.h"
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index de7a477d6665..d429bc5cc183 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -17,6 +17,7 @@
#include <linux/slab.h>
#include <linux/init.h>
#include <linux/kernel.h>
+#include <linux/kref.h>
#include <linux/list.h>
#include <linux/mm.h>
#include <linux/spinlock.h>
diff --git a/drivers/hid/hid-cougar.c b/drivers/hid/hid-cougar.c
index cb8bd8aae15b..2452cddc96c3 100644
--- a/drivers/hid/hid-cougar.c
+++ b/drivers/hid/hid-cougar.c
@@ -8,6 +8,7 @@
#include <linux/hid.h>
#include <linux/module.h>
#include <linux/printk.h>
+#include <linux/kref.h>
#include "hid-ids.h"
diff --git a/drivers/hid/hid-debug.c b/drivers/hid/hid-debug.c
index 7dd83ec74f8a..578a6a97eb51 100644
--- a/drivers/hid/hid-debug.c
+++ b/drivers/hid/hid-debug.c
@@ -19,6 +19,7 @@
#include <linux/debugfs.h>
#include <linux/seq_file.h>
#include <linux/kfifo.h>
+#include <linux/kref.h>
#include <linux/sched/signal.h>
#include <linux/export.h>
#include <linux/slab.h>
diff --git a/drivers/hid/hid-logitech-dj.c b/drivers/hid/hid-logitech-dj.c
index e6a8b6d8eab7..4507f266a6dc 100644
--- a/drivers/hid/hid-logitech-dj.c
+++ b/drivers/hid/hid-logitech-dj.c
@@ -11,6 +11,7 @@
#include <linux/hid.h>
#include <linux/module.h>
#include <linux/kfifo.h>
+#include <linux/kref.h>
#include <linux/delay.h>
#include <linux/usb.h> /* For to_usb_interface for kvm extra intf check */
#include <asm/unaligned.h>
diff --git a/drivers/hid/wacom_sys.c b/drivers/hid/wacom_sys.c
index b613f11ed949..157de6bdd639 100644
--- a/drivers/hid/wacom_sys.c
+++ b/drivers/hid/wacom_sys.c
@@ -6,6 +6,7 @@
#include "wacom_wac.h"
#include "wacom.h"
#include <linux/input/mt.h>
+#include <linux/kref.h>
#define WAC_MSG_RETRIES 5
#define WAC_CMD_RETRIES 10
diff --git a/drivers/iio/buffer/industrialio-buffer-dma.c b/drivers/iio/buffer/industrialio-buffer-dma.c
index 5610ba67925e..e60eaf64157b 100644
--- a/drivers/iio/buffer/industrialio-buffer-dma.c
+++ b/drivers/iio/buffer/industrialio-buffer-dma.c
@@ -6,6 +6,7 @@
#include <linux/slab.h>
#include <linux/kernel.h>
+#include <linux/kref.h>
#include <linux/module.h>
#include <linux/device.h>
#include <linux/workqueue.h>
diff --git a/drivers/iio/industrialio-buffer.c b/drivers/iio/industrialio-buffer.c
index b581a7e80566..b4857010a08b 100644
--- a/drivers/iio/industrialio-buffer.c
+++ b/drivers/iio/industrialio-buffer.c
@@ -19,6 +19,7 @@
#include <linux/slab.h>
#include <linux/poll.h>
#include <linux/sched/signal.h>
+#include <linux/kref.h>
#include <linux/iio/iio.h>
#include <linux/iio/iio-opaque.h>
diff --git a/drivers/infiniband/core/cache.c b/drivers/infiniband/core/cache.c
index c02a96d3572a..0e93a2c47a36 100644
--- a/drivers/infiniband/core/cache.c
+++ b/drivers/infiniband/core/cache.c
@@ -38,6 +38,7 @@
#include <linux/slab.h>
#include <linux/workqueue.h>
#include <linux/netdevice.h>
+#include <linux/kref.h>
#include <net/addrconf.h>
#include <rdma/ib_cache.h>
diff --git a/drivers/infiniband/core/cm.c b/drivers/infiniband/core/cm.c
index ff58058aeadc..9ce6e86c0ab4 100644
--- a/drivers/infiniband/core/cm.c
+++ b/drivers/infiniband/core/cm.c
@@ -10,6 +10,7 @@
#include <linux/completion.h>
#include <linux/dma-mapping.h>
#include <linux/device.h>
+#include <linux/kref.h>
#include <linux/module.h>
#include <linux/err.h>
#include <linux/idr.h>
diff --git a/drivers/infiniband/core/counters.c b/drivers/infiniband/core/counters.c
index af59486fe418..e6be9912ccd3 100644
--- a/drivers/infiniband/core/counters.c
+++ b/drivers/infiniband/core/counters.c
@@ -8,6 +8,8 @@
#include "core_priv.h"
#include "restrack.h"
+#include <linux/kref.h>
+
#define ALL_AUTO_MODE_MASKS (RDMA_COUNTER_MASK_QP_TYPE | RDMA_COUNTER_MASK_PID)
static int __counter_set_mode(struct rdma_port_counter *port_counter,
diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c
index 67bcea7a153c..cd2599f49168 100644
--- a/drivers/infiniband/core/device.c
+++ b/drivers/infiniband/core/device.c
@@ -35,6 +35,7 @@
#include <linux/string.h>
#include <linux/errno.h>
#include <linux/kernel.h>
+#include <linux/kref.h>
#include <linux/slab.h>
#include <linux/init.h>
#include <linux/netdevice.h>
diff --git a/drivers/infiniband/core/restrack.c b/drivers/infiniband/core/restrack.c
index 01a499a8b88d..dd6b781f03ef 100644
--- a/drivers/infiniband/core/restrack.c
+++ b/drivers/infiniband/core/restrack.c
@@ -10,6 +10,7 @@
#include <linux/mutex.h>
#include <linux/sched/task.h>
#include <linux/pid_namespace.h>
+#include <linux/kref.h>
#include "cma_priv.h"
#include "restrack.h"
diff --git a/drivers/infiniband/hw/erdma/erdma_cm.c b/drivers/infiniband/hw/erdma/erdma_cm.c
index 771059a8eb7d..92dc689691d8 100644
--- a/drivers/infiniband/hw/erdma/erdma_cm.c
+++ b/drivers/infiniband/hw/erdma/erdma_cm.c
@@ -11,6 +11,7 @@
/* Copyright (c) 2017, Open Grid Computing, Inc. */
#include <linux/workqueue.h>
+#include <linux/kref.h>
#include <trace/events/sock.h>
#include "erdma.h"
diff --git a/drivers/infiniband/hw/erdma/erdma_qp.c b/drivers/infiniband/hw/erdma/erdma_qp.c
index 6d0330badd68..96ed236f47fc 100644
--- a/drivers/infiniband/hw/erdma/erdma_qp.c
+++ b/drivers/infiniband/hw/erdma/erdma_qp.c
@@ -9,6 +9,8 @@
#include "erdma_cm.h"
#include "erdma_verbs.h"
+#include <linux/kref.h>
+
void erdma_qp_llp_close(struct erdma_qp *qp)
{
struct erdma_qp_attrs qp_attrs;
diff --git a/drivers/infiniband/hw/qedr/qedr_iw_cm.c b/drivers/infiniband/hw/qedr/qedr_iw_cm.c
index a51fc6854984..6d3bddc5a215 100644
--- a/drivers/infiniband/hw/qedr/qedr_iw_cm.c
+++ b/drivers/infiniband/hw/qedr/qedr_iw_cm.c
@@ -39,6 +39,8 @@
#include "qedr.h"
#include "qedr_iw_cm.h"
+#include <linux/kref.h>
+
static inline void
qedr_fill_sockaddr4(const struct qed_iwarp_cm_info *cm_info,
struct iw_cm_event *event)
diff --git a/drivers/infiniband/sw/rxe/rxe_pool.h b/drivers/infiniband/sw/rxe/rxe_pool.h
index b42e26427a70..15b0084b534e 100644
--- a/drivers/infiniband/sw/rxe/rxe_pool.h
+++ b/drivers/infiniband/sw/rxe/rxe_pool.h
@@ -7,6 +7,8 @@
#ifndef RXE_POOL_H
#define RXE_POOL_H
+#include <linux/kref.h>
+
enum rxe_elem_type {
RXE_TYPE_UC,
RXE_TYPE_PD,
diff --git a/drivers/infiniband/sw/rxe/rxe_queue.c b/drivers/infiniband/sw/rxe/rxe_queue.c
index 9611ee191a46..50c8865f313e 100644
--- a/drivers/infiniband/sw/rxe/rxe_queue.c
+++ b/drivers/infiniband/sw/rxe/rxe_queue.c
@@ -5,6 +5,7 @@
*/
#include <linux/vmalloc.h>
+#include <linux/kref.h>
#include "rxe.h"
#include "rxe_loc.h"
#include "rxe_queue.h"
diff --git a/drivers/infiniband/sw/siw/siw.h b/drivers/infiniband/sw/siw/siw.h
index 75253f2b3e3d..a8aaa1c55a30 100644
--- a/drivers/infiniband/sw/siw/siw.h
+++ b/drivers/infiniband/sw/siw/siw.h
@@ -10,6 +10,7 @@
#include <rdma/restrack.h>
#include <linux/socket.h>
#include <linux/skbuff.h>
+#include <linux/kref.h>
#include <crypto/hash.h>
#include <linux/crc32.h>
#include <linux/crc32c.h>
diff --git a/drivers/infiniband/ulp/isert/ib_isert.c b/drivers/infiniband/ulp/isert/ib_isert.c
index 00a7303c8cc6..3dba906546fd 100644
--- a/drivers/infiniband/ulp/isert/ib_isert.c
+++ b/drivers/infiniband/ulp/isert/ib_isert.c
@@ -14,6 +14,7 @@
#include <linux/socket.h>
#include <linux/in.h>
#include <linux/in6.h>
+#include <linux/kref.h>
#include <rdma/ib_verbs.h>
#include <rdma/ib_cm.h>
#include <rdma/rdma_cm.h>
diff --git a/drivers/infiniband/ulp/rtrs/rtrs.c b/drivers/infiniband/ulp/rtrs/rtrs.c
index 4e17d546d4cc..d203f248f766 100644
--- a/drivers/infiniband/ulp/rtrs/rtrs.c
+++ b/drivers/infiniband/ulp/rtrs/rtrs.c
@@ -11,6 +11,7 @@
#include <linux/module.h>
#include <linux/inet.h>
+#include <linux/kref.h>
#include "rtrs-pri.h"
#include "rtrs-log.h"
diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c b/drivers/infiniband/ulp/srpt/ib_srpt.c
index 58f70cfec45a..41280ffff606 100644
--- a/drivers/infiniband/ulp/srpt/ib_srpt.c
+++ b/drivers/infiniband/ulp/srpt/ib_srpt.c
@@ -38,6 +38,7 @@
#include <linux/err.h>
#include <linux/ctype.h>
#include <linux/kthread.h>
+#include <linux/kref.h>
#include <linux/string.h>
#include <linux/delay.h>
#include <linux/atomic.h>
diff --git a/drivers/media/dvb-core/dvb_ca_en50221.c b/drivers/media/dvb-core/dvb_ca_en50221.c
index baf64540dc00..2fe271dca822 100644
--- a/drivers/media/dvb-core/dvb_ca_en50221.c
+++ b/drivers/media/dvb-core/dvb_ca_en50221.c
@@ -26,6 +26,7 @@
#include <linux/spinlock.h>
#include <linux/sched/signal.h>
#include <linux/kthread.h>
+#include <linux/kref.h>
#include <media/dvb_ca_en50221.h>
#include <media/dvb_ringbuffer.h>
diff --git a/drivers/media/dvb-core/dvb_frontend.c b/drivers/media/dvb-core/dvb_frontend.c
index 9293b058ab99..21694f3e8db3 100644
--- a/drivers/media/dvb-core/dvb_frontend.c
+++ b/drivers/media/dvb-core/dvb_frontend.c
@@ -22,6 +22,7 @@
#include <linux/slab.h>
#include <linux/poll.h>
#include <linux/semaphore.h>
+#include <linux/kref.h>
#include <linux/module.h>
#include <linux/nospec.h>
#include <linux/list.h>
diff --git a/drivers/media/dvb-core/dvbdev.c b/drivers/media/dvb-core/dvbdev.c
index 49f0eb7d0b9d..b40367834d22 100644
--- a/drivers/media/dvb-core/dvbdev.c
+++ b/drivers/media/dvb-core/dvbdev.c
@@ -21,6 +21,7 @@
#include <linux/fs.h>
#include <linux/cdev.h>
#include <linux/mutex.h>
+#include <linux/kref.h>
#include <media/dvbdev.h>
/* Due to enum tuner_pad_index */
diff --git a/drivers/misc/genwqe/card_dev.c b/drivers/misc/genwqe/card_dev.c
index 4441aca2280a..a2a2dd307942 100644
--- a/drivers/misc/genwqe/card_dev.c
+++ b/drivers/misc/genwqe/card_dev.c
@@ -25,6 +25,7 @@
#include <linux/wait.h>
#include <linux/delay.h>
#include <linux/atomic.h>
+#include <linux/kref.h>
#include "card_base.h"
#include "card_ddcb.h"
diff --git a/drivers/mtd/mtd_blkdevs.c b/drivers/mtd/mtd_blkdevs.c
index 7e52f6cd0cc2..00bba45a7971 100644
--- a/drivers/mtd/mtd_blkdevs.c
+++ b/drivers/mtd/mtd_blkdevs.c
@@ -20,6 +20,7 @@
#include <linux/hdreg.h>
#include <linux/mutex.h>
#include <linux/uaccess.h>
+#include <linux/kref.h>
#include "mtdcore.h"
diff --git a/drivers/net/ethernet/chelsio/inline_crypto/chtls/chtls.h b/drivers/net/ethernet/chelsio/inline_crypto/chtls/chtls.h
index 7ff82b6778ba..946e03bf687b 100644
--- a/drivers/net/ethernet/chelsio/inline_crypto/chtls/chtls.h
+++ b/drivers/net/ethernet/chelsio/inline_crypto/chtls/chtls.h
@@ -20,6 +20,7 @@
#include <crypto/scatterwalk.h>
#include <crypto/internal/hash.h>
#include <linux/tls.h>
+#include <linux/kref.h>
#include <net/tls.h>
#include <net/tls_prot.h>
#include <net/tls_toe.h>
diff --git a/drivers/net/ethernet/chelsio/inline_crypto/chtls/chtls_cm.c b/drivers/net/ethernet/chelsio/inline_crypto/chtls/chtls_cm.c
index 6f6525983130..fcff72267c1c 100644
--- a/drivers/net/ethernet/chelsio/inline_crypto/chtls/chtls_cm.c
+++ b/drivers/net/ethernet/chelsio/inline_crypto/chtls/chtls_cm.c
@@ -14,6 +14,7 @@
#include <linux/inetdevice.h>
#include <linux/ip.h>
#include <linux/tcp.h>
+#include <linux/kref.h>
#include <linux/sched/signal.h>
#include <linux/kallsyms.h>
#include <linux/kprobes.h>
diff --git a/drivers/net/ethernet/chelsio/libcxgb/libcxgb_ppm.c b/drivers/net/ethernet/chelsio/libcxgb/libcxgb_ppm.c
index 854d87e1125c..e1d418aa5253 100644
--- a/drivers/net/ethernet/chelsio/libcxgb/libcxgb_ppm.c
+++ b/drivers/net/ethernet/chelsio/libcxgb/libcxgb_ppm.c
@@ -47,6 +47,7 @@
#include <linux/skbuff.h>
#include <linux/pci.h>
#include <linux/scatterlist.h>
+#include <linux/kref.h>
#include "libcxgb_ppm.h"
diff --git a/drivers/net/ethernet/intel/ice/ice_sriov.c b/drivers/net/ethernet/intel/ice/ice_sriov.c
index a94a1c48c3de..fd87757bad43 100644
--- a/drivers/net/ethernet/intel/ice/ice_sriov.c
+++ b/drivers/net/ethernet/intel/ice/ice_sriov.c
@@ -14,6 +14,8 @@
#include "ice_vf_vsi_vlan_ops.h"
#include "ice_vlan.h"
+#include <linux/kref.h>
+
/**
* ice_free_vf_entries - Free all VF entries from the hash table
* @pf: pointer to the PF structure
diff --git a/drivers/net/ethernet/intel/ice/ice_vf_lib.c b/drivers/net/ethernet/intel/ice/ice_vf_lib.c
index 2ffdae9a82df..604effc72bb8 100644
--- a/drivers/net/ethernet/intel/ice/ice_vf_lib.c
+++ b/drivers/net/ethernet/intel/ice/ice_vf_lib.c
@@ -7,6 +7,8 @@
#include "ice_fltr.h"
#include "ice_virtchnl_allowlist.h"
+#include <linux/kref.h>
+
/* Public functions which may be accessed by all driver files */
/**
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c b/drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c
index d14459e5c04f..531ef375566c 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c
@@ -35,6 +35,7 @@
#include <linux/mlx5/driver.h>
#include <linux/mlx5/eswitch.h>
#include <linux/mlx5/vport.h>
+#include <linux/kref.h>
#include "lib/devcom.h"
#include "mlx5_core.h"
#include "eswitch.h"
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/lib/devcom.c b/drivers/net/ethernet/mellanox/mlx5/core/lib/devcom.c
index e7d59cfa8708..dbe7fb20fbc6 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/lib/devcom.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/lib/devcom.c
@@ -3,6 +3,7 @@
#include <linux/mlx5/vport.h>
#include <linux/list.h>
+#include <linux/kref.h>
#include "lib/devcom.h"
#include "mlx5_core.h"
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/uar.c b/drivers/net/ethernet/mellanox/mlx5/core/uar.c
index 1513112ecec8..a34567921588 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/uar.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/uar.c
@@ -31,6 +31,7 @@
*/
#include <linux/kernel.h>
+#include <linux/kref.h>
#include <linux/mlx5/driver.h>
#include "mlx5_core.h"
diff --git a/drivers/net/ethernet/netronome/nfp/nfpcore/nfp_cppcore.c b/drivers/net/ethernet/netronome/nfp/nfpcore/nfp_cppcore.c
index a8286d0032d1..79e2585caea2 100644
--- a/drivers/net/ethernet/netronome/nfp/nfpcore/nfp_cppcore.c
+++ b/drivers/net/ethernet/netronome/nfp/nfpcore/nfp_cppcore.c
@@ -19,6 +19,7 @@
#include <linux/sched.h>
#include <linux/slab.h>
#include <linux/wait.h>
+#include <linux/kref.h>
#include "nfp_arm.h"
#include "nfp_cpp.h"
diff --git a/drivers/net/ethernet/qlogic/qede/qede_rdma.c b/drivers/net/ethernet/qlogic/qede/qede_rdma.c
index 6304514a6f2c..f82501dbf6d2 100644
--- a/drivers/net/ethernet/qlogic/qede/qede_rdma.c
+++ b/drivers/net/ethernet/qlogic/qede/qede_rdma.c
@@ -7,6 +7,7 @@
#include <linux/pci.h>
#include <linux/netdevice.h>
#include <linux/list.h>
+#include <linux/kref.h>
#include <linux/mutex.h>
#include <linux/qed/qede_rdma.h>
#include "qede.h"
diff --git a/drivers/net/pse-pd/pse_core.c b/drivers/net/pse-pd/pse_core.c
index 146b81f08a89..a1e8b7f6e1f6 100644
--- a/drivers/net/pse-pd/pse_core.c
+++ b/drivers/net/pse-pd/pse_core.c
@@ -8,6 +8,7 @@
#include <linux/device.h>
#include <linux/of.h>
#include <linux/pse-pd/pse.h>
+#include <linux/kref.h>
static DEFINE_MUTEX(pse_list_mutex);
static LIST_HEAD(pse_controller_list);
diff --git a/drivers/net/wireless/ath/carl9170/tx.c b/drivers/net/wireless/ath/carl9170/tx.c
index 6bb9aa2bfe65..4cd2e15a6a2c 100644
--- a/drivers/net/wireless/ath/carl9170/tx.c
+++ b/drivers/net/wireless/ath/carl9170/tx.c
@@ -40,6 +40,7 @@
#include <linux/slab.h>
#include <linux/module.h>
#include <linux/etherdevice.h>
+#include <linux/kref.h>
#include <net/mac80211.h>
#include "carl9170.h"
#include "hw.h"
diff --git a/drivers/nvdimm/core.c b/drivers/nvdimm/core.c
index d91799b71d23..daf599f431eb 100644
--- a/drivers/nvdimm/core.c
+++ b/drivers/nvdimm/core.c
@@ -14,6 +14,7 @@
#include <linux/mutex.h>
#include <linux/slab.h>
#include <linux/io.h>
+#include <linux/kref.h>
#include "nd-core.h"
#include "nd.h"
diff --git a/drivers/nvdimm/dimm.c b/drivers/nvdimm/dimm.c
index 91d9163ee303..4013e842ac1f 100644
--- a/drivers/nvdimm/dimm.c
+++ b/drivers/nvdimm/dimm.c
@@ -10,6 +10,7 @@
#include <linux/slab.h>
#include <linux/mm.h>
#include <linux/nd.h>
+#include <linux/kref.h>
#include "label.h"
#include "nd.h"
diff --git a/drivers/nvdimm/dimm_devs.c b/drivers/nvdimm/dimm_devs.c
index 21498d461fde..576fdeed35d6 100644
--- a/drivers/nvdimm/dimm_devs.c
+++ b/drivers/nvdimm/dimm_devs.c
@@ -11,6 +11,7 @@
#include <linux/io.h>
#include <linux/fs.h>
#include <linux/mm.h>
+#include <linux/kref.h>
#include "nd-core.h"
#include "label.h"
#include "pmem.h"
diff --git a/drivers/of/dynamic.c b/drivers/of/dynamic.c
index 3bf27052832f..e0af9ac292d6 100644
--- a/drivers/of/dynamic.c
+++ b/drivers/of/dynamic.c
@@ -14,6 +14,7 @@
#include <linux/slab.h>
#include <linux/string.h>
#include <linux/proc_fs.h>
+#include <linux/kref.h>
#include "of_private.h"
diff --git a/drivers/of/unittest.c b/drivers/of/unittest.c
index cfd60e35a899..d920a99ecc25 100644
--- a/drivers/of/unittest.c
+++ b/drivers/of/unittest.c
@@ -11,6 +11,7 @@
#include <linux/err.h>
#include <linux/errno.h>
#include <linux/hashtable.h>
+#include <linux/kref.h>
#include <linux/libfdt.h>
#include <linux/of.h>
#include <linux/of_address.h>
diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c
index 5b1f271c6034..7cf646925192 100644
--- a/drivers/pci/hotplug/acpiphp_glue.c
+++ b/drivers/pci/hotplug/acpiphp_glue.c
@@ -37,6 +37,7 @@
#include <linux/mutex.h>
#include <linux/slab.h>
#include <linux/acpi.h>
+#include <linux/kref.h>
#include "../pci.h"
#include "acpiphp.h"
diff --git a/drivers/pci/slot.c b/drivers/pci/slot.c
index 0f87cade10f7..220212310b30 100644
--- a/drivers/pci/slot.c
+++ b/drivers/pci/slot.c
@@ -10,6 +10,7 @@
#include <linux/module.h>
#include <linux/pci.h>
#include <linux/err.h>
+#include <linux/kref.h>
#include "pci.h"
struct kset *pci_slots_kset;
diff --git a/drivers/pci/switch/switchtec.c b/drivers/pci/switch/switchtec.c
index eea031b3f0ef..b971519e5756 100644
--- a/drivers/pci/switch/switchtec.c
+++ b/drivers/pci/switch/switchtec.c
@@ -16,6 +16,7 @@
#include <linux/wait.h>
#include <linux/io-64-nonatomic-lo-hi.h>
#include <linux/nospec.h>
+#include <linux/kref.h>
MODULE_DESCRIPTION("Microsemi Switchtec(tm) PCIe Management Driver");
MODULE_VERSION("0.1");
diff --git a/drivers/rpmsg/mtk_rpmsg.c b/drivers/rpmsg/mtk_rpmsg.c
index d1213c33da20..c3a099ab2508 100644
--- a/drivers/rpmsg/mtk_rpmsg.c
+++ b/drivers/rpmsg/mtk_rpmsg.c
@@ -10,6 +10,7 @@
#include <linux/rpmsg/mtk_rpmsg.h>
#include <linux/slab.h>
#include <linux/workqueue.h>
+#include <linux/kref.h>
#include "rpmsg_internal.h"
diff --git a/drivers/rpmsg/qcom_glink_native.c b/drivers/rpmsg/qcom_glink_native.c
index 82d460ff4777..b8b1a2ff6d91 100644
--- a/drivers/rpmsg/qcom_glink_native.c
+++ b/drivers/rpmsg/qcom_glink_native.c
@@ -19,6 +19,7 @@
#include <linux/wait.h>
#include <linux/workqueue.h>
#include <linux/mailbox_client.h>
+#include <linux/kref.h>
#include "rpmsg_internal.h"
#include "qcom_glink_native.h"
diff --git a/drivers/rpmsg/qcom_smd.c b/drivers/rpmsg/qcom_smd.c
index 43f601c84b4f..e464ad92b818 100644
--- a/drivers/rpmsg/qcom_smd.c
+++ b/drivers/rpmsg/qcom_smd.c
@@ -20,6 +20,7 @@
#include <linux/wait.h>
#include <linux/rpmsg.h>
#include <linux/rpmsg/qcom_smd.h>
+#include <linux/kref.h>
#include "rpmsg_internal.h"
diff --git a/drivers/rpmsg/virtio_rpmsg_bus.c b/drivers/rpmsg/virtio_rpmsg_bus.c
index 1062939c3264..7cd43e2bb13a 100644
--- a/drivers/rpmsg/virtio_rpmsg_bus.c
+++ b/drivers/rpmsg/virtio_rpmsg_bus.c
@@ -15,6 +15,7 @@
#include <linux/idr.h>
#include <linux/jiffies.h>
#include <linux/kernel.h>
+#include <linux/kref.h>
#include <linux/module.h>
#include <linux/mutex.h>
#include <linux/rpmsg.h>
diff --git a/drivers/scsi/bnx2fc/bnx2fc_els.c b/drivers/scsi/bnx2fc/bnx2fc_els.c
index 754f2e82d955..3b1a9ac9fd9c 100644
--- a/drivers/scsi/bnx2fc/bnx2fc_els.c
+++ b/drivers/scsi/bnx2fc/bnx2fc_els.c
@@ -16,6 +16,8 @@
#include "bnx2fc.h"
+#include <linux/kref.h>
+
static void bnx2fc_logo_resp(struct fc_seq *seq, struct fc_frame *fp,
void *arg);
static void bnx2fc_flogi_resp(struct fc_seq *seq, struct fc_frame *fp,
diff --git a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
index 1078c20c5ef6..5f7fce039d6f 100644
--- a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
+++ b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
@@ -17,6 +17,7 @@
#include "bnx2fc.h"
#include <linux/ethtool.h>
+#include <linux/kref.h>
static struct list_head adapter_list;
static struct list_head if_list;
diff --git a/drivers/scsi/bnx2fc/bnx2fc_hwi.c b/drivers/scsi/bnx2fc/bnx2fc_hwi.c
index 090d436bcef8..cf2052f6f0b7 100644
--- a/drivers/scsi/bnx2fc/bnx2fc_hwi.c
+++ b/drivers/scsi/bnx2fc/bnx2fc_hwi.c
@@ -15,6 +15,8 @@
#include "bnx2fc.h"
+#include <linux/kref.h>
+
DECLARE_PER_CPU(struct bnx2fc_percpu_s, bnx2fc_percpu);
static void bnx2fc_fastpath_notification(struct bnx2fc_hba *hba,
diff --git a/drivers/scsi/bnx2fc/bnx2fc_io.c b/drivers/scsi/bnx2fc/bnx2fc_io.c
index 33057908f147..7595fbd7fb02 100644
--- a/drivers/scsi/bnx2fc/bnx2fc_io.c
+++ b/drivers/scsi/bnx2fc/bnx2fc_io.c
@@ -14,6 +14,8 @@
#include "bnx2fc.h"
+#include <linux/kref.h>
+
#define RESERVE_FREE_LIST_INDEX num_possible_cpus()
static int bnx2fc_split_bd(struct bnx2fc_cmd *io_req, u64 addr, int sg_len,
diff --git a/drivers/scsi/bnx2fc/bnx2fc_tgt.c b/drivers/scsi/bnx2fc/bnx2fc_tgt.c
index 2c246e80c1c4..9d474ad61c3f 100644
--- a/drivers/scsi/bnx2fc/bnx2fc_tgt.c
+++ b/drivers/scsi/bnx2fc/bnx2fc_tgt.c
@@ -14,6 +14,9 @@
*/
#include "bnx2fc.h"
+
+#include <linux/kref.h>
+
static void bnx2fc_upld_timer(struct timer_list *t);
static void bnx2fc_ofld_timer(struct timer_list *t);
static int bnx2fc_init_tgt(struct bnx2fc_rport *tgt,
diff --git a/drivers/scsi/ch.c b/drivers/scsi/ch.c
index 1befcd5b2a0f..34543cf1a193 100644
--- a/drivers/scsi/ch.c
+++ b/drivers/scsi/ch.c
@@ -24,6 +24,7 @@
#include <linux/mutex.h>
#include <linux/idr.h>
#include <linux/slab.h>
+#include <linux/kref.h>
#include <scsi/scsi.h>
#include <scsi/scsi_cmnd.h>
diff --git a/drivers/scsi/cxgbi/libcxgbi.h b/drivers/scsi/cxgbi/libcxgbi.h
index d92cf1dccc2f..d33f45d78dbe 100644
--- a/drivers/scsi/cxgbi/libcxgbi.h
+++ b/drivers/scsi/cxgbi/libcxgbi.h
@@ -15,6 +15,7 @@
#define __LIBCXGBI_H__
#include <linux/kernel.h>
+#include <linux/kref.h>
#include <linux/errno.h>
#include <linux/types.h>
#include <linux/debugfs.h>
diff --git a/drivers/scsi/device_handler/scsi_dh_alua.c b/drivers/scsi/device_handler/scsi_dh_alua.c
index a226dc1b65d7..671730961232 100644
--- a/drivers/scsi/device_handler/scsi_dh_alua.c
+++ b/drivers/scsi/device_handler/scsi_dh_alua.c
@@ -7,6 +7,7 @@
*/
#include <linux/slab.h>
#include <linux/delay.h>
+#include <linux/kref.h>
#include <linux/module.h>
#include <asm/unaligned.h>
#include <scsi/scsi.h>
diff --git a/drivers/scsi/device_handler/scsi_dh_rdac.c b/drivers/scsi/device_handler/scsi_dh_rdac.c
index f8a09e3eba58..584c3eb2a34f 100644
--- a/drivers/scsi/device_handler/scsi_dh_rdac.c
+++ b/drivers/scsi/device_handler/scsi_dh_rdac.c
@@ -25,6 +25,7 @@
#include <linux/workqueue.h>
#include <linux/slab.h>
#include <linux/module.h>
+#include <linux/kref.h>
#define RDAC_NAME "rdac"
#define RDAC_RETRY_COUNT 5
diff --git a/drivers/scsi/elx/efct/efct_hw.c b/drivers/scsi/elx/efct/efct_hw.c
index 5a5525054d71..6be1d4043dda 100644
--- a/drivers/scsi/elx/efct/efct_hw.c
+++ b/drivers/scsi/elx/efct/efct_hw.c
@@ -8,6 +8,8 @@
#include "efct_hw.h"
#include "efct_unsol.h"
+#include <linux/kref.h>
+
struct efct_hw_link_stat_cb_arg {
void (*cb)(int status, u32 num_counters,
struct efct_hw_link_stat_counts *counters, void *arg);
diff --git a/drivers/scsi/elx/efct/efct_io.c b/drivers/scsi/elx/efct/efct_io.c
index c612f0a48839..bc2a8361b32c 100644
--- a/drivers/scsi/elx/efct/efct_io.c
+++ b/drivers/scsi/elx/efct/efct_io.c
@@ -8,6 +8,8 @@
#include "efct_hw.h"
#include "efct_io.h"
+#include <linux/kref.h>
+
struct efct_io_pool {
struct efct *efct;
spinlock_t lock; /* IO pool lock */
diff --git a/drivers/scsi/elx/efct/efct_lio.c b/drivers/scsi/elx/efct/efct_lio.c
index 6a6ec32c46bd..435b18877277 100644
--- a/drivers/scsi/elx/efct/efct_lio.c
+++ b/drivers/scsi/elx/efct/efct_lio.c
@@ -9,6 +9,8 @@
#include "efct_driver.h"
#include "efct_lio.h"
+#include <linux/kref.h>
+
/*
* lio_wq is used to call the LIO backed during creation or deletion of
* sessions. This brings serialization to the session management as we create
diff --git a/drivers/scsi/elx/efct/efct_scsi.c b/drivers/scsi/elx/efct/efct_scsi.c
index afb154992053..b219e56e40b9 100644
--- a/drivers/scsi/elx/efct/efct_scsi.c
+++ b/drivers/scsi/elx/efct/efct_scsi.c
@@ -7,6 +7,8 @@
#include "efct_driver.h"
#include "efct_hw.h"
+#include <linux/kref.h>
+
#define enable_tsend_auto_resp(efct) 1
#define enable_treceive_auto_resp(efct) 0
diff --git a/drivers/scsi/elx/efct/efct_unsol.c b/drivers/scsi/elx/efct/efct_unsol.c
index e6addab66a60..51db356a5122 100644
--- a/drivers/scsi/elx/efct/efct_unsol.c
+++ b/drivers/scsi/elx/efct/efct_unsol.c
@@ -7,6 +7,8 @@
#include "efct_driver.h"
#include "efct_unsol.h"
+#include <linux/kref.h>
+
#define frame_printf(efct, hdr, fmt, ...) \
do { \
char s_id_text[16]; \
diff --git a/drivers/scsi/elx/libefc/efc_domain.c b/drivers/scsi/elx/libefc/efc_domain.c
index ca9d7ff2c0d2..5b0943ea2bcb 100644
--- a/drivers/scsi/elx/libefc/efc_domain.c
+++ b/drivers/scsi/elx/libefc/efc_domain.c
@@ -10,6 +10,8 @@
#include "efc.h"
+#include <linux/kref.h>
+
int
efc_domain_cb(void *arg, int event, void *data)
{
diff --git a/drivers/scsi/elx/libefc/efc_els.c b/drivers/scsi/elx/libefc/efc_els.c
index 84bc81d7ce76..49d1446b826a 100644
--- a/drivers/scsi/elx/libefc/efc_els.c
+++ b/drivers/scsi/elx/libefc/efc_els.c
@@ -11,6 +11,7 @@
#include "efc.h"
#include "efc_els.h"
#include "../libefc_sli/sli4.h"
+#include <linux/kref.h>
#define EFC_LOG_ENABLE_ELS_TRACE(efc) \
(((efc) != NULL) ? (((efc)->logmask & (1U << 1)) != 0) : 0)
diff --git a/drivers/scsi/elx/libefc/efc_node.c b/drivers/scsi/elx/libefc/efc_node.c
index a1b4ce6a27b4..3dbb95aa5727 100644
--- a/drivers/scsi/elx/libefc/efc_node.c
+++ b/drivers/scsi/elx/libefc/efc_node.c
@@ -6,6 +6,8 @@
#include "efc.h"
+#include <linux/kref.h>
+
int
efc_remote_node_cb(void *arg, int event, void *data)
{
diff --git a/drivers/scsi/elx/libefc/efc_nport.c b/drivers/scsi/elx/libefc/efc_nport.c
index 2e83a667901f..84dcd6cc445e 100644
--- a/drivers/scsi/elx/libefc/efc_nport.c
+++ b/drivers/scsi/elx/libefc/efc_nport.c
@@ -27,6 +27,8 @@
#include "efc.h"
+#include <linux/kref.h>
+
void
efc_nport_cb(void *arg, int event, void *data)
{
diff --git a/drivers/scsi/fcoe/fcoe_ctlr.c b/drivers/scsi/fcoe/fcoe_ctlr.c
index 19eee108db02..06aed8faebd5 100644
--- a/drivers/scsi/fcoe/fcoe_ctlr.c
+++ b/drivers/scsi/fcoe/fcoe_ctlr.c
@@ -20,6 +20,7 @@
#include <linux/errno.h>
#include <linux/bitops.h>
#include <linux/slab.h>
+#include <linux/kref.h>
#include <net/rtnetlink.h>
#include <scsi/fc/fc_els.h>
diff --git a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c
index d7f51b84f3c7..ca4a8664a533 100644
--- a/drivers/scsi/hosts.c
+++ b/drivers/scsi/hosts.c
@@ -35,6 +35,7 @@
#include <linux/platform_device.h>
#include <linux/pm_runtime.h>
#include <linux/idr.h>
+#include <linux/kref.h>
#include <scsi/scsi_device.h>
#include <scsi/scsi_host.h>
#include <scsi/scsi_transport.h>
diff --git a/drivers/scsi/libfc/fc_disc.c b/drivers/scsi/libfc/fc_disc.c
index 384f48ff64d7..b6e43d94aab1 100644
--- a/drivers/scsi/libfc/fc_disc.c
+++ b/drivers/scsi/libfc/fc_disc.c
@@ -25,6 +25,7 @@
#include <linux/err.h>
#include <linux/export.h>
#include <linux/list.h>
+#include <linux/kref.h>
#include <asm/unaligned.h>
diff --git a/drivers/scsi/libfc/fc_exch.c b/drivers/scsi/libfc/fc_exch.c
index 1d91c457527f..783a3e1ddf2b 100644
--- a/drivers/scsi/libfc/fc_exch.c
+++ b/drivers/scsi/libfc/fc_exch.c
@@ -16,6 +16,7 @@
#include <linux/err.h>
#include <linux/export.h>
#include <linux/log2.h>
+#include <linux/kref.h>
#include <scsi/fc/fc_fc2.h>
diff --git a/drivers/scsi/libfc/fc_lport.c b/drivers/scsi/libfc/fc_lport.c
index ab06e9aeb613..210222ec25c1 100644
--- a/drivers/scsi/libfc/fc_lport.c
+++ b/drivers/scsi/libfc/fc_lport.c
@@ -79,6 +79,7 @@
#include <linux/delay.h>
#include <linux/module.h>
#include <linux/slab.h>
+#include <linux/kref.h>
#include <asm/unaligned.h>
#include <scsi/fc/fc_gs.h>
diff --git a/drivers/scsi/libfc/fc_rport.c b/drivers/scsi/libfc/fc_rport.c
index 33da3c1085f0..13f7745d1605 100644
--- a/drivers/scsi/libfc/fc_rport.c
+++ b/drivers/scsi/libfc/fc_rport.c
@@ -54,6 +54,7 @@
#include <linux/workqueue.h>
#include <linux/export.h>
#include <linux/rculist.h>
+#include <linux/kref.h>
#include <asm/unaligned.h>
diff --git a/drivers/scsi/libsas/sas_internal.h b/drivers/scsi/libsas/sas_internal.h
index 3804aef165ad..97903a3fecfd 100644
--- a/drivers/scsi/libsas/sas_internal.h
+++ b/drivers/scsi/libsas/sas_internal.h
@@ -15,6 +15,7 @@
#include <scsi/libsas.h>
#include <scsi/sas_ata.h>
#include <linux/pm_runtime.h>
+#include <linux/kref.h>
#ifdef pr_fmt
#undef pr_fmt
diff --git a/drivers/scsi/lpfc/lpfc_bsg.c b/drivers/scsi/lpfc/lpfc_bsg.c
index 595dca92e8db..ce6fa90cdb41 100644
--- a/drivers/scsi/lpfc/lpfc_bsg.c
+++ b/drivers/scsi/lpfc/lpfc_bsg.c
@@ -28,6 +28,7 @@
#include <linux/list.h>
#include <linux/bsg-lib.h>
#include <linux/vmalloc.h>
+#include <linux/kref.h>
#include <scsi/scsi.h>
#include <scsi/scsi_host.h>
diff --git a/drivers/scsi/lpfc/lpfc_debugfs.c b/drivers/scsi/lpfc/lpfc_debugfs.c
index ea9b42225e62..d7a3ea3abdb1 100644
--- a/drivers/scsi/lpfc/lpfc_debugfs.c
+++ b/drivers/scsi/lpfc/lpfc_debugfs.c
@@ -27,6 +27,7 @@
#include <linux/idr.h>
#include <linux/interrupt.h>
#include <linux/kthread.h>
+#include <linux/kref.h>
#include <linux/slab.h>
#include <linux/pci.h>
#include <linux/spinlock.h>
diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c
index 4d723200690a..de690023b63f 100644
--- a/drivers/scsi/lpfc/lpfc_els.c
+++ b/drivers/scsi/lpfc/lpfc_els.c
@@ -26,6 +26,7 @@
#include <linux/slab.h>
#include <linux/interrupt.h>
#include <linux/delay.h>
+#include <linux/kref.h>
#include <scsi/scsi.h>
#include <scsi/scsi_device.h>
diff --git a/drivers/scsi/lpfc/lpfc_hbadisc.c b/drivers/scsi/lpfc/lpfc_hbadisc.c
index f80bbc315f4c..48fe93633c2f 100644
--- a/drivers/scsi/lpfc/lpfc_hbadisc.c
+++ b/drivers/scsi/lpfc/lpfc_hbadisc.c
@@ -29,6 +29,7 @@
#include <linux/interrupt.h>
#include <linux/lockdep.h>
#include <linux/utsname.h>
+#include <linux/kref.h>
#include <scsi/scsi.h>
#include <scsi/scsi_device.h>
diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
index ee966d95b470..e97255e88ab6 100644
--- a/drivers/scsi/lpfc/lpfc_init.c
+++ b/drivers/scsi/lpfc/lpfc_init.c
@@ -28,6 +28,7 @@
#include <linux/interrupt.h>
#include <linux/module.h>
#include <linux/kthread.h>
+#include <linux/kref.h>
#include <linux/pci.h>
#include <linux/spinlock.h>
#include <linux/sched/clock.h>
diff --git a/drivers/scsi/lpfc/lpfc_nportdisc.c b/drivers/scsi/lpfc/lpfc_nportdisc.c
index d9074929fbab..5ea5b829fe65 100644
--- a/drivers/scsi/lpfc/lpfc_nportdisc.c
+++ b/drivers/scsi/lpfc/lpfc_nportdisc.c
@@ -25,6 +25,7 @@
#include <linux/pci.h>
#include <linux/slab.h>
#include <linux/interrupt.h>
+#include <linux/kref.h>
#include <scsi/scsi.h>
#include <scsi/scsi_device.h>
diff --git a/drivers/scsi/lpfc/lpfc_nvme.c b/drivers/scsi/lpfc/lpfc_nvme.c
index 128fc1bab586..b8dfc7610a3b 100644
--- a/drivers/scsi/lpfc/lpfc_nvme.c
+++ b/drivers/scsi/lpfc/lpfc_nvme.c
@@ -23,6 +23,7 @@
#include <linux/pci.h>
#include <linux/slab.h>
#include <linux/interrupt.h>
+#include <linux/kref.h>
#include <linux/delay.h>
#include <asm/unaligned.h>
#include <linux/crc-t10dif.h>
diff --git a/drivers/scsi/lpfc/lpfc_nvmet.c b/drivers/scsi/lpfc/lpfc_nvmet.c
index 425328d9c2d8..9c32e48e92a1 100644
--- a/drivers/scsi/lpfc/lpfc_nvmet.c
+++ b/drivers/scsi/lpfc/lpfc_nvmet.c
@@ -23,6 +23,7 @@
#include <linux/pci.h>
#include <linux/slab.h>
#include <linux/interrupt.h>
+#include <linux/kref.h>
#include <linux/delay.h>
#include <asm/unaligned.h>
#include <linux/crc-t10dif.h>
diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c
index 706985358c6a..6c780b8525f7 100644
--- a/drivers/scsi/lpfc/lpfc_sli.c
+++ b/drivers/scsi/lpfc/lpfc_sli.c
@@ -25,6 +25,7 @@
#include <linux/pci.h>
#include <linux/interrupt.h>
#include <linux/delay.h>
+#include <linux/kref.h>
#include <linux/slab.h>
#include <linux/lockdep.h>
diff --git a/drivers/scsi/mpi3mr/mpi3mr.h b/drivers/scsi/mpi3mr/mpi3mr.h
index 3de1ee05c44e..0d2c32c8d9ff 100644
--- a/drivers/scsi/mpi3mr/mpi3mr.h
+++ b/drivers/scsi/mpi3mr/mpi3mr.h
@@ -20,6 +20,7 @@
#include <linux/io.h>
#include <linux/interrupt.h>
#include <linux/kernel.h>
+#include <linux/kref.h>
#include <linux/miscdevice.h>
#include <linux/module.h>
#include <linux/pci.h>
diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.h b/drivers/scsi/mpt3sas/mpt3sas_base.h
index bf100a4ebfc3..c561ec02c57a 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_base.h
+++ b/drivers/scsi/mpt3sas/mpt3sas_base.h
@@ -68,6 +68,7 @@
#include <linux/pci.h>
#include <linux/poll.h>
#include <linux/irq_poll.h>
+#include <linux/kref.h>
#include "mpt3sas_debug.h"
#include "mpt3sas_trigger_diag.h"
diff --git a/drivers/scsi/qedf/qedf_els.c b/drivers/scsi/qedf/qedf_els.c
index 1ff5bc314fc0..44fd48a14abb 100644
--- a/drivers/scsi/qedf/qedf_els.c
+++ b/drivers/scsi/qedf/qedf_els.c
@@ -5,6 +5,8 @@
*/
#include "qedf.h"
+#include <linux/kref.h>
+
/* It's assumed that the lock is held when calling this function. */
static int qedf_initiate_els(struct qedf_rport *fcport, unsigned int op,
void *data, uint32_t data_len,
diff --git a/drivers/scsi/qedf/qedf_io.c b/drivers/scsi/qedf/qedf_io.c
index bf921caaf6ae..71a4ba767212 100644
--- a/drivers/scsi/qedf/qedf_io.c
+++ b/drivers/scsi/qedf/qedf_io.c
@@ -5,6 +5,7 @@
*/
#include <linux/spinlock.h>
#include <linux/vmalloc.h>
+#include <linux/kref.h>
#include "qedf.h"
#include <scsi/scsi_tcq.h>
diff --git a/drivers/scsi/qedf/qedf_main.c b/drivers/scsi/qedf/qedf_main.c
index a58353b7b4e8..a10e77fc79d4 100644
--- a/drivers/scsi/qedf/qedf_main.c
+++ b/drivers/scsi/qedf/qedf_main.c
@@ -20,6 +20,7 @@
#include <linux/if_ether.h>
#include <linux/if_vlan.h>
#include <linux/cpu.h>
+#include <linux/kref.h>
#include "qedf.h"
#include "qedf_dbg.h"
#include <uapi/linux/pci_regs.h>
diff --git a/drivers/scsi/qla2xxx/qla_inline.h b/drivers/scsi/qla2xxx/qla_inline.h
index a4a56ab0ba74..f12eb8bea8e6 100644
--- a/drivers/scsi/qla2xxx/qla_inline.h
+++ b/drivers/scsi/qla2xxx/qla_inline.h
@@ -5,6 +5,9 @@
*/
#include "qla_target.h"
+
+#include <linux/kref.h>
+
/**
* qla24xx_calc_iocbs() - Determine number of Command Type 3 and
* Continuation Type 1 IOCBs to allocate.
diff --git a/drivers/scsi/qla4xxx/ql4_isr.c b/drivers/scsi/qla4xxx/ql4_isr.c
index cf52258ecdde..c6b143cfd84a 100644
--- a/drivers/scsi/qla4xxx/ql4_isr.c
+++ b/drivers/scsi/qla4xxx/ql4_isr.c
@@ -9,6 +9,8 @@
#include "ql4_dbg.h"
#include "ql4_inline.h"
+#include <linux/kref.h>
+
/**
* qla4xxx_copy_sense - copy sense data into cmd sense buffer
* @ha: Pointer to host adapter structure.
diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c
index 675332e49a7b..b6faa09eedb3 100644
--- a/drivers/scsi/qla4xxx/ql4_os.c
+++ b/drivers/scsi/qla4xxx/ql4_os.c
@@ -8,6 +8,7 @@
#include <linux/blkdev.h>
#include <linux/iscsi_boot_sysfs.h>
#include <linux/inet.h>
+#include <linux/kref.h>
#include <scsi/scsi_tcq.h>
#include <scsi/scsicam.h>
diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c
index 70c0319be34c..ebfe960b2f45 100644
--- a/drivers/scsi/scsi_scan.c
+++ b/drivers/scsi/scsi_scan.c
@@ -35,6 +35,7 @@
#include <linux/spinlock.h>
#include <linux/async.h>
#include <linux/slab.h>
+#include <linux/kref.h>
#include <asm/unaligned.h>
#include <scsi/scsi.h>
diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c
index 24f6eefb6803..dbd5e097a1fd 100644
--- a/drivers/scsi/scsi_sysfs.c
+++ b/drivers/scsi/scsi_sysfs.c
@@ -14,6 +14,7 @@
#include <linux/device.h>
#include <linux/pm_runtime.h>
#include <linux/bsg.h>
+#include <linux/kref.h>
#include <scsi/scsi.h>
#include <scsi/scsi_device.h>
diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c
index 86210e4dd0d3..ef420343c5b5 100644
--- a/drivers/scsi/sg.c
+++ b/drivers/scsi/sg.c
@@ -48,6 +48,7 @@ static int sg_version_num = 30536; /* 2 digits for each component */
#include <linux/ratelimit.h>
#include <linux/uio.h>
#include <linux/cred.h> /* for sg_check_file_access() */
+#include <linux/kref.h>
#include <scsi/scsi.h>
#include <scsi/scsi_cmnd.h>
diff --git a/drivers/soc/qcom/smem_state.c b/drivers/soc/qcom/smem_state.c
index e848cc9a3cf8..ded25c077ec5 100644
--- a/drivers/soc/qcom/smem_state.c
+++ b/drivers/soc/qcom/smem_state.c
@@ -9,6 +9,7 @@
#include <linux/of.h>
#include <linux/slab.h>
#include <linux/soc/qcom/smem_state.h>
+#include <linux/kref.h>
static LIST_HEAD(smem_states);
static DEFINE_MUTEX(list_lock);
diff --git a/drivers/staging/greybus/authentication.c b/drivers/staging/greybus/authentication.c
index d53e58f92e81..6d900eebfcb3 100644
--- a/drivers/staging/greybus/authentication.c
+++ b/drivers/staging/greybus/authentication.c
@@ -11,6 +11,7 @@
#include <linux/fs.h>
#include <linux/ioctl.h>
#include <linux/uaccess.h>
+#include <linux/kref.h>
#include "greybus_authentication.h"
#include "firmware.h"
diff --git a/drivers/staging/greybus/fw-download.c b/drivers/staging/greybus/fw-download.c
index 2a5c6d1b049c..455888dcb13b 100644
--- a/drivers/staging/greybus/fw-download.c
+++ b/drivers/staging/greybus/fw-download.c
@@ -8,6 +8,7 @@
#include <linux/firmware.h>
#include <linux/jiffies.h>
+#include <linux/kref.h>
#include <linux/mutex.h>
#include <linux/workqueue.h>
#include <linux/greybus.h>
diff --git a/drivers/staging/greybus/fw-management.c b/drivers/staging/greybus/fw-management.c
index 3054f084d777..33073951a2cb 100644
--- a/drivers/staging/greybus/fw-management.c
+++ b/drivers/staging/greybus/fw-management.c
@@ -14,6 +14,7 @@
#include <linux/ioctl.h>
#include <linux/uaccess.h>
#include <linux/greybus.h>
+#include <linux/kref.h>
#include "firmware.h"
#include "greybus_firmware.h"
diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c
index 1d25e64b068a..3a59f3732047 100644
--- a/drivers/target/iscsi/iscsi_target.c
+++ b/drivers/target/iscsi/iscsi_target.c
@@ -16,6 +16,7 @@
#include <linux/vmalloc.h>
#include <linux/idr.h>
#include <linux/delay.h>
+#include <linux/kref.h>
#include <linux/sched/signal.h>
#include <asm/unaligned.h>
#include <linux/inet.h>
diff --git a/drivers/target/iscsi/iscsi_target_nego.c b/drivers/target/iscsi/iscsi_target_nego.c
index fa3fb5f4e6bc..a10e01a34b49 100644
--- a/drivers/target/iscsi/iscsi_target_nego.c
+++ b/drivers/target/iscsi/iscsi_target_nego.c
@@ -12,6 +12,7 @@
#include <linux/kthread.h>
#include <linux/slab.h>
#include <linux/sched/signal.h>
+#include <linux/kref.h>
#include <net/sock.h>
#include <trace/events/sock.h>
#include <scsi/iscsi_proto.h>
diff --git a/drivers/target/iscsi/iscsi_target_tpg.c b/drivers/target/iscsi/iscsi_target_tpg.c
index f7bac98fd4fe..f6ed6a65e90e 100644
--- a/drivers/target/iscsi/iscsi_target_tpg.c
+++ b/drivers/target/iscsi/iscsi_target_tpg.c
@@ -9,6 +9,7 @@
******************************************************************************/
#include <linux/slab.h>
+#include <linux/kref.h>
#include <target/target_core_base.h>
#include <target/target_core_fabric.h>
#include <target/iscsi/iscsi_target_core.h>
diff --git a/drivers/target/target_core_device.c b/drivers/target/target_core_device.c
index 7a85e6477e46..f9abc0895dbd 100644
--- a/drivers/target/target_core_device.c
+++ b/drivers/target/target_core_device.c
@@ -17,6 +17,7 @@
#include <linux/timer.h>
#include <linux/slab.h>
#include <linux/spinlock.h>
+#include <linux/kref.h>
#include <linux/kthread.h>
#include <linux/in.h>
#include <linux/export.h>
diff --git a/drivers/target/target_core_pr.c b/drivers/target/target_core_pr.c
index 80b7d85030d0..a566d4d38192 100644
--- a/drivers/target/target_core_pr.c
+++ b/drivers/target/target_core_pr.c
@@ -18,6 +18,7 @@
#include <linux/file.h>
#include <linux/fcntl.h>
#include <linux/fs.h>
+#include <linux/kref.h>
#include <scsi/scsi_proto.h>
#include <asm/unaligned.h>
diff --git a/drivers/target/target_core_tmr.c b/drivers/target/target_core_tmr.c
index 4718db628222..16da808bcc61 100644
--- a/drivers/target/target_core_tmr.c
+++ b/drivers/target/target_core_tmr.c
@@ -14,6 +14,8 @@
#include <linux/spinlock.h>
#include <linux/list.h>
#include <linux/export.h>
+#include <linux/workqueue.h>
+#include <linux/kref.h>
#include <target/target_core_base.h>
#include <target/target_core_backend.h>
diff --git a/drivers/target/target_core_tpg.c b/drivers/target/target_core_tpg.c
index c0e429e5ef31..881b5d362064 100644
--- a/drivers/target/target_core_tpg.c
+++ b/drivers/target/target_core_tpg.c
@@ -17,6 +17,7 @@
#include <linux/spinlock.h>
#include <linux/in.h>
#include <linux/export.h>
+#include <linux/kref.h>
#include <net/sock.h>
#include <net/tcp.h>
#include <scsi/scsi_proto.h>
diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c
index 73d0d6133ac8..03ed135934b0 100644
--- a/drivers/target/target_core_transport.c
+++ b/drivers/target/target_core_transport.c
@@ -16,6 +16,7 @@
#include <linux/timer.h>
#include <linux/slab.h>
#include <linux/spinlock.h>
+#include <linux/kref.h>
#include <linux/kthread.h>
#include <linux/in.h>
#include <linux/cdrom.h>
diff --git a/drivers/target/target_core_user.c b/drivers/target/target_core_user.c
index 7eb94894bd68..13817d9b18ca 100644
--- a/drivers/target/target_core_user.c
+++ b/drivers/target/target_core_user.c
@@ -21,6 +21,7 @@
#include <linux/mutex.h>
#include <linux/workqueue.h>
#include <linux/pagemap.h>
+#include <linux/kref.h>
#include <net/genetlink.h>
#include <scsi/scsi_common.h>
#include <scsi/scsi_proto.h>
diff --git a/drivers/usb/core/config.c b/drivers/usb/core/config.c
index 7f8d33f92ddb..095a913b7b2a 100644
--- a/drivers/usb/core/config.c
+++ b/drivers/usb/core/config.c
@@ -10,6 +10,7 @@
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/device.h>
+#include <linux/kref.h>
#include <asm/byteorder.h>
#include "usb.h"
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
index 14fc28c4cf48..d311effc69a4 100644
--- a/drivers/usb/core/hcd.c
+++ b/drivers/usb/core/hcd.c
@@ -32,6 +32,7 @@
#include <linux/genalloc.h>
#include <linux/io.h>
#include <linux/kcov.h>
+#include <linux/kref.h>
#include <linux/phy/phy.h>
#include <linux/usb.h>
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index 3ee8455585b6..8813cd02d505 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -31,6 +31,7 @@
#include <linux/random.h>
#include <linux/pm_qos.h>
#include <linux/kobject.h>
+#include <linux/kref.h>
#include <linux/bitfield.h>
#include <linux/uaccess.h>
diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c
index 077dfe48d01c..522b571aaba1 100644
--- a/drivers/usb/core/message.c
+++ b/drivers/usb/core/message.c
@@ -21,6 +21,7 @@
#include <linux/usb/quirks.h>
#include <linux/usb/hcd.h> /* for usbcore internals */
#include <linux/usb/of.h>
+#include <linux/kref.h>
#include <asm/byteorder.h>
#include "usb.h"
diff --git a/drivers/usb/core/urb.c b/drivers/usb/core/urb.c
index 7576920e2d5a..0b66127e3b8f 100644
--- a/drivers/usb/core/urb.c
+++ b/drivers/usb/core/urb.c
@@ -13,6 +13,7 @@
#include <linux/wait.h>
#include <linux/usb/hcd.h>
#include <linux/scatterlist.h>
+#include <linux/kref.h>
#define to_urb(d) container_of(d, struct urb, kref)
diff --git a/drivers/usb/gadget/function/f_fs.c b/drivers/usb/gadget/function/f_fs.c
index be3851cffb73..c71496856fcc 100644
--- a/drivers/usb/gadget/function/f_fs.c
+++ b/drivers/usb/gadget/function/f_fs.c
@@ -25,6 +25,7 @@
#include <linux/sched/signal.h>
#include <linux/uio.h>
#include <linux/vmalloc.h>
+#include <linux/kref.h>
#include <asm/unaligned.h>
#include <linux/usb/ccid.h>
diff --git a/drivers/usb/host/oxu210hp-hcd.c b/drivers/usb/host/oxu210hp-hcd.c
index d467472f9d3c..98f5c649df3d 100644
--- a/drivers/usb/host/oxu210hp-hcd.c
+++ b/drivers/usb/host/oxu210hp-hcd.c
@@ -25,6 +25,7 @@
#include <linux/dma-mapping.h>
#include <linux/io.h>
#include <linux/iopoll.h>
+#include <linux/kref.h>
#include <asm/irq.h>
#include <asm/unaligned.h>
diff --git a/drivers/usb/misc/usblcd.c b/drivers/usb/misc/usblcd.c
index bb546f624a45..b91645d9b3c4 100644
--- a/drivers/usb/misc/usblcd.c
+++ b/drivers/usb/misc/usblcd.c
@@ -21,6 +21,7 @@
#include <linux/rwsem.h>
#include <linux/uaccess.h>
#include <linux/usb.h>
+#include <linux/kref.h>
#define DRIVER_VERSION "USBLCD Driver Version 1.05"
diff --git a/drivers/vfio/container.c b/drivers/vfio/container.c
index d53d08f16973..7ef54f61c423 100644
--- a/drivers/vfio/container.c
+++ b/drivers/vfio/container.c
@@ -9,6 +9,7 @@
#include <linux/fs.h>
#include <linux/capability.h>
#include <linux/iommu.h>
+#include <linux/kref.h>
#include <linux/miscdevice.h>
#include <linux/vfio.h>
#include <uapi/linux/vfio.h>
diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c
index 282aac45c690..f7e467a946e8 100644
--- a/drivers/vhost/scsi.c
+++ b/drivers/vhost/scsi.c
@@ -36,6 +36,7 @@
#include <linux/virtio_scsi.h>
#include <linux/llist.h>
#include <linux/bitmap.h>
+#include <linux/kref.h>
#include "vhost.h"
diff --git a/drivers/video/fbdev/smscufx.c b/drivers/video/fbdev/smscufx.c
index 35d682b110c4..2b6143c7203c 100644
--- a/drivers/video/fbdev/smscufx.c
+++ b/drivers/video/fbdev/smscufx.c
@@ -29,6 +29,7 @@
#include <linux/vmalloc.h>
#include <linux/slab.h>
#include <linux/delay.h>
+#include <linux/kref.h>
#include "edid.h"
#define check_warn(status, fmt, args...) \
diff --git a/drivers/xen/xen-scsiback.c b/drivers/xen/xen-scsiback.c
index 0c51edfd13dc..946bcd5e0eea 100644
--- a/drivers/xen/xen-scsiback.c
+++ b/drivers/xen/xen-scsiback.c
@@ -44,6 +44,7 @@
#include <linux/delay.h>
#include <linux/spinlock.h>
#include <linux/configfs.h>
+#include <linux/kref.h>
#include <generated/utsrelease.h>
diff --git a/drivers/xen/xenbus/xenbus_dev_frontend.c b/drivers/xen/xenbus/xenbus_dev_frontend.c
index 6f56640092a9..5a639f2ff6bb 100644
--- a/drivers/xen/xenbus/xenbus_dev_frontend.c
+++ b/drivers/xen/xenbus/xenbus_dev_frontend.c
@@ -56,6 +56,7 @@
#include <linux/slab.h>
#include <linux/miscdevice.h>
#include <linux/workqueue.h>
+#include <linux/kref.h>
#include <xen/xenbus.h>
#include <xen/xen.h>
diff --git a/fs/configfs/item.c b/fs/configfs/item.c
index 254170a82aa3..07d43d0a8410 100644
--- a/fs/configfs/item.c
+++ b/fs/configfs/item.c
@@ -15,6 +15,7 @@
#include <linux/module.h>
#include <linux/stat.h>
#include <linux/slab.h>
+#include <linux/kref.h>
#include <linux/configfs.h>
diff --git a/include/drm/drm_atomic.h b/include/drm/drm_atomic.h
index cf8e1220a4ac..fb92a70a83dc 100644
--- a/include/drm/drm_atomic.h
+++ b/include/drm/drm_atomic.h
@@ -31,6 +31,8 @@
#include <drm/drm_crtc.h>
#include <drm/drm_util.h>
+#include <linux/kref.h>
+
/**
* struct drm_crtc_commit - track modeset commits on a CRTC
*
diff --git a/include/drm/drm_auth.h b/include/drm/drm_auth.h
index cb7377d5f5c3..da669629536c 100644
--- a/include/drm/drm_auth.h
+++ b/include/drm/drm_auth.h
@@ -29,7 +29,7 @@
*/
#include <linux/idr.h>
-#include <linux/kref.h>
+#include <linux/kref_types.h>
struct drm_file;
diff --git a/include/drm/drm_device.h b/include/drm/drm_device.h
index 6a1bbdd515cd..6ea1ca468d20 100644
--- a/include/drm/drm_device.h
+++ b/include/drm/drm_device.h
@@ -2,7 +2,7 @@
#define _DRM_DEVICE_H_
#include <linux/list.h>
-#include <linux/kref.h>
+#include <linux/kref_types.h>
#include <linux/mutex_types.h>
#include <linux/idr.h>
diff --git a/include/drm/drm_framebuffer.h b/include/drm/drm_framebuffer.h
index 668077009fce..bdee553d86fb 100644
--- a/include/drm/drm_framebuffer.h
+++ b/include/drm/drm_framebuffer.h
@@ -26,6 +26,7 @@
#include <linux/ctype.h>
#include <linux/list.h>
#include <linux/sched.h>
+#include <linux/kref.h>
#include <drm/drm_fourcc.h>
#include <drm/drm_mode_object.h>
diff --git a/include/drm/drm_mode_object.h b/include/drm/drm_mode_object.h
index 08d7a7f0188f..df8f92230fda 100644
--- a/include/drm/drm_mode_object.h
+++ b/include/drm/drm_mode_object.h
@@ -23,7 +23,7 @@
#ifndef __DRM_MODESET_H__
#define __DRM_MODESET_H__
-#include <linux/kref.h>
+#include <linux/kref_types.h>
#include <drm/drm_lease.h>
struct drm_object_properties;
struct drm_property;
diff --git a/include/kvm/arm_vgic.h b/include/kvm/arm_vgic.h
index c1c4a6266b58..00bf2cc4bb02 100644
--- a/include/kvm/arm_vgic.h
+++ b/include/kvm/arm_vgic.h
@@ -8,7 +8,7 @@
#include <linux/bits.h>
#include <linux/kvm.h>
#include <linux/irqreturn.h>
-#include <linux/kref.h>
+#include <linux/kref_types.h>
#include <linux/mutex_types.h>
#include <linux/spinlock_types.h>
#include <linux/static_key.h>
diff --git a/include/linux/backing-dev-defs.h b/include/linux/backing-dev-defs.h
index 977f0323383d..b379687434fa 100644
--- a/include/linux/backing-dev-defs.h
+++ b/include/linux/backing-dev-defs.h
@@ -12,7 +12,7 @@
#include <linux/timer_types.h>
#include <linux/wait.h>
#include <linux/workqueue_types.h>
-#include <linux/kref.h>
+#include <linux/kref_types.h>
#ifdef CONFIG_CGROUP_WRITEBACK
#include <linux/rwsem.h>
diff --git a/include/linux/backing-dev.h b/include/linux/backing-dev.h
index 8e7af9a03b41..cc56faa15622 100644
--- a/include/linux/backing-dev.h
+++ b/include/linux/backing-dev.h
@@ -16,6 +16,7 @@
#include <linux/writeback.h>
#include <linux/backing-dev-defs.h>
#include <linux/slab.h>
+#include <linux/kref.h>
static inline struct backing_dev_info *bdi_get(struct backing_dev_info *bdi)
{
diff --git a/include/linux/ceph/messenger.h b/include/linux/ceph/messenger.h
index 908b4a7fcb45..100083dfcedf 100644
--- a/include/linux/ceph/messenger.h
+++ b/include/linux/ceph/messenger.h
@@ -4,7 +4,7 @@
#include <linux/bvec.h>
#include <linux/crypto.h>
-#include <linux/kref.h>
+#include <linux/kref_types.h>
#include <linux/mutex_types.h>
#include <linux/net.h>
#include <linux/uio.h>
diff --git a/include/linux/ceph/mon_client.h b/include/linux/ceph/mon_client.h
index 8226ea42fc78..1b23c4cf663b 100644
--- a/include/linux/ceph/mon_client.h
+++ b/include/linux/ceph/mon_client.h
@@ -3,7 +3,7 @@
#define _FS_CEPH_MON_CLIENT_H
#include <linux/completion.h>
-#include <linux/kref.h>
+#include <linux/kref_types.h>
#include <linux/rbtree_types.h>
#include <linux/ceph/messenger.h>
diff --git a/include/linux/ceph/osd_client.h b/include/linux/ceph/osd_client.h
index b27b9faeabf7..2e6320a4c1d3 100644
--- a/include/linux/ceph/osd_client.h
+++ b/include/linux/ceph/osd_client.h
@@ -4,7 +4,7 @@
#include <linux/bitrev.h>
#include <linux/completion.h>
-#include <linux/kref.h>
+#include <linux/kref_types.h>
#include <linux/mempool.h>
#include <linux/rbtree_types.h>
#include <linux/refcount_types.h>
diff --git a/include/linux/comedi/comedidev.h b/include/linux/comedi/comedidev.h
index bde0255d4406..d7a75b15c6f7 100644
--- a/include/linux/comedi/comedidev.h
+++ b/include/linux/comedi/comedidev.h
@@ -14,7 +14,7 @@
#include <linux/mutex_types.h>
#include <linux/spinlock_types.h>
#include <linux/rwsem.h>
-#include <linux/kref.h>
+#include <linux/kref_types.h>
#include <linux/comedi.h>
#define COMEDI_VERSION(a, b, c) (((a) << 16) + ((b) << 8) + (c))
diff --git a/include/linux/configfs.h b/include/linux/configfs.h
index 4a8326e7342b..5aac65d90883 100644
--- a/include/linux/configfs.h
+++ b/include/linux/configfs.h
@@ -22,7 +22,7 @@
#include <linux/stat.h> /* S_IRUGO */
#include <linux/types.h> /* ssize_t */
#include <linux/list.h> /* struct list_head */
-#include <linux/kref.h> /* struct kref */
+#include <linux/kref_types.h> /* struct kref */
#include <linux/mutex_types.h> /* struct mutex */
#define CONFIGFS_ITEM_NAME_LEN 20
diff --git a/include/linux/cpu_rmap.h b/include/linux/cpu_rmap.h
index effe8bef0a3a..db82833bfe21 100644
--- a/include/linux/cpu_rmap.h
+++ b/include/linux/cpu_rmap.h
@@ -10,7 +10,7 @@
#include <linux/cpumask.h>
#include <linux/gfp_types.h>
#include <linux/slab.h>
-#include <linux/kref.h>
+#include <linux/kref_types.h>
/**
* struct cpu_rmap - CPU affinity reverse-map
diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h
index 1a202761599a..32c2f49177b1 100644
--- a/include/linux/dmaengine.h
+++ b/include/linux/dmaengine.h
@@ -13,6 +13,7 @@
#include <linux/scatterlist.h>
#include <linux/bitmap.h>
#include <linux/types.h>
+#include <linux/kref.h>
#include <asm/page.h>
/**
diff --git a/include/linux/greybus/connection.h b/include/linux/greybus/connection.h
index d8926e864937..168fa2a284a8 100644
--- a/include/linux/greybus/connection.h
+++ b/include/linux/greybus/connection.h
@@ -12,7 +12,7 @@
#include <linux/bits.h>
#include <linux/list.h>
#include <linux/kfifo.h>
-#include <linux/kref.h>
+#include <linux/kref_types.h>
#define GB_CONNECTION_FLAG_CSD BIT(0)
#define GB_CONNECTION_FLAG_NO_FLOWCTRL BIT(1)
diff --git a/include/linux/greybus/operation.h b/include/linux/greybus/operation.h
index ba5f09816035..c49053e5707d 100644
--- a/include/linux/greybus/operation.h
+++ b/include/linux/greybus/operation.h
@@ -10,7 +10,7 @@
#define __OPERATION_H
#include <linux/completion.h>
-#include <linux/kref.h>
+#include <linux/kref_types.h>
#include <linux/timer_types.h>
#include <linux/types.h>
#include <linux/workqueue_types.h>
diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
index 444d509c2647..de6cbc00806e 100644
--- a/include/linux/hugetlb.h
+++ b/include/linux/hugetlb.h
@@ -10,7 +10,7 @@
#include <linux/cgroup.h>
#include <linux/page_ref.h>
#include <linux/list.h>
-#include <linux/kref.h>
+#include <linux/kref_types.h>
#include <linux/pgtable.h>
#include <linux/gfp_types.h>
#include <linux/userfaultfd_k.h>
diff --git a/include/linux/hw_random.h b/include/linux/hw_random.h
index 136e9842120e..96cad10d0201 100644
--- a/include/linux/hw_random.h
+++ b/include/linux/hw_random.h
@@ -15,7 +15,7 @@
#include <linux/completion.h>
#include <linux/types.h>
#include <linux/list.h>
-#include <linux/kref.h>
+#include <linux/kref_types.h>
/**
* struct hwrng - Hardware Random Number Generator driver
diff --git a/include/linux/iio/buffer-dma.h b/include/linux/iio/buffer-dma.h
index 395762ed9bf1..8c04fff96e57 100644
--- a/include/linux/iio/buffer-dma.h
+++ b/include/linux/iio/buffer-dma.h
@@ -8,7 +8,7 @@
#define __INDUSTRIALIO_DMA_BUFFER_H__
#include <linux/list.h>
-#include <linux/kref.h>
+#include <linux/kref_types.h>
#include <linux/spinlock_types.h>
#include <linux/mutex_types.h>
#include <linux/iio/buffer_impl.h>
diff --git a/include/linux/iio/buffer_impl.h b/include/linux/iio/buffer_impl.h
index 89c3fd7c29ca..184f8c399854 100644
--- a/include/linux/iio/buffer_impl.h
+++ b/include/linux/iio/buffer_impl.h
@@ -2,7 +2,7 @@
#ifndef _IIO_BUFFER_GENERIC_IMPL_H_
#define _IIO_BUFFER_GENERIC_IMPL_H_
#include <linux/sysfs.h>
-#include <linux/kref.h>
+#include <linux/kref_types.h>
#ifdef CONFIG_IIO_BUFFER
diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h
index 2ac9e5f9af3d..e3a0f2c22a75 100644
--- a/include/linux/interrupt.h
+++ b/include/linux/interrupt.h
@@ -10,7 +10,7 @@
#include <linux/irqnr.h>
#include <linux/hardirq.h>
#include <linux/irqflags.h>
-#include <linux/kref.h>
+#include <linux/kref_types.h>
#include <linux/workqueue_types.h>
#include <linux/jump_label.h>
diff --git a/include/linux/klist.h b/include/linux/klist.h
index 632ae9c720ac..5bd7819286d7 100644
--- a/include/linux/klist.h
+++ b/include/linux/klist.h
@@ -11,7 +11,7 @@
#define _LINUX_KLIST_H
#include <linux/spinlock_types.h>
-#include <linux/kref.h>
+#include <linux/kref_types.h>
#include <linux/list.h>
struct klist_node;
diff --git a/include/linux/kobject.h b/include/linux/kobject.h
index 774db9d28800..c120ea4addca 100644
--- a/include/linux/kobject.h
+++ b/include/linux/kobject.h
@@ -21,7 +21,7 @@
#include <linux/compiler.h>
#include <linux/container_of.h>
#include <linux/spinlock_types.h>
-#include <linux/kref.h>
+#include <linux/kref_types.h>
#include <linux/kobject_ns.h>
#include <linux/uidgid_types.h>
diff --git a/include/linux/kref.h b/include/linux/kref.h
index 536ada1a1bc4..ca6280808d1a 100644
--- a/include/linux/kref.h
+++ b/include/linux/kref.h
@@ -13,12 +13,9 @@
#ifndef _KREF_H_
#define _KREF_H_
+#include <linux/kref_types.h>
#include <linux/refcount.h>
-struct kref {
- refcount_t refcount;
-};
-
#define KREF_INIT(n) { .refcount = REFCOUNT_INIT(n), }
/**
diff --git a/include/linux/kref_types.h b/include/linux/kref_types.h
new file mode 100644
index 000000000000..cd048cc26178
--- /dev/null
+++ b/include/linux/kref_types.h
@@ -0,0 +1,12 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#ifndef _KREF_TYPES_H_
+#define _KREF_TYPES_H_
+
+#include <linux/refcount_types.h>
+
+struct kref {
+ refcount_t refcount;
+};
+
+#endif /* _KREF_TYPES_H_ */
diff --git a/include/linux/lockd/lockd.h b/include/linux/lockd/lockd.h
index 81432629646d..f9f8ad171d6a 100644
--- a/include/linux/lockd/lockd.h
+++ b/include/linux/lockd/lockd.h
@@ -16,7 +16,7 @@
#include <linux/in6.h>
#include <net/ipv6.h>
#include <linux/fs.h>
-#include <linux/kref.h>
+#include <linux/kref_types.h>
#include <linux/refcount_types.h>
#include <linux/utsname.h>
#include <linux/lockd/bind.h>
diff --git a/include/linux/memory-tiers.h b/include/linux/memory-tiers.h
index f3f91280d20b..524d774e52b0 100644
--- a/include/linux/memory-tiers.h
+++ b/include/linux/memory-tiers.h
@@ -4,7 +4,7 @@
#include <linux/types.h>
#include <linux/nodemask_types.h>
-#include <linux/kref.h>
+#include <linux/kref_types.h>
#include <linux/mmzone.h>
#include <linux/notifier.h>
/*
diff --git a/include/linux/mm_inline.h b/include/linux/mm_inline.h
index f4fe593c1400..e9b6c2d1348d 100644
--- a/include/linux/mm_inline.h
+++ b/include/linux/mm_inline.h
@@ -10,6 +10,10 @@
#include <linux/userfaultfd_k.h>
#include <linux/swapops.h>
+#ifdef CONFIG_ANON_VMA_NAME
+#include <linux/kref.h>
+#endif
+
/**
* folio_is_file_lru - Should the folio be on a file LRU or anon LRU?
* @folio: The folio to test.
diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
index 81d042c00018..28856bc6fdde 100644
--- a/include/linux/mm_types.h
+++ b/include/linux/mm_types.h
@@ -5,7 +5,7 @@
#include <linux/mm_types_task.h>
#include <linux/auxvec.h>
-#include <linux/kref.h>
+#include <linux/kref_types.h>
#include <linux/list.h>
#include <linux/spinlock_types.h>
#include <linux/rbtree_types.h>
diff --git a/include/linux/mtd/blktrans.h b/include/linux/mtd/blktrans.h
index 7be6117fad23..a50f6bce4db1 100644
--- a/include/linux/mtd/blktrans.h
+++ b/include/linux/mtd/blktrans.h
@@ -7,7 +7,7 @@
#define __MTD_TRANS_H__
#include <linux/mutex_types.h>
-#include <linux/kref.h>
+#include <linux/kref_types.h>
#include <linux/list.h>
struct hd_geometry;
diff --git a/include/linux/nfs_page.h b/include/linux/nfs_page.h
index 13411baa80c6..69e5528cd6c4 100644
--- a/include/linux/nfs_page.h
+++ b/include/linux/nfs_page.h
@@ -16,7 +16,7 @@
#include <linux/sunrpc/auth.h>
#include <linux/nfs_xdr.h>
-#include <linux/kref.h>
+#include <linux/kref_types.h>
/*
* Valid flags for a dirty buffer
diff --git a/include/linux/relay.h b/include/linux/relay.h
index 50ac01f8d6d1..d33735edc3cb 100644
--- a/include/linux/relay.h
+++ b/include/linux/relay.h
@@ -19,7 +19,7 @@
#include <linux/bug.h>
#include <linux/fs.h>
#include <linux/poll.h>
-#include <linux/kref.h>
+#include <linux/kref_types.h>
#include <linux/percpu.h>
/*
diff --git a/include/linux/rpmsg.h b/include/linux/rpmsg.h
index cdc3574fd712..f4113dc73dce 100644
--- a/include/linux/rpmsg.h
+++ b/include/linux/rpmsg.h
@@ -14,7 +14,7 @@
#include <linux/device.h>
#include <linux/err.h>
#include <linux/mod_devicetable.h>
-#include <linux/kref.h>
+#include <linux/kref_types.h>
#include <linux/mutex_types.h>
#include <linux/poll.h>
#include <linux/rpmsg/byteorder.h>
diff --git a/include/linux/sh_clk.h b/include/linux/sh_clk.h
index 3b2d8de6e7d8..ec5c2199bfce 100644
--- a/include/linux/sh_clk.h
+++ b/include/linux/sh_clk.h
@@ -5,7 +5,7 @@
#include <linux/list.h>
#include <linux/cpufreq.h>
#include <linux/types.h>
-#include <linux/kref.h>
+#include <linux/kref_types.h>
#include <linux/clk.h>
#include <linux/err.h>
diff --git a/include/linux/sunrpc/xprt.h b/include/linux/sunrpc/xprt.h
index 464f6a9492ab..8e0db9706986 100644
--- a/include/linux/sunrpc/xprt.h
+++ b/include/linux/sunrpc/xprt.h
@@ -14,7 +14,7 @@
#include <linux/socket.h>
#include <linux/in.h>
#include <linux/ktime.h>
-#include <linux/kref.h>
+#include <linux/kref_types.h>
#include <linux/sunrpc/sched.h>
#include <linux/sunrpc/xdr.h>
#include <linux/sunrpc/msg_prot.h>
diff --git a/include/linux/surface_aggregator/serial_hub.h b/include/linux/surface_aggregator/serial_hub.h
index d8dbef6b7fc2..a1fa81483c61 100644
--- a/include/linux/surface_aggregator/serial_hub.h
+++ b/include/linux/surface_aggregator/serial_hub.h
@@ -13,7 +13,7 @@
#define _LINUX_SURFACE_AGGREGATOR_SERIAL_HUB_H
#include <linux/crc-itu-t.h>
-#include <linux/kref.h>
+#include <linux/kref_types.h>
#include <linux/ktime.h>
#include <linux/list.h>
#include <linux/types.h>
diff --git a/include/linux/tee_drv.h b/include/linux/tee_drv.h
index 911ddf92dcee..6e900afbefb8 100644
--- a/include/linux/tee_drv.h
+++ b/include/linux/tee_drv.h
@@ -8,7 +8,7 @@
#include <linux/device.h>
#include <linux/idr.h>
-#include <linux/kref.h>
+#include <linux/kref_types.h>
#include <linux/list.h>
#include <linux/mod_devicetable.h>
#include <linux/tee.h>
diff --git a/include/linux/usb.h b/include/linux/usb.h
index 311a30c69a89..3dbfbef457de 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -15,7 +15,7 @@
#include <linux/delay.h> /* for mdelay() */
#include <linux/interrupt.h> /* for in_interrupt() */
#include <linux/list.h> /* for struct list_head */
-#include <linux/kref.h> /* for struct kref */
+#include <linux/kref_types.h> /* for struct kref */
#include <linux/device.h> /* for struct device */
#include <linux/fs.h> /* for struct file_operations */
#include <linux/completion.h> /* for struct completion */
diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h
index 2d47c0ae9d64..9e187981537e 100644
--- a/include/linux/usb/serial.h
+++ b/include/linux/usb/serial.h
@@ -9,7 +9,7 @@
#ifndef __LINUX_USB_SERIAL_H
#define __LINUX_USB_SERIAL_H
-#include <linux/kref.h>
+#include <linux/kref_types.h>
#include <linux/mutex_types.h>
#include <linux/serial.h>
#include <linux/kfifo.h>
diff --git a/include/linux/watch_queue.h b/include/linux/watch_queue.h
index 429c7b6afead..7943a4d15c2f 100644
--- a/include/linux/watch_queue.h
+++ b/include/linux/watch_queue.h
@@ -11,7 +11,7 @@
#define _LINUX_WATCH_QUEUE_H
#include <uapi/linux/watch_queue.h>
-#include <linux/kref.h>
+#include <linux/kref_types.h>
#include <linux/rcupdate.h>
#ifdef CONFIG_WATCH_QUEUE
diff --git a/include/media/media-request.h b/include/media/media-request.h
index 3cd25a2717ce..0747bd09d93d 100644
--- a/include/media/media-request.h
+++ b/include/media/media-request.h
@@ -16,6 +16,7 @@
#include <linux/slab.h>
#include <linux/spinlock.h>
#include <linux/refcount.h>
+#include <linux/kref.h>
#include <media/media-device.h>
diff --git a/include/media/v4l2-device.h b/include/media/v4l2-device.h
index f6f111fae33c..59bdd74f312c 100644
--- a/include/media/v4l2-device.h
+++ b/include/media/v4l2-device.h
@@ -13,6 +13,8 @@
#include <media/v4l2-subdev.h>
#include <media/v4l2-dev.h>
+#include <linux/kref.h>
+
struct v4l2_ctrl_handler;
/**
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index 8f8dd9173714..eb1e03e8f479 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -29,6 +29,7 @@
#include <linux/idr.h>
#include <linux/leds.h>
#include <linux/rculist.h>
+#include <linux/kref.h>
#include <net/bluetooth/hci.h>
#include <net/bluetooth/hci_sync.h>
diff --git a/include/net/tls_toe.h b/include/net/tls_toe.h
index b3aa7593ce2c..7bd0d9edfe8c 100644
--- a/include/net/tls_toe.h
+++ b/include/net/tls_toe.h
@@ -31,7 +31,7 @@
* SOFTWARE.
*/
-#include <linux/kref.h>
+#include <linux/kref_types.h>
#include <linux/list.h>
struct sock;
diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
index 3800bb8b9c14..64b62d1388a4 100644
--- a/include/rdma/ib_verbs.h
+++ b/include/rdma/ib_verbs.h
@@ -16,7 +16,7 @@
#include <linux/types.h>
#include <linux/device.h>
#include <linux/dma-mapping.h>
-#include <linux/kref.h>
+#include <linux/kref_types.h>
#include <linux/list.h>
#include <linux/rwsem.h>
#include <linux/workqueue_types.h>
diff --git a/include/rdma/restrack.h b/include/rdma/restrack.h
index 11e487bdf61c..f5a4ae56a1d9 100644
--- a/include/rdma/restrack.h
+++ b/include/rdma/restrack.h
@@ -8,7 +8,7 @@
#include <linux/typecheck.h>
#include <linux/sched.h>
-#include <linux/kref.h>
+#include <linux/kref_types.h>
#include <linux/completion.h>
#include <linux/sched/task.h>
#include <uapi/rdma/rdma_netlink.h>
diff --git a/include/rdma/uverbs_types.h b/include/rdma/uverbs_types.h
index ccd11631c167..8744e75220a3 100644
--- a/include/rdma/uverbs_types.h
+++ b/include/rdma/uverbs_types.h
@@ -7,6 +7,7 @@
#define _UVERBS_TYPES_
#include <linux/kernel.h>
+#include <linux/kref.h>
#include <rdma/ib_verbs.h>
struct uverbs_obj_type;
diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
index 1782f90cd8c6..9fc9d3dd066c 100644
--- a/kernel/irq/manage.c
+++ b/kernel/irq/manage.c
@@ -10,6 +10,7 @@
#include <linux/irq.h>
#include <linux/kthread.h>
+#include <linux/kref.h>
#include <linux/module.h>
#include <linux/random.h>
#include <linux/interrupt.h>
diff --git a/kernel/relay.c b/kernel/relay.c
index a8e90e98bf2c..c4e746950db9 100644
--- a/kernel/relay.c
+++ b/kernel/relay.c
@@ -22,6 +22,7 @@
#include <linux/mm.h>
#include <linux/cpu.h>
#include <linux/splice.h>
+#include <linux/kref.h>
/* list of open channels, for cpu hotplug */
static DEFINE_MUTEX(relay_channels_mutex);
diff --git a/kernel/watch_queue.c b/kernel/watch_queue.c
index 2655c71c0763..89f29ce7c58c 100644
--- a/kernel/watch_queue.c
+++ b/kernel/watch_queue.c
@@ -15,6 +15,7 @@
#include <linux/printk.h>
#include <linux/miscdevice.h>
#include <linux/fs.h>
+#include <linux/kref.h>
#include <linux/mm.h>
#include <linux/pagemap.h>
#include <linux/poll.h>
diff --git a/lib/klist.c b/lib/klist.c
index 332a4fbf18ff..4b21ad1f24ad 100644
--- a/lib/klist.c
+++ b/lib/klist.c
@@ -36,6 +36,7 @@
#include <linux/klist.h>
#include <linux/export.h>
#include <linux/sched.h>
+#include <linux/kref.h>
/*
* Use the lowest bit of n_klist to mark deleted nodes and exclude
diff --git a/lib/kobject.c b/lib/kobject.c
index 3375f5b92baf..c7b3513158ad 100644
--- a/lib/kobject.c
+++ b/lib/kobject.c
@@ -20,6 +20,7 @@
#include <linux/random.h>
#include <linux/uidgid.h>
#include <linux/workqueue.h>
+#include <linux/kref.h>
/**
* kobject_namespace() - Return @kobj's namespace tag.
diff --git a/mm/memory-tiers.c b/mm/memory-tiers.c
index 58636ccd0494..425fcd857ef1 100644
--- a/mm/memory-tiers.c
+++ b/mm/memory-tiers.c
@@ -3,6 +3,7 @@
#include <linux/lockdep.h>
#include <linux/sysfs.h>
#include <linux/kobject.h>
+#include <linux/kref.h>
#include <linux/memory.h>
#include <linux/memory-tiers.h>
#include <linux/notifier.h>
diff --git a/mm/z3fold.c b/mm/z3fold.c
index 7c76b396b74c..8ce04e6e7443 100644
--- a/mm/z3fold.c
+++ b/mm/z3fold.c
@@ -40,6 +40,7 @@
#include <linux/spinlock.h>
#include <linux/zpool.h>
#include <linux/kmemleak.h>
+#include <linux/kref.h>
/*
* NCHUNKS_ORDER determines the internal allocation granularity, effectively
diff --git a/mm/zswap.c b/mm/zswap.c
index de68a5928527..01d2a0722d45 100644
--- a/mm/zswap.c
+++ b/mm/zswap.c
@@ -36,6 +36,7 @@
#include <linux/pagemap.h>
#include <linux/workqueue.h>
#include <linux/list_lru.h>
+#include <linux/kref.h>
#include "swap.h"
#include "internal.h"
diff --git a/net/can/j1939/main.c b/net/can/j1939/main.c
index ecff1c947d68..5ee94b242a25 100644
--- a/net/can/j1939/main.c
+++ b/net/can/j1939/main.c
@@ -17,6 +17,7 @@
#include <linux/can/skb.h>
#include <linux/if_arp.h>
#include <linux/module.h>
+#include <linux/kref.h>
#include "j1939-priv.h"
diff --git a/net/can/j1939/transport.c b/net/can/j1939/transport.c
index fba7d1a0bd5c..258d638701f5 100644
--- a/net/can/j1939/transport.c
+++ b/net/can/j1939/transport.c
@@ -10,6 +10,7 @@
#include <linux/can/skb.h>
#include <linux/hrtimer.h>
+#include <linux/kref.h>
#include "j1939-priv.h"
diff --git a/net/dsa/dsa.c b/net/dsa/dsa.c
index ac7be864e80d..8d2de3a80e7f 100644
--- a/net/dsa/dsa.c
+++ b/net/dsa/dsa.c
@@ -17,6 +17,7 @@
#include <linux/of.h>
#include <linux/of_mdio.h>
#include <linux/of_net.h>
+#include <linux/kref.h>
#include <net/dsa_stubs.h>
#include <net/sch_generic.h>
diff --git a/net/nfc/llcp_core.c b/net/nfc/llcp_core.c
index 18be13fb9b75..0a0af3b7f7e6 100644
--- a/net/nfc/llcp_core.c
+++ b/net/nfc/llcp_core.c
@@ -8,6 +8,7 @@
#include <linux/init.h>
#include <linux/kernel.h>
+#include <linux/kref.h>
#include <linux/list.h>
#include <linux/nfc.h>
diff --git a/net/qrtr/af_qrtr.c b/net/qrtr/af_qrtr.c
index 41ece61eb57a..f26aa822c8ef 100644
--- a/net/qrtr/af_qrtr.c
+++ b/net/qrtr/af_qrtr.c
@@ -9,6 +9,7 @@
#include <linux/termios.h> /* For TIOCINQ/OUTQ */
#include <linux/spinlock.h>
#include <linux/wait.h>
+#include <linux/kref.h>
#include <net/sock.h>
diff --git a/net/rds/message.c b/net/rds/message.c
index 7af59d2443e5..8f9d4d0b3b54 100644
--- a/net/rds/message.c
+++ b/net/rds/message.c
@@ -36,6 +36,7 @@
#include <linux/skbuff.h>
#include <linux/list.h>
#include <linux/errqueue.h>
+#include <linux/kref.h>
#include "rds.h"
diff --git a/net/rds/rdma.c b/net/rds/rdma.c
index fba82d36593a..b1746a7efd7d 100644
--- a/net/rds/rdma.c
+++ b/net/rds/rdma.c
@@ -31,6 +31,7 @@
*
*/
#include <linux/pagemap.h>
+#include <linux/kref.h>
#include <linux/slab.h>
#include <linux/rbtree.h>
#include <linux/dma-mapping.h> /* for DMA_*_DEVICE */
diff --git a/net/tipc/node.c b/net/tipc/node.c
index c1e890a82434..9f57d181e468 100644
--- a/net/tipc/node.c
+++ b/net/tipc/node.c
@@ -46,6 +46,8 @@
#include "trace.h"
#include "crypto.h"
+#include <linux/kref.h>
+
#define INVALID_NODE_SIG 0x10000
#define NODE_CLEANUP_AFTER 300000
diff --git a/net/tipc/subscr.c b/net/tipc/subscr.c
index 05d49ad81290..2aecf783a314 100644
--- a/net/tipc/subscr.c
+++ b/net/tipc/subscr.c
@@ -39,6 +39,8 @@
#include "name_table.h"
#include "subscr.h"
+#include <linux/kref.h>
+
static void tipc_sub_send_event(struct tipc_subscription *sub,
struct publication *p,
u32 event)
diff --git a/net/tipc/topsrv.c b/net/tipc/topsrv.c
index 8ee0c07d00e9..5691abab78f2 100644
--- a/net/tipc/topsrv.c
+++ b/net/tipc/topsrv.c
@@ -43,6 +43,7 @@
#include "bearer.h"
#include <net/sock.h>
#include <linux/module.h>
+#include <linux/kref.h>
#include <trace/events/sock.h>
/* Number of messages to send before rescheduling */
diff --git a/net/tls/tls_toe.c b/net/tls/tls_toe.c
index 825669e1ab47..1a1c7aca3cda 100644
--- a/net/tls/tls_toe.c
+++ b/net/tls/tls_toe.c
@@ -34,6 +34,7 @@
#include <linux/list.h>
#include <linux/rcupdate.h>
#include <linux/spinlock.h>
+#include <linux/kref.h>
#include <net/inet_connection_sock.h>
#include <net/tls.h>
#include <net/tls_toe.h>
diff --git a/sound/soc/qcom/qdsp6/q6apm.c b/sound/soc/qcom/qdsp6/q6apm.c
index 2a2a5bd98110..93dcbc01db77 100644
--- a/sound/soc/qcom/qdsp6/q6apm.c
+++ b/sound/soc/qcom/qdsp6/q6apm.c
@@ -12,6 +12,7 @@
#include <linux/slab.h>
#include <linux/soc/qcom/apr.h>
#include <linux/wait.h>
+#include <linux/kref.h>
#include <sound/soc.h>
#include <sound/soc-dapm.h>
#include <sound/pcm.h>
--
2.39.2
By providing declarations in a lean header, we can reduce header
dependencies.
Signed-off-by: Max Kellermann <[email protected]>
---
include/linux/bio.h | 74 +---------------------------------
include/linux/bio_types.h | 84 +++++++++++++++++++++++++++++++++++++++
include/linux/blkdev.h | 2 +-
3 files changed, 86 insertions(+), 74 deletions(-)
create mode 100644 include/linux/bio_types.h
diff --git a/include/linux/bio.h b/include/linux/bio.h
index b8562d4b57b2..cada670f63d8 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -5,6 +5,7 @@
#ifndef __LINUX_BIO_H
#define __LINUX_BIO_H
+#include <linux/bio_types.h>
#include <linux/mempool.h>
/* struct bio, bio_vec and BIO_* flags are defined in blk_types.h */
#include <linux/blk_types.h>
@@ -20,35 +21,6 @@ static inline unsigned int bio_max_segs(unsigned int nr_segs)
return min(nr_segs, BIO_MAX_VECS);
}
-#define bio_prio(bio) (bio)->bi_ioprio
-#define bio_set_prio(bio, prio) ((bio)->bi_ioprio = prio)
-
-#define bio_iter_iovec(bio, iter) \
- bvec_iter_bvec((bio)->bi_io_vec, (iter))
-
-#define bio_iter_page(bio, iter) \
- bvec_iter_page((bio)->bi_io_vec, (iter))
-#define bio_iter_len(bio, iter) \
- bvec_iter_len((bio)->bi_io_vec, (iter))
-#define bio_iter_offset(bio, iter) \
- bvec_iter_offset((bio)->bi_io_vec, (iter))
-
-#define bio_page(bio) bio_iter_page((bio), (bio)->bi_iter)
-#define bio_offset(bio) bio_iter_offset((bio), (bio)->bi_iter)
-#define bio_iovec(bio) bio_iter_iovec((bio), (bio)->bi_iter)
-
-#define bvec_iter_sectors(iter) ((iter).bi_size >> 9)
-#define bvec_iter_end_sector(iter) ((iter).bi_sector + bvec_iter_sectors((iter)))
-
-#define bio_sectors(bio) bvec_iter_sectors((bio)->bi_iter)
-#define bio_end_sector(bio) bvec_iter_end_sector((bio)->bi_iter)
-
-/*
- * Return the data direction, READ or WRITE.
- */
-#define bio_data_dir(bio) \
- (op_is_write(bio_op(bio)) ? WRITE : READ)
-
static inline void *bio_data(struct bio *bio)
{
if (bio_has_data(bio))
@@ -521,18 +493,6 @@ static inline void bio_set_dev(struct bio *bio, struct block_device *bdev)
bio_associate_blkg(bio);
}
-/*
- * BIO list management for use by remapping drivers (e.g. DM or MD) and loop.
- *
- * A bio_list anchors a singly-linked list of bios chained through the bi_next
- * member of the bio. The bio_list also caches the last list member to allow
- * fast access to the tail.
- */
-struct bio_list {
- struct bio *head;
- struct bio *tail;
-};
-
static inline int bio_list_empty(const struct bio_list *bl)
{
return bl->head == NULL;
@@ -656,38 +616,6 @@ static inline void bio_inc_remaining(struct bio *bio)
*/
#define BIO_POOL_SIZE 2
-struct bio_set {
- struct kmem_cache *bio_slab;
- unsigned int front_pad;
-
- /*
- * per-cpu bio alloc cache
- */
- struct bio_alloc_cache __percpu *cache;
-
- mempool_t bio_pool;
- mempool_t bvec_pool;
-#if defined(CONFIG_BLK_DEV_INTEGRITY)
- mempool_t bio_integrity_pool;
- mempool_t bvec_integrity_pool;
-#endif
-
- unsigned int back_pad;
- /*
- * Deadlock avoidance for stacking block drivers: see comments in
- * bio_alloc_bioset() for details
- */
- spinlock_t rescue_lock;
- struct bio_list rescue_list;
- struct work_struct rescue_work;
- struct workqueue_struct *rescue_workqueue;
-
- /*
- * Hot un-plug notifier for the per-cpu cache, if used
- */
- struct hlist_node cpuhp_dead;
-};
-
static inline bool bioset_initialized(struct bio_set *bs)
{
return bs->bio_slab != NULL;
diff --git a/include/linux/bio_types.h b/include/linux/bio_types.h
new file mode 100644
index 000000000000..bf0d8def2777
--- /dev/null
+++ b/include/linux/bio_types.h
@@ -0,0 +1,84 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (C) 2001 Jens Axboe <[email protected]>
+ */
+#ifndef __LINUX_BIO_TYPES_H
+#define __LINUX_BIO_TYPES_H
+
+#include <linux/mempool.h>
+#include <linux/workqueue_types.h>
+
+#define bio_prio(bio) (bio)->bi_ioprio
+#define bio_set_prio(bio, prio) ((bio)->bi_ioprio = prio)
+
+#define bio_iter_iovec(bio, iter) \
+ bvec_iter_bvec((bio)->bi_io_vec, (iter))
+
+#define bio_iter_page(bio, iter) \
+ bvec_iter_page((bio)->bi_io_vec, (iter))
+#define bio_iter_len(bio, iter) \
+ bvec_iter_len((bio)->bi_io_vec, (iter))
+#define bio_iter_offset(bio, iter) \
+ bvec_iter_offset((bio)->bi_io_vec, (iter))
+
+#define bio_page(bio) bio_iter_page((bio), (bio)->bi_iter)
+#define bio_offset(bio) bio_iter_offset((bio), (bio)->bi_iter)
+#define bio_iovec(bio) bio_iter_iovec((bio), (bio)->bi_iter)
+
+#define bvec_iter_sectors(iter) ((iter).bi_size >> 9)
+#define bvec_iter_end_sector(iter) ((iter).bi_sector + bvec_iter_sectors((iter)))
+
+#define bio_sectors(bio) bvec_iter_sectors((bio)->bi_iter)
+#define bio_end_sector(bio) bvec_iter_end_sector((bio)->bi_iter)
+
+/*
+ * Return the data direction, READ or WRITE.
+ */
+#define bio_data_dir(bio) \
+ (op_is_write(bio_op(bio)) ? WRITE : READ)
+
+/*
+ * BIO list management for use by remapping drivers (e.g. DM or MD) and loop.
+ *
+ * A bio_list anchors a singly-linked list of bios chained through the bi_next
+ * member of the bio. The bio_list also caches the last list member to allow
+ * fast access to the tail.
+ */
+struct bio_list {
+ struct bio *head;
+ struct bio *tail;
+};
+
+struct bio_set {
+ struct kmem_cache *bio_slab;
+ unsigned int front_pad;
+
+ /*
+ * per-cpu bio alloc cache
+ */
+ struct bio_alloc_cache __percpu *cache;
+
+ mempool_t bio_pool;
+ mempool_t bvec_pool;
+#if defined(CONFIG_BLK_DEV_INTEGRITY)
+ mempool_t bio_integrity_pool;
+ mempool_t bvec_integrity_pool;
+#endif
+
+ unsigned int back_pad;
+ /*
+ * Deadlock avoidance for stacking block drivers: see comments in
+ * bio_alloc_bioset() for details
+ */
+ spinlock_t rescue_lock;
+ struct bio_list rescue_list;
+ struct work_struct rescue_work;
+ struct workqueue_struct *rescue_workqueue;
+
+ /*
+ * Hot un-plug notifier for the per-cpu cache, if used
+ */
+ struct hlist_node cpuhp_dead;
+};
+
+#endif /* __LINUX_BIO_TYPES_H */
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index a5e41a54de18..09e8f023070c 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -14,7 +14,7 @@
#include <linux/timer_types.h>
#include <linux/workqueue_types.h>
#include <linux/wait_types.h>
-#include <linux/bio.h>
+#include <linux/bio_types.h>
#include <linux/gfp_types.h>
#include <linux/kdev_t.h>
#include <linux/rcupdate.h>
--
2.39.2
By providing declarations in a lean header, we can reduce header
dependencies.
Signed-off-by: Max Kellermann <[email protected]>
---
include/linux/list_bl.h | 19 +-----------------
include/linux/list_bl_types.h | 36 +++++++++++++++++++++++++++++++++++
include/linux/mbcache.h | 2 +-
3 files changed, 38 insertions(+), 19 deletions(-)
create mode 100644 include/linux/list_bl_types.h
diff --git a/include/linux/list_bl.h b/include/linux/list_bl.h
index ae1b541446c9..39c14b6bad71 100644
--- a/include/linux/list_bl.h
+++ b/include/linux/list_bl.h
@@ -2,7 +2,7 @@
#ifndef _LINUX_LIST_BL_H
#define _LINUX_LIST_BL_H
-#include <linux/list.h>
+#include <linux/list_bl_types.h>
#include <linux/bit_spinlock.h>
/*
@@ -30,23 +30,6 @@
#define LIST_BL_BUG_ON(x)
#endif
-
-struct hlist_bl_head {
- struct hlist_bl_node *first;
-};
-
-struct hlist_bl_node {
- struct hlist_bl_node *next, **pprev;
-};
-#define INIT_HLIST_BL_HEAD(ptr) \
- ((ptr)->first = NULL)
-
-static inline void INIT_HLIST_BL_NODE(struct hlist_bl_node *h)
-{
- h->next = NULL;
- h->pprev = NULL;
-}
-
#define hlist_bl_entry(ptr, type, member) container_of(ptr,type,member)
static inline bool hlist_bl_unhashed(const struct hlist_bl_node *h)
diff --git a/include/linux/list_bl_types.h b/include/linux/list_bl_types.h
new file mode 100644
index 000000000000..84229bb7bd02
--- /dev/null
+++ b/include/linux/list_bl_types.h
@@ -0,0 +1,36 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef _LINUX_LIST_BL_TYPES_H
+#define _LINUX_LIST_BL_TYPES_H
+
+#include <linux/list.h>
+
+/*
+ * Special version of lists, where head of the list has a lock in the lowest
+ * bit. This is useful for scalable hash tables without increasing memory
+ * footprint overhead.
+ *
+ * For modification operations, the 0 bit of hlist_bl_head->first
+ * pointer must be set.
+ *
+ * With some small modifications, this can easily be adapted to store several
+ * arbitrary bits (not just a single lock bit), if the need arises to store
+ * some fast and compact auxiliary data.
+ */
+
+struct hlist_bl_head {
+ struct hlist_bl_node *first;
+};
+
+struct hlist_bl_node {
+ struct hlist_bl_node *next, **pprev;
+};
+#define INIT_HLIST_BL_HEAD(ptr) \
+ ((ptr)->first = NULL)
+
+static inline void INIT_HLIST_BL_NODE(struct hlist_bl_node *h)
+{
+ h->next = NULL;
+ h->pprev = NULL;
+}
+
+#endif
diff --git a/include/linux/mbcache.h b/include/linux/mbcache.h
index 97e64184767d..32ebbb428053 100644
--- a/include/linux/mbcache.h
+++ b/include/linux/mbcache.h
@@ -3,7 +3,7 @@
#define _LINUX_MBCACHE_H
#include <linux/hash.h>
-#include <linux/list_bl.h>
+#include <linux/list_bl_types.h>
#include <linux/list.h>
#include <linux/atomic.h>
#include <linux/fs.h>
--
2.39.2
By providing declarations in a lean header, we can reduce header
dependencies.
Signed-off-by: Max Kellermann <[email protected]>
---
block/blk-mq.h | 1 +
include/linux/blk-mq.h | 2 +-
include/linux/sbitmap.h | 124 +-------------------------------
include/linux/sbitmap_types.h | 129 ++++++++++++++++++++++++++++++++++
4 files changed, 132 insertions(+), 124 deletions(-)
create mode 100644 include/linux/sbitmap_types.h
diff --git a/block/blk-mq.h b/block/blk-mq.h
index f75a9ecfebde..cc8e690171db 100644
--- a/block/blk-mq.h
+++ b/block/blk-mq.h
@@ -3,6 +3,7 @@
#define INT_BLK_MQ_H
#include <linux/blk-mq.h>
+#include <linux/sbitmap.h>
#include "blk-stat.h"
struct blk_mq_tag_set;
diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h
index ed3760b04baa..201ee354a3d5 100644
--- a/include/linux/blk-mq.h
+++ b/include/linux/blk-mq.h
@@ -4,7 +4,7 @@
#include <linux/bio.h>
#include <linux/blkdev.h>
-#include <linux/sbitmap.h>
+#include <linux/sbitmap_types.h>
#include <linux/lockdep_types.h>
#include <linux/scatterlist.h>
#include <linux/prefetch.h>
diff --git a/include/linux/sbitmap.h b/include/linux/sbitmap.h
index f7279f7632fe..c43d1c0eafbb 100644
--- a/include/linux/sbitmap.h
+++ b/include/linux/sbitmap.h
@@ -9,142 +9,20 @@
#ifndef __LINUX_SCALE_BITMAP_H
#define __LINUX_SCALE_BITMAP_H
+#include <linux/sbitmap_types.h>
#include <linux/atomic.h>
#include <linux/bitops.h>
-#include <linux/cache.h>
#include <linux/list.h>
#include <linux/log2.h>
#include <linux/minmax.h>
#include <linux/percpu.h>
#include <linux/slab.h>
-#include <linux/types.h>
-#include <linux/wait_types.h>
struct seq_file;
-/**
- * struct sbitmap_word - Word in a &struct sbitmap.
- */
-struct sbitmap_word {
- /**
- * @word: word holding free bits
- */
- unsigned long word;
-
- /**
- * @cleared: word holding cleared bits
- */
- unsigned long cleared ____cacheline_aligned_in_smp;
-} ____cacheline_aligned_in_smp;
-
-/**
- * struct sbitmap - Scalable bitmap.
- *
- * A &struct sbitmap is spread over multiple cachelines to avoid ping-pong. This
- * trades off higher memory usage for better scalability.
- */
-struct sbitmap {
- /**
- * @depth: Number of bits used in the whole bitmap.
- */
- unsigned int depth;
-
- /**
- * @shift: log2(number of bits used per word)
- */
- unsigned int shift;
-
- /**
- * @map_nr: Number of words (cachelines) being used for the bitmap.
- */
- unsigned int map_nr;
-
- /**
- * @round_robin: Allocate bits in strict round-robin order.
- */
- bool round_robin;
-
- /**
- * @map: Allocated bitmap.
- */
- struct sbitmap_word *map;
-
- /*
- * @alloc_hint: Cache of last successfully allocated or freed bit.
- *
- * This is per-cpu, which allows multiple users to stick to different
- * cachelines until the map is exhausted.
- */
- unsigned int __percpu *alloc_hint;
-};
-
#define SBQ_WAIT_QUEUES 8
#define SBQ_WAKE_BATCH 8
-/**
- * struct sbq_wait_state - Wait queue in a &struct sbitmap_queue.
- */
-struct sbq_wait_state {
- /**
- * @wait: Wait queue.
- */
- wait_queue_head_t wait;
-} ____cacheline_aligned_in_smp;
-
-/**
- * struct sbitmap_queue - Scalable bitmap with the added ability to wait on free
- * bits.
- *
- * A &struct sbitmap_queue uses multiple wait queues and rolling wakeups to
- * avoid contention on the wait queue spinlock. This ensures that we don't hit a
- * scalability wall when we run out of free bits and have to start putting tasks
- * to sleep.
- */
-struct sbitmap_queue {
- /**
- * @sb: Scalable bitmap.
- */
- struct sbitmap sb;
-
- /**
- * @wake_batch: Number of bits which must be freed before we wake up any
- * waiters.
- */
- unsigned int wake_batch;
-
- /**
- * @wake_index: Next wait queue in @ws to wake up.
- */
- atomic_t wake_index;
-
- /**
- * @ws: Wait queues.
- */
- struct sbq_wait_state *ws;
-
- /*
- * @ws_active: count of currently active ws waitqueues
- */
- atomic_t ws_active;
-
- /**
- * @min_shallow_depth: The minimum shallow depth which may be passed to
- * sbitmap_queue_get_shallow()
- */
- unsigned int min_shallow_depth;
-
- /**
- * @completion_cnt: Number of bits cleared passed to the
- * wakeup function.
- */
- atomic_t completion_cnt;
-
- /**
- * @wakeup_cnt: Number of thread wake ups issued.
- */
- atomic_t wakeup_cnt;
-};
-
/**
* sbitmap_init_node() - Initialize a &struct sbitmap on a specific memory node.
* @sb: Bitmap to initialize.
diff --git a/include/linux/sbitmap_types.h b/include/linux/sbitmap_types.h
new file mode 100644
index 000000000000..078c7859905c
--- /dev/null
+++ b/include/linux/sbitmap_types.h
@@ -0,0 +1,129 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+#ifndef __LINUX_SCALE_BITMAP_TYPES_H
+#define __LINUX_SCALE_BITMAP_TYPES_H
+
+#include <linux/cache.h>
+#include <linux/types.h>
+#include <linux/wait_types.h>
+
+/**
+ * struct sbitmap_word - Word in a &struct sbitmap.
+ */
+struct sbitmap_word {
+ /**
+ * @word: word holding free bits
+ */
+ unsigned long word;
+
+ /**
+ * @cleared: word holding cleared bits
+ */
+ unsigned long cleared ____cacheline_aligned_in_smp;
+} ____cacheline_aligned_in_smp;
+
+/**
+ * struct sbitmap - Scalable bitmap.
+ *
+ * A &struct sbitmap is spread over multiple cachelines to avoid ping-pong. This
+ * trades off higher memory usage for better scalability.
+ */
+struct sbitmap {
+ /**
+ * @depth: Number of bits used in the whole bitmap.
+ */
+ unsigned int depth;
+
+ /**
+ * @shift: log2(number of bits used per word)
+ */
+ unsigned int shift;
+
+ /**
+ * @map_nr: Number of words (cachelines) being used for the bitmap.
+ */
+ unsigned int map_nr;
+
+ /**
+ * @round_robin: Allocate bits in strict round-robin order.
+ */
+ bool round_robin;
+
+ /**
+ * @map: Allocated bitmap.
+ */
+ struct sbitmap_word *map;
+
+ /*
+ * @alloc_hint: Cache of last successfully allocated or freed bit.
+ *
+ * This is per-cpu, which allows multiple users to stick to different
+ * cachelines until the map is exhausted.
+ */
+ unsigned int __percpu *alloc_hint;
+};
+
+/**
+ * struct sbq_wait_state - Wait queue in a &struct sbitmap_queue.
+ */
+struct sbq_wait_state {
+ /**
+ * @wait: Wait queue.
+ */
+ wait_queue_head_t wait;
+} ____cacheline_aligned_in_smp;
+
+/**
+ * struct sbitmap_queue - Scalable bitmap with the added ability to wait on free
+ * bits.
+ *
+ * A &struct sbitmap_queue uses multiple wait queues and rolling wakeups to
+ * avoid contention on the wait queue spinlock. This ensures that we don't hit a
+ * scalability wall when we run out of free bits and have to start putting tasks
+ * to sleep.
+ */
+struct sbitmap_queue {
+ /**
+ * @sb: Scalable bitmap.
+ */
+ struct sbitmap sb;
+
+ /**
+ * @wake_batch: Number of bits which must be freed before we wake up any
+ * waiters.
+ */
+ unsigned int wake_batch;
+
+ /**
+ * @wake_index: Next wait queue in @ws to wake up.
+ */
+ atomic_t wake_index;
+
+ /**
+ * @ws: Wait queues.
+ */
+ struct sbq_wait_state *ws;
+
+ /*
+ * @ws_active: count of currently active ws waitqueues
+ */
+ atomic_t ws_active;
+
+ /**
+ * @min_shallow_depth: The minimum shallow depth which may be passed to
+ * sbitmap_queue_get_shallow()
+ */
+ unsigned int min_shallow_depth;
+
+ /**
+ * @completion_cnt: Number of bits cleared passed to the
+ * wakeup function.
+ */
+ atomic_t completion_cnt;
+
+ /**
+ * @wakeup_cnt: Number of thread wake ups issued.
+ */
+ atomic_t wakeup_cnt;
+};
+
+#endif /* __LINUX_SCALE_BITMAP_TYPES_H */
--
2.39.2
By providing declarations in a lean header, we can reduce header
dependencies.
Signed-off-by: Max Kellermann <[email protected]>
---
block/disk-events.c | 1 +
block/early-lookup.c | 1 +
block/partitions/core.c | 1 +
drivers/counter/counter-chrdev.c | 1 +
drivers/cxl/cxl.h | 1 +
drivers/devfreq/devfreq-event.c | 1 +
drivers/extcon/extcon.h | 2 +-
drivers/gpu/drm/mcde/mcde_clk_div.c | 1 +
.../gpu/drm/renesas/rcar-du/rcar_du_encoder.c | 1 +
.../drm/renesas/rcar-du/rcar_du_writeback.c | 2 +
drivers/gpu/drm/sun4i/sun4i_layer.c | 2 +
drivers/gpu/drm/sun4i/sun4i_tcon_dclk.c | 1 +
drivers/gpu/drm/tidss/tidss_encoder.c | 1 +
drivers/gpu/drm/tidss/tidss_plane.c | 1 +
include/linux/acpi.h | 2 +-
include/linux/backlight.h | 2 +-
include/linux/blk_types.h | 2 +-
include/linux/blkdev.h | 2 +-
include/linux/container.h | 2 +-
include/linux/coresight.h | 2 +-
include/linux/counter.h | 2 +-
include/linux/devfreq-event.h | 2 +-
include/linux/devfreq.h | 2 +-
include/linux/device.h | 466 +---------------
include/linux/device_types.h | 500 ++++++++++++++++++
include/linux/dmaengine.h | 2 +-
include/linux/edac.h | 2 +-
include/linux/enclosure.h | 2 +-
include/linux/fpga/fpga-bridge.h | 2 +-
include/linux/fpga/fpga-region.h | 2 +-
include/linux/framer/framer.h | 2 +-
include/linux/hdmi.h | 2 +-
include/linux/hwmon-sysfs.h | 2 +-
include/linux/iio/iio.h | 2 +-
include/linux/lcd.h | 2 +-
include/linux/node.h | 2 +-
include/linux/pm_clock.h | 2 +-
include/linux/pm_domain.h | 2 +-
include/linux/pm_qos.h | 2 +-
include/linux/power_supply.h | 2 +-
include/linux/powercap.h | 2 +-
include/linux/rtc.h | 2 +-
include/linux/swiotlb.h | 3 +-
include/linux/thermal.h | 2 +-
include/linux/w1.h | 2 +-
include/media/cec.h | 2 +-
include/media/media-devnode.h | 2 +-
include/net/nfc/nfc.h | 2 +-
include/pcmcia/ss.h | 2 +-
include/scsi/scsi_device.h | 1 +
kernel/trace/blktrace.c | 1 +
51 files changed, 552 insertions(+), 500 deletions(-)
create mode 100644 include/linux/device_types.h
diff --git a/block/disk-events.c b/block/disk-events.c
index e5b3006bcef6..3e182ba939b5 100644
--- a/block/disk-events.c
+++ b/block/disk-events.c
@@ -5,6 +5,7 @@
#include <linux/export.h>
#include <linux/moduleparam.h>
#include <linux/blkdev.h>
+#include <linux/device.h>
#include <linux/kobject.h>
#include "blk.h"
diff --git a/block/early-lookup.c b/block/early-lookup.c
index 3effbd0d35e9..44d0bc80afb5 100644
--- a/block/early-lookup.c
+++ b/block/early-lookup.c
@@ -5,6 +5,7 @@
*/
#include <linux/blkdev.h>
#include <linux/ctype.h>
+#include <linux/device.h>
struct uuidcmp {
const char *uuid;
diff --git a/block/partitions/core.c b/block/partitions/core.c
index e6aad6f5f97f..7adfa786b0b5 100644
--- a/block/partitions/core.c
+++ b/block/partitions/core.c
@@ -9,6 +9,7 @@
#include <linux/major.h>
#include <linux/slab.h>
#include <linux/ctype.h>
+#include <linux/device.h>
#include <linux/vmalloc.h>
#include <linux/raid/detect.h>
#include "check.h"
diff --git a/drivers/counter/counter-chrdev.c b/drivers/counter/counter-chrdev.c
index afc94d0062b1..7d3e44315c8c 100644
--- a/drivers/counter/counter-chrdev.c
+++ b/drivers/counter/counter-chrdev.c
@@ -5,6 +5,7 @@
*/
#include <linux/cdev.h>
#include <linux/counter.h>
+#include <linux/device.h>
#include <linux/err.h>
#include <linux/errno.h>
#include <linux/export.h>
diff --git a/drivers/cxl/cxl.h b/drivers/cxl/cxl.h
index 784bcd943215..0c4b2b3f6217 100644
--- a/drivers/cxl/cxl.h
+++ b/drivers/cxl/cxl.h
@@ -7,6 +7,7 @@
#include <linux/libnvdimm.h>
#include <linux/bitfield.h>
#include <linux/bitops.h>
+#include <linux/device_types.h>
#include <linux/device/driver.h>
#include <linux/log2.h>
#include <linux/node.h>
diff --git a/drivers/devfreq/devfreq-event.c b/drivers/devfreq/devfreq-event.c
index 3ebac2496679..9243135a701f 100644
--- a/drivers/devfreq/devfreq-event.c
+++ b/drivers/devfreq/devfreq-event.c
@@ -9,6 +9,7 @@
*/
#include <linux/devfreq-event.h>
+#include <linux/device.h>
#include <linux/kernel.h>
#include <linux/err.h>
#include <linux/init.h>
diff --git a/drivers/extcon/extcon.h b/drivers/extcon/extcon.h
index b2e0f715d81c..1b850b2a06ac 100644
--- a/drivers/extcon/extcon.h
+++ b/drivers/extcon/extcon.h
@@ -2,7 +2,7 @@
#ifndef __LINUX_EXTCON_INTERNAL_H__
#define __LINUX_EXTCON_INTERNAL_H__
-#include <linux/device.h>
+#include <linux/device_types.h>
#include <linux/extcon-provider.h>
/**
diff --git a/drivers/gpu/drm/mcde/mcde_clk_div.c b/drivers/gpu/drm/mcde/mcde_clk_div.c
index 3056ac566473..ac90497d366a 100644
--- a/drivers/gpu/drm/mcde/mcde_clk_div.c
+++ b/drivers/gpu/drm/mcde/mcde_clk_div.c
@@ -1,5 +1,6 @@
// SPDX-License-Identifier: GPL-2.0
#include <linux/clk-provider.h>
+#include <linux/device.h> // for devm_kzalloc()
#include <linux/io.h>
#include <linux/regulator/consumer.h>
diff --git a/drivers/gpu/drm/renesas/rcar-du/rcar_du_encoder.c b/drivers/gpu/drm/renesas/rcar-du/rcar_du_encoder.c
index 7ecec7b04a8d..18842d466b74 100644
--- a/drivers/gpu/drm/renesas/rcar-du/rcar_du_encoder.c
+++ b/drivers/gpu/drm/renesas/rcar-du/rcar_du_encoder.c
@@ -7,6 +7,7 @@
* Contact: Laurent Pinchart ([email protected])
*/
+#include <linux/device.h> // for dev_dbg()
#include <linux/export.h>
#include <linux/of.h>
diff --git a/drivers/gpu/drm/renesas/rcar-du/rcar_du_writeback.c b/drivers/gpu/drm/renesas/rcar-du/rcar_du_writeback.c
index 8cd37d7b8ae2..0fb49db3a5b6 100644
--- a/drivers/gpu/drm/renesas/rcar-du/rcar_du_writeback.c
+++ b/drivers/gpu/drm/renesas/rcar-du/rcar_du_writeback.c
@@ -13,6 +13,8 @@
#include <drm/drm_probe_helper.h>
#include <drm/drm_writeback.h>
+#include <linux/device.h> // for dev_dbg()
+
#include "rcar_du_crtc.h"
#include "rcar_du_drv.h"
#include "rcar_du_kms.h"
diff --git a/drivers/gpu/drm/sun4i/sun4i_layer.c b/drivers/gpu/drm/sun4i/sun4i_layer.c
index 98f3176366c0..77517fda1eda 100644
--- a/drivers/gpu/drm/sun4i/sun4i_layer.c
+++ b/drivers/gpu/drm/sun4i/sun4i_layer.c
@@ -11,6 +11,8 @@
#include <drm/drm_blend.h>
#include <drm/drm_gem_atomic_helper.h>
+#include <linux/device.h> // for devm_kzalloc()
+
#include "sun4i_backend.h"
#include "sun4i_frontend.h"
#include "sun4i_layer.h"
diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon_dclk.c b/drivers/gpu/drm/sun4i/sun4i_tcon_dclk.c
index 03d7de1911cd..e27219f38e80 100644
--- a/drivers/gpu/drm/sun4i/sun4i_tcon_dclk.c
+++ b/drivers/gpu/drm/sun4i/sun4i_tcon_dclk.c
@@ -7,6 +7,7 @@
*/
#include <linux/clk-provider.h>
+#include <linux/device.h> // for devm_kzalloc()
#include <linux/regmap.h>
#include "sun4i_tcon.h"
diff --git a/drivers/gpu/drm/tidss/tidss_encoder.c b/drivers/gpu/drm/tidss/tidss_encoder.c
index 17a86bed8054..c002c07f262e 100644
--- a/drivers/gpu/drm/tidss/tidss_encoder.c
+++ b/drivers/gpu/drm/tidss/tidss_encoder.c
@@ -4,6 +4,7 @@
* Author: Tomi Valkeinen <[email protected]>
*/
+#include <linux/device.h> // for dev_dbg()
#include <linux/export.h>
#include <drm/drm_atomic_helper.h>
diff --git a/drivers/gpu/drm/tidss/tidss_plane.c b/drivers/gpu/drm/tidss/tidss_plane.c
index e1c0ef0c3894..41166047771b 100644
--- a/drivers/gpu/drm/tidss/tidss_plane.c
+++ b/drivers/gpu/drm/tidss/tidss_plane.c
@@ -11,6 +11,7 @@
#include <drm/drm_fourcc.h>
#include <drm/drm_framebuffer.h>
#include <drm/drm_gem_atomic_helper.h>
+#include <linux/device.h> // for dev_dbg()
#include "tidss_crtc.h"
#include "tidss_dispc.h"
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 3beab76d31d4..9f0a021dfef3 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -11,7 +11,7 @@
#include <linux/errno.h>
#include <linux/ioport.h> /* for struct resource */
#include <linux/resource_ext.h>
-#include <linux/device.h>
+#include <linux/device_types.h>
#include <linux/mod_devicetable.h>
#include <linux/property.h>
#include <linux/uuid.h>
diff --git a/include/linux/backlight.h b/include/linux/backlight.h
index 614653e07e3a..9164ee5f1c8b 100644
--- a/include/linux/backlight.h
+++ b/include/linux/backlight.h
@@ -9,7 +9,7 @@
#ifndef _LINUX_BACKLIGHT_H
#define _LINUX_BACKLIGHT_H
-#include <linux/device.h>
+#include <linux/device_types.h>
#include <linux/fb.h>
#include <linux/mutex.h>
#include <linux/notifier.h>
diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h
index 9d2d8a8328a6..96a37f399928 100644
--- a/include/linux/blk_types.h
+++ b/include/linux/blk_types.h
@@ -8,7 +8,7 @@
#include <linux/types.h>
#include <linux/bvec_types.h>
-#include <linux/device.h>
+#include <linux/device_types.h>
#include <linux/ktime.h>
struct bio_set;
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 3a14de75286a..3916d2f0a9af 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -8,7 +8,7 @@
#include <linux/types.h>
#include <linux/fs.h> // for inode_unhashed()
#include <linux/blk_types.h>
-#include <linux/device.h>
+#include <linux/device_types.h>
#include <linux/list.h>
#include <linux/minmax.h>
#include <linux/timer_types.h>
diff --git a/include/linux/container.h b/include/linux/container.h
index dd00cc918a92..a90e59f0c65d 100644
--- a/include/linux/container.h
+++ b/include/linux/container.h
@@ -9,7 +9,7 @@
#ifndef _LINUX_CONTAINER_H
#define _LINUX_CONTAINER_H
-#include <linux/device.h>
+#include <linux/device_types.h>
/* drivers/base/power/container.c */
extern const struct bus_type container_subsys;
diff --git a/include/linux/coresight.h b/include/linux/coresight.h
index a4cb7dd6ca23..fce16528de85 100644
--- a/include/linux/coresight.h
+++ b/include/linux/coresight.h
@@ -8,7 +8,7 @@
#include <linux/amba/bus.h>
#include <linux/clk.h>
-#include <linux/device.h>
+#include <linux/device_types.h>
#include <linux/io.h>
#include <linux/perf_event.h>
#include <linux/sched.h>
diff --git a/include/linux/counter.h b/include/linux/counter.h
index 638ebb5b4d27..95e8067f4b78 100644
--- a/include/linux/counter.h
+++ b/include/linux/counter.h
@@ -7,7 +7,7 @@
#define _COUNTER_H_
#include <linux/cdev.h>
-#include <linux/device.h>
+#include <linux/device_types.h>
#include <linux/kernel.h>
#include <linux/kfifo.h>
#include <linux/mutex_types.h>
diff --git a/include/linux/devfreq-event.h b/include/linux/devfreq-event.h
index 4a50a5c71a5f..36f0e6cf7cc5 100644
--- a/include/linux/devfreq-event.h
+++ b/include/linux/devfreq-event.h
@@ -9,7 +9,7 @@
#ifndef __LINUX_DEVFREQ_EVENT_H__
#define __LINUX_DEVFREQ_EVENT_H__
-#include <linux/device.h>
+#include <linux/device_types.h>
/**
* struct devfreq_event_dev - the devfreq-event device
diff --git a/include/linux/devfreq.h b/include/linux/devfreq.h
index d312ffbac4dd..bf8d30af9fa2 100644
--- a/include/linux/devfreq.h
+++ b/include/linux/devfreq.h
@@ -10,7 +10,7 @@
#ifndef __LINUX_DEVFREQ_H__
#define __LINUX_DEVFREQ_H__
-#include <linux/device.h>
+#include <linux/device_types.h>
#include <linux/notifier.h>
#include <linux/pm_opp.h>
#include <linux/pm_qos.h>
diff --git a/include/linux/device.h b/include/linux/device.h
index 3e221c132d89..56735ece2ada 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -12,6 +12,7 @@
#ifndef _DEVICE_H_
#define _DEVICE_H_
+#include <linux/device_types.h>
#include <linux/dev_printk.h>
#include <linux/energy_model.h>
#include <linux/ioport.h>
@@ -30,7 +31,6 @@
#include <linux/device/driver.h>
#include <linux/cleanup.h>
#include <linux/sysfs.h> // for __ATTR_*
-#include <asm/device.h>
struct device;
struct device_private;
@@ -46,27 +46,6 @@ struct dev_pin_info;
struct dev_iommu;
struct msi_device_data;
-/**
- * struct subsys_interface - interfaces to device functions
- * @name: name of the device function
- * @subsys: subsystem of the devices to attach to
- * @node: the list of functions registered at the subsystem
- * @add_dev: device hookup to device function handler
- * @remove_dev: device hookup to device function handler
- *
- * Simple interfaces attached to a subsystem. Multiple interfaces can
- * attach to a subsystem and its devices. Unlike drivers, they do not
- * exclusively claim or control devices. Interfaces usually represent
- * a specific functionality of a subsystem/class of devices.
- */
-struct subsys_interface {
- const char *name;
- const struct bus_type *subsys;
- struct list_head node;
- int (*add_dev)(struct device *dev, struct subsys_interface *sif);
- void (*remove_dev)(struct device *dev, struct subsys_interface *sif);
-};
-
int subsys_interface_register(struct subsys_interface *sif);
void subsys_interface_unregister(struct subsys_interface *sif);
@@ -75,50 +54,6 @@ int subsys_system_register(const struct bus_type *subsys,
int subsys_virtual_register(const struct bus_type *subsys,
const struct attribute_group **groups);
-/*
- * The type of device, "struct device" is embedded in. A class
- * or bus can contain devices of different types
- * like "partitions" and "disks", "mouse" and "event".
- * This identifies the device type and carries type-specific
- * information, equivalent to the kobj_type of a kobject.
- * If "name" is specified, the uevent will contain it in
- * the DEVTYPE variable.
- */
-struct device_type {
- const char *name;
- const struct attribute_group **groups;
- int (*uevent)(const struct device *dev, struct kobj_uevent_env *env);
- char *(*devnode)(const struct device *dev, umode_t *mode,
- kuid_t *uid, kgid_t *gid);
- void (*release)(struct device *dev);
-
- const struct dev_pm_ops *pm;
-};
-
-/**
- * struct device_attribute - Interface for exporting device attributes.
- * @attr: sysfs attribute definition.
- * @show: Show handler.
- * @store: Store handler.
- */
-struct device_attribute {
- struct attribute attr;
- ssize_t (*show)(struct device *dev, struct device_attribute *attr,
- char *buf);
- ssize_t (*store)(struct device *dev, struct device_attribute *attr,
- const char *buf, size_t count);
-};
-
-/**
- * struct dev_ext_attribute - Exported device attribute with extra context.
- * @attr: Exported device attribute.
- * @var: Pointer to context.
- */
-struct dev_ext_attribute {
- struct device_attribute attr;
- void *var;
-};
-
ssize_t device_show_ulong(struct device *dev, struct device_attribute *attr,
char *buf);
ssize_t device_store_ulong(struct device *dev, struct device_attribute *attr,
@@ -423,34 +358,6 @@ void __percpu *__devm_alloc_percpu(struct device *dev, size_t size,
size_t align);
void devm_free_percpu(struct device *dev, void __percpu *pdata);
-struct device_dma_parameters {
- /*
- * a low level driver may set these to teach IOMMU code about
- * sg limitations.
- */
- unsigned int max_segment_size;
- unsigned int min_align_mask;
- unsigned long segment_boundary_mask;
-};
-
-/**
- * enum device_link_state - Device link states.
- * @DL_STATE_NONE: The presence of the drivers is not being tracked.
- * @DL_STATE_DORMANT: None of the supplier/consumer drivers is present.
- * @DL_STATE_AVAILABLE: The supplier driver is present, but the consumer is not.
- * @DL_STATE_CONSUMER_PROBE: The consumer is probing (supplier driver present).
- * @DL_STATE_ACTIVE: Both the supplier and consumer drivers are present.
- * @DL_STATE_SUPPLIER_UNBIND: The supplier driver is unbinding.
- */
-enum device_link_state {
- DL_STATE_NONE = -1,
- DL_STATE_DORMANT = 0,
- DL_STATE_AVAILABLE,
- DL_STATE_CONSUMER_PROBE,
- DL_STATE_ACTIVE,
- DL_STATE_SUPPLIER_UNBIND,
-};
-
/*
* Device link flags.
*
@@ -475,363 +382,6 @@ enum device_link_state {
#define DL_FLAG_INFERRED BIT(8)
#define DL_FLAG_CYCLE BIT(9)
-/**
- * enum dl_dev_state - Device driver presence tracking information.
- * @DL_DEV_NO_DRIVER: There is no driver attached to the device.
- * @DL_DEV_PROBING: A driver is probing.
- * @DL_DEV_DRIVER_BOUND: The driver has been bound to the device.
- * @DL_DEV_UNBINDING: The driver is unbinding from the device.
- */
-enum dl_dev_state {
- DL_DEV_NO_DRIVER = 0,
- DL_DEV_PROBING,
- DL_DEV_DRIVER_BOUND,
- DL_DEV_UNBINDING,
-};
-
-/**
- * enum device_removable - Whether the device is removable. The criteria for a
- * device to be classified as removable is determined by its subsystem or bus.
- * @DEVICE_REMOVABLE_NOT_SUPPORTED: This attribute is not supported for this
- * device (default).
- * @DEVICE_REMOVABLE_UNKNOWN: Device location is Unknown.
- * @DEVICE_FIXED: Device is not removable by the user.
- * @DEVICE_REMOVABLE: Device is removable by the user.
- */
-enum device_removable {
- DEVICE_REMOVABLE_NOT_SUPPORTED = 0, /* must be 0 */
- DEVICE_REMOVABLE_UNKNOWN,
- DEVICE_FIXED,
- DEVICE_REMOVABLE,
-};
-
-/**
- * struct dev_links_info - Device data related to device links.
- * @suppliers: List of links to supplier devices.
- * @consumers: List of links to consumer devices.
- * @defer_sync: Hook to global list of devices that have deferred sync_state.
- * @status: Driver status information.
- */
-struct dev_links_info {
- struct list_head suppliers;
- struct list_head consumers;
- struct list_head defer_sync;
- enum dl_dev_state status;
-};
-
-/**
- * struct dev_msi_info - Device data related to MSI
- * @domain: The MSI interrupt domain associated to the device
- * @data: Pointer to MSI device data
- */
-struct dev_msi_info {
-#ifdef CONFIG_GENERIC_MSI_IRQ
- struct irq_domain *domain;
- struct msi_device_data *data;
-#endif
-};
-
-/**
- * enum device_physical_location_panel - Describes which panel surface of the
- * system's housing the device connection point resides on.
- * @DEVICE_PANEL_TOP: Device connection point is on the top panel.
- * @DEVICE_PANEL_BOTTOM: Device connection point is on the bottom panel.
- * @DEVICE_PANEL_LEFT: Device connection point is on the left panel.
- * @DEVICE_PANEL_RIGHT: Device connection point is on the right panel.
- * @DEVICE_PANEL_FRONT: Device connection point is on the front panel.
- * @DEVICE_PANEL_BACK: Device connection point is on the back panel.
- * @DEVICE_PANEL_UNKNOWN: The panel with device connection point is unknown.
- */
-enum device_physical_location_panel {
- DEVICE_PANEL_TOP,
- DEVICE_PANEL_BOTTOM,
- DEVICE_PANEL_LEFT,
- DEVICE_PANEL_RIGHT,
- DEVICE_PANEL_FRONT,
- DEVICE_PANEL_BACK,
- DEVICE_PANEL_UNKNOWN,
-};
-
-/**
- * enum device_physical_location_vertical_position - Describes vertical
- * position of the device connection point on the panel surface.
- * @DEVICE_VERT_POS_UPPER: Device connection point is at upper part of panel.
- * @DEVICE_VERT_POS_CENTER: Device connection point is at center part of panel.
- * @DEVICE_VERT_POS_LOWER: Device connection point is at lower part of panel.
- */
-enum device_physical_location_vertical_position {
- DEVICE_VERT_POS_UPPER,
- DEVICE_VERT_POS_CENTER,
- DEVICE_VERT_POS_LOWER,
-};
-
-/**
- * enum device_physical_location_horizontal_position - Describes horizontal
- * position of the device connection point on the panel surface.
- * @DEVICE_HORI_POS_LEFT: Device connection point is at left part of panel.
- * @DEVICE_HORI_POS_CENTER: Device connection point is at center part of panel.
- * @DEVICE_HORI_POS_RIGHT: Device connection point is at right part of panel.
- */
-enum device_physical_location_horizontal_position {
- DEVICE_HORI_POS_LEFT,
- DEVICE_HORI_POS_CENTER,
- DEVICE_HORI_POS_RIGHT,
-};
-
-/**
- * struct device_physical_location - Device data related to physical location
- * of the device connection point.
- * @panel: Panel surface of the system's housing that the device connection
- * point resides on.
- * @vertical_position: Vertical position of the device connection point within
- * the panel.
- * @horizontal_position: Horizontal position of the device connection point
- * within the panel.
- * @dock: Set if the device connection point resides in a docking station or
- * port replicator.
- * @lid: Set if this device connection point resides on the lid of laptop
- * system.
- */
-struct device_physical_location {
- enum device_physical_location_panel panel;
- enum device_physical_location_vertical_position vertical_position;
- enum device_physical_location_horizontal_position horizontal_position;
- bool dock;
- bool lid;
-};
-
-/**
- * struct device - The basic device structure
- * @parent: The device's "parent" device, the device to which it is attached.
- * In most cases, a parent device is some sort of bus or host
- * controller. If parent is NULL, the device, is a top-level device,
- * which is not usually what you want.
- * @p: Holds the private data of the driver core portions of the device.
- * See the comment of the struct device_private for detail.
- * @kobj: A top-level, abstract class from which other classes are derived.
- * @init_name: Initial name of the device.
- * @type: The type of device.
- * This identifies the device type and carries type-specific
- * information.
- * @mutex: Mutex to synchronize calls to its driver.
- * @bus: Type of bus device is on.
- * @driver: Which driver has allocated this
- * @platform_data: Platform data specific to the device.
- * Example: For devices on custom boards, as typical of embedded
- * and SOC based hardware, Linux often uses platform_data to point
- * to board-specific structures describing devices and how they
- * are wired. That can include what ports are available, chip
- * variants, which GPIO pins act in what additional roles, and so
- * on. This shrinks the "Board Support Packages" (BSPs) and
- * minimizes board-specific #ifdefs in drivers.
- * @driver_data: Private pointer for driver specific info.
- * @links: Links to suppliers and consumers of this device.
- * @power: For device power management.
- * See Documentation/driver-api/pm/devices.rst for details.
- * @pm_domain: Provide callbacks that are executed during system suspend,
- * hibernation, system resume and during runtime PM transitions
- * along with subsystem-level and driver-level callbacks.
- * @em_pd: device's energy model performance domain
- * @pins: For device pin management.
- * See Documentation/driver-api/pin-control.rst for details.
- * @msi: MSI related data
- * @numa_node: NUMA node this device is close to.
- * @dma_ops: DMA mapping operations for this device.
- * @dma_mask: Dma mask (if dma'ble device).
- * @coherent_dma_mask: Like dma_mask, but for alloc_coherent mapping as not all
- * hardware supports 64-bit addresses for consistent allocations
- * such descriptors.
- * @bus_dma_limit: Limit of an upstream bridge or bus which imposes a smaller
- * DMA limit than the device itself supports.
- * @dma_range_map: map for DMA memory ranges relative to that of RAM
- * @dma_parms: A low level driver may set these to teach IOMMU code about
- * segment limitations.
- * @dma_pools: Dma pools (if dma'ble device).
- * @dma_mem: Internal for coherent mem override.
- * @cma_area: Contiguous memory area for dma allocations
- * @dma_io_tlb_mem: Software IO TLB allocator. Not for driver use.
- * @dma_io_tlb_pools: List of transient swiotlb memory pools.
- * @dma_io_tlb_lock: Protects changes to the list of active pools.
- * @dma_uses_io_tlb: %true if device has used the software IO TLB.
- * @archdata: For arch-specific additions.
- * @of_node: Associated device tree node.
- * @fwnode: Associated device node supplied by platform firmware.
- * @devt: For creating the sysfs "dev".
- * @id: device instance
- * @devres_lock: Spinlock to protect the resource of the device.
- * @devres_head: The resources list of the device.
- * @class: The class of the device.
- * @groups: Optional attribute groups.
- * @release: Callback to free the device after all references have
- * gone away. This should be set by the allocator of the
- * device (i.e. the bus driver that discovered the device).
- * @iommu_group: IOMMU group the device belongs to.
- * @iommu: Per device generic IOMMU runtime data
- * @physical_location: Describes physical location of the device connection
- * point in the system housing.
- * @removable: Whether the device can be removed from the system. This
- * should be set by the subsystem / bus driver that discovered
- * the device.
- *
- * @offline_disabled: If set, the device is permanently online.
- * @offline: Set after successful invocation of bus type's .offline().
- * @of_node_reused: Set if the device-tree node is shared with an ancestor
- * device.
- * @state_synced: The hardware state of this device has been synced to match
- * the software state of this device by calling the driver/bus
- * sync_state() callback.
- * @can_match: The device has matched with a driver at least once or it is in
- * a bus (like AMBA) which can't check for matching drivers until
- * other devices probe successfully.
- * @dma_coherent: this particular device is dma coherent, even if the
- * architecture supports non-coherent devices.
- * @dma_ops_bypass: If set to %true then the dma_ops are bypassed for the
- * streaming DMA operations (->map_* / ->unmap_* / ->sync_*),
- * and optionall (if the coherent mask is large enough) also
- * for dma allocations. This flag is managed by the dma ops
- * instance from ->dma_supported.
- *
- * At the lowest level, every device in a Linux system is represented by an
- * instance of struct device. The device structure contains the information
- * that the device model core needs to model the system. Most subsystems,
- * however, track additional information about the devices they host. As a
- * result, it is rare for devices to be represented by bare device structures;
- * instead, that structure, like kobject structures, is usually embedded within
- * a higher-level representation of the device.
- */
-struct device {
- struct kobject kobj;
- struct device *parent;
-
- struct device_private *p;
-
- const char *init_name; /* initial name of the device */
- const struct device_type *type;
-
- const struct bus_type *bus; /* type of bus device is on */
- struct device_driver *driver; /* which driver has allocated this
- device */
- void *platform_data; /* Platform specific data, device
- core doesn't touch it */
- void *driver_data; /* Driver data, set and get with
- dev_set_drvdata/dev_get_drvdata */
- struct mutex mutex; /* mutex to synchronize calls to
- * its driver.
- */
-
- struct dev_links_info links;
- struct dev_pm_info power;
- struct dev_pm_domain *pm_domain;
-
-#ifdef CONFIG_ENERGY_MODEL
- struct em_perf_domain *em_pd;
-#endif
-
-#ifdef CONFIG_PINCTRL
- struct dev_pin_info *pins;
-#endif
- struct dev_msi_info msi;
-#ifdef CONFIG_DMA_OPS
- const struct dma_map_ops *dma_ops;
-#endif
- u64 *dma_mask; /* dma mask (if dma'able device) */
- u64 coherent_dma_mask;/* Like dma_mask, but for
- alloc_coherent mappings as
- not all hardware supports
- 64 bit addresses for consistent
- allocations such descriptors. */
- u64 bus_dma_limit; /* upstream dma constraint */
- const struct bus_dma_region *dma_range_map;
-
- struct device_dma_parameters *dma_parms;
-
- struct list_head dma_pools; /* dma pools (if dma'ble) */
-
-#ifdef CONFIG_DMA_DECLARE_COHERENT
- struct dma_coherent_mem *dma_mem; /* internal for coherent mem
- override */
-#endif
-#ifdef CONFIG_DMA_CMA
- struct cma *cma_area; /* contiguous memory area for dma
- allocations */
-#endif
-#ifdef CONFIG_SWIOTLB
- struct io_tlb_mem *dma_io_tlb_mem;
-#endif
-#ifdef CONFIG_SWIOTLB_DYNAMIC
- struct list_head dma_io_tlb_pools;
- spinlock_t dma_io_tlb_lock;
- bool dma_uses_io_tlb;
-#endif
- /* arch specific additions */
- struct dev_archdata archdata;
-
- struct device_node *of_node; /* associated device tree node */
- struct fwnode_handle *fwnode; /* firmware device node */
-
-#ifdef CONFIG_NUMA
- int numa_node; /* NUMA node this device is close to */
-#endif
- dev_t devt; /* dev_t, creates the sysfs "dev" */
- u32 id; /* device instance */
-
- spinlock_t devres_lock;
- struct list_head devres_head;
-
- const struct class *class;
- const struct attribute_group **groups; /* optional groups */
-
- void (*release)(struct device *dev);
- struct iommu_group *iommu_group;
- struct dev_iommu *iommu;
-
- struct device_physical_location *physical_location;
-
- enum device_removable removable;
-
- bool offline_disabled:1;
- bool offline:1;
- bool of_node_reused:1;
- bool state_synced:1;
- bool can_match:1;
-#if defined(CONFIG_ARCH_HAS_SYNC_DMA_FOR_DEVICE) || \
- defined(CONFIG_ARCH_HAS_SYNC_DMA_FOR_CPU) || \
- defined(CONFIG_ARCH_HAS_SYNC_DMA_FOR_CPU_ALL)
- bool dma_coherent:1;
-#endif
-#ifdef CONFIG_DMA_OPS_BYPASS
- bool dma_ops_bypass : 1;
-#endif
-};
-
-/**
- * struct device_link - Device link representation.
- * @supplier: The device on the supplier end of the link.
- * @s_node: Hook to the supplier device's list of links to consumers.
- * @consumer: The device on the consumer end of the link.
- * @c_node: Hook to the consumer device's list of links to suppliers.
- * @link_dev: device used to expose link details in sysfs
- * @status: The state of the link (with respect to the presence of drivers).
- * @flags: Link flags.
- * @rpm_active: Whether or not the consumer device is runtime-PM-active.
- * @kref: Count repeated addition of the same link.
- * @rm_work: Work structure used for removing the link.
- * @supplier_preactivated: Supplier has been made active before consumer probe.
- */
-struct device_link {
- struct device *supplier;
- struct list_head s_node;
- struct device *consumer;
- struct list_head c_node;
- struct device link_dev;
- enum device_link_state status;
- u32 flags;
- refcount_t rpm_active;
- struct kref kref;
- struct work_struct rm_work;
- bool supplier_preactivated; /* Owned by consumer probe. */
-};
-
#define kobj_to_dev(__kobj) container_of_const(__kobj, struct device, kobj)
/**
@@ -847,20 +397,6 @@ static inline bool device_iommu_mapped(struct device *dev)
/* Get the wakeup routines, which depend on struct device */
#include <linux/pm_wakeup.h>
-/**
- * dev_name - Return a device's name.
- * @dev: Device with name to get.
- * Return: The kobject name of the device, or its initial name if unavailable.
- */
-static inline const char *dev_name(const struct device *dev)
-{
- /* Use the init name until the kobject becomes available */
- if (dev->init_name)
- return dev->init_name;
-
- return kobject_name(&dev->kobj);
-}
-
/**
* dev_bus_name - Return a device's bus/class name, if at all possible
* @dev: struct device to get the bus/class name of
diff --git a/include/linux/device_types.h b/include/linux/device_types.h
new file mode 100644
index 000000000000..1e5a3842d5d3
--- /dev/null
+++ b/include/linux/device_types.h
@@ -0,0 +1,500 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * device.h - generic, centralized driver model
+ *
+ * Copyright (c) 2001-2003 Patrick Mochel <[email protected]>
+ * Copyright (c) 2004-2009 Greg Kroah-Hartman <[email protected]>
+ * Copyright (c) 2008-2009 Novell Inc.
+ *
+ * See Documentation/driver-api/driver-model/ for more information.
+ */
+
+#ifndef _DEVICE_TYPES_H_
+#define _DEVICE_TYPES_H_
+
+#include <linux/kobject_types.h>
+#include <linux/pm.h>
+#include <linux/sysfs_types.h>
+#include <linux/uidgid_types.h>
+#include <asm/device.h>
+
+struct device;
+struct device_private;
+struct device_driver;
+struct driver_private;
+struct module;
+struct class;
+struct subsys_private;
+struct device_node;
+struct fwnode_handle;
+struct iommu_group;
+struct dev_pin_info;
+struct dev_iommu;
+struct msi_device_data;
+struct kobj_uevent_env;
+
+/**
+ * struct subsys_interface - interfaces to device functions
+ * @name: name of the device function
+ * @subsys: subsystem of the devices to attach to
+ * @node: the list of functions registered at the subsystem
+ * @add_dev: device hookup to device function handler
+ * @remove_dev: device hookup to device function handler
+ *
+ * Simple interfaces attached to a subsystem. Multiple interfaces can
+ * attach to a subsystem and its devices. Unlike drivers, they do not
+ * exclusively claim or control devices. Interfaces usually represent
+ * a specific functionality of a subsystem/class of devices.
+ */
+struct subsys_interface {
+ const char *name;
+ const struct bus_type *subsys;
+ struct list_head node;
+ int (*add_dev)(struct device *dev, struct subsys_interface *sif);
+ void (*remove_dev)(struct device *dev, struct subsys_interface *sif);
+};
+
+/*
+ * The type of device, "struct device" is embedded in. A class
+ * or bus can contain devices of different types
+ * like "partitions" and "disks", "mouse" and "event".
+ * This identifies the device type and carries type-specific
+ * information, equivalent to the kobj_type of a kobject.
+ * If "name" is specified, the uevent will contain it in
+ * the DEVTYPE variable.
+ */
+struct device_type {
+ const char *name;
+ const struct attribute_group **groups;
+ int (*uevent)(const struct device *dev, struct kobj_uevent_env *env);
+ char *(*devnode)(const struct device *dev, umode_t *mode,
+ kuid_t *uid, kgid_t *gid);
+ void (*release)(struct device *dev);
+
+ const struct dev_pm_ops *pm;
+};
+
+/**
+ * struct device_attribute - Interface for exporting device attributes.
+ * @attr: sysfs attribute definition.
+ * @show: Show handler.
+ * @store: Store handler.
+ */
+struct device_attribute {
+ struct attribute attr;
+ ssize_t (*show)(struct device *dev, struct device_attribute *attr,
+ char *buf);
+ ssize_t (*store)(struct device *dev, struct device_attribute *attr,
+ const char *buf, size_t count);
+};
+
+/**
+ * struct dev_ext_attribute - Exported device attribute with extra context.
+ * @attr: Exported device attribute.
+ * @var: Pointer to context.
+ */
+struct dev_ext_attribute {
+ struct device_attribute attr;
+ void *var;
+};
+
+struct device_dma_parameters {
+ /*
+ * a low level driver may set these to teach IOMMU code about
+ * sg limitations.
+ */
+ unsigned int max_segment_size;
+ unsigned int min_align_mask;
+ unsigned long segment_boundary_mask;
+};
+
+/**
+ * enum device_link_state - Device link states.
+ * @DL_STATE_NONE: The presence of the drivers is not being tracked.
+ * @DL_STATE_DORMANT: None of the supplier/consumer drivers is present.
+ * @DL_STATE_AVAILABLE: The supplier driver is present, but the consumer is not.
+ * @DL_STATE_CONSUMER_PROBE: The consumer is probing (supplier driver present).
+ * @DL_STATE_ACTIVE: Both the supplier and consumer drivers are present.
+ * @DL_STATE_SUPPLIER_UNBIND: The supplier driver is unbinding.
+ */
+enum device_link_state {
+ DL_STATE_NONE = -1,
+ DL_STATE_DORMANT = 0,
+ DL_STATE_AVAILABLE,
+ DL_STATE_CONSUMER_PROBE,
+ DL_STATE_ACTIVE,
+ DL_STATE_SUPPLIER_UNBIND,
+};
+
+/**
+ * enum dl_dev_state - Device driver presence tracking information.
+ * @DL_DEV_NO_DRIVER: There is no driver attached to the device.
+ * @DL_DEV_PROBING: A driver is probing.
+ * @DL_DEV_DRIVER_BOUND: The driver has been bound to the device.
+ * @DL_DEV_UNBINDING: The driver is unbinding from the device.
+ */
+enum dl_dev_state {
+ DL_DEV_NO_DRIVER = 0,
+ DL_DEV_PROBING,
+ DL_DEV_DRIVER_BOUND,
+ DL_DEV_UNBINDING,
+};
+
+/**
+ * enum device_removable - Whether the device is removable. The criteria for a
+ * device to be classified as removable is determined by its subsystem or bus.
+ * @DEVICE_REMOVABLE_NOT_SUPPORTED: This attribute is not supported for this
+ * device (default).
+ * @DEVICE_REMOVABLE_UNKNOWN: Device location is Unknown.
+ * @DEVICE_FIXED: Device is not removable by the user.
+ * @DEVICE_REMOVABLE: Device is removable by the user.
+ */
+enum device_removable {
+ DEVICE_REMOVABLE_NOT_SUPPORTED = 0, /* must be 0 */
+ DEVICE_REMOVABLE_UNKNOWN,
+ DEVICE_FIXED,
+ DEVICE_REMOVABLE,
+};
+
+/**
+ * struct dev_links_info - Device data related to device links.
+ * @suppliers: List of links to supplier devices.
+ * @consumers: List of links to consumer devices.
+ * @defer_sync: Hook to global list of devices that have deferred sync_state.
+ * @status: Driver status information.
+ */
+struct dev_links_info {
+ struct list_head suppliers;
+ struct list_head consumers;
+ struct list_head defer_sync;
+ enum dl_dev_state status;
+};
+
+/**
+ * struct dev_msi_info - Device data related to MSI
+ * @domain: The MSI interrupt domain associated to the device
+ * @data: Pointer to MSI device data
+ */
+struct dev_msi_info {
+#ifdef CONFIG_GENERIC_MSI_IRQ
+ struct irq_domain *domain;
+ struct msi_device_data *data;
+#endif
+};
+
+/**
+ * enum device_physical_location_panel - Describes which panel surface of the
+ * system's housing the device connection point resides on.
+ * @DEVICE_PANEL_TOP: Device connection point is on the top panel.
+ * @DEVICE_PANEL_BOTTOM: Device connection point is on the bottom panel.
+ * @DEVICE_PANEL_LEFT: Device connection point is on the left panel.
+ * @DEVICE_PANEL_RIGHT: Device connection point is on the right panel.
+ * @DEVICE_PANEL_FRONT: Device connection point is on the front panel.
+ * @DEVICE_PANEL_BACK: Device connection point is on the back panel.
+ * @DEVICE_PANEL_UNKNOWN: The panel with device connection point is unknown.
+ */
+enum device_physical_location_panel {
+ DEVICE_PANEL_TOP,
+ DEVICE_PANEL_BOTTOM,
+ DEVICE_PANEL_LEFT,
+ DEVICE_PANEL_RIGHT,
+ DEVICE_PANEL_FRONT,
+ DEVICE_PANEL_BACK,
+ DEVICE_PANEL_UNKNOWN,
+};
+
+/**
+ * enum device_physical_location_vertical_position - Describes vertical
+ * position of the device connection point on the panel surface.
+ * @DEVICE_VERT_POS_UPPER: Device connection point is at upper part of panel.
+ * @DEVICE_VERT_POS_CENTER: Device connection point is at center part of panel.
+ * @DEVICE_VERT_POS_LOWER: Device connection point is at lower part of panel.
+ */
+enum device_physical_location_vertical_position {
+ DEVICE_VERT_POS_UPPER,
+ DEVICE_VERT_POS_CENTER,
+ DEVICE_VERT_POS_LOWER,
+};
+
+/**
+ * enum device_physical_location_horizontal_position - Describes horizontal
+ * position of the device connection point on the panel surface.
+ * @DEVICE_HORI_POS_LEFT: Device connection point is at left part of panel.
+ * @DEVICE_HORI_POS_CENTER: Device connection point is at center part of panel.
+ * @DEVICE_HORI_POS_RIGHT: Device connection point is at right part of panel.
+ */
+enum device_physical_location_horizontal_position {
+ DEVICE_HORI_POS_LEFT,
+ DEVICE_HORI_POS_CENTER,
+ DEVICE_HORI_POS_RIGHT,
+};
+
+/**
+ * struct device_physical_location - Device data related to physical location
+ * of the device connection point.
+ * @panel: Panel surface of the system's housing that the device connection
+ * point resides on.
+ * @vertical_position: Vertical position of the device connection point within
+ * the panel.
+ * @horizontal_position: Horizontal position of the device connection point
+ * within the panel.
+ * @dock: Set if the device connection point resides in a docking station or
+ * port replicator.
+ * @lid: Set if this device connection point resides on the lid of laptop
+ * system.
+ */
+struct device_physical_location {
+ enum device_physical_location_panel panel;
+ enum device_physical_location_vertical_position vertical_position;
+ enum device_physical_location_horizontal_position horizontal_position;
+ bool dock;
+ bool lid;
+};
+
+/**
+ * struct device - The basic device structure
+ * @parent: The device's "parent" device, the device to which it is attached.
+ * In most cases, a parent device is some sort of bus or host
+ * controller. If parent is NULL, the device, is a top-level device,
+ * which is not usually what you want.
+ * @p: Holds the private data of the driver core portions of the device.
+ * See the comment of the struct device_private for detail.
+ * @kobj: A top-level, abstract class from which other classes are derived.
+ * @init_name: Initial name of the device.
+ * @type: The type of device.
+ * This identifies the device type and carries type-specific
+ * information.
+ * @mutex: Mutex to synchronize calls to its driver.
+ * @bus: Type of bus device is on.
+ * @driver: Which driver has allocated this
+ * @platform_data: Platform data specific to the device.
+ * Example: For devices on custom boards, as typical of embedded
+ * and SOC based hardware, Linux often uses platform_data to point
+ * to board-specific structures describing devices and how they
+ * are wired. That can include what ports are available, chip
+ * variants, which GPIO pins act in what additional roles, and so
+ * on. This shrinks the "Board Support Packages" (BSPs) and
+ * minimizes board-specific #ifdefs in drivers.
+ * @driver_data: Private pointer for driver specific info.
+ * @links: Links to suppliers and consumers of this device.
+ * @power: For device power management.
+ * See Documentation/driver-api/pm/devices.rst for details.
+ * @pm_domain: Provide callbacks that are executed during system suspend,
+ * hibernation, system resume and during runtime PM transitions
+ * along with subsystem-level and driver-level callbacks.
+ * @em_pd: device's energy model performance domain
+ * @pins: For device pin management.
+ * See Documentation/driver-api/pin-control.rst for details.
+ * @msi: MSI related data
+ * @numa_node: NUMA node this device is close to.
+ * @dma_ops: DMA mapping operations for this device.
+ * @dma_mask: Dma mask (if dma'ble device).
+ * @coherent_dma_mask: Like dma_mask, but for alloc_coherent mapping as not all
+ * hardware supports 64-bit addresses for consistent allocations
+ * such descriptors.
+ * @bus_dma_limit: Limit of an upstream bridge or bus which imposes a smaller
+ * DMA limit than the device itself supports.
+ * @dma_range_map: map for DMA memory ranges relative to that of RAM
+ * @dma_parms: A low level driver may set these to teach IOMMU code about
+ * segment limitations.
+ * @dma_pools: Dma pools (if dma'ble device).
+ * @dma_mem: Internal for coherent mem override.
+ * @cma_area: Contiguous memory area for dma allocations
+ * @dma_io_tlb_mem: Software IO TLB allocator. Not for driver use.
+ * @dma_io_tlb_pools: List of transient swiotlb memory pools.
+ * @dma_io_tlb_lock: Protects changes to the list of active pools.
+ * @dma_uses_io_tlb: %true if device has used the software IO TLB.
+ * @archdata: For arch-specific additions.
+ * @of_node: Associated device tree node.
+ * @fwnode: Associated device node supplied by platform firmware.
+ * @devt: For creating the sysfs "dev".
+ * @id: device instance
+ * @devres_lock: Spinlock to protect the resource of the device.
+ * @devres_head: The resources list of the device.
+ * @class: The class of the device.
+ * @groups: Optional attribute groups.
+ * @release: Callback to free the device after all references have
+ * gone away. This should be set by the allocator of the
+ * device (i.e. the bus driver that discovered the device).
+ * @iommu_group: IOMMU group the device belongs to.
+ * @iommu: Per device generic IOMMU runtime data
+ * @physical_location: Describes physical location of the device connection
+ * point in the system housing.
+ * @removable: Whether the device can be removed from the system. This
+ * should be set by the subsystem / bus driver that discovered
+ * the device.
+ *
+ * @offline_disabled: If set, the device is permanently online.
+ * @offline: Set after successful invocation of bus type's .offline().
+ * @of_node_reused: Set if the device-tree node is shared with an ancestor
+ * device.
+ * @state_synced: The hardware state of this device has been synced to match
+ * the software state of this device by calling the driver/bus
+ * sync_state() callback.
+ * @can_match: The device has matched with a driver at least once or it is in
+ * a bus (like AMBA) which can't check for matching drivers until
+ * other devices probe successfully.
+ * @dma_coherent: this particular device is dma coherent, even if the
+ * architecture supports non-coherent devices.
+ * @dma_ops_bypass: If set to %true then the dma_ops are bypassed for the
+ * streaming DMA operations (->map_* / ->unmap_* / ->sync_*),
+ * and optionall (if the coherent mask is large enough) also
+ * for dma allocations. This flag is managed by the dma ops
+ * instance from ->dma_supported.
+ *
+ * At the lowest level, every device in a Linux system is represented by an
+ * instance of struct device. The device structure contains the information
+ * that the device model core needs to model the system. Most subsystems,
+ * however, track additional information about the devices they host. As a
+ * result, it is rare for devices to be represented by bare device structures;
+ * instead, that structure, like kobject structures, is usually embedded within
+ * a higher-level representation of the device.
+ */
+struct device {
+ struct kobject kobj;
+ struct device *parent;
+
+ struct device_private *p;
+
+ const char *init_name; /* initial name of the device */
+ const struct device_type *type;
+
+ const struct bus_type *bus; /* type of bus device is on */
+ struct device_driver *driver; /* which driver has allocated this
+ device */
+ void *platform_data; /* Platform specific data, device
+ core doesn't touch it */
+ void *driver_data; /* Driver data, set and get with
+ dev_set_drvdata/dev_get_drvdata */
+ struct mutex mutex; /* mutex to synchronize calls to
+ * its driver.
+ */
+
+ struct dev_links_info links;
+ struct dev_pm_info power;
+ struct dev_pm_domain *pm_domain;
+
+#ifdef CONFIG_ENERGY_MODEL
+ struct em_perf_domain *em_pd;
+#endif
+
+#ifdef CONFIG_PINCTRL
+ struct dev_pin_info *pins;
+#endif
+ struct dev_msi_info msi;
+#ifdef CONFIG_DMA_OPS
+ const struct dma_map_ops *dma_ops;
+#endif
+ u64 *dma_mask; /* dma mask (if dma'able device) */
+ u64 coherent_dma_mask;/* Like dma_mask, but for
+ alloc_coherent mappings as
+ not all hardware supports
+ 64 bit addresses for consistent
+ allocations such descriptors. */
+ u64 bus_dma_limit; /* upstream dma constraint */
+ const struct bus_dma_region *dma_range_map;
+
+ struct device_dma_parameters *dma_parms;
+
+ struct list_head dma_pools; /* dma pools (if dma'ble) */
+
+#ifdef CONFIG_DMA_DECLARE_COHERENT
+ struct dma_coherent_mem *dma_mem; /* internal for coherent mem
+ override */
+#endif
+#ifdef CONFIG_DMA_CMA
+ struct cma *cma_area; /* contiguous memory area for dma
+ allocations */
+#endif
+#ifdef CONFIG_SWIOTLB
+ struct io_tlb_mem *dma_io_tlb_mem;
+#endif
+#ifdef CONFIG_SWIOTLB_DYNAMIC
+ struct list_head dma_io_tlb_pools;
+ spinlock_t dma_io_tlb_lock;
+ bool dma_uses_io_tlb;
+#endif
+ /* arch specific additions */
+ struct dev_archdata archdata;
+
+ struct device_node *of_node; /* associated device tree node */
+ struct fwnode_handle *fwnode; /* firmware device node */
+
+#ifdef CONFIG_NUMA
+ int numa_node; /* NUMA node this device is close to */
+#endif
+ dev_t devt; /* dev_t, creates the sysfs "dev" */
+ u32 id; /* device instance */
+
+ spinlock_t devres_lock;
+ struct list_head devres_head;
+
+ const struct class *class;
+ const struct attribute_group **groups; /* optional groups */
+
+ void (*release)(struct device *dev);
+ struct iommu_group *iommu_group;
+ struct dev_iommu *iommu;
+
+ struct device_physical_location *physical_location;
+
+ enum device_removable removable;
+
+ bool offline_disabled:1;
+ bool offline:1;
+ bool of_node_reused:1;
+ bool state_synced:1;
+ bool can_match:1;
+#if defined(CONFIG_ARCH_HAS_SYNC_DMA_FOR_DEVICE) || \
+ defined(CONFIG_ARCH_HAS_SYNC_DMA_FOR_CPU) || \
+ defined(CONFIG_ARCH_HAS_SYNC_DMA_FOR_CPU_ALL)
+ bool dma_coherent:1;
+#endif
+#ifdef CONFIG_DMA_OPS_BYPASS
+ bool dma_ops_bypass : 1;
+#endif
+};
+
+/**
+ * struct device_link - Device link representation.
+ * @supplier: The device on the supplier end of the link.
+ * @s_node: Hook to the supplier device's list of links to consumers.
+ * @consumer: The device on the consumer end of the link.
+ * @c_node: Hook to the consumer device's list of links to suppliers.
+ * @link_dev: device used to expose link details in sysfs
+ * @status: The state of the link (with respect to the presence of drivers).
+ * @flags: Link flags.
+ * @rpm_active: Whether or not the consumer device is runtime-PM-active.
+ * @kref: Count repeated addition of the same link.
+ * @rm_work: Work structure used for removing the link.
+ * @supplier_preactivated: Supplier has been made active before consumer probe.
+ */
+struct device_link {
+ struct device *supplier;
+ struct list_head s_node;
+ struct device *consumer;
+ struct list_head c_node;
+ struct device link_dev;
+ enum device_link_state status;
+ u32 flags;
+ refcount_t rpm_active;
+ struct kref kref;
+ struct work_struct rm_work;
+ bool supplier_preactivated; /* Owned by consumer probe. */
+};
+
+/**
+ * dev_name - Return a device's name.
+ * @dev: Device with name to get.
+ * Return: The kobject name of the device, or its initial name if unavailable.
+ */
+static inline const char *dev_name(const struct device *dev)
+{
+ /* Use the init name until the kobject becomes available */
+ if (dev->init_name)
+ return dev->init_name;
+
+ return kobject_name(&dev->kobj);
+}
+
+#endif /* _DEVICE_TYPES_H_ */
diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h
index 32c2f49177b1..765f799d49bd 100644
--- a/include/linux/dmaengine.h
+++ b/include/linux/dmaengine.h
@@ -5,7 +5,7 @@
#ifndef LINUX_DMAENGINE_H
#define LINUX_DMAENGINE_H
-#include <linux/device.h>
+#include <linux/device_types.h>
#include <linux/err.h>
#include <linux/idr.h> // for struct ida
#include <linux/uio.h>
diff --git a/include/linux/edac.h b/include/linux/edac.h
index 7b78403cac40..08ba34f2a43e 100644
--- a/include/linux/edac.h
+++ b/include/linux/edac.h
@@ -13,7 +13,7 @@
#define _LINUX_EDAC_H_
#include <linux/atomic.h>
-#include <linux/device.h>
+#include <linux/device_types.h>
#include <linux/completion_types.h>
#include <linux/workqueue_types.h>
#include <linux/debugfs.h>
diff --git a/include/linux/enclosure.h b/include/linux/enclosure.h
index 1c630e2c2756..8fb9f561263f 100644
--- a/include/linux/enclosure.h
+++ b/include/linux/enclosure.h
@@ -12,7 +12,7 @@
#ifndef _LINUX_ENCLOSURE_H_
#define _LINUX_ENCLOSURE_H_
-#include <linux/device.h>
+#include <linux/device_types.h>
#include <linux/list.h>
/* A few generic types ... taken from ses-2 */
diff --git a/include/linux/fpga/fpga-bridge.h b/include/linux/fpga/fpga-bridge.h
index 223da48a6d18..3a1eeb26bd65 100644
--- a/include/linux/fpga/fpga-bridge.h
+++ b/include/linux/fpga/fpga-bridge.h
@@ -3,7 +3,7 @@
#ifndef _LINUX_FPGA_BRIDGE_H
#define _LINUX_FPGA_BRIDGE_H
-#include <linux/device.h>
+#include <linux/device_types.h>
#include <linux/fpga/fpga-mgr.h>
struct fpga_bridge;
diff --git a/include/linux/fpga/fpga-region.h b/include/linux/fpga/fpga-region.h
index 9d4d32909340..be1e5033f0d3 100644
--- a/include/linux/fpga/fpga-region.h
+++ b/include/linux/fpga/fpga-region.h
@@ -3,7 +3,7 @@
#ifndef _FPGA_REGION_H
#define _FPGA_REGION_H
-#include <linux/device.h>
+#include <linux/device_types.h>
#include <linux/fpga/fpga-mgr.h>
#include <linux/fpga/fpga-bridge.h>
diff --git a/include/linux/framer/framer.h b/include/linux/framer/framer.h
index 2352a52d7d0f..ebaacd782702 100644
--- a/include/linux/framer/framer.h
+++ b/include/linux/framer/framer.h
@@ -14,7 +14,7 @@
#include <linux/mutex_types.h>
#include <linux/notifier.h>
#include <linux/of.h>
-#include <linux/device.h>
+#include <linux/device_types.h>
#include <linux/workqueue_types.h>
/**
diff --git a/include/linux/hdmi.h b/include/linux/hdmi.h
index 3bb87bf6bc65..5803588f86db 100644
--- a/include/linux/hdmi.h
+++ b/include/linux/hdmi.h
@@ -25,7 +25,7 @@
#define __LINUX_HDMI_H_
#include <linux/types.h>
-#include <linux/device.h>
+#include <linux/device_types.h>
enum hdmi_packet_type {
HDMI_PACKET_TYPE_NULL = 0x00,
diff --git a/include/linux/hwmon-sysfs.h b/include/linux/hwmon-sysfs.h
index d896713359cd..6b13b3e5a9b5 100644
--- a/include/linux/hwmon-sysfs.h
+++ b/include/linux/hwmon-sysfs.h
@@ -7,7 +7,7 @@
#ifndef _LINUX_HWMON_SYSFS_H
#define _LINUX_HWMON_SYSFS_H
-#include <linux/device.h>
+#include <linux/device_types.h>
#include <linux/kstrtox.h>
struct sensor_device_attribute{
diff --git a/include/linux/iio/iio.h b/include/linux/iio/iio.h
index 6dafef342e91..91d67fdda784 100644
--- a/include/linux/iio/iio.h
+++ b/include/linux/iio/iio.h
@@ -7,7 +7,7 @@
#ifndef _INDUSTRIAL_IO_H_
#define _INDUSTRIAL_IO_H_
-#include <linux/device.h>
+#include <linux/device_types.h>
#include <linux/cdev.h>
#include <linux/device.h>
#include <linux/slab.h>
diff --git a/include/linux/lcd.h b/include/linux/lcd.h
index 238fb1dfed98..a0deeeb3db49 100644
--- a/include/linux/lcd.h
+++ b/include/linux/lcd.h
@@ -9,7 +9,7 @@
#ifndef _LINUX_LCD_H
#define _LINUX_LCD_H
-#include <linux/device.h>
+#include <linux/device_types.h>
#include <linux/mutex.h>
#include <linux/notifier.h>
#include <linux/fb.h>
diff --git a/include/linux/node.h b/include/linux/node.h
index c4c17037c954..791954e0f01b 100644
--- a/include/linux/node.h
+++ b/include/linux/node.h
@@ -15,7 +15,7 @@
#ifndef _LINUX_NODE_H_
#define _LINUX_NODE_H_
-#include <linux/device.h>
+#include <linux/device_types.h>
#include <linux/cpumask.h>
#include <linux/list.h>
#include <linux/mmzone.h> // for enum meminit_context
diff --git a/include/linux/pm_clock.h b/include/linux/pm_clock.h
index 68669ce18720..8b89565c6e6e 100644
--- a/include/linux/pm_clock.h
+++ b/include/linux/pm_clock.h
@@ -8,7 +8,7 @@
#ifndef _LINUX_PM_CLOCK_H
#define _LINUX_PM_CLOCK_H
-#include <linux/device.h>
+#include <linux/device_types.h>
#include <linux/notifier.h>
struct pm_clk_notifier_block {
diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h
index 5b01ebf9c254..a2ec26d5cba9 100644
--- a/include/linux/pm_domain.h
+++ b/include/linux/pm_domain.h
@@ -8,7 +8,7 @@
#ifndef _LINUX_PM_DOMAIN_H
#define _LINUX_PM_DOMAIN_H
-#include <linux/device.h>
+#include <linux/device_types.h>
#include <linux/ktime.h>
#include <linux/mutex_types.h>
#include <linux/pm.h>
diff --git a/include/linux/pm_qos.h b/include/linux/pm_qos.h
index 4a69d4af3ff8..97234cba44e0 100644
--- a/include/linux/pm_qos.h
+++ b/include/linux/pm_qos.h
@@ -14,7 +14,7 @@
#include <linux/plist.h>
#include <linux/notifier.h>
-#include <linux/device.h>
+#include <linux/device_types.h>
enum pm_qos_flags_status {
PM_QOS_FLAGS_UNDEFINED = -1,
diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h
index 2bcf998da2a7..762ffc2c5dc2 100644
--- a/include/linux/power_supply.h
+++ b/include/linux/power_supply.h
@@ -12,7 +12,7 @@
#ifndef __LINUX_POWER_SUPPLY_H__
#define __LINUX_POWER_SUPPLY_H__
-#include <linux/device.h>
+#include <linux/device_types.h>
#include <linux/workqueue_types.h>
#include <linux/leds.h>
#include <linux/spinlock_types.h>
diff --git a/include/linux/powercap.h b/include/linux/powercap.h
index 3d557bbcd2c7..da48bd9bcdd7 100644
--- a/include/linux/powercap.h
+++ b/include/linux/powercap.h
@@ -7,7 +7,7 @@
#ifndef __POWERCAP_H__
#define __POWERCAP_H__
-#include <linux/device.h>
+#include <linux/device_types.h>
#include <linux/idr.h>
/*
diff --git a/include/linux/rtc.h b/include/linux/rtc.h
index 98401e771e75..82cb7f0fd843 100644
--- a/include/linux/rtc.h
+++ b/include/linux/rtc.h
@@ -34,7 +34,7 @@ static inline time64_t rtc_tm_sub(struct rtc_time *lhs, struct rtc_time *rhs)
return rtc_tm_to_time64(lhs) - rtc_tm_to_time64(rhs);
}
-#include <linux/device.h>
+#include <linux/device_types.h>
#include <linux/seq_file.h>
#include <linux/cdev.h>
#include <linux/poll.h>
diff --git a/include/linux/swiotlb.h b/include/linux/swiotlb.h
index c37473373649..94aa8de02ea7 100644
--- a/include/linux/swiotlb.h
+++ b/include/linux/swiotlb.h
@@ -2,7 +2,7 @@
#ifndef __LINUX_SWIOTLB_H
#define __LINUX_SWIOTLB_H
-#include <linux/device.h>
+#include <linux/device_types.h>
#include <linux/dma-direction.h>
#include <linux/init.h>
#include <linux/types.h>
@@ -10,7 +10,6 @@
#include <linux/spinlock_types.h>
#include <linux/workqueue_types.h>
-struct device;
struct page;
struct scatterlist;
diff --git a/include/linux/thermal.h b/include/linux/thermal.h
index f58dcf5712ad..b2722cffdb3e 100644
--- a/include/linux/thermal.h
+++ b/include/linux/thermal.h
@@ -12,7 +12,7 @@
#include <linux/of.h>
#include <linux/idr.h>
-#include <linux/device.h>
+#include <linux/device_types.h>
#include <linux/sysfs_types.h>
#include <linux/workqueue_types.h>
#include <uapi/linux/thermal.h>
diff --git a/include/linux/w1.h b/include/linux/w1.h
index 9a2a0ef39018..3cbc5e0bab9d 100644
--- a/include/linux/w1.h
+++ b/include/linux/w1.h
@@ -6,7 +6,7 @@
#ifndef __LINUX_W1_H
#define __LINUX_W1_H
-#include <linux/device.h>
+#include <linux/device_types.h>
/**
* struct w1_reg_num - broken out slave device id
diff --git a/include/media/cec.h b/include/media/cec.h
index 085dd6a526c8..92fae6461437 100644
--- a/include/media/cec.h
+++ b/include/media/cec.h
@@ -11,7 +11,7 @@
#include <linux/poll.h>
#include <linux/fs.h>
#include <linux/debugfs.h>
-#include <linux/device.h>
+#include <linux/device_types.h>
#include <linux/cdev.h>
#include <linux/kthread.h>
#include <linux/cec-funcs.h>
diff --git a/include/media/media-devnode.h b/include/media/media-devnode.h
index d27c1c646c28..e690f171c67e 100644
--- a/include/media/media-devnode.h
+++ b/include/media/media-devnode.h
@@ -18,7 +18,7 @@
#include <linux/poll.h>
#include <linux/fs.h>
-#include <linux/device.h>
+#include <linux/device_types.h>
#include <linux/cdev.h>
struct media_device;
diff --git a/include/net/nfc/nfc.h b/include/net/nfc/nfc.h
index 5dee575fbe86..9b8991560a3e 100644
--- a/include/net/nfc/nfc.h
+++ b/include/net/nfc/nfc.h
@@ -12,7 +12,7 @@
#define __NET_NFC_H
#include <linux/nfc.h>
-#include <linux/device.h>
+#include <linux/device_types.h>
#include <linux/skbuff.h>
#define nfc_dbg(dev, fmt, ...) dev_dbg((dev), "NFC: " fmt, ##__VA_ARGS__)
diff --git a/include/pcmcia/ss.h b/include/pcmcia/ss.h
index 694e5ae0f245..4bf85a0cfa5e 100644
--- a/include/pcmcia/ss.h
+++ b/include/pcmcia/ss.h
@@ -12,7 +12,7 @@
#ifndef _LINUX_SS_H
#define _LINUX_SS_H
-#include <linux/device.h>
+#include <linux/device_types.h>
#include <linux/sched.h> /* task_struct, completion */
#include <linux/mutex_types.h>
diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h
index c70aafd415b5..74c9a6d165ac 100644
--- a/include/scsi/scsi_device.h
+++ b/include/scsi/scsi_device.h
@@ -2,6 +2,7 @@
#ifndef _SCSI_SCSI_DEVICE_H
#define _SCSI_SCSI_DEVICE_H
+#include <linux/device.h> // for device_reprobe()
#include <linux/list.h>
#include <linux/spinlock_types.h>
#include <linux/workqueue_types.h>
diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c
index d5d94510afd3..6c61c24b53cf 100644
--- a/kernel/trace/blktrace.c
+++ b/kernel/trace/blktrace.c
@@ -14,6 +14,7 @@
#include <linux/mutex.h>
#include <linux/slab.h>
#include <linux/debugfs.h>
+#include <linux/device.h>
#include <linux/export.h>
#include <linux/time.h>
#include <linux/uaccess.h>
--
2.39.2
By providing declarations in a lean header, we can reduce header
dependencies.
Signed-off-by: Max Kellermann <[email protected]>
---
include/linux/cgroup-defs.h | 2 +-
include/linux/percpu-rwsem.h | 15 +--------------
include/linux/percpu-rwsem_types.h | 24 ++++++++++++++++++++++++
3 files changed, 26 insertions(+), 15 deletions(-)
create mode 100644 include/linux/percpu-rwsem_types.h
diff --git a/include/linux/cgroup-defs.h b/include/linux/cgroup-defs.h
index 878deefba0e1..691c50aeafae 100644
--- a/include/linux/cgroup-defs.h
+++ b/include/linux/cgroup-defs.h
@@ -16,7 +16,7 @@
#include <linux/rcupdate.h>
#include <linux/refcount_types.h>
#include <linux/percpu-refcount_types.h>
-#include <linux/percpu-rwsem.h>
+#include <linux/percpu-rwsem_types.h>
#include <linux/u64_stats_sync.h>
#include <linux/workqueue.h>
#include <linux/bpf-cgroup-defs.h>
diff --git a/include/linux/percpu-rwsem.h b/include/linux/percpu-rwsem.h
index 36b942b67b7d..0f427bd5217a 100644
--- a/include/linux/percpu-rwsem.h
+++ b/include/linux/percpu-rwsem.h
@@ -2,24 +2,11 @@
#ifndef _LINUX_PERCPU_RWSEM_H
#define _LINUX_PERCPU_RWSEM_H
+#include <linux/percpu-rwsem_types.h>
#include <linux/atomic.h>
#include <linux/percpu.h>
-#include <linux/rcuwait.h>
-#include <linux/wait.h>
-#include <linux/rcu_sync.h>
#include <linux/lockdep.h>
-struct percpu_rw_semaphore {
- struct rcu_sync rss;
- unsigned int __percpu *read_count;
- struct rcuwait writer;
- wait_queue_head_t waiters;
- atomic_t block;
-#ifdef CONFIG_DEBUG_LOCK_ALLOC
- struct lockdep_map dep_map;
-#endif
-};
-
#ifdef CONFIG_DEBUG_LOCK_ALLOC
#define __PERCPU_RWSEM_DEP_MAP_INIT(lockname) .dep_map = { .name = #lockname },
#else
diff --git a/include/linux/percpu-rwsem_types.h b/include/linux/percpu-rwsem_types.h
new file mode 100644
index 000000000000..0716d08b758b
--- /dev/null
+++ b/include/linux/percpu-rwsem_types.h
@@ -0,0 +1,24 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef _LINUX_PERCPU_RWSEM_TYPES_H
+#define _LINUX_PERCPU_RWSEM_TYPES_H
+
+#include <linux/rcu_sync.h>
+#include <linux/rcuwait.h>
+#include <linux/types.h>
+#include <linux/wait_types.h>
+#ifdef CONFIG_DEBUG_LOCK_ALLOC
+#include <linux/lockdep_types.h>
+#endif
+
+struct percpu_rw_semaphore {
+ struct rcu_sync rss;
+ unsigned int __percpu *read_count;
+ struct rcuwait writer;
+ wait_queue_head_t waiters;
+ atomic_t block;
+#ifdef CONFIG_DEBUG_LOCK_ALLOC
+ struct lockdep_map dep_map;
+#endif
+};
+
+#endif
--
2.39.2
By providing declarations in a lean header, we can reduce header
dependencies.
Signed-off-by: Max Kellermann <[email protected]>
---
drivers/firmware/dmi-sysfs.c | 1 +
drivers/firmware/memmap.c | 1 +
drivers/input/vivaldi-fmap.c | 1 +
drivers/of/kobj.c | 1 +
.../staging/greybus/audio_manager_module.c | 1 +
include/linux/device/bus.h | 2 +-
include/linux/iio/buffer_impl.h | 3 +-
include/linux/kobject.h | 2 +-
include/linux/module.h | 2 +-
include/linux/perf_event.h | 2 +-
include/linux/sysfs.h | 63 +------------
include/linux/sysfs_types.h | 89 +++++++++++++++++++
include/linux/thermal.h | 2 +-
include/net/netdev_rx_queue.h | 2 +-
include/rdma/ib_sysfs.h | 2 +-
kernel/kheaders.c | 1 +
lib/kobject.c | 1 +
mm/cma_sysfs.c | 1 +
18 files changed, 107 insertions(+), 70 deletions(-)
create mode 100644 include/linux/sysfs_types.h
diff --git a/drivers/firmware/dmi-sysfs.c b/drivers/firmware/dmi-sysfs.c
index 8d91997036e4..6bce0273beca 100644
--- a/drivers/firmware/dmi-sysfs.c
+++ b/drivers/firmware/dmi-sysfs.c
@@ -24,6 +24,7 @@
#include <linux/dmi.h>
#include <linux/capability.h>
#include <linux/slab.h>
+#include <linux/sysfs.h>
#include <linux/list.h>
#include <linux/io.h>
#include <asm/dmi.h>
diff --git a/drivers/firmware/memmap.c b/drivers/firmware/memmap.c
index a92d17c6fc0f..b87645e67673 100644
--- a/drivers/firmware/memmap.c
+++ b/drivers/firmware/memmap.c
@@ -13,6 +13,7 @@
#include <linux/types.h>
#include <linux/memblock.h>
#include <linux/slab.h>
+#include <linux/sysfs.h>
#include <linux/mm.h>
/*
diff --git a/drivers/input/vivaldi-fmap.c b/drivers/input/vivaldi-fmap.c
index 0d29ec014e2f..72845c0720f2 100644
--- a/drivers/input/vivaldi-fmap.c
+++ b/drivers/input/vivaldi-fmap.c
@@ -9,6 +9,7 @@
#include <linux/input/vivaldi-fmap.h>
#include <linux/kernel.h>
#include <linux/module.h>
+#include <linux/sysfs.h>
#include <linux/types.h>
/**
diff --git a/drivers/of/kobj.c b/drivers/of/kobj.c
index 3dbce1e6f184..95a7a461f8e9 100644
--- a/drivers/of/kobj.c
+++ b/drivers/of/kobj.c
@@ -1,6 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
#include <linux/of.h>
#include <linux/slab.h>
+#include <linux/sysfs.h>
#include "of_private.h"
diff --git a/drivers/staging/greybus/audio_manager_module.c b/drivers/staging/greybus/audio_manager_module.c
index 5f9dcbdbc191..2adb1c1fc2a7 100644
--- a/drivers/staging/greybus/audio_manager_module.c
+++ b/drivers/staging/greybus/audio_manager_module.c
@@ -6,6 +6,7 @@
*/
#include <linux/slab.h>
+#include <linux/sysfs.h>
#include "audio_manager.h"
#include "audio_manager_private.h"
diff --git a/include/linux/device/bus.h b/include/linux/device/bus.h
index bdd8ac64f629..a6fc75a825a3 100644
--- a/include/linux/device/bus.h
+++ b/include/linux/device/bus.h
@@ -16,7 +16,7 @@
#include <linux/klist.h>
#include <linux/pm.h>
-#include <linux/sysfs.h> // for struct attribute
+#include <linux/sysfs_types.h> // for struct attribute
struct device_driver;
struct device_node;
diff --git a/include/linux/iio/buffer_impl.h b/include/linux/iio/buffer_impl.h
index 184f8c399854..df4cad6a8c8e 100644
--- a/include/linux/iio/buffer_impl.h
+++ b/include/linux/iio/buffer_impl.h
@@ -1,7 +1,8 @@
/* SPDX-License-Identifier: GPL-2.0 */
#ifndef _IIO_BUFFER_GENERIC_IMPL_H_
#define _IIO_BUFFER_GENERIC_IMPL_H_
-#include <linux/sysfs.h>
+
+#include <linux/sysfs_types.h> // for struct attribute_group
#include <linux/kref_types.h>
#ifdef CONFIG_IIO_BUFFER
diff --git a/include/linux/kobject.h b/include/linux/kobject.h
index fc5c0fffc262..55e7d15aa7cc 100644
--- a/include/linux/kobject.h
+++ b/include/linux/kobject.h
@@ -18,7 +18,7 @@
#include <linux/kobject_types.h>
#include <linux/types.h>
#include <linux/list.h>
-#include <linux/sysfs.h>
+#include <linux/sysfs_types.h> // for struct attribute
#include <linux/compiler.h>
#include <linux/container_of.h>
#include <linux/spinlock_types.h>
diff --git a/include/linux/module.h b/include/linux/module.h
index 426d3bdf83bb..ba3c0d129cb5 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -27,7 +27,7 @@
#include <linux/tracepoint-defs.h>
#include <linux/srcu.h>
#include <linux/static_call_types.h>
-#include <linux/sysfs.h> // for struct attribute
+#include <linux/sysfs_types.h> // for struct attribute
#include <linux/dynamic_debug.h>
#include <linux/percpu.h>
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index eaf5d5f76e0e..b3aec977b0e4 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -55,7 +55,7 @@ struct perf_guest_info_callbacks {
#include <linux/static_key.h>
#include <linux/jump_label_ratelimit.h>
#include <linux/atomic.h>
-#include <linux/sysfs.h>
+#include <linux/sysfs_types.h>
#include <linux/perf_regs.h>
#include <linux/cgroup.h>
#include <linux/refcount_types.h>
diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h
index 34e29761d125..b0e27637b400 100644
--- a/include/linux/sysfs.h
+++ b/include/linux/sysfs.h
@@ -13,6 +13,7 @@
#ifndef _SYSFS_H_
#define _SYSFS_H_
+#include <linux/sysfs_types.h>
#include <linux/kernfs.h>
#include <linux/compiler.h>
#include <linux/list.h>
@@ -22,16 +23,6 @@ struct kobject;
struct module;
struct bin_attribute;
-struct attribute {
- const char *name;
- umode_t mode;
-#ifdef CONFIG_DEBUG_LOCK_ALLOC
- bool ignore_lockdep:1;
- struct lock_class_key *key;
- struct lock_class_key skey;
-#endif
-};
-
/**
* sysfs_attr_init - initialize a dynamically allocated sysfs attribute
* @attr: struct attribute to initialize
@@ -53,39 +44,6 @@ do { \
#define sysfs_attr_init(attr) do {} while (0)
#endif
-/**
- * struct attribute_group - data structure used to declare an attribute group.
- * @name: Optional: Attribute group name
- * If specified, the attribute group will be created in
- * a new subdirectory with this name.
- * @is_visible: Optional: Function to return permissions associated with an
- * attribute of the group. Will be called repeatedly for each
- * non-binary attribute in the group. Only read/write
- * permissions as well as SYSFS_PREALLOC are accepted. Must
- * return 0 if an attribute is not visible. The returned value
- * will replace static permissions defined in struct attribute.
- * @is_bin_visible:
- * Optional: Function to return permissions associated with a
- * binary attribute of the group. Will be called repeatedly
- * for each binary attribute in the group. Only read/write
- * permissions as well as SYSFS_PREALLOC are accepted. Must
- * return 0 if a binary attribute is not visible. The returned
- * value will replace static permissions defined in
- * struct bin_attribute.
- * @attrs: Pointer to NULL terminated list of attributes.
- * @bin_attrs: Pointer to NULL terminated list of binary attributes.
- * Either attrs or bin_attrs or both must be provided.
- */
-struct attribute_group {
- const char *name;
- umode_t (*is_visible)(struct kobject *,
- struct attribute *, int);
- umode_t (*is_bin_visible)(struct kobject *,
- struct bin_attribute *, int);
- struct attribute **attrs;
- struct bin_attribute **bin_attrs;
-};
-
/*
* Use these macros to make defining attributes easier.
* See include/linux/device.h for examples..
@@ -163,25 +121,6 @@ static const struct attribute_group _name##_group = { \
}; \
__ATTRIBUTE_GROUPS(_name)
-struct file;
-struct vm_area_struct;
-struct address_space;
-
-struct bin_attribute {
- struct attribute attr;
- size_t size;
- void *private;
- struct address_space *(*f_mapping)(void);
- ssize_t (*read)(struct file *, struct kobject *, struct bin_attribute *,
- char *, loff_t, size_t);
- ssize_t (*write)(struct file *, struct kobject *, struct bin_attribute *,
- char *, loff_t, size_t);
- loff_t (*llseek)(struct file *, struct kobject *, struct bin_attribute *,
- loff_t, int);
- int (*mmap)(struct file *, struct kobject *, struct bin_attribute *attr,
- struct vm_area_struct *vma);
-};
-
/**
* sysfs_bin_attr_init - initialize a dynamically allocated bin_attribute
* @attr: struct bin_attribute to initialize
diff --git a/include/linux/sysfs_types.h b/include/linux/sysfs_types.h
new file mode 100644
index 000000000000..2840a1935ea1
--- /dev/null
+++ b/include/linux/sysfs_types.h
@@ -0,0 +1,89 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * sysfs.h - definitions for the device driver filesystem
+ *
+ * Copyright (c) 2001,2002 Patrick Mochel
+ * Copyright (c) 2004 Silicon Graphics, Inc.
+ * Copyright (c) 2007 SUSE Linux Products GmbH
+ * Copyright (c) 2007 Tejun Heo <[email protected]>
+ *
+ * Please see Documentation/filesystems/sysfs.rst for more information.
+ */
+
+#ifndef _SYSFS_TYPES_H_
+#define _SYSFS_TYPES_H_
+
+#include <linux/types.h>
+#include <linux/lockdep_types.h>
+
+struct kobject;
+struct module;
+struct bin_attribute;
+
+struct attribute {
+ const char *name;
+ umode_t mode;
+#ifdef CONFIG_DEBUG_LOCK_ALLOC
+ bool ignore_lockdep:1;
+ struct lock_class_key *key;
+ struct lock_class_key skey;
+#endif
+};
+
+/**
+ * struct attribute_group - data structure used to declare an attribute group.
+ * @name: Optional: Attribute group name
+ * If specified, the attribute group will be created in
+ * a new subdirectory with this name.
+ * @is_visible: Optional: Function to return permissions associated with an
+ * attribute of the group. Will be called repeatedly for each
+ * non-binary attribute in the group. Only read/write
+ * permissions as well as SYSFS_PREALLOC are accepted. Must
+ * return 0 if an attribute is not visible. The returned value
+ * will replace static permissions defined in struct attribute.
+ * @is_bin_visible:
+ * Optional: Function to return permissions associated with a
+ * binary attribute of the group. Will be called repeatedly
+ * for each binary attribute in the group. Only read/write
+ * permissions as well as SYSFS_PREALLOC are accepted. Must
+ * return 0 if a binary attribute is not visible. The returned
+ * value will replace static permissions defined in
+ * struct bin_attribute.
+ * @attrs: Pointer to NULL terminated list of attributes.
+ * @bin_attrs: Pointer to NULL terminated list of binary attributes.
+ * Either attrs or bin_attrs or both must be provided.
+ */
+struct attribute_group {
+ const char *name;
+ umode_t (*is_visible)(struct kobject *,
+ struct attribute *, int);
+ umode_t (*is_bin_visible)(struct kobject *,
+ struct bin_attribute *, int);
+ struct attribute **attrs;
+ struct bin_attribute **bin_attrs;
+};
+
+struct file;
+struct vm_area_struct;
+struct address_space;
+
+struct bin_attribute {
+ struct attribute attr;
+ size_t size;
+#ifdef __cplusplus
+ void *private_;
+#else
+ void *private;
+#endif
+ struct address_space *(*f_mapping)(void);
+ ssize_t (*read)(struct file *, struct kobject *, struct bin_attribute *,
+ char *, loff_t, size_t);
+ ssize_t (*write)(struct file *, struct kobject *, struct bin_attribute *,
+ char *, loff_t, size_t);
+ loff_t (*llseek)(struct file *, struct kobject *, struct bin_attribute *,
+ loff_t, int);
+ int (*mmap)(struct file *, struct kobject *, struct bin_attribute *attr,
+ struct vm_area_struct *vma);
+};
+
+#endif /* _SYSFS_TYPES_H_ */
diff --git a/include/linux/thermal.h b/include/linux/thermal.h
index db474472e982..f58dcf5712ad 100644
--- a/include/linux/thermal.h
+++ b/include/linux/thermal.h
@@ -13,7 +13,7 @@
#include <linux/of.h>
#include <linux/idr.h>
#include <linux/device.h>
-#include <linux/sysfs.h>
+#include <linux/sysfs_types.h>
#include <linux/workqueue_types.h>
#include <uapi/linux/thermal.h>
diff --git a/include/net/netdev_rx_queue.h b/include/net/netdev_rx_queue.h
index 4841ec031857..7122cb4b7e44 100644
--- a/include/net/netdev_rx_queue.h
+++ b/include/net/netdev_rx_queue.h
@@ -4,7 +4,7 @@
#include <linux/kobject_types.h>
#include <linux/netdevice.h>
-#include <linux/sysfs.h>
+#include <linux/sysfs_types.h>
#include <net/xdp.h>
/* This structure contains an instance of an RX queue. */
diff --git a/include/rdma/ib_sysfs.h b/include/rdma/ib_sysfs.h
index 3b77cfd74d9a..ece1b920c690 100644
--- a/include/rdma/ib_sysfs.h
+++ b/include/rdma/ib_sysfs.h
@@ -5,7 +5,7 @@
#ifndef DEF_RDMA_IB_SYSFS_H
#define DEF_RDMA_IB_SYSFS_H
-#include <linux/sysfs.h>
+#include <linux/sysfs_types.h>
struct ib_device;
diff --git a/kernel/kheaders.c b/kernel/kheaders.c
index 42163c9e94e5..b48bd8a23cda 100644
--- a/kernel/kheaders.c
+++ b/kernel/kheaders.c
@@ -10,6 +10,7 @@
#include <linux/module.h>
#include <linux/kobject.h>
#include <linux/init.h>
+#include <linux/sysfs.h>
/*
* Define kernel_headers_data and kernel_headers_data_end, within which the
diff --git a/lib/kobject.c b/lib/kobject.c
index c7b3513158ad..b7aa69ed802e 100644
--- a/lib/kobject.c
+++ b/lib/kobject.c
@@ -21,6 +21,7 @@
#include <linux/uidgid.h>
#include <linux/workqueue.h>
#include <linux/kref.h>
+#include <linux/sysfs.h>
/**
* kobject_namespace() - Return @kobj's namespace tag.
diff --git a/mm/cma_sysfs.c b/mm/cma_sysfs.c
index 56347d15b7e8..8af53a35fbc6 100644
--- a/mm/cma_sysfs.c
+++ b/mm/cma_sysfs.c
@@ -8,6 +8,7 @@
#include <linux/cma.h>
#include <linux/kernel.h>
#include <linux/slab.h>
+#include <linux/sysfs.h>
#include "cma.h"
--
2.39.2
Reduce header dependencies by removing `#include` directives that are
completely unnecessary (or obsolete) or eliminate them by using
forward declarations.
Signed-off-by: Max Kellermann <[email protected]>
---
include/crypto/drbg.h | 1 -
include/crypto/if_alg.h | 1 -
include/drm/drm_auth.h | 1 -
include/drm/drm_debugfs.h | 2 ++
include/drm/drm_file.h | 2 +-
include/drm/drm_gem_shmem_helper.h | 1 -
include/drm/drm_mm.h | 1 -
include/drm/drm_print.h | 2 ++
include/drm/drm_util.h | 1 -
include/drm/drm_vma_manager.h | 1 -
include/drm/ttm/ttm_device.h | 1 -
include/drm/ttm/ttm_resource.h | 1 -
include/keys/asymmetric-subtype.h | 1 +
include/kunit/test.h | 1 -
include/linux/acpi_amd_wbrf.h | 7 +++++--
include/linux/acpi_dma.h | 3 ++-
include/linux/async_tx.h | 1 -
include/linux/atmdev.h | 2 --
include/linux/backing-dev-defs.h | 1 -
include/linux/blkdev.h | 2 --
include/linux/blktrace_api.h | 2 --
include/linux/bpf-netns.h | 1 -
include/linux/bpf.h | 1 -
include/linux/cacheinfo.h | 1 -
include/linux/cdev.h | 2 +-
include/linux/ceph/libceph.h | 1 -
include/linux/ceph/messenger.h | 1 -
include/linux/cgroup.h | 1 -
include/linux/clocksource.h | 1 -
include/linux/connector.h | 1 -
include/linux/cpuidle.h | 1 -
include/linux/dax.h | 1 -
include/linux/dccp.h | 1 -
include/linux/debugfs.h | 1 +
include/linux/debugobjects.h | 1 -
include/linux/device.h | 2 --
include/linux/device/bus.h | 3 ++-
include/linux/device/class.h | 3 +--
include/linux/device/driver.h | 2 --
include/linux/dma-fence.h | 1 -
include/linux/dma-resv.h | 1 -
include/linux/dmi.h | 1 -
include/linux/dpll.h | 1 -
include/linux/energy_model.h | 4 ++--
include/linux/extcon.h | 5 ++++-
include/linux/fb.h | 2 +-
include/linux/filter.h | 1 -
include/linux/firewire.h | 1 -
include/linux/freezer.h | 1 -
include/linux/fs.h | 1 -
include/linux/greybus/connection.h | 1 -
include/linux/hrtimer.h | 1 -
include/linux/hyperv.h | 1 -
include/linux/i2c-smbus.h | 2 --
include/linux/i3c/master.h | 1 -
include/linux/iio/buffer.h | 2 +-
include/linux/init_task.h | 2 --
include/linux/interconnect.h | 1 -
include/linux/interrupt.h | 1 -
include/linux/io_uring.h | 1 -
include/linux/ism.h | 2 --
include/linux/kernel_stat.h | 1 -
include/linux/kernfs.h | 5 -----
include/linux/kobj_map.h | 4 +++-
include/linux/kobject.h | 2 --
include/linux/kprobes.h | 2 --
include/linux/kvm_host.h | 1 -
include/linux/lapb.h | 1 -
include/linux/libnvdimm.h | 3 ++-
include/linux/lru_cache.h | 1 -
include/linux/lsm_audit.h | 1 -
include/linux/mISDNif.h | 3 ++-
include/linux/mailbox_client.h | 2 +-
include/linux/mailbox_controller.h | 2 +-
include/linux/mdio-mux.h | 6 ++++--
include/linux/mdio/mdio-mscc-miim.h | 8 +++++---
include/linux/mempolicy.h | 1 -
include/linux/mfd/altera-a10sr.h | 1 -
include/linux/mfd/max8907.h | 1 -
include/linux/mfd/wm831x/core.h | 1 -
include/linux/mfd/wm8350/supply.h | 1 -
include/linux/mfd/wm8400-private.h | 1 -
include/linux/mfd/wm8994/core.h | 1 -
include/linux/mm.h | 1 -
include/linux/mm_types.h | 1 -
include/linux/mmu_notifier.h | 1 -
include/linux/mtd/blktrans.h | 1 -
include/linux/mtd/qinfo.h | 2 --
include/linux/netdevice.h | 1 -
include/linux/netfilter.h | 1 -
include/linux/nfs_fs.h | 1 -
include/linux/nfs_page.h | 1 -
include/linux/nodemask.h | 3 +++
include/linux/nsproxy.h | 1 -
include/linux/percpu_counter.h | 1 -
include/linux/perf/arm_pmu.h | 1 -
include/linux/phy.h | 2 --
include/linux/phylink.h | 2 --
include/linux/pid_namespace.h | 1 -
include/linux/pktcdvd.h | 3 ---
include/linux/platform_data/asoc-ti-mcbsp.h | 1 -
include/linux/pm.h | 1 -
include/linux/posix-timers.h | 1 -
include/linux/pps_kernel.h | 3 ++-
include/linux/psi_types.h | 1 -
include/linux/pwm.h | 1 -
include/linux/quota.h | 1 -
include/linux/random.h | 1 -
include/linux/regmap.h | 1 -
include/linux/relay.h | 1 -
include/linux/remoteproc.h | 1 -
include/linux/rfkill.h | 2 --
include/linux/ring_buffer.h | 1 -
include/linux/rtc/ds1685.h | 1 -
include/linux/rtnetlink.h | 2 --
include/linux/sbitmap.h | 1 -
include/linux/sched/clock.h | 2 +-
include/linux/sched/signal.h | 1 +
include/linux/seq_file.h | 1 -
include/linux/sh_clk.h | 1 -
include/linux/slab.h | 1 -
include/linux/slimbus.h | 3 ++-
include/linux/soc/apple/rtkit.h | 3 ++-
include/linux/soc/apple/sart.h | 2 +-
include/linux/soc/mediatek/mtk-cmdq.h | 1 -
include/linux/soc/qcom/qcom_aoss.h | 2 +-
include/linux/spi/spi_bitbang.h | 1 -
include/linux/srcu.h | 2 --
include/linux/stm.h | 4 +++-
include/linux/sunrpc/auth.h | 1 -
include/linux/sunrpc/metrics.h | 3 ++-
include/linux/sunrpc/rpc_pipe_fs.h | 1 -
include/linux/sunrpc/sched.h | 1 -
include/linux/sunrpc/svc.h | 1 -
include/linux/sunrpc/svc_rdma.h | 1 -
include/linux/swait.h | 1 -
include/linux/swapops.h | 1 -
include/linux/sync_file.h | 1 -
include/linux/sys_soc.h | 3 ++-
include/linux/syscalls.h | 1 -
include/linux/sysfs.h | 5 -----
include/linux/torture.h | 4 ----
include/linux/tracefs.h | 1 -
include/linux/transport_class.h | 3 ++-
include/linux/tty_driver.h | 1 +
include/linux/tty_ldisc.h | 2 --
include/linux/tty_port.h | 2 +-
include/linux/u64_stats_sync.h | 3 +++
include/linux/uprobes.h | 2 --
include/linux/usb/hcd.h | 1 -
include/linux/usb/role.h | 5 ++++-
include/linux/user_namespace.h | 1 -
include/linux/vfio_pci_core.h | 1 -
include/linux/vmalloc.h | 1 -
include/linux/vt_kern.h | 1 -
include/linux/writeback.h | 1 -
include/media/cec.h | 1 -
include/media/dmxdev.h | 1 -
include/media/dvb_demux.h | 1 -
include/media/rc-core.h | 1 -
include/media/v4l2-async.h | 1 -
include/media/v4l2-event.h | 1 -
include/media/v4l2-ioctl.h | 1 -
include/net/ax25.h | 1 -
include/net/bluetooth/bluetooth.h | 3 ++-
include/net/bonding.h | 1 -
include/net/bpf_sk_storage.h | 4 ----
include/net/caif/cfcnfg.h | 1 -
include/net/caif/cfsrvl.h | 1 -
include/net/devlink.h | 3 +--
include/net/dsa.h | 2 --
include/net/dsa_stubs.h | 1 -
include/net/inet_hashtables.h | 1 -
include/net/inet_timewait_sock.h | 1 -
include/net/inetpeer.h | 1 -
include/net/ip_fib.h | 1 -
include/net/lib80211.h | 3 ++-
include/net/neighbour.h | 3 ++-
include/net/net_namespace.h | 1 -
include/net/net_ratelimit.h | 2 --
include/net/netns/conntrack.h | 1 -
include/net/netns/xfrm.h | 1 -
include/net/netrom.h | 1 -
include/net/pkt_cls.h | 3 ++-
include/net/sch_generic.h | 1 -
include/net/smc.h | 2 +-
include/net/snmp.h | 1 -
include/net/tcp.h | 4 ++--
include/net/udp.h | 3 ++-
include/net/xfrm.h | 1 -
include/rdma/ib_umem.h | 1 -
include/rdma/restrack.h | 1 -
include/scsi/scsi_cmnd.h | 1 -
include/scsi/scsi_host.h | 1 +
include/sound/core.h | 1 -
include/video/atmel_lcdc.h | 2 --
include/xen/interface/memory.h | 2 --
include/xen/xenbus.h | 1 -
198 files changed, 90 insertions(+), 235 deletions(-)
diff --git a/include/crypto/drbg.h b/include/crypto/drbg.h
index af5ad51d3eef..e78a671a9e76 100644
--- a/include/crypto/drbg.h
+++ b/include/crypto/drbg.h
@@ -52,7 +52,6 @@
#include <linux/fips.h>
#include <linux/mutex.h>
#include <linux/list.h>
-#include <linux/workqueue.h>
/*
* Concatenation Helper and string operation helper
diff --git a/include/crypto/if_alg.h b/include/crypto/if_alg.h
index 78ecaf5db04c..6e532e2a6e6b 100644
--- a/include/crypto/if_alg.h
+++ b/include/crypto/if_alg.h
@@ -9,7 +9,6 @@
#define _CRYPTO_IF_ALG_H
#include <linux/compiler.h>
-#include <linux/completion.h>
#include <linux/if_alg.h>
#include <linux/scatterlist.h>
#include <linux/types.h>
diff --git a/include/drm/drm_auth.h b/include/drm/drm_auth.h
index 50131383ed81..cb7377d5f5c3 100644
--- a/include/drm/drm_auth.h
+++ b/include/drm/drm_auth.h
@@ -30,7 +30,6 @@
#include <linux/idr.h>
#include <linux/kref.h>
-#include <linux/wait.h>
struct drm_file;
diff --git a/include/drm/drm_debugfs.h b/include/drm/drm_debugfs.h
index cf06cee4343f..ebf0973aaa8a 100644
--- a/include/drm/drm_debugfs.h
+++ b/include/drm/drm_debugfs.h
@@ -37,6 +37,8 @@
#include <drm/drm_gpuvm.h>
+struct seq_file;
+
/**
* DRM_DEBUGFS_GPUVA_INFO - &drm_info_list entry to dump a GPU VA space
* @show: the &drm_info_list's show callback
diff --git a/include/drm/drm_file.h b/include/drm/drm_file.h
index ab230d3af138..5d97a20cf80f 100644
--- a/include/drm/drm_file.h
+++ b/include/drm/drm_file.h
@@ -31,13 +31,13 @@
#define _DRM_FILE_H_
#include <linux/types.h>
-#include <linux/completion.h>
#include <linux/idr.h>
#include <uapi/drm/drm.h>
#include <drm/drm_prime.h>
+struct completion;
struct dma_fence;
struct drm_file;
struct drm_device;
diff --git a/include/drm/drm_gem_shmem_helper.h b/include/drm/drm_gem_shmem_helper.h
index bf0c31aa8fbe..dd74ffd10252 100644
--- a/include/drm/drm_gem_shmem_helper.h
+++ b/include/drm/drm_gem_shmem_helper.h
@@ -5,7 +5,6 @@
#include <linux/fs.h>
#include <linux/mm.h>
-#include <linux/mutex.h>
#include <drm/drm_file.h>
#include <drm/drm_gem.h>
diff --git a/include/drm/drm_mm.h b/include/drm/drm_mm.h
index ac33ba1b18bc..abc1d1d48142 100644
--- a/include/drm/drm_mm.h
+++ b/include/drm/drm_mm.h
@@ -42,7 +42,6 @@
#include <linux/limits.h>
#include <linux/mm_types.h>
#include <linux/list.h>
-#include <linux/spinlock.h>
#ifdef CONFIG_DRM_DEBUG_MM
#include <linux/stackdepot.h>
#endif
diff --git a/include/drm/drm_print.h b/include/drm/drm_print.h
index 5ed26a702e3e..36b0d14be87e 100644
--- a/include/drm/drm_print.h
+++ b/include/drm/drm_print.h
@@ -35,6 +35,8 @@
#include <drm/drm.h>
+struct seq_file;
+
/* Do *not* use outside of drm_print.[ch]! */
extern unsigned long __drm_debug;
diff --git a/include/drm/drm_util.h b/include/drm/drm_util.h
index 79952d8c4bba..15fd591f3e1d 100644
--- a/include/drm/drm_util.h
+++ b/include/drm/drm_util.h
@@ -35,7 +35,6 @@
#include <linux/interrupt.h>
#include <linux/kgdb.h>
#include <linux/preempt.h>
-#include <linux/smp.h>
/*
* Use EXPORT_SYMBOL_FOR_TESTS_ONLY() for functions that shall
diff --git a/include/drm/drm_vma_manager.h b/include/drm/drm_vma_manager.h
index 6c2a2f21dbf0..b0efaeeb4cf0 100644
--- a/include/drm/drm_vma_manager.h
+++ b/include/drm/drm_vma_manager.h
@@ -26,7 +26,6 @@
#include <drm/drm_mm.h>
#include <linux/mm.h>
#include <linux/rbtree.h>
-#include <linux/spinlock.h>
#include <linux/types.h>
/* We make up offsets for buffer objects so we can recognize them at
diff --git a/include/drm/ttm/ttm_device.h b/include/drm/ttm/ttm_device.h
index c22f30535c84..122f1455a2df 100644
--- a/include/drm/ttm/ttm_device.h
+++ b/include/drm/ttm/ttm_device.h
@@ -26,7 +26,6 @@
#define _TTM_DEVICE_H_
#include <linux/types.h>
-#include <linux/workqueue.h>
#include <drm/ttm/ttm_resource.h>
#include <drm/ttm/ttm_pool.h>
diff --git a/include/drm/ttm/ttm_resource.h b/include/drm/ttm/ttm_resource.h
index 78a226eba953..043aeff83913 100644
--- a/include/drm/ttm/ttm_resource.h
+++ b/include/drm/ttm/ttm_resource.h
@@ -27,7 +27,6 @@
#include <linux/types.h>
#include <linux/list.h>
-#include <linux/mutex.h>
#include <linux/iosys-map.h>
#include <linux/dma-fence.h>
diff --git a/include/keys/asymmetric-subtype.h b/include/keys/asymmetric-subtype.h
index d55171f640a0..ea7d4ca9e315 100644
--- a/include/keys/asymmetric-subtype.h
+++ b/include/keys/asymmetric-subtype.h
@@ -13,6 +13,7 @@
#include <linux/seq_file.h>
#include <keys/asymmetric-type.h>
+struct seq_file;
struct kernel_pkey_query;
struct kernel_pkey_params;
struct public_key_signature;
diff --git a/include/kunit/test.h b/include/kunit/test.h
index fcb4a4940ace..febd48635ab1 100644
--- a/include/kunit/test.h
+++ b/include/kunit/test.h
@@ -19,7 +19,6 @@
#include <linux/init.h>
#include <linux/jump_label.h>
#include <linux/kconfig.h>
-#include <linux/kref.h>
#include <linux/list.h>
#include <linux/module.h>
#include <linux/slab.h>
diff --git a/include/linux/acpi_amd_wbrf.h b/include/linux/acpi_amd_wbrf.h
index 898f31d536d4..8b83cc9f6f7b 100644
--- a/include/linux/acpi_amd_wbrf.h
+++ b/include/linux/acpi_amd_wbrf.h
@@ -7,8 +7,11 @@
#ifndef _ACPI_AMD_WBRF_H
#define _ACPI_AMD_WBRF_H
-#include <linux/device.h>
-#include <linux/notifier.h>
+#include <linux/errno.h>
+#include <linux/types.h>
+
+struct device;
+struct notifier_block;
/* The maximum number of frequency band ranges */
#define MAX_NUM_OF_WBRF_RANGES 11
diff --git a/include/linux/acpi_dma.h b/include/linux/acpi_dma.h
index 72cedb916a9c..40d99e88ddd2 100644
--- a/include/linux/acpi_dma.h
+++ b/include/linux/acpi_dma.h
@@ -12,10 +12,11 @@
#define __LINUX_ACPI_DMA_H
#include <linux/list.h>
-#include <linux/device.h>
#include <linux/err.h>
#include <linux/dmaengine.h>
+struct device;
+
/**
* struct acpi_dma_spec - slave device DMA resources
* @chan_id: channel unique id
diff --git a/include/linux/async_tx.h b/include/linux/async_tx.h
index 5cc73d7e5b52..9ba1dd21e4de 100644
--- a/include/linux/async_tx.h
+++ b/include/linux/async_tx.h
@@ -5,7 +5,6 @@
#ifndef _ASYNC_TX_H_
#define _ASYNC_TX_H_
#include <linux/dmaengine.h>
-#include <linux/spinlock.h>
#include <linux/interrupt.h>
/* on architectures without dma-mapping capabilities we need to ensure
diff --git a/include/linux/atmdev.h b/include/linux/atmdev.h
index 9b02961d65ee..4f9117f83d39 100644
--- a/include/linux/atmdev.h
+++ b/include/linux/atmdev.h
@@ -3,8 +3,6 @@
#ifndef LINUX_ATMDEV_H
#define LINUX_ATMDEV_H
-
-#include <linux/wait.h> /* wait_queue_head_t */
#include <linux/time.h> /* struct timeval */
#include <linux/net.h>
#include <linux/bug.h>
diff --git a/include/linux/backing-dev-defs.h b/include/linux/backing-dev-defs.h
index 721659b4edd7..7bf50450cd69 100644
--- a/include/linux/backing-dev-defs.h
+++ b/include/linux/backing-dev-defs.h
@@ -13,7 +13,6 @@
#include <linux/wait.h>
#include <linux/workqueue.h>
#include <linux/kref.h>
-#include <linux/refcount.h>
#ifdef CONFIG_CGROUP_WRITEBACK
#include <linux/rwsem.h>
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 09e7268bc590..a98a9f1d21a0 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -10,7 +10,6 @@
#include <linux/blk_types.h>
#include <linux/device.h>
#include <linux/list.h>
-#include <linux/llist.h>
#include <linux/minmax.h>
#include <linux/timer.h>
#include <linux/workqueue.h>
@@ -22,7 +21,6 @@
#include <linux/percpu-refcount.h>
#include <linux/blkzoned.h>
#include <linux/sched.h>
-#include <linux/sbitmap.h>
#include <linux/uio.h> // for iov_iter_is_aligned()
#include <linux/uuid.h>
#include <linux/xarray.h>
diff --git a/include/linux/blktrace_api.h b/include/linux/blktrace_api.h
index 122c62e561fc..c9e0ecae5fa0 100644
--- a/include/linux/blktrace_api.h
+++ b/include/linux/blktrace_api.h
@@ -11,8 +11,6 @@
#if defined(CONFIG_BLK_DEV_IO_TRACE)
-#include <linux/sysfs.h>
-
struct blk_trace {
int trace_state;
struct rchan *rchan;
diff --git a/include/linux/bpf-netns.h b/include/linux/bpf-netns.h
index 413cfa5e4b07..c5bcf01d712e 100644
--- a/include/linux/bpf-netns.h
+++ b/include/linux/bpf-netns.h
@@ -2,7 +2,6 @@
#ifndef _BPF_NETNS_H
#define _BPF_NETNS_H
-#include <linux/mutex.h>
#include <net/netns/bpf.h>
#include <uapi/linux/bpf.h>
diff --git a/include/linux/bpf.h b/include/linux/bpf.h
index 1ebbee1d648e..5f2ee4e017db 100644
--- a/include/linux/bpf.h
+++ b/include/linux/bpf.h
@@ -14,7 +14,6 @@
#include <linux/rbtree_latch.h>
#include <linux/numa.h>
#include <linux/mm_types.h>
-#include <linux/wait.h>
#include <linux/refcount.h>
#include <linux/mutex.h>
#include <linux/module.h>
diff --git a/include/linux/cacheinfo.h b/include/linux/cacheinfo.h
index d504eb4b49ab..9e422f4fdc38 100644
--- a/include/linux/cacheinfo.h
+++ b/include/linux/cacheinfo.h
@@ -4,7 +4,6 @@
#include <linux/bitops.h>
#include <linux/cpumask.h>
-#include <linux/smp.h>
struct device_node;
struct attribute;
diff --git a/include/linux/cdev.h b/include/linux/cdev.h
index 0e8cd6293deb..6f4892ff3a40 100644
--- a/include/linux/cdev.h
+++ b/include/linux/cdev.h
@@ -5,8 +5,8 @@
#include <linux/kobject.h>
#include <linux/kdev_t.h>
#include <linux/list.h>
-#include <linux/device.h>
+struct device;
struct file_operations;
struct inode;
struct module;
diff --git a/include/linux/ceph/libceph.h b/include/linux/ceph/libceph.h
index 4497d0a6772c..b86a567e9493 100644
--- a/include/linux/ceph/libceph.h
+++ b/include/linux/ceph/libceph.h
@@ -6,7 +6,6 @@
#include <asm/unaligned.h>
#include <linux/backing-dev.h>
-#include <linux/completion.h>
#include <linux/exportfs.h>
#include <linux/bug.h>
#include <linux/fs.h>
diff --git a/include/linux/ceph/messenger.h b/include/linux/ceph/messenger.h
index 2eaaabbe98cb..e1a440f6c353 100644
--- a/include/linux/ceph/messenger.h
+++ b/include/linux/ceph/messenger.h
@@ -7,7 +7,6 @@
#include <linux/kref.h>
#include <linux/mutex.h>
#include <linux/net.h>
-#include <linux/radix-tree.h>
#include <linux/uio.h>
#include <linux/workqueue.h>
#include <net/net_namespace.h>
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
index 34aaf0e87def..24dcff53bd05 100644
--- a/include/linux/cgroup.h
+++ b/include/linux/cgroup.h
@@ -11,7 +11,6 @@
#include <linux/sched.h>
#include <linux/cpumask.h>
-#include <linux/nodemask.h>
#include <linux/rculist.h>
#include <linux/cgroupstats.h>
#include <linux/fs.h>
diff --git a/include/linux/clocksource.h b/include/linux/clocksource.h
index 1d42d4b17327..4cfdc7068baa 100644
--- a/include/linux/clocksource.h
+++ b/include/linux/clocksource.h
@@ -14,7 +14,6 @@
#include <linux/time.h>
#include <linux/list.h>
#include <linux/cache.h>
-#include <linux/timer.h>
#include <linux/init.h>
#include <linux/of.h>
#include <linux/clocksource_ids.h>
diff --git a/include/linux/connector.h b/include/linux/connector.h
index 70bc1160f3d8..c85ddfc2094e 100644
--- a/include/linux/connector.h
+++ b/include/linux/connector.h
@@ -12,7 +12,6 @@
#include <linux/refcount.h>
#include <linux/list.h>
-#include <linux/workqueue.h>
#include <net/sock.h>
#include <uapi/linux/connector.h>
diff --git a/include/linux/cpuidle.h b/include/linux/cpuidle.h
index 3183aeb7f5b4..188003e46c29 100644
--- a/include/linux/cpuidle.h
+++ b/include/linux/cpuidle.h
@@ -13,7 +13,6 @@
#include <linux/percpu.h>
#include <linux/list.h>
-#include <linux/hrtimer.h>
#include <linux/context_tracking.h>
#define CPUIDLE_STATE_MAX 10
diff --git a/include/linux/dax.h b/include/linux/dax.h
index b463502b16e1..50f1e1ea2a47 100644
--- a/include/linux/dax.h
+++ b/include/linux/dax.h
@@ -4,7 +4,6 @@
#include <linux/fs.h>
#include <linux/mm.h>
-#include <linux/radix-tree.h>
typedef unsigned long dax_entry_t;
diff --git a/include/linux/dccp.h b/include/linux/dccp.h
index 325af611909f..743f1abd20fb 100644
--- a/include/linux/dccp.h
+++ b/include/linux/dccp.h
@@ -8,7 +8,6 @@
#include <linux/ktime.h>
#include <linux/list.h>
#include <linux/uio.h>
-#include <linux/workqueue.h>
#include <net/inet_connection_sock.h>
#include <net/inet_sock.h>
diff --git a/include/linux/debugfs.h b/include/linux/debugfs.h
index c9c65b132c0f..ef158781a580 100644
--- a/include/linux/debugfs.h
+++ b/include/linux/debugfs.h
@@ -20,6 +20,7 @@
struct device;
struct file_operations;
+struct seq_file;
struct debugfs_blob_wrapper {
void *data;
diff --git a/include/linux/debugobjects.h b/include/linux/debugobjects.h
index 32444686b6ff..3c689461781f 100644
--- a/include/linux/debugobjects.h
+++ b/include/linux/debugobjects.h
@@ -3,7 +3,6 @@
#define _LINUX_DEBUGOBJECTS_H
#include <linux/list.h>
-#include <linux/spinlock.h>
enum debug_obj_state {
ODEBUG_STATE_NONE,
diff --git a/include/linux/device.h b/include/linux/device.h
index ddba2d30c541..5e47c9b5d0fa 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -22,8 +22,6 @@
#include <linux/compiler.h>
#include <linux/types.h>
#include <linux/mutex.h>
-#include <linux/pm.h>
-#include <linux/atomic.h>
#include <linux/uidgid.h>
#include <linux/gfp.h>
#include <linux/overflow.h>
diff --git a/include/linux/device/bus.h b/include/linux/device/bus.h
index 76826d165298..bdd8ac64f629 100644
--- a/include/linux/device/bus.h
+++ b/include/linux/device/bus.h
@@ -14,13 +14,14 @@
#ifndef _DEVICE_BUS_H_
#define _DEVICE_BUS_H_
-#include <linux/kobject.h>
#include <linux/klist.h>
#include <linux/pm.h>
#include <linux/sysfs.h> // for struct attribute
struct device_driver;
+struct device_node;
struct fwnode_handle;
+struct kobj_uevent_env;
/**
* struct bus_type - The bus type of the device
diff --git a/include/linux/device/class.h b/include/linux/device/class.h
index 6b1cebe43f8e..cf140c3e61f2 100644
--- a/include/linux/device/class.h
+++ b/include/linux/device/class.h
@@ -14,14 +14,13 @@
#ifndef _DEVICE_CLASS_H_
#define _DEVICE_CLASS_H_
-#include <linux/kobject.h>
#include <linux/klist.h>
-#include <linux/pm.h>
#include <linux/uidgid_types.h>
#include <linux/device/bus.h>
struct device;
struct fwnode_handle;
+struct kobj_uevent_env;
/**
* struct class - device classes
diff --git a/include/linux/device/driver.h b/include/linux/device/driver.h
index 7738f458995f..a3b51f5bd0e9 100644
--- a/include/linux/device/driver.h
+++ b/include/linux/device/driver.h
@@ -14,9 +14,7 @@
#ifndef _DEVICE_DRIVER_H_
#define _DEVICE_DRIVER_H_
-#include <linux/kobject.h>
#include <linux/klist.h>
-#include <linux/pm.h>
#include <linux/device/bus.h>
#include <linux/module.h>
diff --git a/include/linux/dma-fence.h b/include/linux/dma-fence.h
index e06bad467f55..0b613c1b7520 100644
--- a/include/linux/dma-fence.h
+++ b/include/linux/dma-fence.h
@@ -14,7 +14,6 @@
#define __LINUX_DMA_FENCE_H
#include <linux/err.h>
-#include <linux/wait.h>
#include <linux/list.h>
#include <linux/bitops.h>
#include <linux/kref.h>
diff --git a/include/linux/dma-resv.h b/include/linux/dma-resv.h
index 8d0e34dad446..4aae9e4cc592 100644
--- a/include/linux/dma-resv.h
+++ b/include/linux/dma-resv.h
@@ -42,7 +42,6 @@
#include <linux/ww_mutex.h>
#include <linux/dma-fence.h>
#include <linux/slab.h>
-#include <linux/seqlock.h>
#include <linux/rcupdate.h>
extern struct ww_class reservation_ww_class;
diff --git a/include/linux/dmi.h b/include/linux/dmi.h
index 927f8a8b7a1d..bb0d945e4163 100644
--- a/include/linux/dmi.h
+++ b/include/linux/dmi.h
@@ -3,7 +3,6 @@
#define __DMI_H__
#include <linux/list.h>
-#include <linux/kobject.h>
#include <linux/mod_devicetable.h>
/* enum dmi_field is in mod_devicetable.h */
diff --git a/include/linux/dpll.h b/include/linux/dpll.h
index 9cf896ea1d41..de21b3ba41c0 100644
--- a/include/linux/dpll.h
+++ b/include/linux/dpll.h
@@ -8,7 +8,6 @@
#define __DPLL_H__
#include <uapi/linux/dpll.h>
-#include <linux/device.h>
#include <linux/netlink.h>
struct dpll_device;
diff --git a/include/linux/energy_model.h b/include/linux/energy_model.h
index 88d91e087471..a1212432e447 100644
--- a/include/linux/energy_model.h
+++ b/include/linux/energy_model.h
@@ -2,14 +2,14 @@
#ifndef _LINUX_ENERGY_MODEL_H
#define _LINUX_ENERGY_MODEL_H
#include <linux/cpumask.h>
-#include <linux/device.h>
#include <linux/jump_label.h>
-#include <linux/kobject.h>
#include <linux/rcupdate.h>
#include <linux/sched/cpufreq.h>
#include <linux/sched/topology.h>
#include <linux/types.h>
+struct device;
+
/**
* struct em_perf_state - Performance state of a performance domain
* @frequency: The frequency in KHz, for consistency with CPUFreq
diff --git a/include/linux/extcon.h b/include/linux/extcon.h
index 0fd2ca917549..72a2c4028b2d 100644
--- a/include/linux/extcon.h
+++ b/include/linux/extcon.h
@@ -18,11 +18,14 @@
#ifndef __LINUX_EXTCON_H__
#define __LINUX_EXTCON_H__
-#include <linux/device.h>
#include <linux/errno.h>
#include <linux/notifier.h>
#include <linux/types.h>
+struct device;
+struct device_node;
+struct notifier_block;
+
/*
* Define the type of supported external connectors
*/
diff --git a/include/linux/fb.h b/include/linux/fb.h
index 05dc9624897d..2bbad4a85a5d 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -13,7 +13,6 @@
#include <linux/workqueue.h>
#include <linux/notifier.h>
#include <linux/list.h>
-#include <linux/backlight.h>
#include <linux/slab.h>
#include <asm/fb.h>
@@ -24,6 +23,7 @@ struct device;
struct file;
struct videomode;
struct device_node;
+struct backlight_device;
/* Definitions below are used in the parsed monitor specs */
#define FB_DPMS_ACTIVE_OFF 1
diff --git a/include/linux/filter.h b/include/linux/filter.h
index fee070b9826e..60c8371badec 100644
--- a/include/linux/filter.h
+++ b/include/linux/filter.h
@@ -12,7 +12,6 @@
#include <linux/skbuff.h>
#include <linux/linkage.h>
#include <linux/printk.h>
-#include <linux/workqueue.h>
#include <linux/sched.h>
#include <linux/sched/clock.h>
#include <linux/capability.h>
diff --git a/include/linux/firewire.h b/include/linux/firewire.h
index dd9f2d765e68..c325e3523f93 100644
--- a/include/linux/firewire.h
+++ b/include/linux/firewire.h
@@ -10,7 +10,6 @@
#include <linux/list.h>
#include <linux/mutex.h>
#include <linux/spinlock.h>
-#include <linux/sysfs.h>
#include <linux/timer.h>
#include <linux/types.h>
#include <linux/workqueue.h>
diff --git a/include/linux/freezer.h b/include/linux/freezer.h
index b303472255be..5eb2a34ad7eb 100644
--- a/include/linux/freezer.h
+++ b/include/linux/freezer.h
@@ -6,7 +6,6 @@
#include <linux/debug_locks.h>
#include <linux/sched.h>
-#include <linux/wait.h>
#include <linux/atomic.h>
#include <linux/jump_label.h>
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 1cc1f3f08107..4048cf6ebb4f 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -12,7 +12,6 @@
#include <linux/list.h>
#include <linux/list_lru.h>
#include <linux/llist.h>
-#include <linux/radix-tree.h>
#include <linux/xarray.h>
#include <linux/rbtree.h>
#include <linux/init.h>
diff --git a/include/linux/greybus/connection.h b/include/linux/greybus/connection.h
index d59b7fc1de3e..d8926e864937 100644
--- a/include/linux/greybus/connection.h
+++ b/include/linux/greybus/connection.h
@@ -13,7 +13,6 @@
#include <linux/list.h>
#include <linux/kfifo.h>
#include <linux/kref.h>
-#include <linux/workqueue.h>
#define GB_CONNECTION_FLAG_CSD BIT(0)
#define GB_CONNECTION_FLAG_NO_FLOWCTRL BIT(1)
diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h
index ba795d668766..d31dd0be881b 100644
--- a/include/linux/hrtimer.h
+++ b/include/linux/hrtimer.h
@@ -17,7 +17,6 @@
#include <linux/init.h>
#include <linux/list.h>
#include <linux/percpu-defs.h>
-#include <linux/rbtree.h>
#include <linux/seqlock.h>
#include <linux/timer.h>
#include <asm/processor.h> /* for cpu_relax() */
diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h
index 2b00faf98017..249c4eb67f38 100644
--- a/include/linux/hyperv.h
+++ b/include/linux/hyperv.h
@@ -18,7 +18,6 @@
#include <linux/types.h>
#include <linux/scatterlist.h>
#include <linux/list.h>
-#include <linux/timer.h>
#include <linux/completion.h>
#include <linux/device.h>
#include <linux/mod_devicetable.h>
diff --git a/include/linux/i2c-smbus.h b/include/linux/i2c-smbus.h
index ced1c6ead52a..7d6a3235ddf4 100644
--- a/include/linux/i2c-smbus.h
+++ b/include/linux/i2c-smbus.h
@@ -9,8 +9,6 @@
#define _LINUX_I2C_SMBUS_H
#include <linux/i2c.h>
-#include <linux/spinlock.h>
-#include <linux/workqueue.h>
/**
diff --git a/include/linux/i3c/master.h b/include/linux/i3c/master.h
index 0ca27dd86956..7fc1e0bb4122 100644
--- a/include/linux/i3c/master.h
+++ b/include/linux/i3c/master.h
@@ -15,7 +15,6 @@
#include <linux/i3c/ccc.h>
#include <linux/i3c/device.h>
#include <linux/rwsem.h>
-#include <linux/spinlock.h>
#include <linux/workqueue.h>
#define I3C_HOT_JOIN_ADDR 0x2
diff --git a/include/linux/iio/buffer.h b/include/linux/iio/buffer.h
index 418b1307d3f2..70c06c5b4e5d 100644
--- a/include/linux/iio/buffer.h
+++ b/include/linux/iio/buffer.h
@@ -6,7 +6,7 @@
#ifndef _IIO_BUFFER_GENERIC_H_
#define _IIO_BUFFER_GENERIC_H_
-#include <linux/sysfs.h>
+
#include <linux/iio/iio.h>
struct iio_buffer;
diff --git a/include/linux/init_task.h b/include/linux/init_task.h
index bccb3f1f6262..0f4ce5661d6d 100644
--- a/include/linux/init_task.h
+++ b/include/linux/init_task.h
@@ -11,8 +11,6 @@
#include <linux/pid_namespace.h>
#include <linux/user_namespace.h>
#include <linux/securebits.h>
-#include <linux/seqlock.h>
-#include <linux/rbtree.h>
#include <linux/refcount.h>
#include <linux/sched/autogroup.h>
#include <net/net_namespace.h>
diff --git a/include/linux/interconnect.h b/include/linux/interconnect.h
index 97ac253df62c..1763a7956b87 100644
--- a/include/linux/interconnect.h
+++ b/include/linux/interconnect.h
@@ -7,7 +7,6 @@
#ifndef __LINUX_INTERCONNECT_H
#define __LINUX_INTERCONNECT_H
-#include <linux/mutex.h>
#include <linux/types.h>
/* macros for converting to icc units */
diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h
index 76121c2bb4f8..6322804d7534 100644
--- a/include/linux/interrupt.h
+++ b/include/linux/interrupt.h
@@ -10,7 +10,6 @@
#include <linux/irqnr.h>
#include <linux/hardirq.h>
#include <linux/irqflags.h>
-#include <linux/hrtimer.h>
#include <linux/kref.h>
#include <linux/workqueue.h>
#include <linux/jump_label.h>
diff --git a/include/linux/io_uring.h b/include/linux/io_uring.h
index 68ed6697fece..d4142d3b7d10 100644
--- a/include/linux/io_uring.h
+++ b/include/linux/io_uring.h
@@ -3,7 +3,6 @@
#define _LINUX_IO_URING_H
#include <linux/sched.h>
-#include <linux/xarray.h>
#include <uapi/linux/io_uring.h>
#if defined(CONFIG_IO_URING)
diff --git a/include/linux/ism.h b/include/linux/ism.h
index 5428edd90982..48e4dbaae342 100644
--- a/include/linux/ism.h
+++ b/include/linux/ism.h
@@ -9,8 +9,6 @@
#ifndef _ISM_H
#define _ISM_H
-#include <linux/workqueue.h>
-
struct ism_dmb {
u64 dmb_tok;
u64 rgid;
diff --git a/include/linux/kernel_stat.h b/include/linux/kernel_stat.h
index 9935f7ecbfb9..b7747a80e4c7 100644
--- a/include/linux/kernel_stat.h
+++ b/include/linux/kernel_stat.h
@@ -2,7 +2,6 @@
#ifndef _LINUX_KERNEL_STAT_H
#define _LINUX_KERNEL_STAT_H
-#include <linux/smp.h>
#include <linux/threads.h>
#include <linux/percpu.h>
#include <linux/cpumask.h>
diff --git a/include/linux/kernfs.h b/include/linux/kernfs.h
index 99aaa050ccb7..5d16cb9c2d02 100644
--- a/include/linux/kernfs.h
+++ b/include/linux/kernfs.h
@@ -9,16 +9,11 @@
#include <linux/err.h>
#include <linux/list.h>
#include <linux/mutex.h>
-#include <linux/idr.h>
#include <linux/lockdep.h>
#include <linux/rbtree.h>
-#include <linux/atomic.h>
#include <linux/bug.h>
#include <linux/types.h>
#include <linux/uidgid.h>
-#include <linux/wait.h>
-#include <linux/rwsem.h>
-#include <linux/cache.h>
struct file;
struct dentry;
diff --git a/include/linux/kobj_map.h b/include/linux/kobj_map.h
index c9919f8b2293..5078a587b70c 100644
--- a/include/linux/kobj_map.h
+++ b/include/linux/kobj_map.h
@@ -6,7 +6,9 @@
#ifndef _KOBJ_MAP_H_
#define _KOBJ_MAP_H_
-#include <linux/mutex.h>
+#include <linux/types.h> // for dev_t
+
+struct mutex;
typedef struct kobject *kobj_probe_t(dev_t, int *, void *);
struct kobj_map;
diff --git a/include/linux/kobject.h b/include/linux/kobject.h
index c30affcc43b4..b02c756fc4f2 100644
--- a/include/linux/kobject.h
+++ b/include/linux/kobject.h
@@ -23,8 +23,6 @@
#include <linux/spinlock.h>
#include <linux/kref.h>
#include <linux/kobject_ns.h>
-#include <linux/wait.h>
-#include <linux/atomic.h>
#include <linux/workqueue.h>
#include <linux/uidgid.h>
diff --git a/include/linux/kprobes.h b/include/linux/kprobes.h
index 0ff44d6633e3..b0511d1090ed 100644
--- a/include/linux/kprobes.h
+++ b/include/linux/kprobes.h
@@ -19,10 +19,8 @@
#include <linux/linkage.h>
#include <linux/list.h>
#include <linux/notifier.h>
-#include <linux/smp.h>
#include <linux/bug.h>
#include <linux/percpu.h>
-#include <linux/spinlock.h>
#include <linux/rcupdate.h>
#include <linux/mutex.h>
#include <linux/ftrace.h>
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index 7e7fd25b09b3..c5c00ecaf27e 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -20,7 +20,6 @@
#include <linux/slab.h>
#include <linux/vmalloc.h>
#include <linux/rcupdate.h>
-#include <linux/ratelimit.h>
#include <linux/err.h>
#include <linux/irqflags.h>
#include <linux/context_tracking.h>
diff --git a/include/linux/lapb.h b/include/linux/lapb.h
index b5333f9413dc..7d4c5073aad4 100644
--- a/include/linux/lapb.h
+++ b/include/linux/lapb.h
@@ -7,7 +7,6 @@
#define LAPB_KERNEL_H
#include <linux/skbuff.h>
-#include <linux/timer.h>
struct net_device;
diff --git a/include/linux/libnvdimm.h b/include/linux/libnvdimm.h
index e772aae71843..f8ab7da9cc28 100644
--- a/include/linux/libnvdimm.h
+++ b/include/linux/libnvdimm.h
@@ -11,7 +11,8 @@
#include <linux/types.h>
#include <linux/uuid.h>
#include <linux/spinlock.h>
-#include <linux/bio.h>
+
+struct bio;
struct badrange_entry {
u64 start;
diff --git a/include/linux/lru_cache.h b/include/linux/lru_cache.h
index c9afcdd9324c..03d2cda724ea 100644
--- a/include/linux/lru_cache.h
+++ b/include/linux/lru_cache.h
@@ -17,7 +17,6 @@
#include <linux/list.h>
#include <linux/slab.h>
#include <linux/bitops.h>
-#include <linux/string.h> /* for memset */
#include <linux/seq_file.h>
/*
diff --git a/include/linux/lsm_audit.h b/include/linux/lsm_audit.h
index 97a8b21eb033..bd1ae08af2aa 100644
--- a/include/linux/lsm_audit.h
+++ b/include/linux/lsm_audit.h
@@ -15,7 +15,6 @@
#include <linux/errno.h>
#include <linux/kernel.h>
#include <linux/kdev_t.h>
-#include <linux/spinlock.h>
#include <linux/init.h>
#include <linux/audit.h>
#include <linux/in6.h>
diff --git a/include/linux/mISDNif.h b/include/linux/mISDNif.h
index 7aab4a769736..25f1be21aee3 100644
--- a/include/linux/mISDNif.h
+++ b/include/linux/mISDNif.h
@@ -412,7 +412,8 @@ struct mISDN_ctrl_req {
#include <linux/skbuff.h>
#include <linux/net.h>
#include <net/sock.h>
-#include <linux/completion.h>
+
+struct completion;
#define DEBUG_CORE 0x000000ff
#define DEBUG_CORE_FUNC 0x00000002
diff --git a/include/linux/mailbox_client.h b/include/linux/mailbox_client.h
index 734694912ef7..00abe565898a 100644
--- a/include/linux/mailbox_client.h
+++ b/include/linux/mailbox_client.h
@@ -8,8 +8,8 @@
#define __MAILBOX_CLIENT_H
#include <linux/of.h>
-#include <linux/device.h>
+struct device;
struct mbox_chan;
/**
diff --git a/include/linux/mailbox_controller.h b/include/linux/mailbox_controller.h
index 6fee33cb52f5..254b329f7699 100644
--- a/include/linux/mailbox_controller.h
+++ b/include/linux/mailbox_controller.h
@@ -6,9 +6,9 @@
#include <linux/of.h>
#include <linux/types.h>
#include <linux/hrtimer.h>
-#include <linux/device.h>
#include <linux/completion.h>
+struct device;
struct mbox_chan;
/**
diff --git a/include/linux/mdio-mux.h b/include/linux/mdio-mux.h
index a5d58f221939..88d6cf303bbf 100644
--- a/include/linux/mdio-mux.h
+++ b/include/linux/mdio-mux.h
@@ -9,8 +9,10 @@
*/
#ifndef __LINUX_MDIO_MUX_H
#define __LINUX_MDIO_MUX_H
-#include <linux/device.h>
-#include <linux/phy.h>
+
+struct device;
+struct device_node;
+struct mii_bus;
/* mdio_mux_init() - Initialize a MDIO mux
* @dev The device owning the MDIO mux
diff --git a/include/linux/mdio/mdio-mscc-miim.h b/include/linux/mdio/mdio-mscc-miim.h
index 1ce699740af6..3051d4acdde5 100644
--- a/include/linux/mdio/mdio-mscc-miim.h
+++ b/include/linux/mdio/mdio-mscc-miim.h
@@ -8,9 +8,11 @@
#ifndef MDIO_MSCC_MIIM_H
#define MDIO_MSCC_MIIM_H
-#include <linux/device.h>
-#include <linux/phy.h>
-#include <linux/regmap.h>
+#include <linux/types.h>
+
+struct device;
+struct mii_bus;
+struct regmap;
int mscc_miim_setup(struct device *device, struct mii_bus **bus,
const char *name, struct regmap *mii_regmap,
diff --git a/include/linux/mempolicy.h b/include/linux/mempolicy.h
index 8108fc6e96ca..8128706b9ea0 100644
--- a/include/linux/mempolicy.h
+++ b/include/linux/mempolicy.h
@@ -10,7 +10,6 @@
#include <linux/mmzone.h>
#include <linux/slab.h>
#include <linux/rbtree.h>
-#include <linux/spinlock.h>
#include <linux/nodemask.h>
#include <linux/pagemap.h>
#include <uapi/linux/mempolicy.h>
diff --git a/include/linux/mfd/altera-a10sr.h b/include/linux/mfd/altera-a10sr.h
index d616da4b3c4c..06a18c707d3f 100644
--- a/include/linux/mfd/altera-a10sr.h
+++ b/include/linux/mfd/altera-a10sr.h
@@ -10,7 +10,6 @@
#ifndef __MFD_ALTERA_A10SR_H
#define __MFD_ALTERA_A10SR_H
-#include <linux/completion.h>
#include <linux/list.h>
#include <linux/mfd/core.h>
#include <linux/regmap.h>
diff --git a/include/linux/mfd/max8907.h b/include/linux/mfd/max8907.h
index 4be3c2370e2a..db4de95d3b9e 100644
--- a/include/linux/mfd/max8907.h
+++ b/include/linux/mfd/max8907.h
@@ -10,7 +10,6 @@
#define __LINUX_MFD_MAX8907_H
#include <linux/mutex.h>
-#include <linux/pm.h>
#define MAX8907_GEN_I2C_ADDR (0x78 >> 1)
#define MAX8907_ADC_I2C_ADDR (0x8e >> 1)
diff --git a/include/linux/mfd/wm831x/core.h b/include/linux/mfd/wm831x/core.h
index 511bcad876f0..1eb4e6a56183 100644
--- a/include/linux/mfd/wm831x/core.h
+++ b/include/linux/mfd/wm831x/core.h
@@ -10,7 +10,6 @@
#ifndef __MFD_WM831X_CORE_H__
#define __MFD_WM831X_CORE_H__
-#include <linux/completion.h>
#include <linux/interrupt.h>
#include <linux/irqdomain.h>
#include <linux/list.h>
diff --git a/include/linux/mfd/wm8350/supply.h b/include/linux/mfd/wm8350/supply.h
index d7a91e26177c..797a78c53d32 100644
--- a/include/linux/mfd/wm8350/supply.h
+++ b/include/linux/mfd/wm8350/supply.h
@@ -8,7 +8,6 @@
#ifndef __LINUX_MFD_WM8350_SUPPLY_H_
#define __LINUX_MFD_WM8350_SUPPLY_H_
-#include <linux/mutex.h>
#include <linux/power_supply.h>
/*
diff --git a/include/linux/mfd/wm8400-private.h b/include/linux/mfd/wm8400-private.h
index bc8c2ca6dc70..ba5cf8e0c3e4 100644
--- a/include/linux/mfd/wm8400-private.h
+++ b/include/linux/mfd/wm8400-private.h
@@ -9,7 +9,6 @@
#define __LINUX_MFD_WM8400_PRIV_H
#include <linux/mfd/wm8400.h>
-#include <linux/mutex.h>
#include <linux/platform_device.h>
#include <linux/regmap.h>
diff --git a/include/linux/mfd/wm8994/core.h b/include/linux/mfd/wm8994/core.h
index e8b093522ffd..a4780ac19d0f 100644
--- a/include/linux/mfd/wm8994/core.h
+++ b/include/linux/mfd/wm8994/core.h
@@ -10,7 +10,6 @@
#ifndef __MFD_WM8994_CORE_H__
#define __MFD_WM8994_CORE_H__
-#include <linux/mutex.h>
#include <linux/interrupt.h>
#include <linux/regmap.h>
diff --git a/include/linux/mm.h b/include/linux/mm.h
index b111daecd173..3a47847b0db4 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -15,7 +15,6 @@
#include <linux/mmap_lock.h>
#include <linux/range.h>
#include <linux/pfn.h>
-#include <linux/percpu-refcount.h>
#include <linux/bit_spinlock.h>
#include <linux/shrinker.h>
#include <linux/resource.h>
diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
index 8b611e13153e..05556012321f 100644
--- a/include/linux/mm_types.h
+++ b/include/linux/mm_types.h
@@ -11,7 +11,6 @@
#include <linux/rbtree.h>
#include <linux/maple_tree.h>
#include <linux/rwsem.h>
-#include <linux/completion.h>
#include <linux/cpumask.h>
#include <linux/uprobes.h>
#include <linux/rcupdate.h>
diff --git a/include/linux/mmu_notifier.h b/include/linux/mmu_notifier.h
index f349e08a9dfe..6aa17677254b 100644
--- a/include/linux/mmu_notifier.h
+++ b/include/linux/mmu_notifier.h
@@ -3,7 +3,6 @@
#define _LINUX_MMU_NOTIFIER_H
#include <linux/list.h>
-#include <linux/spinlock.h>
#include <linux/mm_types.h>
#include <linux/mmap_lock.h>
#include <linux/srcu.h>
diff --git a/include/linux/mtd/blktrans.h b/include/linux/mtd/blktrans.h
index 92a7c94777b7..0aa2f072d2a1 100644
--- a/include/linux/mtd/blktrans.h
+++ b/include/linux/mtd/blktrans.h
@@ -9,7 +9,6 @@
#include <linux/mutex.h>
#include <linux/kref.h>
#include <linux/list.h>
-#include <linux/sysfs.h>
struct hd_geometry;
struct mtd_info;
diff --git a/include/linux/mtd/qinfo.h b/include/linux/mtd/qinfo.h
index 0421f12156b5..63ae23b911b1 100644
--- a/include/linux/mtd/qinfo.h
+++ b/include/linux/mtd/qinfo.h
@@ -3,8 +3,6 @@
#define __LINUX_MTD_QINFO_H
#include <linux/mtd/map.h>
-#include <linux/wait.h>
-#include <linux/spinlock.h>
#include <linux/delay.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/flashchip.h>
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 118c40258d07..bf5a43616e1d 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -32,7 +32,6 @@
#include <linux/percpu.h>
#include <linux/rculist.h>
-#include <linux/workqueue.h>
#include <linux/dynamic_queue_limits.h>
#include <net/net_namespace.h>
diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h
index 80900d910992..a75bb2286eee 100644
--- a/include/linux/netfilter.h
+++ b/include/linux/netfilter.h
@@ -8,7 +8,6 @@
#include <linux/if.h>
#include <linux/in.h>
#include <linux/in6.h>
-#include <linux/wait.h>
#include <linux/list.h>
#include <linux/static_key.h>
#include <linux/module.h>
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h
index f5ce7b101146..a832e18f6347 100644
--- a/include/linux/nfs_fs.h
+++ b/include/linux/nfs_fs.h
@@ -25,7 +25,6 @@
#include <linux/rbtree.h>
#include <linux/refcount.h>
#include <linux/rwsem.h>
-#include <linux/wait.h>
#include <linux/sunrpc/debug.h>
#include <linux/sunrpc/auth.h>
diff --git a/include/linux/nfs_page.h b/include/linux/nfs_page.h
index 1c315f854ea8..13411baa80c6 100644
--- a/include/linux/nfs_page.h
+++ b/include/linux/nfs_page.h
@@ -13,7 +13,6 @@
#include <linux/list.h>
#include <linux/pagemap.h>
-#include <linux/wait.h>
#include <linux/sunrpc/auth.h>
#include <linux/nfs_xdr.h>
diff --git a/include/linux/nodemask.h b/include/linux/nodemask.h
index b61438313a73..0fd787033bb4 100644
--- a/include/linux/nodemask.h
+++ b/include/linux/nodemask.h
@@ -95,7 +95,10 @@
#include <linux/minmax.h>
#include <linux/nodemask_types.h>
#include <linux/numa.h>
+
+#if defined(CONFIG_NUMA) && (MAX_NUMNODES > 1)
#include <linux/random.h>
+#endif
extern nodemask_t _unused_nodemask_arg_;
diff --git a/include/linux/nsproxy.h b/include/linux/nsproxy.h
index 5601d14e2886..aaf4abab1051 100644
--- a/include/linux/nsproxy.h
+++ b/include/linux/nsproxy.h
@@ -3,7 +3,6 @@
#define _LINUX_NSPROXY_H
#include <linux/refcount.h>
-#include <linux/spinlock.h>
#include <linux/sched.h>
struct mnt_namespace;
diff --git a/include/linux/percpu_counter.h b/include/linux/percpu_counter.h
index 3a44dd1e33d2..231e75ec1d83 100644
--- a/include/linux/percpu_counter.h
+++ b/include/linux/percpu_counter.h
@@ -8,7 +8,6 @@
*/
#include <linux/spinlock.h>
-#include <linux/smp.h>
#include <linux/list.h>
#include <linux/threads.h>
#include <linux/percpu.h>
diff --git a/include/linux/perf/arm_pmu.h b/include/linux/perf/arm_pmu.h
index b3b34f6670cf..9cde5226e133 100644
--- a/include/linux/perf/arm_pmu.h
+++ b/include/linux/perf/arm_pmu.h
@@ -11,7 +11,6 @@
#include <linux/interrupt.h>
#include <linux/perf_event.h>
#include <linux/platform_device.h>
-#include <linux/sysfs.h>
#include <asm/cputype.h>
#ifdef CONFIG_ARM_PMU
diff --git a/include/linux/phy.h b/include/linux/phy.h
index c9994a59ca2e..468371b1f508 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -12,7 +12,6 @@
#define __PHY_H
#include <linux/compiler.h>
-#include <linux/spinlock.h>
#include <linux/ethtool.h>
#include <linux/leds.h>
#include <linux/linkmode.h>
@@ -21,7 +20,6 @@
#include <linux/mii.h>
#include <linux/mii_timestamper.h>
#include <linux/module.h>
-#include <linux/timer.h>
#include <linux/workqueue.h>
#include <linux/mod_devicetable.h>
#include <linux/u64_stats_sync.h>
diff --git a/include/linux/phylink.h b/include/linux/phylink.h
index d589f89c612c..f00822f4ebd3 100644
--- a/include/linux/phylink.h
+++ b/include/linux/phylink.h
@@ -2,8 +2,6 @@
#define NETDEV_PCS_H
#include <linux/phy.h>
-#include <linux/spinlock.h>
-#include <linux/workqueue.h>
struct device_node;
struct ethtool_cmd;
diff --git a/include/linux/pid_namespace.h b/include/linux/pid_namespace.h
index f9f9931e02d6..c6f8e2e4cd03 100644
--- a/include/linux/pid_namespace.h
+++ b/include/linux/pid_namespace.h
@@ -5,7 +5,6 @@
#include <linux/sched.h>
#include <linux/bug.h>
#include <linux/mm.h>
-#include <linux/workqueue.h>
#include <linux/threads.h>
#include <linux/nsproxy.h>
#include <linux/ns_common.h>
diff --git a/include/linux/pktcdvd.h b/include/linux/pktcdvd.h
index 79594aeb160d..00141d9ca4b9 100644
--- a/include/linux/pktcdvd.h
+++ b/include/linux/pktcdvd.h
@@ -13,10 +13,7 @@
#define __PKTCDVD_H
#include <linux/blkdev.h>
-#include <linux/completion.h>
#include <linux/cdrom.h>
-#include <linux/kobject.h>
-#include <linux/sysfs.h>
#include <linux/mempool.h>
#include <uapi/linux/pktcdvd.h>
diff --git a/include/linux/platform_data/asoc-ti-mcbsp.h b/include/linux/platform_data/asoc-ti-mcbsp.h
index cc8197760015..115796e3af5f 100644
--- a/include/linux/platform_data/asoc-ti-mcbsp.h
+++ b/include/linux/platform_data/asoc-ti-mcbsp.h
@@ -8,7 +8,6 @@
#ifndef __ASOC_TI_MCBSP_H
#define __ASOC_TI_MCBSP_H
-#include <linux/spinlock.h>
#include <linux/clk.h>
/* Platform specific configuration */
diff --git a/include/linux/pm.h b/include/linux/pm.h
index e0014edba850..abad6899e642 100644
--- a/include/linux/pm.h
+++ b/include/linux/pm.h
@@ -13,7 +13,6 @@
#include <linux/workqueue.h>
#include <linux/spinlock.h>
#include <linux/wait.h>
-#include <linux/timer.h>
#include <linux/hrtimer.h>
#include <linux/completion.h>
diff --git a/include/linux/posix-timers.h b/include/linux/posix-timers.h
index dc7b738de299..c88ceca7cb6e 100644
--- a/include/linux/posix-timers.h
+++ b/include/linux/posix-timers.h
@@ -4,7 +4,6 @@
#include <linux/alarmtimer.h>
#include <linux/list.h>
-#include <linux/mutex.h>
#include <linux/posix-timers_types.h>
#include <linux/spinlock.h>
#include <linux/timerqueue.h>
diff --git a/include/linux/pps_kernel.h b/include/linux/pps_kernel.h
index 78c8ac4951b5..10e210ff86d0 100644
--- a/include/linux/pps_kernel.h
+++ b/include/linux/pps_kernel.h
@@ -10,9 +10,10 @@
#include <linux/pps.h>
#include <linux/cdev.h>
-#include <linux/device.h>
#include <linux/time.h>
+struct device;
+
/*
* Global defines
*/
diff --git a/include/linux/psi_types.h b/include/linux/psi_types.h
index f1fd3a8044e0..7b1c9167f756 100644
--- a/include/linux/psi_types.h
+++ b/include/linux/psi_types.h
@@ -5,7 +5,6 @@
#include <linux/kthread.h>
#include <linux/seqlock.h>
#include <linux/types.h>
-#include <linux/kref.h>
#include <linux/wait.h>
#ifdef CONFIG_PSI
diff --git a/include/linux/pwm.h b/include/linux/pwm.h
index 8ffe9ae7a23a..bb98b237ef52 100644
--- a/include/linux/pwm.h
+++ b/include/linux/pwm.h
@@ -3,7 +3,6 @@
#define __LINUX_PWM_H
#include <linux/err.h>
-#include <linux/mutex.h>
#include <linux/of.h>
struct pwm_chip;
diff --git a/include/linux/quota.h b/include/linux/quota.h
index 07071e64abf3..72a2efc77fb5 100644
--- a/include/linux/quota.h
+++ b/include/linux/quota.h
@@ -36,7 +36,6 @@
#include <linux/mutex.h>
#include <linux/rwsem.h>
#include <linux/spinlock.h>
-#include <linux/wait.h>
#include <linux/percpu_counter.h>
#include <linux/dqblk_xfs.h>
diff --git a/include/linux/random.h b/include/linux/random.h
index b0a940af4fff..70e5250f3bc4 100644
--- a/include/linux/random.h
+++ b/include/linux/random.h
@@ -5,7 +5,6 @@
#include <linux/bug.h>
#include <linux/kernel.h>
-#include <linux/list.h>
#include <uapi/linux/random.h>
diff --git a/include/linux/regmap.h b/include/linux/regmap.h
index c9182a47736e..f0938b59600a 100644
--- a/include/linux/regmap.h
+++ b/include/linux/regmap.h
@@ -11,7 +11,6 @@
*/
#include <linux/list.h>
-#include <linux/rbtree.h>
#include <linux/ktime.h>
#include <linux/delay.h>
#include <linux/err.h>
diff --git a/include/linux/relay.h b/include/linux/relay.h
index 72b876dd5cb8..50ac01f8d6d1 100644
--- a/include/linux/relay.h
+++ b/include/linux/relay.h
@@ -13,7 +13,6 @@
#include <linux/types.h>
#include <linux/sched.h>
-#include <linux/timer.h>
#include <linux/wait.h>
#include <linux/list.h>
#include <linux/irq_work.h>
diff --git a/include/linux/remoteproc.h b/include/linux/remoteproc.h
index b4795698d8c2..a924a7d5b44a 100644
--- a/include/linux/remoteproc.h
+++ b/include/linux/remoteproc.h
@@ -39,7 +39,6 @@
#include <linux/mutex.h>
#include <linux/virtio.h>
#include <linux/cdev.h>
-#include <linux/completion.h>
#include <linux/idr.h>
#include <linux/of.h>
diff --git a/include/linux/rfkill.h b/include/linux/rfkill.h
index 373003ace639..0e8d11410f9f 100644
--- a/include/linux/rfkill.h
+++ b/include/linux/rfkill.h
@@ -31,8 +31,6 @@ enum rfkill_user_states {
#undef RFKILL_STATE_HARD_BLOCKED
#include <linux/kernel.h>
-#include <linux/list.h>
-#include <linux/mutex.h>
#include <linux/leds.h>
#include <linux/err.h>
diff --git a/include/linux/ring_buffer.h b/include/linux/ring_buffer.h
index fa802db216f9..a4553db80912 100644
--- a/include/linux/ring_buffer.h
+++ b/include/linux/ring_buffer.h
@@ -3,7 +3,6 @@
#define _LINUX_RING_BUFFER_H
#include <linux/mm.h>
-#include <linux/seq_file.h>
#include <linux/poll.h>
struct trace_buffer;
diff --git a/include/linux/rtc/ds1685.h b/include/linux/rtc/ds1685.h
index 5a41c3bbcbe3..1bda17f878bb 100644
--- a/include/linux/rtc/ds1685.h
+++ b/include/linux/rtc/ds1685.h
@@ -23,7 +23,6 @@
#include <linux/rtc.h>
#include <linux/platform_device.h>
-#include <linux/workqueue.h>
/**
* struct ds1685_priv - DS1685 private data structure.
diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h
index 410529fca18b..904cf20a7ae6 100644
--- a/include/linux/rtnetlink.h
+++ b/include/linux/rtnetlink.h
@@ -2,8 +2,6 @@
#ifndef __LINUX_RTNETLINK_H
#define __LINUX_RTNETLINK_H
-
-#include <linux/mutex.h>
#include <linux/netdevice.h>
#include <linux/wait.h>
#include <linux/refcount.h>
diff --git a/include/linux/sbitmap.h b/include/linux/sbitmap.h
index d662cf136021..d7d3fba174f8 100644
--- a/include/linux/sbitmap.h
+++ b/include/linux/sbitmap.h
@@ -17,7 +17,6 @@
#include <linux/minmax.h>
#include <linux/percpu.h>
#include <linux/slab.h>
-#include <linux/smp.h>
#include <linux/types.h>
#include <linux/wait.h>
diff --git a/include/linux/sched/clock.h b/include/linux/sched/clock.h
index 196f0ca351a2..bb5aaf98bf87 100644
--- a/include/linux/sched/clock.h
+++ b/include/linux/sched/clock.h
@@ -2,7 +2,7 @@
#ifndef _LINUX_SCHED_CLOCK_H
#define _LINUX_SCHED_CLOCK_H
-#include <linux/smp.h>
+#include <linux/types.h>
/*
* Do not use outside of architecture code which knows its limitations.
diff --git a/include/linux/sched/signal.h b/include/linux/sched/signal.h
index 4b7664c56208..8a2d65337c48 100644
--- a/include/linux/sched/signal.h
+++ b/include/linux/sched/signal.h
@@ -2,6 +2,7 @@
#ifndef _LINUX_SCHED_SIGNAL_H
#define _LINUX_SCHED_SIGNAL_H
+#include <linux/completion.h>
#include <linux/rculist.h>
#include <linux/signal.h>
#include <linux/sched.h>
diff --git a/include/linux/seq_file.h b/include/linux/seq_file.h
index 234bcdb1fba4..96d595cd7659 100644
--- a/include/linux/seq_file.h
+++ b/include/linux/seq_file.h
@@ -8,7 +8,6 @@
#include <linux/bug.h>
#include <linux/mutex.h>
#include <linux/cpumask.h>
-#include <linux/nodemask.h>
#include <linux/fs.h>
#include <linux/cred.h>
diff --git a/include/linux/sh_clk.h b/include/linux/sh_clk.h
index 7bed5be886c6..3b2d8de6e7d8 100644
--- a/include/linux/sh_clk.h
+++ b/include/linux/sh_clk.h
@@ -3,7 +3,6 @@
#define __SH_CLOCK_H
#include <linux/list.h>
-#include <linux/seq_file.h>
#include <linux/cpufreq.h>
#include <linux/types.h>
#include <linux/kref.h>
diff --git a/include/linux/slab.h b/include/linux/slab.h
index 12a62a17e893..b9716534a678 100644
--- a/include/linux/slab.h
+++ b/include/linux/slab.h
@@ -16,7 +16,6 @@
#include <linux/gfp.h>
#include <linux/overflow.h>
#include <linux/types.h>
-#include <linux/workqueue.h>
#include <linux/percpu-refcount.h>
#include <linux/cleanup.h>
#include <linux/hash.h>
diff --git a/include/linux/slimbus.h b/include/linux/slimbus.h
index 12c9719b2a55..e29958e5e96d 100644
--- a/include/linux/slimbus.h
+++ b/include/linux/slimbus.h
@@ -7,9 +7,10 @@
#define _LINUX_SLIMBUS_H
#include <linux/device.h>
#include <linux/module.h>
-#include <linux/completion.h>
#include <linux/mod_devicetable.h>
+struct completion;
+
extern struct bus_type slimbus_bus;
/**
diff --git a/include/linux/soc/apple/rtkit.h b/include/linux/soc/apple/rtkit.h
index 8c9ca857ccf6..64a4059249f6 100644
--- a/include/linux/soc/apple/rtkit.h
+++ b/include/linux/soc/apple/rtkit.h
@@ -10,10 +10,11 @@
#ifndef _LINUX_APPLE_RTKIT_H_
#define _LINUX_APPLE_RTKIT_H_
-#include <linux/device.h>
#include <linux/types.h>
#include <linux/mailbox_client.h>
+struct device;
+
/*
* Struct to represent implementation-specific RTKit operations.
*
diff --git a/include/linux/soc/apple/sart.h b/include/linux/soc/apple/sart.h
index 2249bf6cde09..f5d5dd678471 100644
--- a/include/linux/soc/apple/sart.h
+++ b/include/linux/soc/apple/sart.h
@@ -12,10 +12,10 @@
#ifndef _LINUX_SOC_APPLE_SART_H_
#define _LINUX_SOC_APPLE_SART_H_
-#include <linux/device.h>
#include <linux/err.h>
#include <linux/types.h>
+struct device;
struct apple_sart;
/*
diff --git a/include/linux/soc/mediatek/mtk-cmdq.h b/include/linux/soc/mediatek/mtk-cmdq.h
index 649955d2cf5c..64411659966a 100644
--- a/include/linux/soc/mediatek/mtk-cmdq.h
+++ b/include/linux/soc/mediatek/mtk-cmdq.h
@@ -9,7 +9,6 @@
#include <linux/mailbox_client.h>
#include <linux/mailbox/mtk-cmdq-mailbox.h>
-#include <linux/timer.h>
#define CMDQ_ADDR_HIGH(addr) ((u32)(((addr) >> 16) & GENMASK(31, 0)))
#define CMDQ_ADDR_LOW(addr) ((u16)(addr) | BIT(1))
diff --git a/include/linux/soc/qcom/qcom_aoss.h b/include/linux/soc/qcom/qcom_aoss.h
index 7361ca028752..21d345a7e9c5 100644
--- a/include/linux/soc/qcom/qcom_aoss.h
+++ b/include/linux/soc/qcom/qcom_aoss.h
@@ -7,8 +7,8 @@
#define __QCOM_AOSS_H__
#include <linux/err.h>
-#include <linux/device.h>
+struct device;
struct qmp;
#if IS_ENABLED(CONFIG_QCOM_AOSS_QMP)
diff --git a/include/linux/spi/spi_bitbang.h b/include/linux/spi/spi_bitbang.h
index 0bd120e2c701..5a5852cb47c7 100644
--- a/include/linux/spi/spi_bitbang.h
+++ b/include/linux/spi/spi_bitbang.h
@@ -4,7 +4,6 @@
#include <linux/mutex.h>
#include <linux/types.h>
-#include <linux/workqueue.h>
struct spi_bitbang {
struct mutex lock;
diff --git a/include/linux/srcu.h b/include/linux/srcu.h
index 236610e4a8fa..b86233c200e1 100644
--- a/include/linux/srcu.h
+++ b/include/linux/srcu.h
@@ -16,9 +16,7 @@
#ifndef _LINUX_SRCU_H
#define _LINUX_SRCU_H
-#include <linux/mutex.h>
#include <linux/rcupdate.h>
-#include <linux/workqueue.h>
#include <linux/rcu_segcblist.h>
struct srcu_struct;
diff --git a/include/linux/stm.h b/include/linux/stm.h
index 3b22689512be..c61f3841712c 100644
--- a/include/linux/stm.h
+++ b/include/linux/stm.h
@@ -7,7 +7,9 @@
#ifndef _STM_H_
#define _STM_H_
-#include <linux/device.h>
+#include <linux/types.h>
+
+struct device;
/**
* enum stp_packet_type - STP packets that an STM driver sends
diff --git a/include/linux/sunrpc/auth.h b/include/linux/sunrpc/auth.h
index 61e58327b1aa..45be9d7e5976 100644
--- a/include/linux/sunrpc/auth.h
+++ b/include/linux/sunrpc/auth.h
@@ -16,7 +16,6 @@
#include <linux/atomic.h>
#include <linux/rcupdate.h>
-#include <linux/uidgid.h>
#include <linux/utsname.h>
/*
diff --git a/include/linux/sunrpc/metrics.h b/include/linux/sunrpc/metrics.h
index 0ee3f7052846..6bfed383ed63 100644
--- a/include/linux/sunrpc/metrics.h
+++ b/include/linux/sunrpc/metrics.h
@@ -26,12 +26,13 @@
#ifndef _LINUX_SUNRPC_METRICS_H
#define _LINUX_SUNRPC_METRICS_H
-#include <linux/seq_file.h>
#include <linux/ktime.h>
#include <linux/spinlock.h>
#define RPC_IOSTATS_VERS "1.1"
+struct seq_file;
+
struct rpc_iostats {
spinlock_t om_lock;
diff --git a/include/linux/sunrpc/rpc_pipe_fs.h b/include/linux/sunrpc/rpc_pipe_fs.h
index 5438de45300d..c26733d8fde7 100644
--- a/include/linux/sunrpc/rpc_pipe_fs.h
+++ b/include/linux/sunrpc/rpc_pipe_fs.h
@@ -5,7 +5,6 @@
#include <linux/list.h>
#include <linux/spinlock_types.h>
#include <linux/wait.h>
-#include <linux/workqueue.h>
struct rpc_pipe_dir_head {
struct list_head pdh_entries;
diff --git a/include/linux/sunrpc/sched.h b/include/linux/sunrpc/sched.h
index 2d61987b3545..b568e439c6cf 100644
--- a/include/linux/sunrpc/sched.h
+++ b/include/linux/sunrpc/sched.h
@@ -10,7 +10,6 @@
#ifndef _LINUX_SUNRPC_SCHED_H_
#define _LINUX_SUNRPC_SCHED_H_
-#include <linux/timer.h>
#include <linux/ktime.h>
#include <linux/sunrpc/types.h>
#include <linux/spinlock.h>
diff --git a/include/linux/sunrpc/svc.h b/include/linux/sunrpc/svc.h
index 23617da0e565..4cb592e892bc 100644
--- a/include/linux/sunrpc/svc.h
+++ b/include/linux/sunrpc/svc.h
@@ -18,7 +18,6 @@
#include <linux/sunrpc/auth.h>
#include <linux/sunrpc/svcauth.h>
#include <linux/lwq.h>
-#include <linux/wait.h>
#include <linux/mm.h>
#include <linux/pagevec.h>
diff --git a/include/linux/sunrpc/svc_rdma.h b/include/linux/sunrpc/svc_rdma.h
index e7595ae62fe2..1cfaf76d0732 100644
--- a/include/linux/sunrpc/svc_rdma.h
+++ b/include/linux/sunrpc/svc_rdma.h
@@ -49,7 +49,6 @@
#include <linux/sunrpc/rpc_rdma_cid.h>
#include <linux/sunrpc/svc_rdma_pcl.h>
-#include <linux/percpu_counter.h>
#include <rdma/ib_verbs.h>
#include <rdma/rdma_cm.h>
diff --git a/include/linux/swait.h b/include/linux/swait.h
index d324419482a0..535637f3bf32 100644
--- a/include/linux/swait.h
+++ b/include/linux/swait.h
@@ -5,7 +5,6 @@
#include <linux/list.h>
#include <linux/stddef.h>
#include <linux/spinlock.h>
-#include <linux/wait.h>
#include <asm/current.h>
/*
diff --git a/include/linux/swapops.h b/include/linux/swapops.h
index 48b700ba1d18..1fe14636d51e 100644
--- a/include/linux/swapops.h
+++ b/include/linux/swapops.h
@@ -2,7 +2,6 @@
#ifndef _LINUX_SWAPOPS_H
#define _LINUX_SWAPOPS_H
-#include <linux/radix-tree.h>
#include <linux/bug.h>
#include <linux/mm_types.h>
diff --git a/include/linux/sync_file.h b/include/linux/sync_file.h
index 790ca021203a..2aa71bff4d4c 100644
--- a/include/linux/sync_file.h
+++ b/include/linux/sync_file.h
@@ -16,7 +16,6 @@
#include <linux/types.h>
#include <linux/ktime.h>
#include <linux/list.h>
-#include <linux/spinlock.h>
#include <linux/dma-fence.h>
#include <linux/dma-fence-array.h>
diff --git a/include/linux/sys_soc.h b/include/linux/sys_soc.h
index d9b3cf0f410c..09d4b53af192 100644
--- a/include/linux/sys_soc.h
+++ b/include/linux/sys_soc.h
@@ -6,7 +6,8 @@
#ifndef __SOC_BUS_H
#define __SOC_BUS_H
-#include <linux/device.h>
+struct device;
+struct soc_device;
struct soc_device_attribute {
const char *machine;
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index 77eb9b0e7685..a7366e5ee88f 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -84,7 +84,6 @@ struct mnt_id_req;
#include <linux/signal.h>
#include <linux/list.h>
#include <linux/bug.h>
-#include <linux/sem.h>
#include <asm/siginfo.h>
#include <linux/unistd.h>
#include <linux/quota.h>
diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h
index b717a70219f6..601ff20acc20 100644
--- a/include/linux/sysfs.h
+++ b/include/linux/sysfs.h
@@ -15,17 +15,12 @@
#include <linux/kernfs.h>
#include <linux/compiler.h>
-#include <linux/errno.h>
#include <linux/list.h>
#include <linux/lockdep.h>
-#include <linux/kobject_ns.h>
-#include <linux/stat.h>
-#include <linux/atomic.h>
struct kobject;
struct module;
struct bin_attribute;
-enum kobj_ns_type;
struct attribute {
const char *name;
diff --git a/include/linux/torture.h b/include/linux/torture.h
index 1541454da03e..f7a91dc7b063 100644
--- a/include/linux/torture.h
+++ b/include/linux/torture.h
@@ -12,12 +12,8 @@
#include <linux/types.h>
#include <linux/cache.h>
-#include <linux/spinlock.h>
#include <linux/threads.h>
#include <linux/cpumask.h>
-#include <linux/seqlock.h>
-#include <linux/lockdep.h>
-#include <linux/completion.h>
#include <linux/debugobjects.h>
#include <linux/bug.h>
#include <linux/compiler.h>
diff --git a/include/linux/tracefs.h b/include/linux/tracefs.h
index 7a5fe17b6bf9..bd5cc895f537 100644
--- a/include/linux/tracefs.h
+++ b/include/linux/tracefs.h
@@ -13,7 +13,6 @@
#define _TRACEFS_H_
#include <linux/fs.h>
-#include <linux/seq_file.h>
#include <linux/types.h>
diff --git a/include/linux/transport_class.h b/include/linux/transport_class.h
index 2efc271a96fa..b7d25a62b4d8 100644
--- a/include/linux/transport_class.h
+++ b/include/linux/transport_class.h
@@ -8,10 +8,11 @@
#ifndef _TRANSPORT_CLASS_H_
#define _TRANSPORT_CLASS_H_
-#include <linux/device.h>
+#include <linux/device/class.h>
#include <linux/bug.h>
#include <linux/attribute_container.h>
+struct device;
struct transport_container;
struct transport_class {
diff --git a/include/linux/tty_driver.h b/include/linux/tty_driver.h
index 7372124fbf90..a9fd888f4cd3 100644
--- a/include/linux/tty_driver.h
+++ b/include/linux/tty_driver.h
@@ -11,6 +11,7 @@
#include <linux/termios.h>
#include <linux/seq_file.h>
+struct attribute_group;
struct tty_struct;
struct tty_driver;
struct serial_icounter_struct;
diff --git a/include/linux/tty_ldisc.h b/include/linux/tty_ldisc.h
index af01e89074b2..3a6f70f2f41e 100644
--- a/include/linux/tty_ldisc.h
+++ b/include/linux/tty_ldisc.h
@@ -5,11 +5,9 @@
struct tty_struct;
#include <linux/fs.h>
-#include <linux/wait.h>
#include <linux/atomic.h>
#include <linux/list.h>
#include <linux/lockdep.h>
-#include <linux/seq_file.h>
/*
* the semaphore definition
diff --git a/include/linux/tty_port.h b/include/linux/tty_port.h
index 2de08c8d2584..1b861f2100b6 100644
--- a/include/linux/tty_port.h
+++ b/include/linux/tty_port.h
@@ -6,7 +6,7 @@
#include <linux/kref.h>
#include <linux/mutex.h>
#include <linux/tty_buffer.h>
-#include <linux/wait_types.h>
+#include <linux/wait.h>
struct attribute_group;
struct tty_driver;
diff --git a/include/linux/u64_stats_sync.h b/include/linux/u64_stats_sync.h
index cf4b090e799a..03311e011724 100644
--- a/include/linux/u64_stats_sync.h
+++ b/include/linux/u64_stats_sync.h
@@ -61,7 +61,10 @@
*/
#include <asm/bitsperlong.h>
+
+#if BITS_PER_LONG == 64
#include <linux/seqlock.h>
+#endif
struct u64_stats_sync {
#if BITS_PER_LONG == 32
diff --git a/include/linux/uprobes.h b/include/linux/uprobes.h
index f46e0ca0169c..a76155cf8ceb 100644
--- a/include/linux/uprobes.h
+++ b/include/linux/uprobes.h
@@ -12,9 +12,7 @@
*/
#include <linux/errno.h>
-#include <linux/rbtree.h>
#include <linux/types.h>
-#include <linux/wait.h>
struct vm_area_struct;
struct mm_struct;
diff --git a/include/linux/usb/hcd.h b/include/linux/usb/hcd.h
index cd77fc6095a1..65f3a953d2c2 100644
--- a/include/linux/usb/hcd.h
+++ b/include/linux/usb/hcd.h
@@ -8,7 +8,6 @@
#ifdef __KERNEL__
-#include <linux/rwsem.h>
#include <linux/interrupt.h>
#include <linux/idr.h>
diff --git a/include/linux/usb/role.h b/include/linux/usb/role.h
index b5deafd91f67..1fd9878daa01 100644
--- a/include/linux/usb/role.h
+++ b/include/linux/usb/role.h
@@ -3,8 +3,11 @@
#ifndef __LINUX_USB_ROLE_H
#define __LINUX_USB_ROLE_H
-#include <linux/device.h>
+#include <linux/errno.h>
+#include <linux/types.h>
+struct device;
+struct fwnode_handle;
struct usb_role_switch;
enum usb_role {
diff --git a/include/linux/user_namespace.h b/include/linux/user_namespace.h
index 6030a8235617..a9cee5a7b8af 100644
--- a/include/linux/user_namespace.h
+++ b/include/linux/user_namespace.h
@@ -2,7 +2,6 @@
#ifndef _LINUX_USER_NAMESPACE_H
#define _LINUX_USER_NAMESPACE_H
-#include <linux/kref.h>
#include <linux/nsproxy.h>
#include <linux/ns_common.h>
#include <linux/sched.h>
diff --git a/include/linux/vfio_pci_core.h b/include/linux/vfio_pci_core.h
index 85e84b92751b..a3075d00675a 100644
--- a/include/linux/vfio_pci_core.h
+++ b/include/linux/vfio_pci_core.h
@@ -13,7 +13,6 @@
#include <linux/vfio.h>
#include <linux/irqbypass.h>
#include <linux/types.h>
-#include <linux/uuid.h>
#include <linux/notifier.h>
#ifndef VFIO_PCI_CORE_H
diff --git a/include/linux/vmalloc.h b/include/linux/vmalloc.h
index 91810b4e9510..77054ddd7eac 100644
--- a/include/linux/vmalloc.h
+++ b/include/linux/vmalloc.h
@@ -2,7 +2,6 @@
#ifndef _LINUX_VMALLOC_H
#define _LINUX_VMALLOC_H
-#include <linux/spinlock.h>
#include <linux/init.h>
#include <linux/list.h>
#include <linux/llist.h>
diff --git a/include/linux/vt_kern.h b/include/linux/vt_kern.h
index d008c3d0a9bb..28cd6b859fea 100644
--- a/include/linux/vt_kern.h
+++ b/include/linux/vt_kern.h
@@ -10,7 +10,6 @@
#include <linux/vt.h>
#include <linux/kd.h>
#include <linux/tty.h>
-#include <linux/mutex.h>
#include <linux/console_struct.h>
#include <linux/mm.h>
#include <linux/consolemap.h>
diff --git a/include/linux/writeback.h b/include/linux/writeback.h
index 9a7a3d2b543f..9f5d9ac072c3 100644
--- a/include/linux/writeback.h
+++ b/include/linux/writeback.h
@@ -6,7 +6,6 @@
#define WRITEBACK_H
#include <linux/sched.h>
-#include <linux/workqueue.h>
#include <linux/fs.h>
#include <linux/flex_proportions.h>
#include <linux/backing-dev-defs.h>
diff --git a/include/media/cec.h b/include/media/cec.h
index d77982685116..085dd6a526c8 100644
--- a/include/media/cec.h
+++ b/include/media/cec.h
@@ -14,7 +14,6 @@
#include <linux/device.h>
#include <linux/cdev.h>
#include <linux/kthread.h>
-#include <linux/timer.h>
#include <linux/cec-funcs.h>
#include <media/rc-core.h>
diff --git a/include/media/dmxdev.h b/include/media/dmxdev.h
index 63219a699370..4f48ed5ceda7 100644
--- a/include/media/dmxdev.h
+++ b/include/media/dmxdev.h
@@ -23,7 +23,6 @@
#include <linux/spinlock.h>
#include <linux/time.h>
#include <linux/timer.h>
-#include <linux/wait.h>
#include <linux/fs.h>
#include <linux/string.h>
#include <linux/mutex.h>
diff --git a/include/media/dvb_demux.h b/include/media/dvb_demux.h
index 3b6aeca7a49e..8f90330274d5 100644
--- a/include/media/dvb_demux.h
+++ b/include/media/dvb_demux.h
@@ -20,7 +20,6 @@
#define _DVB_DEMUX_H_
#include <linux/time.h>
-#include <linux/timer.h>
#include <linux/spinlock.h>
#include <linux/mutex.h>
diff --git a/include/media/rc-core.h b/include/media/rc-core.h
index 803349599c27..eabb19016fec 100644
--- a/include/media/rc-core.h
+++ b/include/media/rc-core.h
@@ -12,7 +12,6 @@
#include <linux/cdev.h>
#include <linux/kfifo.h>
#include <linux/time.h>
-#include <linux/timer.h>
#include <media/rc-map.h>
/**
diff --git a/include/media/v4l2-async.h b/include/media/v4l2-async.h
index 9bd326d31181..95abe99a26b8 100644
--- a/include/media/v4l2-async.h
+++ b/include/media/v4l2-async.h
@@ -9,7 +9,6 @@
#define V4L2_ASYNC_H
#include <linux/list.h>
-#include <linux/mutex.h>
struct dentry;
struct device;
diff --git a/include/media/v4l2-event.h b/include/media/v4l2-event.h
index 3a0e2588361c..2d08ef0752df 100644
--- a/include/media/v4l2-event.h
+++ b/include/media/v4l2-event.h
@@ -14,7 +14,6 @@
#include <linux/types.h>
#include <linux/videodev2.h>
-#include <linux/wait.h>
struct v4l2_fh;
struct v4l2_subdev;
diff --git a/include/media/v4l2-ioctl.h b/include/media/v4l2-ioctl.h
index edb733f21604..d95461c2102d 100644
--- a/include/media/v4l2-ioctl.h
+++ b/include/media/v4l2-ioctl.h
@@ -12,7 +12,6 @@
#include <linux/poll.h>
#include <linux/fs.h>
-#include <linux/mutex.h>
#include <linux/sched/signal.h>
#include <linux/compiler.h> /* need __user */
#include <linux/videodev2.h>
diff --git a/include/net/ax25.h b/include/net/ax25.h
index 0d939e5aee4e..8c5d4698cf29 100644
--- a/include/net/ax25.h
+++ b/include/net/ax25.h
@@ -15,7 +15,6 @@
#include <linux/refcount.h>
#include <net/neighbour.h>
#include <net/sock.h>
-#include <linux/seq_file.h>
#define AX25_T1CLAMPLO 1
#define AX25_T1CLAMPHI (30 * HZ)
diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h
index 7ffa8c192c3f..b8f8c8fc52d3 100644
--- a/include/net/bluetooth/bluetooth.h
+++ b/include/net/bluetooth/bluetooth.h
@@ -28,7 +28,8 @@
#include <linux/poll.h>
#include <net/sock.h>
-#include <linux/seq_file.h>
+
+struct seq_file;
#define BT_SUBSYS_VERSION 2
#define BT_SUBSYS_REVISION 22
diff --git a/include/net/bonding.h b/include/net/bonding.h
index 5b8b1b644a2d..4e7d4bfb0103 100644
--- a/include/net/bonding.h
+++ b/include/net/bonding.h
@@ -13,7 +13,6 @@
#ifndef _NET_BONDING_H
#define _NET_BONDING_H
-#include <linux/timer.h>
#include <linux/proc_fs.h>
#include <linux/if_bonding.h>
#include <linux/cpumask.h>
diff --git a/include/net/bpf_sk_storage.h b/include/net/bpf_sk_storage.h
index 2926f1f00d65..0e49c3602953 100644
--- a/include/net/bpf_sk_storage.h
+++ b/include/net/bpf_sk_storage.h
@@ -3,11 +3,7 @@
#ifndef _BPF_SK_STORAGE_H
#define _BPF_SK_STORAGE_H
-#include <linux/rculist.h>
-#include <linux/list.h>
-#include <linux/hash.h>
#include <linux/types.h>
-#include <linux/spinlock.h>
#include <linux/bpf.h>
#include <net/sock.h>
#include <uapi/linux/sock_diag.h>
diff --git a/include/net/caif/cfcnfg.h b/include/net/caif/cfcnfg.h
index 8819ff4db35a..730aa6c0ebef 100644
--- a/include/net/caif/cfcnfg.h
+++ b/include/net/caif/cfcnfg.h
@@ -6,7 +6,6 @@
#ifndef CFCNFG_H_
#define CFCNFG_H_
-#include <linux/spinlock.h>
#include <linux/netdevice.h>
#include <net/caif/caif_layer.h>
#include <net/caif/cfctrl.h>
diff --git a/include/net/caif/cfsrvl.h b/include/net/caif/cfsrvl.h
index 5ee7b322e18b..6bec9852c6fe 100644
--- a/include/net/caif/cfsrvl.h
+++ b/include/net/caif/cfsrvl.h
@@ -9,7 +9,6 @@
#include <linux/list.h>
#include <linux/stddef.h>
#include <linux/types.h>
-#include <linux/kref.h>
#include <linux/rculist.h>
struct cfsrvl {
diff --git a/include/net/devlink.h b/include/net/devlink.h
index 9ac394bdfbe4..7905d55ed0d4 100644
--- a/include/net/devlink.h
+++ b/include/net/devlink.h
@@ -7,7 +7,6 @@
#ifndef _NET_DEVLINK_H_
#define _NET_DEVLINK_H_
-#include <linux/device.h>
#include <linux/slab.h>
#include <linux/gfp.h>
#include <linux/list.h>
@@ -18,9 +17,9 @@
#include <net/net_namespace.h>
#include <net/flow_offload.h>
#include <uapi/linux/devlink.h>
-#include <linux/xarray.h>
#include <linux/firmware.h>
+struct device;
struct devlink;
struct devlink_linecard;
diff --git a/include/net/dsa.h b/include/net/dsa.h
index 82135fbdb1e6..b473dc806a10 100644
--- a/include/net/dsa.h
+++ b/include/net/dsa.h
@@ -11,8 +11,6 @@
#include <linux/if_ether.h>
#include <linux/list.h>
#include <linux/notifier.h>
-#include <linux/timer.h>
-#include <linux/workqueue.h>
#include <linux/of.h>
#include <linux/ethtool.h>
#include <linux/net_tstamp.h>
diff --git a/include/net/dsa_stubs.h b/include/net/dsa_stubs.h
index 6f384897f287..1490c36ea9c4 100644
--- a/include/net/dsa_stubs.h
+++ b/include/net/dsa_stubs.h
@@ -3,7 +3,6 @@
* include/net/dsa_stubs.h - Stubs for the Distributed Switch Architecture framework
*/
-#include <linux/mutex.h>
#include <linux/netdevice.h>
#include <linux/net_tstamp.h>
#include <net/dsa.h>
diff --git a/include/net/inet_hashtables.h b/include/net/inet_hashtables.h
index 7f1b38458743..5c69fcd3e80e 100644
--- a/include/net/inet_hashtables.h
+++ b/include/net/inet_hashtables.h
@@ -19,7 +19,6 @@
#include <linux/socket.h>
#include <linux/spinlock.h>
#include <linux/types.h>
-#include <linux/wait.h>
#include <net/inet_connection_sock.h>
#include <net/inet_sock.h>
diff --git a/include/net/inet_timewait_sock.h b/include/net/inet_timewait_sock.h
index f28da08a37b4..b7f313b277ea 100644
--- a/include/net/inet_timewait_sock.h
+++ b/include/net/inet_timewait_sock.h
@@ -14,7 +14,6 @@
#include <linux/list.h>
#include <linux/timer.h>
#include <linux/types.h>
-#include <linux/workqueue.h>
#include <net/inet_sock.h>
#include <net/sock.h>
diff --git a/include/net/inetpeer.h b/include/net/inetpeer.h
index 74ff688568a0..de3536f280cc 100644
--- a/include/net/inetpeer.h
+++ b/include/net/inetpeer.h
@@ -11,7 +11,6 @@
#include <linux/types.h>
#include <linux/init.h>
#include <linux/jiffies.h>
-#include <linux/spinlock.h>
#include <linux/rtnetlink.h>
#include <net/ipv6.h>
#include <linux/atomic.h>
diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h
index d4667b7797e3..0d80e9a10019 100644
--- a/include/net/ip_fib.h
+++ b/include/net/ip_fib.h
@@ -13,7 +13,6 @@
#define _NET_IP_FIB_H
#include <net/flow.h>
-#include <linux/seq_file.h>
#include <linux/rcupdate.h>
#include <net/fib_notifier.h>
#include <net/fib_rules.h>
diff --git a/include/net/lib80211.h b/include/net/lib80211.h
index 8b47d3a51cf8..973049cb0453 100644
--- a/include/net/lib80211.h
+++ b/include/net/lib80211.h
@@ -31,7 +31,8 @@
#include <linux/skbuff.h>
#include <linux/ieee80211.h>
#include <linux/timer.h>
-#include <linux/seq_file.h>
+
+struct seq_file;
#define NUM_WEP_KEYS 4
diff --git a/include/net/neighbour.h b/include/net/neighbour.h
index 0d28172193fa..1197433b3315 100644
--- a/include/net/neighbour.h
+++ b/include/net/neighbour.h
@@ -22,7 +22,6 @@
#include <linux/netdevice.h>
#include <linux/skbuff.h>
#include <linux/rcupdate.h>
-#include <linux/seq_file.h>
#include <linux/bitmap.h>
#include <linux/err.h>
@@ -30,6 +29,8 @@
#include <linux/workqueue.h>
#include <net/rtnetlink.h>
+struct seq_file;
+
/*
* NUD stands for "neighbor unreachability detection"
*/
diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h
index 13b3a4e29fdb..a2f221a39cd2 100644
--- a/include/net/net_namespace.h
+++ b/include/net/net_namespace.h
@@ -7,7 +7,6 @@
#include <linux/atomic.h>
#include <linux/refcount.h>
-#include <linux/workqueue.h>
#include <linux/list.h>
#include <linux/sysctl.h>
#include <linux/uidgid.h>
diff --git a/include/net/net_ratelimit.h b/include/net/net_ratelimit.h
index 93c1bd5133c2..8bc1c31cce8a 100644
--- a/include/net/net_ratelimit.h
+++ b/include/net/net_ratelimit.h
@@ -2,8 +2,6 @@
#ifndef _LINUX_NET_RATELIMIT_H
#define _LINUX_NET_RATELIMIT_H
-#include <linux/ratelimit.h>
-
extern struct ratelimit_state net_ratelimit_state;
#endif /* _LINUX_NET_RATELIMIT_H */
diff --git a/include/net/netns/conntrack.h b/include/net/netns/conntrack.h
index bae914815aa3..e2caf55de629 100644
--- a/include/net/netns/conntrack.h
+++ b/include/net/netns/conntrack.h
@@ -5,7 +5,6 @@
#include <linux/list.h>
#include <linux/list_nulls.h>
#include <linux/atomic.h>
-#include <linux/workqueue.h>
#include <linux/netfilter/nf_conntrack_tcp.h>
#ifdef CONFIG_NF_CT_PROTO_DCCP
#include <linux/netfilter/nf_conntrack_dccp.h>
diff --git a/include/net/netns/xfrm.h b/include/net/netns/xfrm.h
index 423b52eca908..79d382d72ede 100644
--- a/include/net/netns/xfrm.h
+++ b/include/net/netns/xfrm.h
@@ -3,7 +3,6 @@
#define __NETNS_XFRM_H
#include <linux/list.h>
-#include <linux/wait.h>
#include <linux/workqueue.h>
#include <linux/rhashtable-types.h>
#include <linux/xfrm.h>
diff --git a/include/net/netrom.h b/include/net/netrom.h
index f0565a5987d1..f6fe4a6e307d 100644
--- a/include/net/netrom.h
+++ b/include/net/netrom.h
@@ -13,7 +13,6 @@
#include <linux/slab.h>
#include <net/sock.h>
#include <linux/refcount.h>
-#include <linux/seq_file.h>
#include <net/ax25.h>
#define NR_NETWORK_LEN 15
diff --git a/include/net/pkt_cls.h b/include/net/pkt_cls.h
index f308e8268651..ad5d0f06cf94 100644
--- a/include/net/pkt_cls.h
+++ b/include/net/pkt_cls.h
@@ -3,11 +3,12 @@
#define __NET_PKT_CLS_H
#include <linux/pkt_cls.h>
-#include <linux/workqueue.h>
#include <net/sch_generic.h>
#include <net/act_api.h>
#include <net/net_namespace.h>
+struct rcu_work;
+
/* TC action not accessible from user space */
#define TC_ACT_CONSUMED (TC_ACT_VALUE_MAX + 1)
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
index 934fdb977551..da96e966c807 100644
--- a/include/net/sch_generic.h
+++ b/include/net/sch_generic.h
@@ -11,7 +11,6 @@
#include <linux/dynamic_queue_limits.h>
#include <linux/list.h>
#include <linux/refcount.h>
-#include <linux/workqueue.h>
#include <linux/mutex.h>
#include <linux/rwsem.h>
#include <linux/atomic.h>
diff --git a/include/net/smc.h b/include/net/smc.h
index c9dcb30e3fd9..da590f95811e 100644
--- a/include/net/smc.h
+++ b/include/net/smc.h
@@ -11,12 +11,12 @@
#ifndef _SMC_H
#define _SMC_H
-#include <linux/device.h>
#include <linux/spinlock.h>
#include <linux/types.h>
#include <linux/wait.h>
#include "linux/ism.h"
+struct device;
struct sock;
#define SMC_MAX_PNETID_LEN 16 /* Max. length of PNET id */
diff --git a/include/net/snmp.h b/include/net/snmp.h
index 468a67836e2f..93ada92299fc 100644
--- a/include/net/snmp.h
+++ b/include/net/snmp.h
@@ -16,7 +16,6 @@
#include <linux/cache.h>
#include <linux/snmp.h>
-#include <linux/smp.h>
/*
* Mibs are stored in array of unsigned long.
diff --git a/include/net/tcp.h b/include/net/tcp.h
index 140e012260a8..36ce457e35ce 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -23,7 +23,6 @@
#include <linux/cache.h>
#include <linux/percpu.h>
#include <linux/skbuff.h>
-#include <linux/kref.h>
#include <linux/ktime.h>
#include <linux/indirect_call_wrapper.h>
#include <linux/hrtimer.h> // for hrtimer_try_to_cancel()
@@ -43,11 +42,12 @@
#include <net/dst.h>
#include <net/mptcp.h>
-#include <linux/seq_file.h>
#include <linux/memcontrol.h>
#include <linux/bpf-cgroup.h>
#include <linux/siphash.h>
+struct seq_file;
+
extern struct inet_hashinfo tcp_hashinfo;
DECLARE_PER_CPU(unsigned int, tcp_orphan_count);
diff --git a/include/net/udp.h b/include/net/udp.h
index 488a6d2babcc..60388bea893d 100644
--- a/include/net/udp.h
+++ b/include/net/udp.h
@@ -26,10 +26,11 @@
#include <net/snmp.h>
#include <net/ip.h>
#include <linux/ipv6.h>
-#include <linux/seq_file.h>
#include <linux/poll.h>
#include <linux/indirect_call_wrapper.h>
+struct seq_file;
+
/**
* struct udp_skb_cb - UDP(-Lite) private variables
*
diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index 1d107241b901..21d4f49cd83f 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -11,7 +11,6 @@
#include <linux/pfkeyv2.h>
#include <linux/ipsec.h>
#include <linux/in6.h>
-#include <linux/mutex.h>
#include <linux/audit.h>
#include <linux/slab.h>
#include <linux/refcount.h>
diff --git a/include/rdma/ib_umem.h b/include/rdma/ib_umem.h
index 565a85044541..9ce4d1a88cad 100644
--- a/include/rdma/ib_umem.h
+++ b/include/rdma/ib_umem.h
@@ -9,7 +9,6 @@
#include <linux/list.h>
#include <linux/scatterlist.h>
-#include <linux/workqueue.h>
#include <rdma/ib_verbs.h>
struct ib_ucontext;
diff --git a/include/rdma/restrack.h b/include/rdma/restrack.h
index 8b7c46daeb07..11e487bdf61c 100644
--- a/include/rdma/restrack.h
+++ b/include/rdma/restrack.h
@@ -12,7 +12,6 @@
#include <linux/completion.h>
#include <linux/sched/task.h>
#include <uapi/rdma/rdma_netlink.h>
-#include <linux/xarray.h>
struct ib_device;
struct sk_buff;
diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h
index 526def14e7fb..b1569693da53 100644
--- a/include/scsi/scsi_cmnd.h
+++ b/include/scsi/scsi_cmnd.h
@@ -7,7 +7,6 @@
#include <linux/t10-pi.h>
#include <linux/list.h>
#include <linux/types.h>
-#include <linux/timer.h>
#include <linux/scatterlist.h>
#include <scsi/scsi_device.h>
diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h
index b259d42a1e1a..2e6aaee6042d 100644
--- a/include/scsi/scsi_host.h
+++ b/include/scsi/scsi_host.h
@@ -11,6 +11,7 @@
#include <linux/blk-mq.h>
#include <scsi/scsi.h>
+struct seq_file;
struct block_device;
struct completion;
struct module;
diff --git a/include/sound/core.h b/include/sound/core.h
index eaae6da1e0b0..a4d06410638b 100644
--- a/include/sound/core.h
+++ b/include/sound/core.h
@@ -11,7 +11,6 @@
#include <linux/sched.h> /* wake_up() */
#include <linux/mutex.h> /* struct mutex */
#include <linux/rwsem.h> /* struct rw_semaphore */
-#include <linux/pm.h> /* pm_message_t */
#include <linux/stringify.h>
#include <linux/printk.h>
#include <linux/wait.h>
diff --git a/include/video/atmel_lcdc.h b/include/video/atmel_lcdc.h
index 43e497cdeb60..282193d8e10f 100644
--- a/include/video/atmel_lcdc.h
+++ b/include/video/atmel_lcdc.h
@@ -9,8 +9,6 @@
#ifndef __ATMEL_LCDC_H__
#define __ATMEL_LCDC_H__
-#include <linux/workqueue.h>
-
/* Way LCD wires are connected to the chip:
* Some Atmel chips use BGR color mode (instead of standard RGB)
* A swapped wiring onboard can bring to RGB mode.
diff --git a/include/xen/interface/memory.h b/include/xen/interface/memory.h
index 1a371a825c55..aa61456091cc 100644
--- a/include/xen/interface/memory.h
+++ b/include/xen/interface/memory.h
@@ -10,8 +10,6 @@
#ifndef __XEN_PUBLIC_MEMORY_H__
#define __XEN_PUBLIC_MEMORY_H__
-#include <linux/spinlock.h>
-
/*
* Increase or decrease the specified domain's memory reservation. Returns a
* -ve errcode on failure, or the # extents successfully allocated or freed.
diff --git a/include/xen/xenbus.h b/include/xen/xenbus.h
index ac22cf08c09f..d0f2e0a134be 100644
--- a/include/xen/xenbus.h
+++ b/include/xen/xenbus.h
@@ -36,7 +36,6 @@
#include <linux/device.h>
#include <linux/notifier.h>
-#include <linux/mutex.h>
#include <linux/export.h>
#include <linux/fs.h>
#include <linux/completion.h>
--
2.39.2
By providing declarations in a lean header, we can reduce header
dependencies.
Signed-off-by: Max Kellermann <[email protected]>
---
fs/super.c | 1 +
include/linux/fs.h | 2 +-
include/linux/list_lru.h | 36 +----------------------------
include/linux/list_lru_types.h | 42 ++++++++++++++++++++++++++++++++++
4 files changed, 45 insertions(+), 36 deletions(-)
create mode 100644 include/linux/list_lru_types.h
diff --git a/fs/super.c b/fs/super.c
index d35e85295489..a1d4d9dfa79a 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -33,6 +33,7 @@
#include <linux/rculist_bl.h>
#include <linux/fscrypt.h>
#include <linux/fsnotify.h>
+#include <linux/list_lru.h>
#include <linux/lockdep.h>
#include <linux/user_namespace.h>
#include <linux/fs_context.h>
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 7b37a22c9513..06eda3a4fb52 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -10,7 +10,7 @@
#include <linux/stat.h>
#include <linux/cache.h>
#include <linux/list.h>
-#include <linux/list_lru.h>
+#include <linux/list_lru_types.h>
#include <linux/llist.h>
#include <linux/xarray.h>
#include <linux/rbtree.h>
diff --git a/include/linux/list_lru.h b/include/linux/list_lru.h
index bf0b71faa059..3a72e8cde939 100644
--- a/include/linux/list_lru.h
+++ b/include/linux/list_lru.h
@@ -8,14 +8,10 @@
#ifndef _LRU_LIST_H
#define _LRU_LIST_H
-#include <linux/list.h>
+#include <linux/list_lru_types.h>
#include <linux/nodemask.h>
#include <linux/shrinker.h>
-#ifdef CONFIG_MEMCG_KMEM
-#include <linux/xarray_types.h>
-#endif
-
struct mem_cgroup;
/* list_lru_walk_cb has to always return one of those */
@@ -29,36 +25,6 @@ enum lru_status {
internally, but has to return locked. */
};
-struct list_lru_one {
- struct list_head list;
- /* may become negative during memcg reparenting */
- long nr_items;
-};
-
-struct list_lru_memcg {
- struct rcu_head rcu;
- /* array of per cgroup per node lists, indexed by node id */
- struct list_lru_one node[];
-};
-
-struct list_lru_node {
- /* protects all lists on the node, including per cgroup */
- spinlock_t lock;
- /* global list, used for the root cgroup in cgroup aware lrus */
- struct list_lru_one lru;
- long nr_items;
-} ____cacheline_aligned_in_smp;
-
-struct list_lru {
- struct list_lru_node *node;
-#ifdef CONFIG_MEMCG_KMEM
- struct list_head list;
- int shrinker_id;
- bool memcg_aware;
- struct xarray xa;
-#endif
-};
-
void list_lru_destroy(struct list_lru *lru);
int __list_lru_init(struct list_lru *lru, bool memcg_aware,
struct lock_class_key *key, struct shrinker *shrinker);
diff --git a/include/linux/list_lru_types.h b/include/linux/list_lru_types.h
new file mode 100644
index 000000000000..51ccef0d6994
--- /dev/null
+++ b/include/linux/list_lru_types.h
@@ -0,0 +1,42 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef _LRU_LIST_TYPES_H
+#define _LRU_LIST_TYPES_H
+
+#include <linux/list.h>
+
+#ifdef CONFIG_MEMCG_KMEM
+#include <linux/types.h> // for bool
+#include <linux/xarray_types.h>
+#endif
+
+struct list_lru_one {
+ struct list_head list;
+ /* may become negative during memcg reparenting */
+ long nr_items;
+};
+
+struct list_lru_memcg {
+ struct rcu_head rcu;
+ /* array of per cgroup per node lists, indexed by node id */
+ struct list_lru_one node[];
+};
+
+struct list_lru_node {
+ /* protects all lists on the node, including per cgroup */
+ spinlock_t lock;
+ /* global list, used for the root cgroup in cgroup aware lrus */
+ struct list_lru_one lru;
+ long nr_items;
+} ____cacheline_aligned_in_smp;
+
+struct list_lru {
+ struct list_lru_node *node;
+#ifdef CONFIG_MEMCG_KMEM
+ struct list_head list;
+ int shrinker_id;
+ bool memcg_aware;
+ struct xarray xa;
+#endif
+};
+
+#endif /* _LRU_LIST_TYPES_H */
--
2.39.2
By providing declarations in a lean header, we can reduce header
dependencies.
Signed-off-by: Max Kellermann <[email protected]>
---
drivers/usb/cdns3/cdnsp-mem.c | 1 +
include/linux/backing-dev-defs.h | 2 +-
include/linux/iocontext.h | 2 +-
include/linux/irqdomain.h | 2 +-
include/linux/mlx4/device.h | 2 +-
include/linux/radix-tree.h | 44 +---------------------------
include/linux/radix-tree_types.h | 50 ++++++++++++++++++++++++++++++++
kernel/dma/debug.c | 1 +
kernel/irq/irqdomain.c | 1 +
9 files changed, 58 insertions(+), 47 deletions(-)
create mode 100644 include/linux/radix-tree_types.h
diff --git a/drivers/usb/cdns3/cdnsp-mem.c b/drivers/usb/cdns3/cdnsp-mem.c
index 97866bfb2da9..bab13f8a0b62 100644
--- a/drivers/usb/cdns3/cdnsp-mem.c
+++ b/drivers/usb/cdns3/cdnsp-mem.c
@@ -12,6 +12,7 @@
#include <linux/dma-mapping.h>
#include <linux/dmapool.h>
+#include <linux/radix-tree.h>
#include <linux/slab.h>
#include <linux/usb.h>
diff --git a/include/linux/backing-dev-defs.h b/include/linux/backing-dev-defs.h
index ffdd82f2f3e6..a48509f21b71 100644
--- a/include/linux/backing-dev-defs.h
+++ b/include/linux/backing-dev-defs.h
@@ -3,7 +3,7 @@
#define __LINUX_BACKING_DEV_DEFS_H
#include <linux/list.h>
-#include <linux/radix-tree.h>
+#include <linux/radix-tree_types.h>
#include <linux/rbtree_types.h>
#include <linux/spinlock_types.h>
#include <linux/percpu_counter_types.h>
diff --git a/include/linux/iocontext.h b/include/linux/iocontext.h
index a05d8a45cce5..aa1409bd9edd 100644
--- a/include/linux/iocontext.h
+++ b/include/linux/iocontext.h
@@ -2,7 +2,7 @@
#ifndef IOCONTEXT_H
#define IOCONTEXT_H
-#include <linux/radix-tree.h>
+#include <linux/radix-tree_types.h>
#include <linux/rcupdate.h>
#include <linux/workqueue_types.h>
diff --git a/include/linux/irqdomain.h b/include/linux/irqdomain.h
index 0503bd4ea55b..c439d47b37a9 100644
--- a/include/linux/irqdomain.h
+++ b/include/linux/irqdomain.h
@@ -35,7 +35,7 @@
#include <linux/irqhandler.h>
#include <linux/of.h>
#include <linux/mutex_types.h>
-#include <linux/radix-tree.h>
+#include <linux/radix-tree_types.h>
struct device_node;
struct fwnode_handle;
diff --git a/include/linux/mlx4/device.h b/include/linux/mlx4/device.h
index 18d71b808bc2..e354c967a21d 100644
--- a/include/linux/mlx4/device.h
+++ b/include/linux/mlx4/device.h
@@ -37,7 +37,7 @@
#include <linux/if_ether.h>
#include <linux/pci.h>
#include <linux/completion_types.h>
-#include <linux/radix-tree.h>
+#include <linux/radix-tree_types.h>
#include <linux/cpu_rmap.h>
#include <linux/crash_dump.h>
diff --git a/include/linux/radix-tree.h b/include/linux/radix-tree.h
index 231c526ec9b8..eb28f5be02cd 100644
--- a/include/linux/radix-tree.h
+++ b/include/linux/radix-tree.h
@@ -8,6 +8,7 @@
#ifndef _LINUX_RADIX_TREE_H
#define _LINUX_RADIX_TREE_H
+#include <linux/radix-tree_types.h>
#include <linux/bitops.h>
#include <linux/gfp_types.h>
#include <linux/list.h>
@@ -20,10 +21,6 @@
#include <linux/xarray.h>
#include <linux/local_lock.h>
-/* Keep unconverted code working */
-#define radix_tree_root xarray
-#define radix_tree_node xa_node
-
struct radix_tree_preload {
local_lock_t lock;
unsigned nr;
@@ -70,45 +67,6 @@ static inline bool radix_tree_is_internal_node(void *ptr)
#define RADIX_TREE_MAX_PATH (DIV_ROUND_UP(RADIX_TREE_INDEX_BITS, \
RADIX_TREE_MAP_SHIFT))
-/* The IDR tag is stored in the low bits of xa_flags */
-#define ROOT_IS_IDR ((__force gfp_t)4)
-/* The top bits of xa_flags are used to store the root tags */
-#define ROOT_TAG_SHIFT (__GFP_BITS_SHIFT)
-
-#define RADIX_TREE_INIT(name, mask) XARRAY_INIT(name, mask)
-
-#define RADIX_TREE(name, mask) \
- struct radix_tree_root name = RADIX_TREE_INIT(name, mask)
-
-#define INIT_RADIX_TREE(root, mask) xa_init_flags(root, mask)
-
-static inline bool radix_tree_empty(const struct radix_tree_root *root)
-{
- return root->xa_head == NULL;
-}
-
-/**
- * struct radix_tree_iter - radix tree iterator state
- *
- * @index: index of current slot
- * @next_index: one beyond the last index for this chunk
- * @tags: bit-mask for tag-iterating
- * @node: node that contains current slot
- *
- * This radix tree iterator works in terms of "chunks" of slots. A chunk is a
- * subinterval of slots contained within one radix tree leaf node. It is
- * described by a pointer to its first slot and a struct radix_tree_iter
- * which holds the chunk's position in the tree and its size. For tagged
- * iteration radix_tree_iter also holds the slots' bit-mask for one chosen
- * radix tree tag.
- */
-struct radix_tree_iter {
- unsigned long index;
- unsigned long next_index;
- unsigned long tags;
- struct radix_tree_node *node;
-};
-
/**
* Radix-tree synchronization
*
diff --git a/include/linux/radix-tree_types.h b/include/linux/radix-tree_types.h
new file mode 100644
index 000000000000..d0d4e051a424
--- /dev/null
+++ b/include/linux/radix-tree_types.h
@@ -0,0 +1,50 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+#ifndef _LINUX_RADIX_TREE_TYPES_H
+#define _LINUX_RADIX_TREE_TYPES_H
+
+#include <linux/xarray_types.h>
+
+/* Keep unconverted code working */
+#define radix_tree_root xarray
+#define radix_tree_node xa_node
+
+#define RADIX_TREE_INIT(name, mask) XARRAY_INIT(name, mask)
+
+#define RADIX_TREE(name, mask) \
+ struct radix_tree_root name = RADIX_TREE_INIT(name, mask)
+
+#define INIT_RADIX_TREE(root, mask) xa_init_flags(root, mask)
+
+static inline bool radix_tree_empty(const struct radix_tree_root *root)
+{
+ return root->xa_head == NULL;
+}
+
+/**
+ * struct radix_tree_iter - radix tree iterator state
+ *
+ * @index: index of current slot
+ * @next_index: one beyond the last index for this chunk
+ * @tags: bit-mask for tag-iterating
+ * @node: node that contains current slot
+ *
+ * This radix tree iterator works in terms of "chunks" of slots. A chunk is a
+ * subinterval of slots contained within one radix tree leaf node. It is
+ * described by a pointer to its first slot and a struct radix_tree_iter
+ * which holds the chunk's position in the tree and its size. For tagged
+ * iteration radix_tree_iter also holds the slots' bit-mask for one chosen
+ * radix tree tag.
+ */
+struct radix_tree_iter {
+ unsigned long index;
+ unsigned long next_index;
+ unsigned long tags;
+ struct radix_tree_node *node;
+};
+
+/* The IDR tag is stored in the low bits of xa_flags */
+#define ROOT_IS_IDR ((__force gfp_t)4)
+/* The top bits of xa_flags are used to store the root tags */
+#define ROOT_TAG_SHIFT (__GFP_BITS_SHIFT)
+
+#endif /* _LINUX_RADIX_TREE_TYPES_H */
diff --git a/kernel/dma/debug.c b/kernel/dma/debug.c
index a6e3792b15f8..4e6d802a2313 100644
--- a/kernel/dma/debug.c
+++ b/kernel/dma/debug.c
@@ -18,6 +18,7 @@
#include <linux/uaccess.h>
#include <linux/export.h>
#include <linux/device.h>
+#include <linux/radix-tree.h>
#include <linux/types.h>
#include <linux/sched.h>
#include <linux/ctype.h>
diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c
index 0bdef4fe925b..397efc4f2ae3 100644
--- a/kernel/irq/irqdomain.c
+++ b/kernel/irq/irqdomain.c
@@ -14,6 +14,7 @@
#include <linux/of.h>
#include <linux/of_address.h>
#include <linux/of_irq.h>
+#include <linux/radix-tree.h>
#include <linux/topology.h>
#include <linux/seq_file.h>
#include <linux/slab.h>
--
2.39.2
By providing declarations in a lean header, we can reduce header
dependencies.
Signed-off-by: Max Kellermann <[email protected]>
---
include/drm/gpu_scheduler.h | 2 +-
include/linux/blkdev.h | 2 +-
include/linux/list_lru.h | 5 ++-
include/linux/mlx5/driver.h | 2 +-
include/linux/msi.h | 2 +-
include/linux/xarray.h | 56 +----------------------------
include/linux/xarray_types.h | 70 ++++++++++++++++++++++++++++++++++++
include/net/net_namespace.h | 2 +-
include/net/sch_generic.h | 2 +-
include/sound/core.h | 5 ++-
10 files changed, 85 insertions(+), 63 deletions(-)
create mode 100644 include/linux/xarray_types.h
diff --git a/include/drm/gpu_scheduler.h b/include/drm/gpu_scheduler.h
index 9a89f72a3bac..f2fb8931cb17 100644
--- a/include/drm/gpu_scheduler.h
+++ b/include/drm/gpu_scheduler.h
@@ -27,7 +27,7 @@
#include <drm/spsc_queue.h>
#include <linux/dma-fence.h>
#include <linux/completion_types.h>
-#include <linux/xarray.h>
+#include <linux/xarray_types.h>
#include <linux/wait_types.h>
#include <linux/workqueue_types.h>
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 3916d2f0a9af..d2c0934a7224 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -23,7 +23,7 @@
#include <linux/sched.h>
#include <linux/uio.h> // for iov_iter_is_aligned()
#include <linux/uuid.h>
-#include <linux/xarray.h>
+#include <linux/xarray_types.h>
struct module;
struct request_queue;
diff --git a/include/linux/list_lru.h b/include/linux/list_lru.h
index f2882a820690..bf0b71faa059 100644
--- a/include/linux/list_lru.h
+++ b/include/linux/list_lru.h
@@ -11,7 +11,10 @@
#include <linux/list.h>
#include <linux/nodemask.h>
#include <linux/shrinker.h>
-#include <linux/xarray.h>
+
+#ifdef CONFIG_MEMCG_KMEM
+#include <linux/xarray_types.h>
+#endif
struct mem_cgroup;
diff --git a/include/linux/mlx5/driver.h b/include/linux/mlx5/driver.h
index d9b99aca9e72..07956bd2e55b 100644
--- a/include/linux/mlx5/driver.h
+++ b/include/linux/mlx5/driver.h
@@ -41,7 +41,7 @@
#include <linux/semaphore.h>
#include <linux/slab.h>
#include <linux/vmalloc.h>
-#include <linux/xarray.h>
+#include <linux/xarray_types.h>
#include <linux/workqueue_types.h>
#include <linux/mempool.h>
#include <linux/interrupt.h>
diff --git a/include/linux/msi.h b/include/linux/msi.h
index 04fd2c856287..a3969b00a793 100644
--- a/include/linux/msi.h
+++ b/include/linux/msi.h
@@ -21,7 +21,7 @@
#include <linux/irqdomain_defs.h>
#include <linux/cpumask.h>
#include <linux/msi_api.h>
-#include <linux/xarray.h>
+#include <linux/xarray_types.h>
#include <linux/mutex_types.h>
#include <linux/list.h>
#include <linux/irq.h>
diff --git a/include/linux/xarray.h b/include/linux/xarray.h
index 0983c697648a..aab0539f925d 100644
--- a/include/linux/xarray.h
+++ b/include/linux/xarray.h
@@ -9,10 +9,10 @@
* See Documentation/core-api/xarray.rst for how to use the XArray.
*/
+#include <linux/xarray_types.h>
#include <linux/bitmap.h>
#include <linux/bug.h>
#include <linux/compiler.h>
-#include <linux/gfp_types.h>
#include <linux/kconfig.h>
#include <linux/kernel.h>
#include <linux/rcupdate.h>
@@ -224,37 +224,12 @@ static inline int xa_err(void *entry)
return 0;
}
-/**
- * struct xa_limit - Represents a range of IDs.
- * @min: The lowest ID to allocate (inclusive).
- * @max: The maximum ID to allocate (inclusive).
- *
- * This structure is used either directly or via the XA_LIMIT() macro
- * to communicate the range of IDs that are valid for allocation.
- * Three common ranges are predefined for you:
- * * xa_limit_32b - [0 - UINT_MAX]
- * * xa_limit_31b - [0 - INT_MAX]
- * * xa_limit_16b - [0 - USHRT_MAX]
- */
-struct xa_limit {
- u32 max;
- u32 min;
-};
-
#define XA_LIMIT(_min, _max) (struct xa_limit) { .min = _min, .max = _max }
#define xa_limit_32b XA_LIMIT(0, UINT_MAX)
#define xa_limit_31b XA_LIMIT(0, INT_MAX)
#define xa_limit_16b XA_LIMIT(0, USHRT_MAX)
-typedef unsigned __bitwise xa_mark_t;
-#define XA_MARK_0 ((__force xa_mark_t)0U)
-#define XA_MARK_1 ((__force xa_mark_t)1U)
-#define XA_MARK_2 ((__force xa_mark_t)2U)
-#define XA_PRESENT ((__force xa_mark_t)8U)
-#define XA_MARK_MAX XA_MARK_2
-#define XA_FREE_MARK XA_MARK_0
-
enum xa_lock_type {
XA_LOCK_IRQ = 1,
XA_LOCK_BH = 2,
@@ -277,35 +252,6 @@ enum xa_lock_type {
#define XA_FLAGS_ALLOC (XA_FLAGS_TRACK_FREE | XA_FLAGS_MARK(XA_FREE_MARK))
#define XA_FLAGS_ALLOC1 (XA_FLAGS_TRACK_FREE | XA_FLAGS_ZERO_BUSY)
-/**
- * struct xarray - The anchor of the XArray.
- * @xa_lock: Lock that protects the contents of the XArray.
- *
- * To use the xarray, define it statically or embed it in your data structure.
- * It is a very small data structure, so it does not usually make sense to
- * allocate it separately and keep a pointer to it in your data structure.
- *
- * You may use the xa_lock to protect your own data structures as well.
- */
-/*
- * If all of the entries in the array are NULL, @xa_head is a NULL pointer.
- * If the only non-NULL entry in the array is at index 0, @xa_head is that
- * entry. If any other entry in the array is non-NULL, @xa_head points
- * to an @xa_node.
- */
-struct xarray {
- spinlock_t xa_lock;
-/* private: The rest of the data structure is not to be used directly. */
- gfp_t xa_flags;
- void __rcu * xa_head;
-};
-
-#define XARRAY_INIT(name, flags) { \
- .xa_lock = __SPIN_LOCK_UNLOCKED(name.xa_lock), \
- .xa_flags = flags, \
- .xa_head = NULL, \
-}
-
/**
* DEFINE_XARRAY_FLAGS() - Define an XArray with custom flags.
* @name: A string that names your XArray.
diff --git a/include/linux/xarray_types.h b/include/linux/xarray_types.h
new file mode 100644
index 000000000000..ff241ce647a9
--- /dev/null
+++ b/include/linux/xarray_types.h
@@ -0,0 +1,70 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+#ifndef _LINUX_XARRAY_TYPES_H
+#define _LINUX_XARRAY_TYPES_H
+/*
+ * eXtensible Arrays
+ * Copyright (c) 2017 Microsoft Corporation
+ * Author: Matthew Wilcox <[email protected]>
+ *
+ * See Documentation/core-api/xarray.rst for how to use the XArray.
+ */
+
+#include <linux/gfp_types.h>
+#include <linux/spinlock_types.h>
+#include <linux/types.h>
+
+/**
+ * struct xa_limit - Represents a range of IDs.
+ * @min: The lowest ID to allocate (inclusive).
+ * @max: The maximum ID to allocate (inclusive).
+ *
+ * This structure is used either directly or via the XA_LIMIT() macro
+ * to communicate the range of IDs that are valid for allocation.
+ * Three common ranges are predefined for you:
+ * * xa_limit_32b - [0 - UINT_MAX]
+ * * xa_limit_31b - [0 - INT_MAX]
+ * * xa_limit_16b - [0 - USHRT_MAX]
+ */
+struct xa_limit {
+ u32 max;
+ u32 min;
+};
+
+typedef unsigned __bitwise xa_mark_t;
+#define XA_MARK_0 ((__force xa_mark_t)0U)
+#define XA_MARK_1 ((__force xa_mark_t)1U)
+#define XA_MARK_2 ((__force xa_mark_t)2U)
+#define XA_PRESENT ((__force xa_mark_t)8U)
+#define XA_MARK_MAX XA_MARK_2
+#define XA_FREE_MARK XA_MARK_0
+
+/**
+ * struct xarray - The anchor of the XArray.
+ * @xa_lock: Lock that protects the contents of the XArray.
+ *
+ * To use the xarray, define it statically or embed it in your data structure.
+ * It is a very small data structure, so it does not usually make sense to
+ * allocate it separately and keep a pointer to it in your data structure.
+ *
+ * You may use the xa_lock to protect your own data structures as well.
+ */
+/*
+ * If all of the entries in the array are NULL, @xa_head is a NULL pointer.
+ * If the only non-NULL entry in the array is at index 0, @xa_head is that
+ * entry. If any other entry in the array is non-NULL, @xa_head points
+ * to an @xa_node.
+ */
+struct xarray {
+ spinlock_t xa_lock;
+/* private: The rest of the data structure is not to be used directly. */
+ gfp_t xa_flags;
+ void __rcu * xa_head;
+};
+
+#define XARRAY_INIT(name, flags) { \
+ .xa_lock = __SPIN_LOCK_UNLOCKED(name.xa_lock), \
+ .xa_flags = flags, \
+ .xa_head = NULL, \
+}
+
+#endif /* _LINUX_XARRAY_TYPES_H */
diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h
index a2f221a39cd2..7ffdd8c31151 100644
--- a/include/net/net_namespace.h
+++ b/include/net/net_namespace.h
@@ -41,7 +41,7 @@
#include <linux/idr.h>
#include <linux/skbuff.h>
#include <linux/notifier.h>
-#include <linux/xarray.h>
+#include <linux/xarray_types.h>
struct user_namespace;
struct proc_dir_entry;
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
index 6ec5064156d9..9845ea172382 100644
--- a/include/net/sch_generic.h
+++ b/include/net/sch_generic.h
@@ -18,7 +18,7 @@
#include <net/gen_stats.h>
#include <net/rtnetlink.h>
#include <net/flow_offload.h>
-#include <linux/xarray.h>
+#include <linux/xarray_types.h>
struct Qdisc_ops;
struct qdisc_walker;
diff --git a/include/sound/core.h b/include/sound/core.h
index f95f6863986f..7dcba88b2fb7 100644
--- a/include/sound/core.h
+++ b/include/sound/core.h
@@ -14,7 +14,10 @@
#include <linux/stringify.h>
#include <linux/printk.h>
#include <linux/wait.h>
-#include <linux/xarray.h>
+
+#ifdef CONFIG_SND_CTL_FAST_LOOKUP
+#include <linux/xarray_types.h>
+#endif
/* number of supported soundcards */
#ifdef CONFIG_SND_DYNAMIC_MINORS
--
2.39.2
By providing declarations in a lean header, we can reduce header
dependencies.
Signed-off-by: Max Kellermann <[email protected]>
---
drivers/target/target_core_xcopy.c | 1 +
include/drm/drm_audio_component.h | 2 +-
include/drm/gpu_scheduler.h | 2 +-
include/linux/ceph/osd_client.h | 2 +-
include/linux/completion.h | 18 +----------------
include/linux/completion_types.h | 31 ++++++++++++++++++++++++++++++
include/linux/cpufreq.h | 2 +-
include/linux/edac.h | 2 +-
include/linux/firewire.h | 2 +-
include/linux/greybus/operation.h | 2 +-
include/linux/hw_random.h | 2 +-
include/linux/hyperv.h | 2 +-
include/linux/livepatch.h | 2 +-
include/linux/mailbox_controller.h | 2 +-
include/linux/mfd/cs42l43.h | 2 +-
include/linux/mfd/da9052/da9052.h | 2 +-
include/linux/mfd/wm8350/core.h | 2 +-
include/linux/mlx4/device.h | 2 +-
include/linux/mlx5/cq.h | 1 +
include/linux/mlx5/driver.h | 2 +-
include/linux/mmc/core.h | 2 +-
include/linux/mtd/onenand.h | 2 +-
include/linux/mtd/sh_flctl.h | 2 +-
include/linux/ntb.h | 2 +-
include/linux/pm.h | 2 +-
include/linux/rcupdate_wait.h | 2 +-
include/linux/sched/signal.h | 1 +
include/linux/soc/qcom/qmi.h | 2 +-
include/linux/spi/spi.h | 2 +-
include/linux/srcutree.h | 2 +-
include/linux/usb.h | 2 +-
include/net/inet_frag.h | 2 +-
include/rdma/ib_sa.h | 2 +-
include/rdma/restrack.h | 2 +-
include/target/target_core_base.h | 2 +-
include/xen/xenbus.h | 2 +-
36 files changed, 66 insertions(+), 48 deletions(-)
create mode 100644 include/linux/completion_types.h
diff --git a/drivers/target/target_core_xcopy.c b/drivers/target/target_core_xcopy.c
index 4128631c9dfd..c822f57daa39 100644
--- a/drivers/target/target_core_xcopy.c
+++ b/drivers/target/target_core_xcopy.c
@@ -16,6 +16,7 @@
#include <linux/spinlock.h>
#include <linux/list.h>
#include <linux/rculist.h>
+#include <linux/completion.h>
#include <linux/configfs.h>
#include <linux/ratelimit.h>
#include <scsi/scsi_proto.h>
diff --git a/include/drm/drm_audio_component.h b/include/drm/drm_audio_component.h
index 5a4cd1fa8e2a..d4e95bca4d10 100644
--- a/include/drm/drm_audio_component.h
+++ b/include/drm/drm_audio_component.h
@@ -4,7 +4,7 @@
#ifndef _DRM_AUDIO_COMPONENT_H_
#define _DRM_AUDIO_COMPONENT_H_
-#include <linux/completion.h>
+#include <linux/completion_types.h>
#include <linux/types.h>
struct drm_audio_component;
diff --git a/include/drm/gpu_scheduler.h b/include/drm/gpu_scheduler.h
index 05591cc987c2..9a89f72a3bac 100644
--- a/include/drm/gpu_scheduler.h
+++ b/include/drm/gpu_scheduler.h
@@ -26,7 +26,7 @@
#include <drm/spsc_queue.h>
#include <linux/dma-fence.h>
-#include <linux/completion.h>
+#include <linux/completion_types.h>
#include <linux/xarray.h>
#include <linux/wait_types.h>
#include <linux/workqueue_types.h>
diff --git a/include/linux/ceph/osd_client.h b/include/linux/ceph/osd_client.h
index 2e6320a4c1d3..905c8afc095d 100644
--- a/include/linux/ceph/osd_client.h
+++ b/include/linux/ceph/osd_client.h
@@ -3,7 +3,7 @@
#define _FS_CEPH_OSD_CLIENT_H
#include <linux/bitrev.h>
-#include <linux/completion.h>
+#include <linux/completion_types.h>
#include <linux/kref_types.h>
#include <linux/mempool.h>
#include <linux/rbtree_types.h>
diff --git a/include/linux/completion.h b/include/linux/completion.h
index fb2915676574..a57ffe2836b9 100644
--- a/include/linux/completion.h
+++ b/include/linux/completion.h
@@ -9,25 +9,9 @@
* See kernel/sched/completion.c for details.
*/
+#include <linux/completion_types.h>
#include <linux/swait.h>
-/*
- * struct completion - structure used to maintain state for a "completion"
- *
- * This is the opaque structure used to maintain the state for a "completion".
- * Completions currently use a FIFO to queue threads that have to wait for
- * the "completion" event.
- *
- * See also: complete(), wait_for_completion() (and friends _timeout,
- * _interruptible, _interruptible_timeout, and _killable), init_completion(),
- * reinit_completion(), and macros DECLARE_COMPLETION(),
- * DECLARE_COMPLETION_ONSTACK().
- */
-struct completion {
- unsigned int done;
- struct swait_queue_head wait;
-};
-
#define init_completion_map(x, m) init_completion(x)
static inline void complete_acquire(struct completion *x) {}
static inline void complete_release(struct completion *x) {}
diff --git a/include/linux/completion_types.h b/include/linux/completion_types.h
new file mode 100644
index 000000000000..032192c95462
--- /dev/null
+++ b/include/linux/completion_types.h
@@ -0,0 +1,31 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef __LINUX_COMPLETION_TYPES_H
+#define __LINUX_COMPLETION_TYPES_H
+
+/*
+ * (C) Copyright 2001 Linus Torvalds
+ *
+ * Atomic wait-for-completion handler data structures.
+ * See kernel/sched/completion.c for details.
+ */
+
+#include <linux/swait_types.h>
+
+/*
+ * struct completion - structure used to maintain state for a "completion"
+ *
+ * This is the opaque structure used to maintain the state for a "completion".
+ * Completions currently use a FIFO to queue threads that have to wait for
+ * the "completion" event.
+ *
+ * See also: complete(), wait_for_completion() (and friends _timeout,
+ * _interruptible, _interruptible_timeout, and _killable), init_completion(),
+ * reinit_completion(), and macros DECLARE_COMPLETION(),
+ * DECLARE_COMPLETION_ONSTACK().
+ */
+struct completion {
+ unsigned int done;
+ struct swait_queue_head wait;
+};
+
+#endif
diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h
index 9f57e106b040..7472dea7b7c6 100644
--- a/include/linux/cpufreq.h
+++ b/include/linux/cpufreq.h
@@ -11,7 +11,7 @@
#include <linux/clk.h>
#include <linux/cpu.h>
#include <linux/cpumask.h>
-#include <linux/completion.h>
+#include <linux/completion_types.h>
#include <linux/kobject_types.h>
#include <linux/notifier.h>
#include <linux/of.h>
diff --git a/include/linux/edac.h b/include/linux/edac.h
index f939d5fad491..7b78403cac40 100644
--- a/include/linux/edac.h
+++ b/include/linux/edac.h
@@ -14,7 +14,7 @@
#include <linux/atomic.h>
#include <linux/device.h>
-#include <linux/completion.h>
+#include <linux/completion_types.h>
#include <linux/workqueue_types.h>
#include <linux/debugfs.h>
#include <linux/numa.h>
diff --git a/include/linux/firewire.h b/include/linux/firewire.h
index feef7e09b60a..a81e31472530 100644
--- a/include/linux/firewire.h
+++ b/include/linux/firewire.h
@@ -2,7 +2,7 @@
#ifndef _LINUX_FIREWIRE_H
#define _LINUX_FIREWIRE_H
-#include <linux/completion.h>
+#include <linux/completion_types.h>
#include <linux/device.h>
#include <linux/dma-mapping.h>
#include <linux/kernel.h>
diff --git a/include/linux/greybus/operation.h b/include/linux/greybus/operation.h
index c49053e5707d..8d849f4ee99f 100644
--- a/include/linux/greybus/operation.h
+++ b/include/linux/greybus/operation.h
@@ -9,7 +9,7 @@
#ifndef __OPERATION_H
#define __OPERATION_H
-#include <linux/completion.h>
+#include <linux/completion_types.h>
#include <linux/kref_types.h>
#include <linux/timer_types.h>
#include <linux/types.h>
diff --git a/include/linux/hw_random.h b/include/linux/hw_random.h
index 96cad10d0201..69838419f2e7 100644
--- a/include/linux/hw_random.h
+++ b/include/linux/hw_random.h
@@ -12,7 +12,7 @@
#ifndef LINUX_HWRANDOM_H_
#define LINUX_HWRANDOM_H_
-#include <linux/completion.h>
+#include <linux/completion_types.h>
#include <linux/types.h>
#include <linux/list.h>
#include <linux/kref_types.h>
diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h
index 249c4eb67f38..60ed23c4ca17 100644
--- a/include/linux/hyperv.h
+++ b/include/linux/hyperv.h
@@ -18,7 +18,7 @@
#include <linux/types.h>
#include <linux/scatterlist.h>
#include <linux/list.h>
-#include <linux/completion.h>
+#include <linux/completion_types.h>
#include <linux/device.h>
#include <linux/mod_devicetable.h>
#include <linux/interrupt.h>
diff --git a/include/linux/livepatch.h b/include/linux/livepatch.h
index 9b9b38e89563..5277d2a768eb 100644
--- a/include/linux/livepatch.h
+++ b/include/linux/livepatch.h
@@ -11,7 +11,7 @@
#include <linux/module.h>
#include <linux/ftrace.h>
-#include <linux/completion.h>
+#include <linux/completion_types.h>
#include <linux/list.h>
#include <linux/livepatch_sched.h>
diff --git a/include/linux/mailbox_controller.h b/include/linux/mailbox_controller.h
index fec4affa1543..d785db5d1915 100644
--- a/include/linux/mailbox_controller.h
+++ b/include/linux/mailbox_controller.h
@@ -6,7 +6,7 @@
#include <linux/of.h>
#include <linux/types.h>
#include <linux/hrtimer_types.h>
-#include <linux/completion.h>
+#include <linux/completion_types.h>
struct device;
struct mbox_chan;
diff --git a/include/linux/mfd/cs42l43.h b/include/linux/mfd/cs42l43.h
index 7649f2770697..3b3cbd0530c2 100644
--- a/include/linux/mfd/cs42l43.h
+++ b/include/linux/mfd/cs42l43.h
@@ -6,7 +6,7 @@
* Cirrus Logic International Semiconductor Ltd.
*/
-#include <linux/completion.h>
+#include <linux/completion_types.h>
#include <linux/device.h>
#include <linux/gpio/consumer.h>
#include <linux/mutex_types.h>
diff --git a/include/linux/mfd/da9052/da9052.h b/include/linux/mfd/da9052/da9052.h
index 76feb3a7066d..ade7e7ca0729 100644
--- a/include/linux/mfd/da9052/da9052.h
+++ b/include/linux/mfd/da9052/da9052.h
@@ -13,7 +13,7 @@
#include <linux/interrupt.h>
#include <linux/regmap.h>
#include <linux/slab.h>
-#include <linux/completion.h>
+#include <linux/completion_types.h>
#include <linux/list.h>
#include <linux/mfd/core.h>
diff --git a/include/linux/mfd/wm8350/core.h b/include/linux/mfd/wm8350/core.h
index dc6ff85cb5b0..25379c7f94c4 100644
--- a/include/linux/mfd/wm8350/core.h
+++ b/include/linux/mfd/wm8350/core.h
@@ -11,7 +11,7 @@
#include <linux/kernel.h>
#include <linux/mutex_types.h>
#include <linux/interrupt.h>
-#include <linux/completion.h>
+#include <linux/completion_types.h>
#include <linux/regmap.h>
#include <linux/mfd/wm8350/audio.h>
diff --git a/include/linux/mlx4/device.h b/include/linux/mlx4/device.h
index 27f42f713c89..18d71b808bc2 100644
--- a/include/linux/mlx4/device.h
+++ b/include/linux/mlx4/device.h
@@ -36,7 +36,7 @@
#include <linux/auxiliary_bus.h>
#include <linux/if_ether.h>
#include <linux/pci.h>
-#include <linux/completion.h>
+#include <linux/completion_types.h>
#include <linux/radix-tree.h>
#include <linux/cpu_rmap.h>
#include <linux/crash_dump.h>
diff --git a/include/linux/mlx5/cq.h b/include/linux/mlx5/cq.h
index cb15308b5cb0..7acfefd41950 100644
--- a/include/linux/mlx5/cq.h
+++ b/include/linux/mlx5/cq.h
@@ -35,6 +35,7 @@
#include <linux/mlx5/driver.h>
#include <linux/refcount.h>
+#include <linux/completion.h>
struct mlx5_core_cq {
u32 cqn;
diff --git a/include/linux/mlx5/driver.h b/include/linux/mlx5/driver.h
index 7d47499ce75a..d9b99aca9e72 100644
--- a/include/linux/mlx5/driver.h
+++ b/include/linux/mlx5/driver.h
@@ -34,7 +34,7 @@
#define MLX5_DRIVER_H
#include <linux/kernel.h>
-#include <linux/completion.h>
+#include <linux/completion_types.h>
#include <linux/pci.h>
#include <linux/irq.h>
#include <linux/spinlock_types.h>
diff --git a/include/linux/mmc/core.h b/include/linux/mmc/core.h
index 2c7928a50907..54cee0bf305d 100644
--- a/include/linux/mmc/core.h
+++ b/include/linux/mmc/core.h
@@ -5,7 +5,7 @@
#ifndef LINUX_MMC_CORE_H
#define LINUX_MMC_CORE_H
-#include <linux/completion.h>
+#include <linux/completion_types.h>
#include <linux/types.h>
struct mmc_data;
diff --git a/include/linux/mtd/onenand.h b/include/linux/mtd/onenand.h
index 7ebd8180c617..43e0f8812f52 100644
--- a/include/linux/mtd/onenand.h
+++ b/include/linux/mtd/onenand.h
@@ -10,7 +10,7 @@
#define __LINUX_MTD_ONENAND_H
#include <linux/spinlock_types.h>
-#include <linux/completion.h>
+#include <linux/completion_types.h>
#include <linux/mtd/flashchip.h>
#include <linux/mtd/onenand_regs.h>
#include <linux/mtd/bbm.h>
diff --git a/include/linux/mtd/sh_flctl.h b/include/linux/mtd/sh_flctl.h
index 78fc2d4218c8..2f48438bf2a3 100644
--- a/include/linux/mtd/sh_flctl.h
+++ b/include/linux/mtd/sh_flctl.h
@@ -8,7 +8,7 @@
#ifndef __SH_FLCTL_H__
#define __SH_FLCTL_H__
-#include <linux/completion.h>
+#include <linux/completion_types.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/rawnand.h>
#include <linux/mtd/partitions.h>
diff --git a/include/linux/ntb.h b/include/linux/ntb.h
index 191b524e5c0d..b8a8be4052e1 100644
--- a/include/linux/ntb.h
+++ b/include/linux/ntb.h
@@ -56,7 +56,7 @@
#ifndef _NTB_H_
#define _NTB_H_
-#include <linux/completion.h>
+#include <linux/completion_types.h>
#include <linux/device.h>
#include <linux/interrupt.h>
diff --git a/include/linux/pm.h b/include/linux/pm.h
index 14f95d7e67ab..05e483d6a7c9 100644
--- a/include/linux/pm.h
+++ b/include/linux/pm.h
@@ -14,7 +14,7 @@
#include <linux/spinlock_types.h>
#include <linux/wait_types.h>
#include <linux/hrtimer_types.h>
-#include <linux/completion.h>
+#include <linux/completion_types.h>
#ifdef CONFIG_PM_CLK
#include <linux/mutex_types.h>
diff --git a/include/linux/rcupdate_wait.h b/include/linux/rcupdate_wait.h
index d07f0848802e..a28b4fce69a5 100644
--- a/include/linux/rcupdate_wait.h
+++ b/include/linux/rcupdate_wait.h
@@ -7,7 +7,7 @@
*/
#include <linux/rcupdate.h>
-#include <linux/completion.h>
+#include <linux/completion_types.h>
#include <linux/sched.h>
/*
diff --git a/include/linux/sched/signal.h b/include/linux/sched/signal.h
index 0fe856628e60..50ff10ba803e 100644
--- a/include/linux/sched/signal.h
+++ b/include/linux/sched/signal.h
@@ -8,6 +8,7 @@
#include <linux/sched.h>
#include <linux/sched/jobctl.h>
#include <linux/sched/task.h>
+#include <linux/completion_types.h>
#include <linux/cred.h>
#include <linux/refcount.h>
#include <linux/pid.h>
diff --git a/include/linux/soc/qcom/qmi.h b/include/linux/soc/qcom/qmi.h
index 900c4b3540cc..d2e725b1864b 100644
--- a/include/linux/soc/qcom/qmi.h
+++ b/include/linux/soc/qcom/qmi.h
@@ -6,7 +6,7 @@
#ifndef __QMI_HELPERS_H__
#define __QMI_HELPERS_H__
-#include <linux/completion.h>
+#include <linux/completion_types.h>
#include <linux/idr.h>
#include <linux/list.h>
#include <linux/qrtr.h>
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h
index 8bf398247f0a..97312a919a70 100644
--- a/include/linux/spi/spi.h
+++ b/include/linux/spi/spi.h
@@ -8,7 +8,7 @@
#include <linux/acpi.h>
#include <linux/bits.h>
-#include <linux/completion.h>
+#include <linux/completion_types.h>
#include <linux/device.h>
#include <linux/gpio/consumer.h>
#include <linux/kthread.h>
diff --git a/include/linux/srcutree.h b/include/linux/srcutree.h
index 74edc15cfcf3..8b1747a66608 100644
--- a/include/linux/srcutree.h
+++ b/include/linux/srcutree.h
@@ -12,7 +12,7 @@
#define _LINUX_SRCU_TREE_H
#include <linux/rcu_node_tree.h>
-#include <linux/completion.h>
+#include <linux/completion_types.h>
#include <linux/mutex_types.h>
#include <linux/workqueue.h>
diff --git a/include/linux/usb.h b/include/linux/usb.h
index 3dbfbef457de..bf089b335a88 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -18,7 +18,7 @@
#include <linux/kref_types.h> /* for struct kref */
#include <linux/device.h> /* for struct device */
#include <linux/fs.h> /* for struct file_operations */
-#include <linux/completion.h> /* for struct completion */
+#include <linux/completion_types.h> /* for struct completion */
#include <linux/sched.h> /* for current && schedule_timeout */
#include <linux/mutex_types.h> /* for struct mutex */
#include <linux/pm_runtime.h> /* for runtime PM */
diff --git a/include/net/inet_frag.h b/include/net/inet_frag.h
index 153960663ce4..eafb78c7cd76 100644
--- a/include/net/inet_frag.h
+++ b/include/net/inet_frag.h
@@ -3,7 +3,7 @@
#define __NET_FRAG_H__
#include <linux/rhashtable-types.h>
-#include <linux/completion.h>
+#include <linux/completion_types.h>
#include <linux/in6.h>
#include <linux/rbtree_types.h>
#include <linux/refcount.h>
diff --git a/include/rdma/ib_sa.h b/include/rdma/ib_sa.h
index b46353fc53bf..fd6f7630e91e 100644
--- a/include/rdma/ib_sa.h
+++ b/include/rdma/ib_sa.h
@@ -8,7 +8,7 @@
#ifndef IB_SA_H
#define IB_SA_H
-#include <linux/completion.h>
+#include <linux/completion_types.h>
#include <linux/compiler.h>
#include <linux/atomic.h>
diff --git a/include/rdma/restrack.h b/include/rdma/restrack.h
index f5a4ae56a1d9..48aba5db7544 100644
--- a/include/rdma/restrack.h
+++ b/include/rdma/restrack.h
@@ -9,7 +9,7 @@
#include <linux/typecheck.h>
#include <linux/sched.h>
#include <linux/kref_types.h>
-#include <linux/completion.h>
+#include <linux/completion_types.h>
#include <linux/sched/task.h>
#include <uapi/rdma/rdma_netlink.h>
diff --git a/include/target/target_core_base.h b/include/target/target_core_base.h
index 97099a5e3f6c..5b9156adceca 100644
--- a/include/target/target_core_base.h
+++ b/include/target/target_core_base.h
@@ -7,7 +7,7 @@
#include <linux/sbitmap.h>
#include <linux/percpu-refcount.h>
#include <linux/semaphore.h> /* struct semaphore */
-#include <linux/completion.h>
+#include <linux/completion_types.h>
#define TARGET_CORE_VERSION "v5.0"
diff --git a/include/xen/xenbus.h b/include/xen/xenbus.h
index d0f2e0a134be..a7326aa58680 100644
--- a/include/xen/xenbus.h
+++ b/include/xen/xenbus.h
@@ -38,7 +38,7 @@
#include <linux/notifier.h>
#include <linux/export.h>
#include <linux/fs.h>
-#include <linux/completion.h>
+#include <linux/completion_types.h>
#include <linux/init.h>
#include <linux/slab.h>
#include <linux/semaphore.h>
--
2.39.2
Hi Max,
On 1/31/24 06:49, Max Kellermann wrote:
> This patch set aims to reduce the dependencies between headers, in
> order to have cleaner code and speed up the build. It continues
> previous efforts by other developers.
>
> As a preparation, the first patch adds "#include" directives to source
> files that were missing previously, but due to indirect includes, this
> was never noticed. After the cleanup, many missing directives would
> result in a compiler failure.
>
> The second patch removes superfluous "#include" directives, some of
> which may be a leftover from refactoring patches.
[snip]
> Max Kellermann (28):
> include: add missing includes
> include: remove unnecessary #include directives
How were these (a) missing and (b) unnecessary includes
found or determined?
Did you use some tool for that? If so, which one?
thanks.
--
#Randy
On Wed, Jan 31, 2024 at 10:44 PM Randy Dunlap <[email protected]> wrote:
> How were these (a) missing and (b) unnecessary includes
> found or determined?
> Did you use some tool for that? If so, which one?
No tool, just stgit to edit the patches (in arbitrary order). I
reduced header dependencies, but got lots of build errors because
symbols were missing in different sources, which were previously
fulfilled by indirect includes that were now removed. I fixed all
those build errors by adding missing includes to those headers, moving
those changes to the first patch.
I found the unnecessary includes manually along the way by using "git
grep" to find all include directives for a certain header; I checked
the source for the reason why this header was included, and whether
the include could be replaced with "X_types.h" instead. Sometimes, I
found that not even "X_types.h" was necessary, but no include at all,
so I removed the include completely and had those changes in the
second patch.
The first two patches grew along the way. It was refreshed over and
over (with stgit), while I was editing the other patches.
I know there's the "iwyu" tool, and it may be helpful eventually, but
there's so much low-hanging fruit in the kernel, iwyu is not useful
yet I think.
Max
On Wed, Jan 31, 2024 at 11:00:27PM +0100, Max Kellermann wrote:
> On Wed, Jan 31, 2024 at 10:44 PM Randy Dunlap <[email protected]> wrote:
> > How were these (a) missing and (b) unnecessary includes
> > found or determined?
> > Did you use some tool for that? If so, which one?
>
> No tool, just stgit to edit the patches (in arbitrary order). I
> reduced header dependencies, but got lots of build errors because
> symbols were missing in different sources, which were previously
> fulfilled by indirect includes that were now removed. I fixed all
> those build errors by adding missing includes to those headers, moving
> those changes to the first patch.
>
> I found the unnecessary includes manually along the way by using "git
> grep" to find all include directives for a certain header; I checked
> the source for the reason why this header was included, and whether
> the include could be replaced with "X_types.h" instead. Sometimes, I
> found that not even "X_types.h" was necessary, but no include at all,
> so I removed the include completely and had those changes in the
> second patch.
>
> The first two patches grew along the way. It was refreshed over and
> over (with stgit), while I was editing the other patches.
>
> I know there's the "iwyu" tool, and it may be helpful eventually, but
> there's so much low-hanging fruit in the kernel, iwyu is not useful
> yet I think.
We just wrapped up an internship where Tanzir was looking into getting IWYU
working on the kernel. He presented about it at Linux Plumbers Conf '23
recently.
https://youtu.be/eFq_oqLiXPM?si=0VhuMnwjHnMPJeaR
https://youtu.be/XMVLSEzbpQ8?si=_2DQpS7JBlEC4FK1
https://github.com/ClangBuiltLinux/IWYUScripts
https://lore.kernel.org/lkml/?q=f%3Atanzirh%40google.com
Some of his patches have landed, others had requests from maintainers that
weren't reasonable to satisfy in the short duration of an internship. But still
worth pursuing. Happy to chat more about the general problem sometime.
>
> Max
Hi Max,
kernel test robot noticed the following build warnings:
[auto build test WARNING on next-20240131]
[cannot apply to mkp-scsi/for-next jejb-scsi/for-next axboe-block/for-next linus/master v6.8-rc2 v6.8-rc1 v6.7 v6.8-rc2]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Max-Kellermann/include-add-missing-includes/20240131-231042
base: next-20240131
patch link: https://lore.kernel.org/r/20240131145008.1345531-17-max.kellermann%40ionos.com
patch subject: [PATCH 16/28] device.h: move declarations to device_types.h
config: arm64-defconfig (https://download.01.org/0day-ci/archive/20240203/[email protected]/config)
compiler: aarch64-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240203/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All warnings (new ones prefixed by >>):
| ^~~~~
mm/slub.c:6327:14: error: 'slabs' undeclared here (not in a function); did you mean 'slab'?
6327 | SLAB_ATTR_RO(slabs);
| ^~~~~
mm/slub.c:6132:68: note: in definition of macro 'SLAB_ATTR_RO'
6132 | static struct slab_attribute _name##_attr = __ATTR_RO_MODE(_name, 0400)
| ^~~~~
mm/slub.c:6333:14: error: 'total_objects' undeclared here (not in a function); did you mean 'oo_objects'?
6333 | SLAB_ATTR_RO(total_objects);
| ^~~~~~~~~~~~~
mm/slub.c:6132:68: note: in definition of macro 'SLAB_ATTR_RO'
6132 | static struct slab_attribute _name##_attr = __ATTR_RO_MODE(_name, 0400)
| ^~~~~
mm/slub.c:6339:14: error: 'objects' undeclared here (not in a function); did you mean 'kobject'?
6339 | SLAB_ATTR_RO(objects);
| ^~~~~~~
mm/slub.c:6132:68: note: in definition of macro 'SLAB_ATTR_RO'
6132 | static struct slab_attribute _name##_attr = __ATTR_RO_MODE(_name, 0400)
| ^~~~~
mm/slub.c:6345:14: error: 'sanity_checks' undeclared here (not in a function); did you mean 'sanity_checks_attr'?
6345 | SLAB_ATTR_RO(sanity_checks);
| ^~~~~~~~~~~~~
mm/slub.c:6132:68: note: in definition of macro 'SLAB_ATTR_RO'
6132 | static struct slab_attribute _name##_attr = __ATTR_RO_MODE(_name, 0400)
| ^~~~~
mm/slub.c:6132:53: error: invalid initializer
6132 | static struct slab_attribute _name##_attr = __ATTR_RO_MODE(_name, 0400)
| ^~~~~~~~~~~~~~
mm/slub.c:6351:1: note: in expansion of macro 'SLAB_ATTR_RO'
6351 | SLAB_ATTR_RO(trace);
| ^~~~~~~~~~~~
mm/slub.c:6358:14: error: 'red_zone' undeclared here (not in a function)
6358 | SLAB_ATTR_RO(red_zone);
| ^~~~~~~~
mm/slub.c:6132:68: note: in definition of macro 'SLAB_ATTR_RO'
6132 | static struct slab_attribute _name##_attr = __ATTR_RO_MODE(_name, 0400)
| ^~~~~
mm/slub.c:6365:14: error: 'poison' undeclared here (not in a function)
6365 | SLAB_ATTR_RO(poison);
| ^~~~~~
mm/slub.c:6132:68: note: in definition of macro 'SLAB_ATTR_RO'
6132 | static struct slab_attribute _name##_attr = __ATTR_RO_MODE(_name, 0400)
| ^~~~~
mm/slub.c:6372:14: error: 'store_user' undeclared here (not in a function); did you mean 'pte_user'?
6372 | SLAB_ATTR_RO(store_user);
| ^~~~~~~~~~
mm/slub.c:6132:68: note: in definition of macro 'SLAB_ATTR_RO'
6132 | static struct slab_attribute _name##_attr = __ATTR_RO_MODE(_name, 0400)
| ^~~~~
mm/slub.c:6391:11: error: 'validate' undeclared here (not in a function); did you mean 'key_validate'?
6391 | SLAB_ATTR(validate);
| ^~~~~~~~
mm/slub.c:6135:68: note: in definition of macro 'SLAB_ATTR'
6135 | static struct slab_attribute _name##_attr = __ATTR_RW_MODE(_name, 0600)
| ^~~~~
mm/slub.c:6431:11: error: 'shrink' undeclared here (not in a function); did you mean 'shrinker'?
6431 | SLAB_ATTR(shrink);
| ^~~~~~
mm/slub.c:6135:68: note: in definition of macro 'SLAB_ATTR'
6135 | static struct slab_attribute _name##_attr = __ATTR_RW_MODE(_name, 0600)
| ^~~~~
mm/slub.c:6455:11: error: 'remote_node_defrag_ratio' undeclared here (not in a function); did you mean 'remote_node_defrag_ratio_attr'?
6455 | SLAB_ATTR(remote_node_defrag_ratio);
| ^~~~~~~~~~~~~~~~~~~~~~~~
mm/slub.c:6135:68: note: in definition of macro 'SLAB_ATTR'
6135 | static struct slab_attribute _name##_attr = __ATTR_RW_MODE(_name, 0600)
| ^~~~~
mm/slub.c:6682:21: error: variable 'slab_sysfs_ops' has initializer but incomplete type
6682 | static const struct sysfs_ops slab_sysfs_ops = {
| ^~~~~~~~~
mm/slub.c:6683:10: error: 'const struct sysfs_ops' has no member named 'show'
6683 | .show = slab_attr_show,
| ^~~~
mm/slub.c:6683:17: warning: excess elements in struct initializer
6683 | .show = slab_attr_show,
| ^~~~~~~~~~~~~~
mm/slub.c:6683:17: note: (near initialization for 'slab_sysfs_ops')
mm/slub.c:6684:10: error: 'const struct sysfs_ops' has no member named 'store'
6684 | .store = slab_attr_store,
| ^~~~~
mm/slub.c:6684:18: warning: excess elements in struct initializer
6684 | .store = slab_attr_store,
| ^~~~~~~~~~~~~~~
mm/slub.c:6684:18: note: (near initialization for 'slab_sysfs_ops')
mm/slub.c: In function 'sysfs_slab_add':
mm/slub.c:6760:17: error: implicit declaration of function 'sysfs_remove_link' [-Werror=implicit-function-declaration]
6760 | sysfs_remove_link(&slab_kset->kobj, s->name);
| ^~~~~~~~~~~~~~~~~
mm/slub.c:6777:15: error: implicit declaration of function 'sysfs_create_group' [-Werror=implicit-function-declaration]
6777 | err = sysfs_create_group(&s->kobj, &slab_attr_group);
| ^~~~~~~~~~~~~~~~~~
mm/slub.c: In function 'sysfs_slab_alias':
mm/slub.c:6827:24: error: implicit declaration of function 'sysfs_create_link'; did you mean 'kernfs_create_link'? [-Werror=implicit-function-declaration]
6827 | return sysfs_create_link(&slab_kset->kobj, &s->kobj, name);
| ^~~~~~~~~~~~~~~~~
| kernfs_create_link
mm/slub.c: At top level:
mm/slub.c:6682:31: error: storage size of 'slab_sysfs_ops' isn't known
6682 | static const struct sysfs_ops slab_sysfs_ops = {
| ^~~~~~~~~~~~~~
>> mm/slub.c:6439:16: warning: 'remote_node_defrag_ratio_store' defined but not used [-Wunused-function]
6439 | static ssize_t remote_node_defrag_ratio_store(struct kmem_cache *s,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> mm/slub.c:6434:16: warning: 'remote_node_defrag_ratio_show' defined but not used [-Wunused-function]
6434 | static ssize_t remote_node_defrag_ratio_show(struct kmem_cache *s, char *buf)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
mm/slub.c:6422:16: warning: 'shrink_store' defined but not used [-Wunused-function]
6422 | static ssize_t shrink_store(struct kmem_cache *s,
| ^~~~~~~~~~~~
mm/slub.c:6417:16: warning: 'shrink_show' defined but not used [-Wunused-function]
6417 | static ssize_t shrink_show(struct kmem_cache *s, char *buf)
| ^~~~~~~~~~~
mm/slub.c:6379:16: warning: 'validate_store' defined but not used [-Wunused-function]
6379 | static ssize_t validate_store(struct kmem_cache *s,
| ^~~~~~~~~~~~~~
mm/slub.c:6374:16: warning: 'validate_show' defined but not used [-Wunused-function]
6374 | static ssize_t validate_show(struct kmem_cache *s, char *buf)
| ^~~~~~~~~~~~~
mm/slub.c:6367:16: warning: 'store_user_show' defined but not used [-Wunused-function]
6367 | static ssize_t store_user_show(struct kmem_cache *s, char *buf)
| ^~~~~~~~~~~~~~~
mm/slub.c:6360:16: warning: 'poison_show' defined but not used [-Wunused-function]
6360 | static ssize_t poison_show(struct kmem_cache *s, char *buf)
| ^~~~~~~~~~~
mm/slub.c:6353:16: warning: 'red_zone_show' defined but not used [-Wunused-function]
6353 | static ssize_t red_zone_show(struct kmem_cache *s, char *buf)
| ^~~~~~~~~~~~~
mm/slub.c:6347:16: warning: 'trace_show' defined but not used [-Wunused-function]
6347 | static ssize_t trace_show(struct kmem_cache *s, char *buf)
| ^~~~~~~~~~
mm/slub.c:6341:16: warning: 'sanity_checks_show' defined but not used [-Wunused-function]
6341 | static ssize_t sanity_checks_show(struct kmem_cache *s, char *buf)
| ^~~~~~~~~~~~~~~~~~
mm/slub.c:6335:16: warning: 'objects_show' defined but not used [-Wunused-function]
6335 | static ssize_t objects_show(struct kmem_cache *s, char *buf)
| ^~~~~~~~~~~~
mm/slub.c:6329:16: warning: 'total_objects_show' defined but not used [-Wunused-function]
6329 | static ssize_t total_objects_show(struct kmem_cache *s, char *buf)
| ^~~~~~~~~~~~~~~~~~
mm/slub.c:6323:16: warning: 'slabs_show' defined but not used [-Wunused-function]
6323 | static ssize_t slabs_show(struct kmem_cache *s, char *buf)
| ^~~~~~~~~~
mm/slub.c:6316:16: warning: 'destroy_by_rcu_show' defined but not used [-Wunused-function]
6316 | static ssize_t destroy_by_rcu_show(struct kmem_cache *s, char *buf)
| ^~~~~~~~~~~~~~~~~~~
mm/slub.c:6301:16: warning: 'cache_dma_show' defined but not used [-Wunused-function]
6301 | static ssize_t cache_dma_show(struct kmem_cache *s, char *buf)
| ^~~~~~~~~~~~~~
mm/slub.c:6294:16: warning: 'hwcache_align_show' defined but not used [-Wunused-function]
6294 | static ssize_t hwcache_align_show(struct kmem_cache *s, char *buf)
| ^~~~~~~~~~~~~~~~~~
mm/slub.c:6288:16: warning: 'reclaim_account_show' defined but not used [-Wunused-function]
6288 | static ssize_t reclaim_account_show(struct kmem_cache *s, char *buf)
| ^~~~~~~~~~~~~~~~~~~~
mm/slub.c:6247:16: warning: 'slabs_cpu_partial_show' defined but not used [-Wunused-function]
6247 | static ssize_t slabs_cpu_partial_show(struct kmem_cache *s, char *buf)
| ^~~~~~~~~~~~~~~~~~~~~~
mm/slub.c:6241:16: warning: 'objects_partial_show' defined but not used [-Wunused-function]
6241 | static ssize_t objects_partial_show(struct kmem_cache *s, char *buf)
| ^~~~~~~~~~~~~~~~~~~~
mm/slub.c:6235:16: warning: 'cpu_slabs_show' defined but not used [-Wunused-function]
6235 | static ssize_t cpu_slabs_show(struct kmem_cache *s, char *buf)
| ^~~~~~~~~~~~~~
mm/slub.c:6229:16: warning: 'partial_show' defined but not used [-Wunused-function]
6229 | static ssize_t partial_show(struct kmem_cache *s, char *buf)
| ^~~~~~~~~~~~
mm/slub.c:6223:16: warning: 'aliases_show' defined but not used [-Wunused-function]
6223 | static ssize_t aliases_show(struct kmem_cache *s, char *buf)
| ^~~~~~~~~~~~
mm/slub.c:6215:16: warning: 'ctor_show' defined but not used [-Wunused-function]
6215 | static ssize_t ctor_show(struct kmem_cache *s, char *buf)
| ^~~~~~~~~
mm/slub.c:6197:16: warning: 'cpu_partial_store' defined but not used [-Wunused-function]
6197 | static ssize_t cpu_partial_store(struct kmem_cache *s, const char *buf,
| ^~~~~~~~~~~~~~~~~
mm/slub.c:6187:16: warning: 'cpu_partial_show' defined but not used [-Wunused-function]
6187 | static ssize_t cpu_partial_show(struct kmem_cache *s, char *buf)
| ^~~~~~~~~~~~~~~~
mm/slub.c:6172:16: warning: 'min_partial_store' defined but not used [-Wunused-function]
6172 | static ssize_t min_partial_store(struct kmem_cache *s, const char *buf,
| ^~~~~~~~~~~~~~~~~
mm/slub.c:6167:16: warning: 'min_partial_show' defined but not used [-Wunused-function]
6167 | static ssize_t min_partial_show(struct kmem_cache *s, char *buf)
| ^~~~~~~~~~~~~~~~
mm/slub.c:6161:16: warning: 'order_show' defined but not used [-Wunused-function]
6161 | static ssize_t order_show(struct kmem_cache *s, char *buf)
| ^~~~~~~~~~
mm/slub.c:6155:16: warning: 'objs_per_slab_show' defined but not used [-Wunused-function]
6155 | static ssize_t objs_per_slab_show(struct kmem_cache *s, char *buf)
| ^~~~~~~~~~~~~~~~~~
mm/slub.c:6149:16: warning: 'object_size_show' defined but not used [-Wunused-function]
6149 | static ssize_t object_size_show(struct kmem_cache *s, char *buf)
| ^~~~~~~~~~~~~~~~
mm/slub.c:6143:16: warning: 'align_show' defined but not used [-Wunused-function]
6143 | static ssize_t align_show(struct kmem_cache *s, char *buf)
| ^~~~~~~~~~
mm/slub.c:6137:16: warning: 'slab_size_show' defined but not used [-Wunused-function]
6137 | static ssize_t slab_size_show(struct kmem_cache *s, char *buf)
| ^~~~~~~~~~~~~~
cc1: some warnings being treated as errors
vim +/remote_node_defrag_ratio_store +6439 mm/slub.c
2086d26a05a4b5 Christoph Lameter 2007-05-06 6432
81819f0fc8285a Christoph Lameter 2007-05-06 6433 #ifdef CONFIG_NUMA
9824601ead957a Christoph Lameter 2008-01-07 @6434 static ssize_t remote_node_defrag_ratio_show(struct kmem_cache *s, char *buf)
81819f0fc8285a Christoph Lameter 2007-05-06 6435 {
bf16d19aabd8f5 Joe Perches 2020-12-14 6436 return sysfs_emit(buf, "%u\n", s->remote_node_defrag_ratio / 10);
81819f0fc8285a Christoph Lameter 2007-05-06 6437 }
81819f0fc8285a Christoph Lameter 2007-05-06 6438
9824601ead957a Christoph Lameter 2008-01-07 @6439 static ssize_t remote_node_defrag_ratio_store(struct kmem_cache *s,
81819f0fc8285a Christoph Lameter 2007-05-06 6440 const char *buf, size_t length)
81819f0fc8285a Christoph Lameter 2007-05-06 6441 {
eb7235eb842043 Alexey Dobriyan 2018-04-05 6442 unsigned int ratio;
0121c619d03820 Christoph Lameter 2008-04-29 6443 int err;
0121c619d03820 Christoph Lameter 2008-04-29 6444
eb7235eb842043 Alexey Dobriyan 2018-04-05 6445 err = kstrtouint(buf, 10, &ratio);
0121c619d03820 Christoph Lameter 2008-04-29 6446 if (err)
0121c619d03820 Christoph Lameter 2008-04-29 6447 return err;
eb7235eb842043 Alexey Dobriyan 2018-04-05 6448 if (ratio > 100)
eb7235eb842043 Alexey Dobriyan 2018-04-05 6449 return -ERANGE;
0121c619d03820 Christoph Lameter 2008-04-29 6450
0121c619d03820 Christoph Lameter 2008-04-29 6451 s->remote_node_defrag_ratio = ratio * 10;
81819f0fc8285a Christoph Lameter 2007-05-06 6452
81819f0fc8285a Christoph Lameter 2007-05-06 6453 return length;
81819f0fc8285a Christoph Lameter 2007-05-06 6454 }
9824601ead957a Christoph Lameter 2008-01-07 6455 SLAB_ATTR(remote_node_defrag_ratio);
81819f0fc8285a Christoph Lameter 2007-05-06 6456 #endif
81819f0fc8285a Christoph Lameter 2007-05-06 6457
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
Hi Max,
kernel test robot noticed the following build warnings:
[auto build test WARNING on next-20240131]
[cannot apply to mkp-scsi/for-next jejb-scsi/for-next axboe-block/for-next linus/master v6.8-rc2 v6.8-rc1 v6.7 v6.8-rc2]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Max-Kellermann/include-add-missing-includes/20240131-231042
base: next-20240131
patch link: https://lore.kernel.org/r/20240131145008.1345531-3-max.kellermann%40ionos.com
patch subject: [PATCH 02/28] include: remove unnecessary #include directives
config: m68k-allyesconfig (https://download.01.org/0day-ci/archive/20240203/[email protected]/config)
compiler: m68k-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240203/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All warnings (new ones prefixed by >>):
lib/kunit/string-stream-test.c: In function 'string_stream_variable_length_line_test':
lib/kunit/string-stream-test.c:230:26: error: storage size of 'rnd' isn't known
230 | struct rnd_state rnd;
| ^~~
lib/kunit/string-stream-test.c:243:9: error: implicit declaration of function 'prandom_seed_state' [-Werror=implicit-function-declaration]
243 | prandom_seed_state(&rnd, 3141592653589793238ULL);
| ^~~~~~~~~~~~~~~~~~
lib/kunit/string-stream-test.c:246:26: error: implicit declaration of function 'prandom_u32_state' [-Werror=implicit-function-declaration]
246 | offset = prandom_u32_state(&rnd) % (sizeof(line) - 1);
| ^~~~~~~~~~~~~~~~~
>> lib/kunit/string-stream-test.c:230:26: warning: unused variable 'rnd' [-Wunused-variable]
230 | struct rnd_state rnd;
| ^~~
cc1: some warnings being treated as errors
vim +/rnd +230 lib/kunit/string-stream-test.c
4551caca6ab67f Richard Fitzgerald 2023-08-28 222
4551caca6ab67f Richard Fitzgerald 2023-08-28 223 /* Add a series of lines of variable length to a string_stream. */
4551caca6ab67f Richard Fitzgerald 2023-08-28 224 static void string_stream_variable_length_line_test(struct kunit *test)
4551caca6ab67f Richard Fitzgerald 2023-08-28 225 {
4551caca6ab67f Richard Fitzgerald 2023-08-28 226 static const char line[] =
4551caca6ab67f Richard Fitzgerald 2023-08-28 227 "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
4551caca6ab67f Richard Fitzgerald 2023-08-28 228 " 0123456789!$%^&*()_-+={}[]:;@'~#<>,.?/|";
4551caca6ab67f Richard Fitzgerald 2023-08-28 229 struct string_stream *stream;
4551caca6ab67f Richard Fitzgerald 2023-08-28 @230 struct rnd_state rnd;
4551caca6ab67f Richard Fitzgerald 2023-08-28 231 char *concat_string, *pos, *string_end;
4551caca6ab67f Richard Fitzgerald 2023-08-28 232 size_t offset, total_len;
4551caca6ab67f Richard Fitzgerald 2023-08-28 233 int num_lines, i;
4551caca6ab67f Richard Fitzgerald 2023-08-28 234
20631e154c78f4 Richard Fitzgerald 2023-08-28 235 stream = kunit_alloc_string_stream(test, GFP_KERNEL);
4551caca6ab67f Richard Fitzgerald 2023-08-28 236 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, stream);
4551caca6ab67f Richard Fitzgerald 2023-08-28 237
4551caca6ab67f Richard Fitzgerald 2023-08-28 238 /*
4551caca6ab67f Richard Fitzgerald 2023-08-28 239 * Log many lines of varying lengths until we have created
4551caca6ab67f Richard Fitzgerald 2023-08-28 240 * many fragments.
4551caca6ab67f Richard Fitzgerald 2023-08-28 241 * The "randomness" must be repeatable.
4551caca6ab67f Richard Fitzgerald 2023-08-28 242 */
4551caca6ab67f Richard Fitzgerald 2023-08-28 243 prandom_seed_state(&rnd, 3141592653589793238ULL);
4551caca6ab67f Richard Fitzgerald 2023-08-28 244 total_len = 0;
4551caca6ab67f Richard Fitzgerald 2023-08-28 245 for (i = 0; i < 100; ++i) {
4551caca6ab67f Richard Fitzgerald 2023-08-28 246 offset = prandom_u32_state(&rnd) % (sizeof(line) - 1);
4551caca6ab67f Richard Fitzgerald 2023-08-28 247 string_stream_add(stream, "%s\n", &line[offset]);
4551caca6ab67f Richard Fitzgerald 2023-08-28 248 total_len += sizeof(line) - offset;
4551caca6ab67f Richard Fitzgerald 2023-08-28 249 }
4551caca6ab67f Richard Fitzgerald 2023-08-28 250 num_lines = i;
4551caca6ab67f Richard Fitzgerald 2023-08-28 251
4551caca6ab67f Richard Fitzgerald 2023-08-28 252 concat_string = get_concatenated_string(test, stream);
4551caca6ab67f Richard Fitzgerald 2023-08-28 253 KUNIT_EXPECT_NOT_ERR_OR_NULL(test, concat_string);
4551caca6ab67f Richard Fitzgerald 2023-08-28 254 KUNIT_EXPECT_EQ(test, strlen(concat_string), total_len);
4551caca6ab67f Richard Fitzgerald 2023-08-28 255
4551caca6ab67f Richard Fitzgerald 2023-08-28 256 /*
4551caca6ab67f Richard Fitzgerald 2023-08-28 257 * Split the concatenated string at the newlines and check that
4551caca6ab67f Richard Fitzgerald 2023-08-28 258 * all the original added strings are present.
4551caca6ab67f Richard Fitzgerald 2023-08-28 259 */
4551caca6ab67f Richard Fitzgerald 2023-08-28 260 prandom_seed_state(&rnd, 3141592653589793238ULL);
4551caca6ab67f Richard Fitzgerald 2023-08-28 261 pos = concat_string;
4551caca6ab67f Richard Fitzgerald 2023-08-28 262 for (i = 0; i < num_lines; ++i) {
4551caca6ab67f Richard Fitzgerald 2023-08-28 263 string_end = strchr(pos, '\n');
4551caca6ab67f Richard Fitzgerald 2023-08-28 264 KUNIT_EXPECT_NOT_NULL(test, string_end);
4551caca6ab67f Richard Fitzgerald 2023-08-28 265
4551caca6ab67f Richard Fitzgerald 2023-08-28 266 /* Convert to NULL-terminated string */
4551caca6ab67f Richard Fitzgerald 2023-08-28 267 *string_end = '\0';
4551caca6ab67f Richard Fitzgerald 2023-08-28 268
4551caca6ab67f Richard Fitzgerald 2023-08-28 269 offset = prandom_u32_state(&rnd) % (sizeof(line) - 1);
4551caca6ab67f Richard Fitzgerald 2023-08-28 270 KUNIT_EXPECT_STREQ(test, pos, &line[offset]);
4551caca6ab67f Richard Fitzgerald 2023-08-28 271
4551caca6ab67f Richard Fitzgerald 2023-08-28 272 pos = string_end + 1;
4551caca6ab67f Richard Fitzgerald 2023-08-28 273 }
4551caca6ab67f Richard Fitzgerald 2023-08-28 274
4551caca6ab67f Richard Fitzgerald 2023-08-28 275 /* There shouldn't be any more data after this */
4551caca6ab67f Richard Fitzgerald 2023-08-28 276 KUNIT_EXPECT_EQ(test, strlen(pos), 0);
4551caca6ab67f Richard Fitzgerald 2023-08-28 277 }
4551caca6ab67f Richard Fitzgerald 2023-08-28 278
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
Hi Max,
kernel test robot noticed the following build errors:
[auto build test ERROR on next-20240131]
[cannot apply to mkp-scsi/for-next jejb-scsi/for-next axboe-block/for-next linus/master v6.8-rc2 v6.8-rc1 v6.7 v6.8-rc2]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Max-Kellermann/include-add-missing-includes/20240131-231042
base: next-20240131
patch link: https://lore.kernel.org/r/20240131145008.1345531-11-max.kellermann%40ionos.com
patch subject: [PATCH 10/28] uprobes.h: move declarations to uprobes_types.h
config: csky-allnoconfig (https://download.01.org/0day-ci/archive/20240203/[email protected]/config)
compiler: csky-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240203/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All errors (new ones prefixed by >>):
arch/csky/kernel/signal.c: In function 'do_notify_resume':
>> arch/csky/kernel/signal.c:259:17: error: implicit declaration of function 'uprobe_notify_resume'; did you mean 'do_notify_resume'? [-Werror=implicit-function-declaration]
259 | uprobe_notify_resume(regs);
| ^~~~~~~~~~~~~~~~~~~~
| do_notify_resume
cc1: some warnings being treated as errors
vim +259 arch/csky/kernel/signal.c
e9564df753fd54 Guo Ren 2018-09-05 250
e9564df753fd54 Guo Ren 2018-09-05 251 /*
bf241682936293 Guo Ren 2019-04-01 252 * notification of userspace execution resumption
bf241682936293 Guo Ren 2019-04-01 253 * - triggered by the _TIF_WORK_MASK flags
e9564df753fd54 Guo Ren 2018-09-05 254 */
bf241682936293 Guo Ren 2019-04-01 255 asmlinkage void do_notify_resume(struct pt_regs *regs,
bf241682936293 Guo Ren 2019-04-01 256 unsigned long thread_info_flags)
e9564df753fd54 Guo Ren 2018-09-05 257 {
8f6bb793b2be82 Guo Ren 2020-04-02 258 if (thread_info_flags & _TIF_UPROBE)
8f6bb793b2be82 Guo Ren 2020-04-02 @259 uprobe_notify_resume(regs);
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki