Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'timers-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull timer fixes from Thomas Gleixner:
"A small set of fixes for timekeepoing and clocksource drivers:

- VDSO data was updated conditional on the availability of a VDSO
capable clocksource. This causes the VDSO functions which do not
depend on a VDSO capable clocksource to operate on stale data.
Always update unconditionally.

- Prevent a double free in the mediatek driver

- Use the proper helper in the sh_mtu2 driver so it won't attempt to
initialize non-existing interrupts"

* 'timers-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
timekeeping/vsyscall: Update VDSO data unconditionally
clocksource/drivers/sh_mtu2: Do not loop using platform_get_irq_by_name()
clocksource/drivers/mediatek: Fix error handling

+16 -40
-7
arch/arm64/include/asm/vdso/vsyscall.h
··· 31 31 #define __arch_get_clock_mode __arm64_get_clock_mode 32 32 33 33 static __always_inline 34 - int __arm64_use_vsyscall(struct vdso_data *vdata) 35 - { 36 - return !vdata[CS_HRES_COARSE].clock_mode; 37 - } 38 - #define __arch_use_vsyscall __arm64_use_vsyscall 39 - 40 - static __always_inline 41 34 void __arm64_update_vsyscall(struct vdso_data *vdata, struct timekeeper *tk) 42 35 { 43 36 vdata[CS_HRES_COARSE].mask = VDSO_PRECISION_MASK;
-7
arch/mips/include/asm/vdso/vsyscall.h
··· 28 28 } 29 29 #define __arch_get_clock_mode __mips_get_clock_mode 30 30 31 - static __always_inline 32 - int __mips_use_vsyscall(struct vdso_data *vdata) 33 - { 34 - return (vdata[CS_HRES_COARSE].clock_mode != VDSO_CLOCK_NONE); 35 - } 36 - #define __arch_use_vsyscall __mips_use_vsyscall 37 - 38 31 /* The asm-generic header needs to be included after the definitions above */ 39 32 #include <asm-generic/vdso/vsyscall.h> 40 33
+11 -5
drivers/clocksource/sh_mtu2.c
··· 328 328 return 0; 329 329 } 330 330 331 + static const unsigned int sh_mtu2_channel_offsets[] = { 332 + 0x300, 0x380, 0x000, 333 + }; 334 + 331 335 static int sh_mtu2_setup_channel(struct sh_mtu2_channel *ch, unsigned int index, 332 336 struct sh_mtu2_device *mtu) 333 337 { 334 - static const unsigned int channel_offsets[] = { 335 - 0x300, 0x380, 0x000, 336 - }; 337 338 char name[6]; 338 339 int irq; 339 340 int ret; ··· 357 356 return ret; 358 357 } 359 358 360 - ch->base = mtu->mapbase + channel_offsets[index]; 359 + ch->base = mtu->mapbase + sh_mtu2_channel_offsets[index]; 361 360 ch->index = index; 362 361 363 362 return sh_mtu2_register(ch, dev_name(&mtu->pdev->dev)); ··· 409 408 } 410 409 411 410 /* Allocate and setup the channels. */ 412 - mtu->num_channels = 3; 411 + ret = platform_irq_count(pdev); 412 + if (ret < 0) 413 + goto err_unmap; 414 + 415 + mtu->num_channels = min_t(unsigned int, ret, 416 + ARRAY_SIZE(sh_mtu2_channel_offsets)); 413 417 414 418 mtu->channels = kcalloc(mtu->num_channels, sizeof(*mtu->channels), 415 419 GFP_KERNEL);
+2 -8
drivers/clocksource/timer-mediatek.c
··· 268 268 269 269 ret = timer_of_init(node, &to); 270 270 if (ret) 271 - goto err; 271 + return ret; 272 272 273 273 clockevents_config_and_register(&to.clkevt, timer_of_rate(&to), 274 274 TIMER_SYNC_TICKS, 0xffffffff); 275 275 276 276 return 0; 277 - err: 278 - timer_of_cleanup(&to); 279 - return ret; 280 277 } 281 278 282 279 static int __init mtk_gpt_init(struct device_node *node) ··· 290 293 291 294 ret = timer_of_init(node, &to); 292 295 if (ret) 293 - goto err; 296 + return ret; 294 297 295 298 /* Configure clock source */ 296 299 mtk_gpt_setup(&to, TIMER_CLK_SRC, GPT_CTRL_OP_FREERUN); ··· 308 311 mtk_gpt_enable_irq(&to, TIMER_CLK_EVT); 309 312 310 313 return 0; 311 - err: 312 - timer_of_cleanup(&to); 313 - return ret; 314 314 } 315 315 TIMER_OF_DECLARE(mtk_mt6577, "mediatek,mt6577-timer", mtk_gpt_init); 316 316 TIMER_OF_DECLARE(mtk_mt6765, "mediatek,mt6765-timer", mtk_syst_init);
-7
include/asm-generic/vdso/vsyscall.h
··· 25 25 } 26 26 #endif /* __arch_get_clock_mode */ 27 27 28 - #ifndef __arch_use_vsyscall 29 - static __always_inline int __arch_use_vsyscall(struct vdso_data *vdata) 30 - { 31 - return 1; 32 - } 33 - #endif /* __arch_use_vsyscall */ 34 - 35 28 #ifndef __arch_update_vsyscall 36 29 static __always_inline void __arch_update_vsyscall(struct vdso_data *vdata, 37 30 struct timekeeper *tk)
+3 -6
kernel/time/vsyscall.c
··· 110 110 nsec = nsec + tk->wall_to_monotonic.tv_nsec; 111 111 vdso_ts->sec += __iter_div_u64_rem(nsec, NSEC_PER_SEC, &vdso_ts->nsec); 112 112 113 - if (__arch_use_vsyscall(vdata)) 114 - update_vdso_data(vdata, tk); 113 + update_vdso_data(vdata, tk); 115 114 116 115 __arch_update_vsyscall(vdata, tk); 117 116 ··· 123 124 { 124 125 struct vdso_data *vdata = __arch_get_k_vdso_data(); 125 126 126 - if (__arch_use_vsyscall(vdata)) { 127 - vdata[CS_HRES_COARSE].tz_minuteswest = sys_tz.tz_minuteswest; 128 - vdata[CS_HRES_COARSE].tz_dsttime = sys_tz.tz_dsttime; 129 - } 127 + vdata[CS_HRES_COARSE].tz_minuteswest = sys_tz.tz_minuteswest; 128 + vdata[CS_HRES_COARSE].tz_dsttime = sys_tz.tz_dsttime; 130 129 131 130 __arch_sync_vdso_data(vdata); 132 131 }