From: Thierry Reding <treding@xxxxxxxxxx> Hi, Something that's been bugging me over the years is how some drivers have had to adopt file-scoped variables to pass data into something like the syscore operations. This is often harmless, but usually leads to drivers not being able to deal with multiple instances, or additional frameworks or data structures needing to be created to handle multiple instances. This series proposes to "objectify" struct syscore_ops by passing a pointer to struct syscore_ops to the syscore callbacks. Implementations of these callbacks can then make use of container_of() to get access to contextual data that struct syscore_ops was embedded in. This elegantly avoids the need for file-scoped, singleton variables, by tying syscore to individual instances. Patch 1 contains the bulk of these changes. It's fairly intrusive because it does the conversion of the function signature all in one patch. An alternative would've been to introduce new callbacks such that these changes could be staged in. However, the amount of changes here are not quite numerous enough to justify that, in my opinion, and syscore isn't very frequently used, so the risk of another user getting added while this is merged is rather small. All in all I think merging this in one go is the simplest way. Patches 2-7 are conversions of some existing drivers to take advantage of this new parameter and tie the code to per-instance data. Given that the recipient list for this is huge, I'm limiting this to Greg (because it's at the core a... core change) and a set of larger lists for architectures and subsystems that are impacted. Thanks, Thierry Thierry Reding (7): syscore: Pass context data to callbacks MIPS: Embed syscore_ops in PCI context bus: mvebu-mbus: Embed syscore_ops in mbus context clk: ingenic: tcu: Embed syscore_ops in TCU context clk: mvebu: Embed syscore_ops in clock context irqchip/irq-imx-gpcv2: Embed syscore_ops in chip context soc/tegra: pmc: Derive PMC context from syscore ops arch/arm/mach-exynos/mcpm-exynos.c | 4 +- arch/arm/mach-exynos/suspend.c | 14 +++--- arch/arm/mach-pxa/irq.c | 4 +- arch/arm/mach-pxa/mfp-pxa2xx.c | 4 +- arch/arm/mach-pxa/mfp-pxa3xx.c | 4 +- arch/arm/mach-pxa/smemc.c | 4 +- arch/arm/mach-s3c/irq-pm-s3c64xx.c | 4 +- arch/arm/mach-s5pv210/pm.c | 2 +- arch/arm/mach-versatile/integrator_ap.c | 4 +- arch/arm/mm/cache-b15-rac.c | 4 +- arch/loongarch/kernel/smp.c | 4 +- arch/mips/alchemy/common/dbdma.c | 4 +- arch/mips/alchemy/common/irq.c | 8 ++-- arch/mips/alchemy/common/usb.c | 4 +- arch/mips/pci/pci-alchemy.c | 28 ++++++------ arch/powerpc/platforms/cell/spu_base.c | 2 +- arch/powerpc/platforms/powermac/pic.c | 4 +- arch/powerpc/sysdev/fsl_lbc.c | 4 +- arch/powerpc/sysdev/fsl_pci.c | 4 +- arch/powerpc/sysdev/ipic.c | 4 +- arch/powerpc/sysdev/mpic.c | 4 +- arch/powerpc/sysdev/mpic_timer.c | 2 +- arch/sh/mm/pmb.c | 2 +- arch/x86/events/amd/ibs.c | 4 +- arch/x86/hyperv/hv_init.c | 4 +- arch/x86/kernel/amd_gart_64.c | 2 +- arch/x86/kernel/apic/apic.c | 4 +- arch/x86/kernel/apic/io_apic.c | 9 +++- arch/x86/kernel/cpu/aperfmperf.c | 6 +-- arch/x86/kernel/cpu/intel_epb.c | 8 ++-- arch/x86/kernel/cpu/mce/core.c | 6 +-- arch/x86/kernel/cpu/microcode/core.c | 7 ++- arch/x86/kernel/cpu/mtrr/legacy.c | 4 +- arch/x86/kernel/cpu/umwait.c | 2 +- arch/x86/kernel/i8237.c | 2 +- arch/x86/kernel/i8259.c | 6 +-- arch/x86/kernel/kvm.c | 4 +- drivers/acpi/pci_link.c | 2 +- drivers/acpi/sleep.c | 4 +- drivers/base/firmware_loader/main.c | 2 +- drivers/base/syscore.c | 8 ++-- drivers/bus/mvebu-mbus.c | 24 +++++----- drivers/clk/at91/pmc.c | 4 +- drivers/clk/imx/clk-vf610.c | 4 +- drivers/clk/ingenic/pm.c | 4 +- drivers/clk/ingenic/tcu.c | 54 +++++++++++------------ drivers/clk/mvebu/common.c | 25 +++++++---- drivers/clk/rockchip/clk-rk3288.c | 4 +- drivers/clk/samsung/clk-s5pv210-audss.c | 4 +- drivers/clk/samsung/clk.c | 4 +- drivers/clk/tegra/clk-tegra210.c | 4 +- drivers/clocksource/timer-armada-370-xp.c | 4 +- drivers/cpuidle/cpuidle-psci.c | 4 +- drivers/gpio/gpio-mxc.c | 4 +- drivers/gpio/gpio-pxa.c | 4 +- drivers/hv/vmbus_drv.c | 4 +- drivers/iommu/amd/init.c | 4 +- drivers/iommu/intel/iommu.c | 4 +- drivers/irqchip/exynos-combiner.c | 6 ++- drivers/irqchip/irq-armada-370-xp.c | 4 +- drivers/irqchip/irq-bcm7038-l1.c | 4 +- drivers/irqchip/irq-gic-v3-its.c | 4 +- drivers/irqchip/irq-i8259.c | 4 +- drivers/irqchip/irq-imx-gpcv2.c | 33 ++++++-------- drivers/irqchip/irq-loongson-eiointc.c | 4 +- drivers/irqchip/irq-loongson-htpic.c | 2 +- drivers/irqchip/irq-loongson-htvec.c | 4 +- drivers/irqchip/irq-loongson-pch-lpc.c | 4 +- drivers/irqchip/irq-loongson-pch-pic.c | 4 +- drivers/irqchip/irq-mchp-eic.c | 4 +- drivers/irqchip/irq-mst-intc.c | 4 +- drivers/irqchip/irq-mtk-cirq.c | 4 +- drivers/irqchip/irq-renesas-rzg2l.c | 4 +- drivers/irqchip/irq-sa11x0.c | 4 +- drivers/irqchip/irq-sifive-plic.c | 4 +- drivers/irqchip/irq-sun6i-r.c | 10 ++--- drivers/irqchip/irq-tegra.c | 4 +- drivers/irqchip/irq-vic.c | 4 +- drivers/leds/trigger/ledtrig-cpu.c | 6 +-- drivers/macintosh/via-pmu.c | 4 +- drivers/power/reset/sc27xx-poweroff.c | 2 +- drivers/sh/clk/core.c | 2 +- drivers/sh/intc/core.c | 4 +- drivers/soc/bcm/brcmstb/biuctrl.c | 4 +- drivers/soc/tegra/pmc.c | 7 ++- drivers/thermal/intel/intel_hfi.c | 4 +- drivers/xen/xen-acpi-processor.c | 2 +- include/linux/syscore_ops.h | 6 +-- kernel/cpu_pm.c | 4 +- kernel/irq/generic-chip.c | 6 +-- kernel/irq/pm.c | 2 +- kernel/printk/printk.c | 2 +- kernel/time/sched_clock.c | 14 +++++- kernel/time/timekeeping.c | 14 +++++- virt/kvm/kvm_main.c | 6 +-- 95 files changed, 302 insertions(+), 267 deletions(-) -- 2.48.1