WSL2-Linux-Kernel/drivers
Nicolai Stange c3c0a20df9 clocksource: sh_tmu: Compute rate before registration again
With the upcoming NTP correction related rate adjustments to be implemented
in the clockevents core, the latter needs to get informed about every rate
change of a clockevent device made after its registration.

Currently, sh_tmu violates this requirement in that it registers its
clockevent device with a dummy rate and sets its final rate through
clockevents_config() called from its ->set_state_oneshot() and
->set_state_periodic() functions respectively.

This patch moves the setting of the clockevent device's rate to its
registration.

Note that there has been some back and forth regarding this question with
respect to the clocksource also provided by this driver:
  commit 66f49121ff ("clocksource: sh_tmu: compute mult and shift before
                        registration")
moves the rate determination from the clocksource's ->enable() function to
before its registration. OTOH, the later
  commit 0aeac458d9 ("clocksource: sh_tmu: __clocksource_updatefreq_hz()
                        update")
basically reverts this, saying
  "Without this patch the old code uses clocksource_register() together
   with a hack that assumes a never changing clock rate."

However, I checked all current sh_tmu users in arch/sh as well as in
arch/arm/mach-shmobile carefully and right now, none of them changes any
rate in any clock tree relevant to sh_tmu after their respective
time_init(). Since all sh_tmu instances are created after time_init(), none
of them should ever observe any clock rate changes.

What's more, both, a clocksource as well as a clockevent device, can
immediately get selected for use at their registration and thus, enabled
at this point already. So it's probably safer to assume a "never changing
clock rate" here.

- Move the struct sh_tmu_channel's ->rate member to struct sh_tmu_device:
  it's a property of the underlying clock which is in turn specific to
  the sh_tmu_device.
- Determine the ->rate value in sh_tmu_setup() at device probing rather
  than at first usage.
- Set the clockevent device's rate at its registration.
- Although not strictly necessary for the upcoming clockevent core changes,
  set the clocksource's rate at its registration for consistency.

Signed-off-by: Nicolai Stange <nicstange@gmail.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
2017-03-23 12:14:01 -07:00
..
accessibility
acpi acpi/processor: Check for duplicate processor ids at hotplug time 2017-03-11 14:41:20 +01:00
amba
android
ata ahci: qoriq: correct the sata ecc setting error 2017-03-09 11:55:23 -05:00
atm
auxdisplay
base drivers core: remove assert_held_device_hotplug() 2017-03-16 16:56:19 -07:00
bcma
block A fix for the recently discovered misdirected requests bug present in 2017-03-10 11:05:47 -08:00
bluetooth
bus
cdrom
char Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6 2017-03-15 09:26:04 -07:00
clk ARM: SoC: late DT updates for v4.11 2017-03-03 16:15:48 -08:00
clocksource clocksource: sh_tmu: Compute rate before registration again 2017-03-23 12:14:01 -07:00
connector
cpufreq Merge branches 'pm-cpufreq-fixes' and 'intel_pstate-fixes' 2017-03-18 00:45:09 +01:00
cpuidle Merge branch 'WIP.sched-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2017-03-03 10:16:38 -08:00
crypto Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6 2017-03-15 09:26:04 -07:00
dax device-dax: fix debug output typo 2017-03-10 19:56:56 -08:00
dca
devfreq
dio
dma
dma-buf
edac
eisa
extcon
firewire
firmware Merge branch 'efi-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2017-03-07 14:25:48 -08:00
fmc
fpga
fsi
gpio
gpu Merge branch 'drm-fixes-4.11' of git://people.freedesktop.org/~agd5f/linux into drm-fixes 2017-03-16 11:28:44 +10:00
hid
hsi
hv scripts/spelling.txt: add "disble(d)" pattern and fix typo instances 2017-03-09 17:01:09 -08:00
hwmon
hwspinlock
hwtracing
i2c Revert "i2c: copy device properties when using i2c_register_board_info()" 2017-03-09 16:41:48 +01:00
ide
idle Power management turbostat utility updates for v4.11-rc1 2017-03-02 17:41:27 -08:00
iio Staging/IIO driver fixes for 4.11-rc1 2017-03-04 11:26:18 -08:00
infiniband
input
iommu
ipack
irqchip irqchip/irqdomain updates for 4.11-rc2 2017-03-09 12:06:41 +01:00
isdn Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2017-03-14 21:31:23 -07:00
leds
lguest
lightnvm
macintosh powerpc/pmac: Fix crash in dma-mapping.h with NULL dma_ops 2017-03-10 14:17:23 +11:00
mailbox
mcb
md Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/shli/md 2017-03-16 11:43:48 -07:00
media Merge branch 'akpm' (patches from Andrew) 2017-03-10 08:34:42 -08:00
memory
memstick
message
mfd
misc mm: convert generic code to 5-level paging 2017-03-09 11:48:47 -08:00
mmc
mtd scripts/spelling.txt: add "disble(d)" pattern and fix typo instances 2017-03-09 17:01:09 -08:00
net Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2017-03-14 21:31:23 -07:00
nfc
ntb
nubus
nvdimm
nvme Merge branch 'for-linus' of git://git.kernel.dk/linux-block 2017-03-03 10:53:35 -08:00
nvmem
of
oprofile
parisc Merge branch 'parisc-4.11-1' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux 2017-03-03 16:20:06 -08:00
parport
pci PCI/ASPM: Always set link->downstream to avoid NULL dereference on remove 2017-03-07 14:23:30 -06:00
pcmcia
perf
phy
pinctrl pinctrl: uniphier: change pin names of aio/xirq for LD11 2017-03-06 14:38:05 +01:00
platform platform-drivers-x86 for v4.11-2 2017-03-13 13:23:43 -07:00
pnp
power
powercap
pps
ps3
ptp
pwm
rapidio
ras
regulator
remoteproc virtio, vhost: optimizations, fixes 2017-03-02 13:53:13 -08:00
reset
rpmsg virtio, vhost: optimizations, fixes 2017-03-02 13:53:13 -08:00
rtc
s390 Merge branch 'WIP.sched-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2017-03-03 10:16:38 -08:00
sbus
scsi Merge git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending 2017-03-19 18:06:31 -07:00
sfi
sh
sn
soc
spi
spmi
ssb
staging Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2017-03-14 21:31:23 -07:00
target tcmu: Convert cmd_time_out into backend device attribute 2017-03-18 16:32:30 -07:00
tc
thermal
thunderbolt
tty serial: samsung: Continue to work if DMA request fails 2017-03-07 19:58:37 +01:00
uio
usb USB fixes for 4.11-rc2 2017-03-11 00:08:39 -08:00
uwb
vfio
vhost Merge branch 'WIP.sched-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2017-03-03 10:16:38 -08:00
video sched/headers: Remove the <linux/mm_types.h> dependency from <linux/sched.h> 2017-03-03 01:45:16 +01:00
virt
virtio Merge branch 'WIP.sched-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2017-03-03 10:16:38 -08:00
vlynq
vme
w1
watchdog
xen drivers, xen: convert grant_map.users from atomic_t to refcount_t 2017-03-13 12:45:18 -04:00
zorro
Kconfig
Makefile