linux-stable/drivers/clocksource
Daniel Lezcano 7eeb7189c4 clocksource/drivers/timer-of: Remove percpu irq related code
commit 471ef0b5a8 upstream.

GCC's named address space checks errors out with:

drivers/clocksource/timer-of.c: In function ‘timer_of_irq_exit’:
drivers/clocksource/timer-of.c:29:46: error: passing argument 2 of
‘free_percpu_irq’ from pointer to non-enclosed address space
  29 |                 free_percpu_irq(of_irq->irq, clkevt);
     |                                              ^~~~~~
In file included from drivers/clocksource/timer-of.c:8:
./include/linux/interrupt.h:201:43: note: expected ‘__seg_gs void *’
but argument is of type ‘struct clock_event_device *’
 201 | extern void free_percpu_irq(unsigned int, void __percpu *);
     |                                           ^~~~~~~~~~~~~~~
drivers/clocksource/timer-of.c: In function ‘timer_of_irq_init’:
drivers/clocksource/timer-of.c:74:51: error: passing argument 4 of
‘request_percpu_irq’ from pointer to non-enclosed address space
  74 |                                    np->full_name, clkevt) :
     |                                                   ^~~~~~
./include/linux/interrupt.h:190:56: note: expected ‘__seg_gs void *’
but argument is of type ‘struct clock_event_device *’
 190 |                    const char *devname, void __percpu *percpu_dev_id)

Sparse warns about:

timer-of.c:29:46: warning: incorrect type in argument 2 (different address spaces)
timer-of.c:29:46:    expected void [noderef] __percpu *
timer-of.c:29:46:    got struct clock_event_device *clkevt
timer-of.c:74:51: warning: incorrect type in argument 4 (different address spaces)
timer-of.c:74:51:    expected void [noderef] __percpu *percpu_dev_id
timer-of.c:74:51:    got struct clock_event_device *clkevt

It appears the code is incorrect as reported by Uros Bizjak:

"The referred code is questionable as it tries to reuse
the clkevent pointer once as percpu pointer and once as generic
pointer, which should be avoided."

This change removes the percpu related code as no drivers is using it.

[Daniel: Fixed the description]

Fixes: dc11bae785 ("clocksource/drivers: Add timer-of common init routine")
Reported-by: Uros Bizjak <ubizjak@gmail.com>
Tested-by: Uros Bizjak <ubizjak@gmail.com>
Link: https://lore.kernel.org/r/20240819100335.2394751-1-daniel.lezcano@linaro.org
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-09-12 11:11:42 +02:00
..
acpi_pm.c clocksource: Verify HPET and PMTMR when TSC unverified 2023-02-02 14:23:02 -08:00
arc_timer.c clocksource/drivers/arc_timer: Eliminate redefined macro error 2021-10-16 22:15:01 +02:00
arm_arch_timer.c clocksource/drivers/arm_arch_timer: limit XGene-1 workaround 2023-11-20 11:59:12 +01:00
arm_global_timer.c clocksource/drivers/arm_global_timer: Guard against division by zero 2024-08-29 17:33:35 +02:00
armv7m_systick.c
asm9260_timer.c
bcm2835_timer.c clocksource: Explicitly include correct DT includes 2023-08-28 13:30:57 -05:00
bcm_kona_timer.c clocksource/drivers/bcm_kona: Convert to SPDX identifier 2022-05-18 11:08:59 +02:00
clksrc-dbx500-prcmu.c timekeeping, clocksource: Fix various typos in comments 2021-03-22 23:06:48 +01:00
clksrc_st_lpc.c
clps711x-timer.c
dummy_timer.c
dw_apb_timer.c
dw_apb_timer_of.c clocksource/drivers/dw_apb_timer_of: Fix probe failure 2021-12-10 17:46:54 +01:00
em_sti.c clocksource: remove MODULE_LICENSE in non-modules 2023-04-13 13:13:51 -07:00
exynos_mct.c clocksource/drivers/exynos_mct: Explicitly return 0 for shared timer 2023-04-24 16:56:13 +02:00
hyperv_timer.c clocksource: hyper-v: Mark hyperv tsc page unencrypted in sev-snp enlightened guest 2023-08-22 00:38:20 +00:00
i8253.c
ingenic-ost.c clocksource/drivers/ingenic-ost: Define pm functions properly in platform_driver struct 2022-12-01 11:56:36 +01:00
ingenic-sysost.c clocksource/drivers/ingenic: Use bitfield macro helpers 2021-08-14 02:44:35 +02:00
ingenic-timer.c clocksource/drivers/ingenic-timer: Use pm_sleep_ptr() macro 2023-06-19 16:17:42 +02:00
jcore-pit.c clocksource/drivers/jcore: Convert to SPDX identifier 2022-05-18 11:08:59 +02:00
Kconfig clocksource/drivers/timer-oxnas-rps: Remove obsolete timer driver 2023-07-13 14:46:17 +02:00
Makefile clocksource/drivers/timer-oxnas-rps: Remove obsolete timer driver 2023-07-13 14:46:17 +02:00
mips-gic-timer.c clocksource/drivers/mips-gic-timer: Convert to SPDX identifier 2022-05-18 11:08:59 +02:00
mmio.c
mps2-timer.c
mxs_timer.c
nomadik-mtu.c clocksource: Explicitly include correct DT includes 2023-08-28 13:30:57 -05:00
numachip.c
renesas-ostm.c clocksource/drivers/renesas-ostm: Add support for RZ/V2L SoC 2022-09-07 10:12:56 +02:00
samsung_pwm_timer.c clocksource/drivers/samsung_pwm: Constify source IO memory 2021-06-04 10:12:13 +02:00
scx200_hrt.c
sh_cmt.c clocksource/drivers/sh_cmt: Address race condition for clock events 2024-08-14 13:58:41 +02:00
sh_mtu2.c Timekeeping and clocksource/event driver updates the second batch: 2023-04-29 10:24:30 -07:00
sh_tmu.c clocksource: remove MODULE_LICENSE in non-modules 2023-04-13 13:13:51 -07:00
timer-armada-370-xp.c clocksource/drivers/armada-370-xp: Convert to SPDX identifier 2022-05-18 11:08:59 +02:00
timer-atmel-pit.c
timer-atmel-st.c
timer-atmel-tcb.c clocksource/drivers/timer-atmel-tcb: Fix initialization on SAM9 hardware 2023-11-28 17:19:36 +00:00
timer-cadence-ttc.c clocksource: Explicitly include correct DT includes 2023-08-28 13:30:57 -05:00
timer-clint.c RISC-V: Allow marking IPIs as suitable for remote FENCEs 2023-04-08 11:26:24 +01:00
timer-cs5535.c
timer-davinci.c clocksource/drivers/davinci: Fix memory leak in davinci_timer_register when init fails 2023-04-24 16:56:13 +02:00
timer-digicolor.c clocksource/drivers/digicolor: Convert to SPDX identifier 2022-05-18 11:08:59 +02:00
timer-fsl-ftm.c timekeeping, clocksource: Fix various typos in comments 2021-03-22 23:06:48 +01:00
timer-fttmr010.c clocksource/drivers/fttmr010: Pass around less pointers 2021-08-14 10:49:49 +02:00
timer-goldfish.c clocksource/drivers: Add a goldfish-timer clocksource 2022-04-11 11:48:01 +02:00
timer-gx6605s.c
timer-gxp.c clocksource: Explicitly include correct DT includes 2023-08-28 13:30:57 -05:00
timer-imx-gpt.c clocksource/drivers/timer-imx-gpt: Fix potential memory leak 2023-11-28 17:19:36 +00:00
timer-imx-sysctr.c clocksource/drivers/imx-sysctr: handle nxp,no-divider property 2022-09-20 10:49:46 +02:00
timer-imx-tpm.c clocksource/drivers/imx-tpm: Fix next event not taking effect sometime 2024-09-12 11:11:41 +02:00
timer-integrator-ap.c clocksource: Explicitly include correct DT includes 2023-08-28 13:30:57 -05:00
timer-ixp4xx.c clocksource/drivers/ixp4xx: Drop boardfile probe path 2022-05-18 11:08:52 +02:00
timer-keystone.c
timer-loongson1-pwm.c clocksource/drivers/loongson1: Set variable ls1x_timer_lock storage-class-specifier to static 2023-08-18 12:13:03 +02:00
timer-lpc32xx.c clocksource/drivers/lpc32xx: Convert to SPDX identifier 2022-05-18 11:08:59 +02:00
timer-mediatek-cpux.c clocksource/drivers/timer-mediatek: Split out CPUXGPT timers 2023-04-24 16:56:13 +02:00
timer-mediatek.c clocksource/drivers/timer-mediatek: Split out CPUXGPT timers 2023-04-24 16:56:13 +02:00
timer-meson6.c
timer-microchip-pit64b.c clocksource/drivers/timer-microchip-pit64b: Add delay timer 2023-02-13 13:10:17 +01:00
timer-milbeaut.c
timer-mp-csky.c
timer-msc313e.c clocksource/drivers/msc313e: Add support for ssd20xd-based platforms 2021-12-20 13:28:39 +01:00
timer-npcm7xx.c clocksource/drivers/timer-npcm7xx: Enable timer 1 clock before use 2022-12-02 12:48:28 +01:00
timer-of.c clocksource/drivers/timer-of: Remove percpu irq related code 2024-09-12 11:11:42 +02:00
timer-of.h clocksource/drivers/timer-of: Remove percpu irq related code 2024-09-12 11:11:42 +02:00
timer-orion.c clocksource/drivers/orion: Convert to SPDX identifier 2022-05-18 11:08:59 +02:00
timer-owl.c
timer-pistachio.c clocksource/drivers/pistachio: Convert to SPDX identifier 2022-05-18 11:08:59 +02:00
timer-probe.c
timer-pxa.c
timer-qcom.c
timer-rda.c
timer-riscv.c clocksource/timer-riscv: Add ACPI support 2023-06-01 08:45:12 -07:00
timer-rockchip.c
timer-sp.h
timer-sp804.c clocksource/drivers/sp804: Do not use timer namespace for timer_shutdown() function 2022-11-24 15:09:10 +01:00
timer-sprd.c
timer-stm32-lp.c Timekeeping and clocksource/event driver updates the second batch: 2023-04-29 10:24:30 -07:00
timer-stm32.c
timer-sun4i.c clocksource/drivers/timer-sun4i: Add CLOCK_EVT_FEAT_DYNIRQ 2023-02-13 13:10:17 +01:00
timer-sun5i.c clocksource/drivers/sun5i: Convert to platform device driver 2023-08-18 12:15:22 +02:00
timer-tegra.c
timer-tegra186.c clocksource: Explicitly include correct DT includes 2023-08-28 13:30:57 -05:00
timer-ti-32k.c
timer-ti-dm-systimer.c clocksource/drivers/ti: Use of_property_read_bool() for boolean properties 2023-04-24 16:56:14 +02:00
timer-ti-dm.c clocksource/drivers/timer-ti-dm: Fix make W=n kerneldoc warnings 2024-01-25 15:35:42 -08:00
timer-versatile.c
timer-vf-pit.c timekeeping, clocksource: Fix various typos in comments 2021-03-22 23:06:48 +01:00
timer-vt8500.c
timer-zevio.c