aboutsummaryrefslogtreecommitdiff
path: root/drivers/clocksource
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/clocksource')
-rw-r--r--drivers/clocksource/Kconfig2
-rw-r--r--drivers/clocksource/acpi_pm.c4
-rw-r--r--drivers/clocksource/bcm2835_timer.c2
-rw-r--r--drivers/clocksource/clps711x-timer.c2
-rw-r--r--drivers/clocksource/dw_apb_timer.c5
-rw-r--r--drivers/clocksource/hyperv_timer.c2
-rw-r--r--drivers/clocksource/ingenic-sysost.c8
-rw-r--r--drivers/clocksource/ingenic-timer.c3
-rw-r--r--drivers/clocksource/mips-gic-timer.c10
-rw-r--r--drivers/clocksource/mmio.c2
-rw-r--r--drivers/clocksource/mps2-timer.c2
-rw-r--r--drivers/clocksource/renesas-ostm.c2
-rw-r--r--drivers/clocksource/sh_cmt.c5
-rw-r--r--drivers/clocksource/sh_mtu2.c5
-rw-r--r--drivers/clocksource/sh_tmu.c23
-rw-r--r--drivers/clocksource/timer-armada-370-xp.c2
-rw-r--r--drivers/clocksource/timer-atmel-pit.c2
-rw-r--r--drivers/clocksource/timer-cadence-ttc.c4
-rw-r--r--drivers/clocksource/timer-davinci.c2
-rw-r--r--drivers/clocksource/timer-ep93xx.c2
-rw-r--r--drivers/clocksource/timer-fsl-ftm.c2
-rw-r--r--drivers/clocksource/timer-fttmr010.c2
-rw-r--r--drivers/clocksource/timer-goldfish.c2
-rw-r--r--drivers/clocksource/timer-gxp.c2
-rw-r--r--drivers/clocksource/timer-imx-gpt.c2
-rw-r--r--drivers/clocksource/timer-imx-sysctr.c2
-rw-r--r--drivers/clocksource/timer-ixp4xx.c2
-rw-r--r--drivers/clocksource/timer-microchip-pit64b.c4
-rw-r--r--drivers/clocksource/timer-msc313e.c2
-rw-r--r--drivers/clocksource/timer-nxp-pit.c2
-rw-r--r--drivers/clocksource/timer-riscv.c3
-rw-r--r--drivers/clocksource/timer-rockchip.c4
-rw-r--r--drivers/clocksource/timer-sp804.c14
-rw-r--r--drivers/clocksource/timer-stm32.c5
-rw-r--r--drivers/clocksource/timer-ti-dm-systimer.c4
-rw-r--r--drivers/clocksource/timer-zevio.c2
36 files changed, 59 insertions, 84 deletions
diff --git a/drivers/clocksource/Kconfig b/drivers/clocksource/Kconfig
index aa59e5b13351..d1a33a231a44 100644
--- a/drivers/clocksource/Kconfig
+++ b/drivers/clocksource/Kconfig
@@ -254,6 +254,7 @@ config KEYSTONE_TIMER
config INTEGRATOR_AP_TIMER
bool "Integrator-AP timer driver" if COMPILE_TEST
+ depends on OF
select CLKSRC_MMIO
help
Enables support for the Integrator-AP timer.
@@ -595,7 +596,6 @@ config CLKSRC_VERSATILE
config CLKSRC_MIPS_GIC
bool
depends on MIPS_GIC
- select CLOCKSOURCE_WATCHDOG
select TIMER_OF
config CLKSRC_PXA
diff --git a/drivers/clocksource/acpi_pm.c b/drivers/clocksource/acpi_pm.c
index b4330a01a566..67792937242f 100644
--- a/drivers/clocksource/acpi_pm.c
+++ b/drivers/clocksource/acpi_pm.c
@@ -98,7 +98,7 @@ static struct clocksource clocksource_acpi_pm = {
.rating = 200,
.read = acpi_pm_read,
.mask = (u64)ACPI_PM_MASK,
- .flags = CLOCK_SOURCE_IS_CONTINUOUS,
+ .flags = CLOCK_SOURCE_IS_CONTINUOUS | CLOCK_SOURCE_CALIBRATED,
.suspend = acpi_pm_suspend,
.resume = acpi_pm_resume,
};
@@ -243,8 +243,6 @@ static int __init init_acpi_pm_clocksource(void)
return -ENODEV;
}
- if (tsc_clocksource_watchdog_disabled())
- clocksource_acpi_pm.flags |= CLOCK_SOURCE_MUST_VERIFY;
return clocksource_register_hz(&clocksource_acpi_pm, PMTMR_TICKS_PER_SEC);
}
diff --git a/drivers/clocksource/bcm2835_timer.c b/drivers/clocksource/bcm2835_timer.c
index 319c0c780a15..d7662301bf0e 100644
--- a/drivers/clocksource/bcm2835_timer.c
+++ b/drivers/clocksource/bcm2835_timer.c
@@ -98,7 +98,7 @@ static int __init bcm2835_timer_init(struct device_node *node)
goto err_iounmap;
}
- timer = kzalloc(sizeof(*timer), GFP_KERNEL);
+ timer = kzalloc_obj(*timer);
if (!timer) {
ret = -ENOMEM;
goto err_iounmap;
diff --git a/drivers/clocksource/clps711x-timer.c b/drivers/clocksource/clps711x-timer.c
index bbceb0289d45..bb0a44adaf28 100644
--- a/drivers/clocksource/clps711x-timer.c
+++ b/drivers/clocksource/clps711x-timer.c
@@ -54,7 +54,7 @@ static int __init _clps711x_clkevt_init(struct clk *clock, void __iomem *base,
struct clock_event_device *clkevt;
unsigned long rate;
- clkevt = kzalloc(sizeof(*clkevt), GFP_KERNEL);
+ clkevt = kzalloc_obj(*clkevt);
if (!clkevt)
return -ENOMEM;
diff --git a/drivers/clocksource/dw_apb_timer.c b/drivers/clocksource/dw_apb_timer.c
index 3a55ae5fe225..501980303ddf 100644
--- a/drivers/clocksource/dw_apb_timer.c
+++ b/drivers/clocksource/dw_apb_timer.c
@@ -222,8 +222,7 @@ struct dw_apb_clock_event_device *
dw_apb_clockevent_init(int cpu, const char *name, unsigned rating,
void __iomem *base, int irq, unsigned long freq)
{
- struct dw_apb_clock_event_device *dw_ced =
- kzalloc(sizeof(*dw_ced), GFP_KERNEL);
+ struct dw_apb_clock_event_device *dw_ced = kzalloc_obj(*dw_ced);
int err;
if (!dw_ced)
@@ -340,7 +339,7 @@ struct dw_apb_clocksource *
dw_apb_clocksource_init(unsigned rating, const char *name, void __iomem *base,
unsigned long freq)
{
- struct dw_apb_clocksource *dw_cs = kzalloc(sizeof(*dw_cs), GFP_KERNEL);
+ struct dw_apb_clocksource *dw_cs = kzalloc_obj(*dw_cs);
if (!dw_cs)
return NULL;
diff --git a/drivers/clocksource/hyperv_timer.c b/drivers/clocksource/hyperv_timer.c
index 10356d4ec55c..e9f5034a1bc8 100644
--- a/drivers/clocksource/hyperv_timer.c
+++ b/drivers/clocksource/hyperv_timer.c
@@ -535,6 +535,8 @@ static __always_inline void hv_setup_sched_clock(void *sched_clock)
sched_clock_register(sched_clock, 64, NSEC_PER_SEC);
}
#elif defined CONFIG_PARAVIRT
+#include <asm/timer.h>
+
static __always_inline void hv_setup_sched_clock(void *sched_clock)
{
/* We're on x86/x64 *and* using PV ops */
diff --git a/drivers/clocksource/ingenic-sysost.c b/drivers/clocksource/ingenic-sysost.c
index e79cfb0b8e05..026615bbe921 100644
--- a/drivers/clocksource/ingenic-sysost.c
+++ b/drivers/clocksource/ingenic-sysost.c
@@ -279,7 +279,7 @@ static int __init ingenic_ost_register_clock(struct ingenic_ost *ost,
struct ingenic_ost_clk *ost_clk;
int val, err;
- ost_clk = kzalloc(sizeof(*ost_clk), GFP_KERNEL);
+ ost_clk = kzalloc_obj(*ost_clk);
if (!ost_clk)
return -ENOMEM;
@@ -432,7 +432,7 @@ static int __init ingenic_ost_probe(struct device_node *np)
unsigned int i;
int ret;
- ost = kzalloc(sizeof(*ost), GFP_KERNEL);
+ ost = kzalloc_obj(*ost);
if (!ost)
return -ENOMEM;
@@ -458,8 +458,8 @@ static int __init ingenic_ost_probe(struct device_node *np)
ost->soc_info = id->data;
- ost->clocks = kzalloc(struct_size(ost->clocks, hws, ost->soc_info->num_channels),
- GFP_KERNEL);
+ ost->clocks = kzalloc_flex(*ost->clocks, hws,
+ ost->soc_info->num_channels);
if (!ost->clocks) {
ret = -ENOMEM;
goto err_clk_disable;
diff --git a/drivers/clocksource/ingenic-timer.c b/drivers/clocksource/ingenic-timer.c
index 154ee5f7954a..54bb56005dfd 100644
--- a/drivers/clocksource/ingenic-timer.c
+++ b/drivers/clocksource/ingenic-timer.c
@@ -286,8 +286,7 @@ static int __init ingenic_tcu_init(struct device_node *np)
if (IS_ERR(map))
return PTR_ERR(map);
- tcu = kzalloc(struct_size(tcu, timers, num_possible_cpus()),
- GFP_KERNEL);
+ tcu = kzalloc_flex(*tcu, timers, num_possible_cpus());
if (!tcu)
return -ENOMEM;
diff --git a/drivers/clocksource/mips-gic-timer.c b/drivers/clocksource/mips-gic-timer.c
index abb685a080a5..1501c7db9a8e 100644
--- a/drivers/clocksource/mips-gic-timer.c
+++ b/drivers/clocksource/mips-gic-timer.c
@@ -77,13 +77,6 @@ static irqreturn_t gic_compare_interrupt(int irq, void *dev_id)
return IRQ_HANDLED;
}
-static struct irqaction gic_compare_irqaction = {
- .handler = gic_compare_interrupt,
- .percpu_dev_id = &gic_clockevent_device,
- .flags = IRQF_PERCPU | IRQF_TIMER,
- .name = "timer",
-};
-
static void gic_clockevent_cpu_init(unsigned int cpu,
struct clock_event_device *cd)
{
@@ -152,7 +145,8 @@ static int gic_clockevent_init(void)
if (!gic_frequency)
return -ENXIO;
- ret = setup_percpu_irq(gic_timer_irq, &gic_compare_irqaction);
+ ret = request_percpu_irq(gic_timer_irq, gic_compare_interrupt,
+ "timer", &gic_clockevent_device);
if (ret < 0) {
pr_err("IRQ %d setup failed (%d)\n", gic_timer_irq, ret);
return ret;
diff --git a/drivers/clocksource/mmio.c b/drivers/clocksource/mmio.c
index 9de751531831..cd5fbf49ac29 100644
--- a/drivers/clocksource/mmio.c
+++ b/drivers/clocksource/mmio.c
@@ -55,7 +55,7 @@ int __init clocksource_mmio_init(void __iomem *base, const char *name,
if (bits > 64 || bits < 16)
return -EINVAL;
- cs = kzalloc(sizeof(struct clocksource_mmio), GFP_KERNEL);
+ cs = kzalloc_obj(struct clocksource_mmio);
if (!cs)
return -ENOMEM;
diff --git a/drivers/clocksource/mps2-timer.c b/drivers/clocksource/mps2-timer.c
index efe8cad8f2a5..ebca55d8cfed 100644
--- a/drivers/clocksource/mps2-timer.c
+++ b/drivers/clocksource/mps2-timer.c
@@ -136,7 +136,7 @@ static int __init mps2_clockevent_init(struct device_node *np)
goto out_iounmap;
}
- ce = kzalloc(sizeof(*ce), GFP_KERNEL);
+ ce = kzalloc_obj(*ce);
if (!ce) {
ret = -ENOMEM;
goto out_iounmap;
diff --git a/drivers/clocksource/renesas-ostm.c b/drivers/clocksource/renesas-ostm.c
index 2089aeaae225..9404ccb1bda9 100644
--- a/drivers/clocksource/renesas-ostm.c
+++ b/drivers/clocksource/renesas-ostm.c
@@ -165,7 +165,7 @@ static int __init ostm_init(struct device_node *np)
struct timer_of *to;
int ret;
- to = kzalloc(sizeof(*to), GFP_KERNEL);
+ to = kzalloc_obj(*to);
if (!to)
return -ENOMEM;
diff --git a/drivers/clocksource/sh_cmt.c b/drivers/clocksource/sh_cmt.c
index 791b298c995b..cf057f531a58 100644
--- a/drivers/clocksource/sh_cmt.c
+++ b/drivers/clocksource/sh_cmt.c
@@ -1084,8 +1084,7 @@ static int sh_cmt_setup(struct sh_cmt_device *cmt, struct platform_device *pdev)
/* Allocate and setup the channels. */
cmt->num_channels = hweight8(cmt->hw_channels);
- cmt->channels = kcalloc(cmt->num_channels, sizeof(*cmt->channels),
- GFP_KERNEL);
+ cmt->channels = kzalloc_objs(*cmt->channels, cmt->num_channels);
if (cmt->channels == NULL) {
ret = -ENOMEM;
goto err_unmap;
@@ -1139,7 +1138,7 @@ static int sh_cmt_probe(struct platform_device *pdev)
goto out;
}
- cmt = kzalloc(sizeof(*cmt), GFP_KERNEL);
+ cmt = kzalloc_obj(*cmt);
if (cmt == NULL)
return -ENOMEM;
diff --git a/drivers/clocksource/sh_mtu2.c b/drivers/clocksource/sh_mtu2.c
index 34872df5458a..1997639b113e 100644
--- a/drivers/clocksource/sh_mtu2.c
+++ b/drivers/clocksource/sh_mtu2.c
@@ -420,8 +420,7 @@ static int sh_mtu2_setup(struct sh_mtu2_device *mtu,
mtu->num_channels = min_t(unsigned int, ret,
ARRAY_SIZE(sh_mtu2_channel_offsets));
- mtu->channels = kcalloc(mtu->num_channels, sizeof(*mtu->channels),
- GFP_KERNEL);
+ mtu->channels = kzalloc_objs(*mtu->channels, mtu->num_channels);
if (mtu->channels == NULL) {
ret = -ENOMEM;
goto err_unmap;
@@ -462,7 +461,7 @@ static int sh_mtu2_probe(struct platform_device *pdev)
goto out;
}
- mtu = kzalloc(sizeof(*mtu), GFP_KERNEL);
+ mtu = kzalloc_obj(*mtu);
if (mtu == NULL)
return -ENOMEM;
diff --git a/drivers/clocksource/sh_tmu.c b/drivers/clocksource/sh_tmu.c
index beffff81c00f..8d6a9e279f73 100644
--- a/drivers/clocksource/sh_tmu.c
+++ b/drivers/clocksource/sh_tmu.c
@@ -143,16 +143,6 @@ static void sh_tmu_start_stop_ch(struct sh_tmu_channel *ch, int start)
static int __sh_tmu_enable(struct sh_tmu_channel *ch)
{
- int ret;
-
- /* enable clock */
- ret = clk_enable(ch->tmu->clk);
- if (ret) {
- dev_err(&ch->tmu->pdev->dev, "ch%u: cannot enable clock\n",
- ch->index);
- return ret;
- }
-
/* make sure channel is disabled */
sh_tmu_start_stop_ch(ch, 0);
@@ -174,7 +164,6 @@ static int sh_tmu_enable(struct sh_tmu_channel *ch)
if (ch->enable_count++ > 0)
return 0;
- pm_runtime_get_sync(&ch->tmu->pdev->dev);
dev_pm_syscore_device(&ch->tmu->pdev->dev, true);
return __sh_tmu_enable(ch);
@@ -187,9 +176,6 @@ static void __sh_tmu_disable(struct sh_tmu_channel *ch)
/* disable interrupts in TMU block */
sh_tmu_write(ch, TCR, TCR_TPSC_CLK4);
-
- /* stop clock */
- clk_disable(ch->tmu->clk);
}
static void sh_tmu_disable(struct sh_tmu_channel *ch)
@@ -203,7 +189,6 @@ static void sh_tmu_disable(struct sh_tmu_channel *ch)
__sh_tmu_disable(ch);
dev_pm_syscore_device(&ch->tmu->pdev->dev, false);
- pm_runtime_put(&ch->tmu->pdev->dev);
}
static void sh_tmu_set_next(struct sh_tmu_channel *ch, unsigned long delta,
@@ -552,7 +537,6 @@ static int sh_tmu_setup(struct sh_tmu_device *tmu, struct platform_device *pdev)
goto err_clk_unprepare;
tmu->rate = clk_get_rate(tmu->clk) / 4;
- clk_disable(tmu->clk);
/* Map the memory resource. */
ret = sh_tmu_map_memory(tmu);
@@ -562,8 +546,7 @@ static int sh_tmu_setup(struct sh_tmu_device *tmu, struct platform_device *pdev)
}
/* Allocate and setup the channels. */
- tmu->channels = kcalloc(tmu->num_channels, sizeof(*tmu->channels),
- GFP_KERNEL);
+ tmu->channels = kzalloc_objs(*tmu->channels, tmu->num_channels);
if (tmu->channels == NULL) {
ret = -ENOMEM;
goto err_unmap;
@@ -609,7 +592,7 @@ static int sh_tmu_probe(struct platform_device *pdev)
goto out;
}
- tmu = kzalloc(sizeof(*tmu), GFP_KERNEL);
+ tmu = kzalloc_obj(*tmu);
if (tmu == NULL)
return -ENOMEM;
@@ -626,8 +609,6 @@ static int sh_tmu_probe(struct platform_device *pdev)
out:
if (tmu->has_clockevent || tmu->has_clocksource)
pm_runtime_irq_safe(&pdev->dev);
- else
- pm_runtime_idle(&pdev->dev);
return 0;
}
diff --git a/drivers/clocksource/timer-armada-370-xp.c b/drivers/clocksource/timer-armada-370-xp.c
index f2b4cc40db93..a405a084cf72 100644
--- a/drivers/clocksource/timer-armada-370-xp.c
+++ b/drivers/clocksource/timer-armada-370-xp.c
@@ -22,7 +22,7 @@
* doing otherwise leads to using a clocksource whose frequency varies
* when doing cpufreq frequency changes.
*
- * See Documentation/devicetree/bindings/timer/marvell,armada-370-xp-timer.txt
+ * See Documentation/devicetree/bindings/timer/marvell,armada-370-timer.yaml
*/
#include <linux/init.h>
diff --git a/drivers/clocksource/timer-atmel-pit.c b/drivers/clocksource/timer-atmel-pit.c
index b4f264ed1937..888b06731e54 100644
--- a/drivers/clocksource/timer-atmel-pit.c
+++ b/drivers/clocksource/timer-atmel-pit.c
@@ -170,7 +170,7 @@ static int __init at91sam926x_pit_dt_init(struct device_node *node)
int ret;
struct pit_data *data;
- data = kzalloc(sizeof(*data), GFP_KERNEL);
+ data = kzalloc_obj(*data);
if (!data)
return -ENOMEM;
diff --git a/drivers/clocksource/timer-cadence-ttc.c b/drivers/clocksource/timer-cadence-ttc.c
index b8a1cf59b9d6..3c50d6892849 100644
--- a/drivers/clocksource/timer-cadence-ttc.c
+++ b/drivers/clocksource/timer-cadence-ttc.c
@@ -334,7 +334,7 @@ static int __init ttc_setup_clocksource(struct clk *clk, void __iomem *base,
struct ttc_timer_clocksource *ttccs;
int err;
- ttccs = kzalloc(sizeof(*ttccs), GFP_KERNEL);
+ ttccs = kzalloc_obj(*ttccs);
if (!ttccs)
return -ENOMEM;
@@ -417,7 +417,7 @@ static int __init ttc_setup_clockevent(struct clk *clk,
struct ttc_timer_clockevent *ttcce;
int err;
- ttcce = kzalloc(sizeof(*ttcce), GFP_KERNEL);
+ ttcce = kzalloc_obj(*ttcce);
if (!ttcce)
return -ENOMEM;
diff --git a/drivers/clocksource/timer-davinci.c b/drivers/clocksource/timer-davinci.c
index b1c248498be4..16ee0687ef31 100644
--- a/drivers/clocksource/timer-davinci.c
+++ b/drivers/clocksource/timer-davinci.c
@@ -271,7 +271,7 @@ int __init davinci_timer_register(struct clk *clk,
davinci_timer_init(base);
tick_rate = clk_get_rate(clk);
- clockevent = kzalloc(sizeof(*clockevent), GFP_KERNEL);
+ clockevent = kzalloc_obj(*clockevent);
if (!clockevent) {
rv = -ENOMEM;
goto exit_iounmap_base;
diff --git a/drivers/clocksource/timer-ep93xx.c b/drivers/clocksource/timer-ep93xx.c
index 6981ff3ac8a9..1b719282c07f 100644
--- a/drivers/clocksource/timer-ep93xx.c
+++ b/drivers/clocksource/timer-ep93xx.c
@@ -141,7 +141,7 @@ static int __init ep93xx_timer_of_init(struct device_node *np)
struct ep93xx_tcu *tcu;
int ret;
- tcu = kzalloc(sizeof(*tcu), GFP_KERNEL);
+ tcu = kzalloc_obj(*tcu);
if (!tcu)
return -ENOMEM;
diff --git a/drivers/clocksource/timer-fsl-ftm.c b/drivers/clocksource/timer-fsl-ftm.c
index 93f336ec875a..4eed6cb46132 100644
--- a/drivers/clocksource/timer-fsl-ftm.c
+++ b/drivers/clocksource/timer-fsl-ftm.c
@@ -300,7 +300,7 @@ static int __init ftm_timer_init(struct device_node *np)
unsigned long freq;
int ret, irq;
- priv = kzalloc(sizeof(*priv), GFP_KERNEL);
+ priv = kzalloc_obj(*priv);
if (!priv)
return -ENOMEM;
diff --git a/drivers/clocksource/timer-fttmr010.c b/drivers/clocksource/timer-fttmr010.c
index 126fb1f259b2..308f94bfbaed 100644
--- a/drivers/clocksource/timer-fttmr010.c
+++ b/drivers/clocksource/timer-fttmr010.c
@@ -295,7 +295,7 @@ static int __init fttmr010_common_init(struct device_node *np,
return ret;
}
- fttmr010 = kzalloc(sizeof(*fttmr010), GFP_KERNEL);
+ fttmr010 = kzalloc_obj(*fttmr010);
if (!fttmr010) {
ret = -ENOMEM;
goto out_disable_clock;
diff --git a/drivers/clocksource/timer-goldfish.c b/drivers/clocksource/timer-goldfish.c
index 0512d5eabc82..3fe12c7ee7b7 100644
--- a/drivers/clocksource/timer-goldfish.c
+++ b/drivers/clocksource/timer-goldfish.c
@@ -102,7 +102,7 @@ int __init goldfish_timer_init(int irq, void __iomem *base)
struct goldfish_timer *timerdrv;
int ret;
- timerdrv = kzalloc(sizeof(*timerdrv), GFP_KERNEL);
+ timerdrv = kzalloc_obj(*timerdrv);
if (!timerdrv)
return -ENOMEM;
diff --git a/drivers/clocksource/timer-gxp.c b/drivers/clocksource/timer-gxp.c
index 48a73c101eb8..1becc943339d 100644
--- a/drivers/clocksource/timer-gxp.c
+++ b/drivers/clocksource/timer-gxp.c
@@ -76,7 +76,7 @@ static int __init gxp_timer_init(struct device_node *node)
u32 freq;
int ret, irq;
- gxp_timer = kzalloc(sizeof(*gxp_timer), GFP_KERNEL);
+ gxp_timer = kzalloc_obj(*gxp_timer);
if (!gxp_timer) {
ret = -ENOMEM;
pr_err("Can't allocate gxp_timer");
diff --git a/drivers/clocksource/timer-imx-gpt.c b/drivers/clocksource/timer-imx-gpt.c
index 489e69169ed4..8335bd7f8c6c 100644
--- a/drivers/clocksource/timer-imx-gpt.c
+++ b/drivers/clocksource/timer-imx-gpt.c
@@ -428,7 +428,7 @@ static int __init mxc_timer_init_dt(struct device_node *np, enum imx_gpt_type t
if (initialized)
return 0;
- imxtm = kzalloc(sizeof(*imxtm), GFP_KERNEL);
+ imxtm = kzalloc_obj(*imxtm);
if (!imxtm)
return -ENOMEM;
diff --git a/drivers/clocksource/timer-imx-sysctr.c b/drivers/clocksource/timer-imx-sysctr.c
index 44525813be1e..dfbd77950e02 100644
--- a/drivers/clocksource/timer-imx-sysctr.c
+++ b/drivers/clocksource/timer-imx-sysctr.c
@@ -139,7 +139,7 @@ static int __init __sysctr_timer_init(struct device_node *np)
void __iomem *base;
int ret;
- priv = kzalloc(sizeof(struct sysctr_private), GFP_KERNEL);
+ priv = kzalloc_obj(struct sysctr_private);
if (!priv)
return -ENOMEM;
diff --git a/drivers/clocksource/timer-ixp4xx.c b/drivers/clocksource/timer-ixp4xx.c
index 720ed70a2964..4238a004fdef 100644
--- a/drivers/clocksource/timer-ixp4xx.c
+++ b/drivers/clocksource/timer-ixp4xx.c
@@ -166,7 +166,7 @@ static __init int ixp4xx_timer_register(void __iomem *base,
struct ixp4xx_timer *tmr;
int ret;
- tmr = kzalloc(sizeof(*tmr), GFP_KERNEL);
+ tmr = kzalloc_obj(*tmr);
if (!tmr)
return -ENOMEM;
tmr->base = base;
diff --git a/drivers/clocksource/timer-microchip-pit64b.c b/drivers/clocksource/timer-microchip-pit64b.c
index 57209bb38c70..7439bff42233 100644
--- a/drivers/clocksource/timer-microchip-pit64b.c
+++ b/drivers/clocksource/timer-microchip-pit64b.c
@@ -350,7 +350,7 @@ static int __init mchp_pit64b_init_clksrc(struct mchp_pit64b_timer *timer,
struct mchp_pit64b_clksrc *cs;
int ret;
- cs = kzalloc(sizeof(*cs), GFP_KERNEL);
+ cs = kzalloc_obj(*cs);
if (!cs)
return -ENOMEM;
@@ -397,7 +397,7 @@ static int __init mchp_pit64b_init_clkevt(struct mchp_pit64b_timer *timer,
struct mchp_pit64b_clkevt *ce;
int ret;
- ce = kzalloc(sizeof(*ce), GFP_KERNEL);
+ ce = kzalloc_obj(*ce);
if (!ce)
return -ENOMEM;
diff --git a/drivers/clocksource/timer-msc313e.c b/drivers/clocksource/timer-msc313e.c
index 54c54ca7c786..e4b9e3f161bb 100644
--- a/drivers/clocksource/timer-msc313e.c
+++ b/drivers/clocksource/timer-msc313e.c
@@ -171,7 +171,7 @@ static int __init msc313e_clkevt_init(struct device_node *np)
int ret;
struct timer_of *to;
- to = kzalloc(sizeof(*to), GFP_KERNEL);
+ to = kzalloc_obj(*to);
if (!to)
return -ENOMEM;
diff --git a/drivers/clocksource/timer-nxp-pit.c b/drivers/clocksource/timer-nxp-pit.c
index d1740f18f718..bc5157e2ba57 100644
--- a/drivers/clocksource/timer-nxp-pit.c
+++ b/drivers/clocksource/timer-nxp-pit.c
@@ -276,7 +276,7 @@ static int pit_timer_init(struct device_node *np)
unsigned long clk_rate;
int irq, ret;
- pit = kzalloc(sizeof(*pit), GFP_KERNEL);
+ pit = kzalloc_obj(*pit);
if (!pit)
return -ENOMEM;
diff --git a/drivers/clocksource/timer-riscv.c b/drivers/clocksource/timer-riscv.c
index 4d7cf338824a..cfc4d83c42c0 100644
--- a/drivers/clocksource/timer-riscv.c
+++ b/drivers/clocksource/timer-riscv.c
@@ -50,8 +50,9 @@ static int riscv_clock_next_event(unsigned long delta,
if (static_branch_likely(&riscv_sstc_available)) {
#if defined(CONFIG_32BIT)
- csr_write(CSR_STIMECMP, next_tval & 0xFFFFFFFF);
+ csr_write(CSR_STIMECMP, ULONG_MAX);
csr_write(CSR_STIMECMPH, next_tval >> 32);
+ csr_write(CSR_STIMECMP, next_tval & 0xFFFFFFFF);
#else
csr_write(CSR_STIMECMP, next_tval);
#endif
diff --git a/drivers/clocksource/timer-rockchip.c b/drivers/clocksource/timer-rockchip.c
index 1f95d0aca08f..540a16667145 100644
--- a/drivers/clocksource/timer-rockchip.c
+++ b/drivers/clocksource/timer-rockchip.c
@@ -207,7 +207,7 @@ static int __init rk_clkevt_init(struct device_node *np)
struct clock_event_device *ce;
int ret = -EINVAL;
- rk_clkevt = kzalloc(sizeof(struct rk_clkevt), GFP_KERNEL);
+ rk_clkevt = kzalloc_obj(struct rk_clkevt);
if (!rk_clkevt) {
ret = -ENOMEM;
goto out;
@@ -254,7 +254,7 @@ static int __init rk_clksrc_init(struct device_node *np)
{
int ret = -EINVAL;
- rk_clksrc = kzalloc(sizeof(struct rk_timer), GFP_KERNEL);
+ rk_clksrc = kzalloc_obj(struct rk_timer);
if (!rk_clksrc) {
ret = -ENOMEM;
goto out;
diff --git a/drivers/clocksource/timer-sp804.c b/drivers/clocksource/timer-sp804.c
index e82a95ea4724..d69858427359 100644
--- a/drivers/clocksource/timer-sp804.c
+++ b/drivers/clocksource/timer-sp804.c
@@ -106,21 +106,25 @@ static u64 notrace sp804_read(void)
return ~readl_relaxed(sched_clkevt->value);
}
+/* Register delay timer backed by the hardware counter */
#ifdef CONFIG_ARM
static struct delay_timer delay;
+static struct sp804_clkevt *delay_clkevt;
+
static unsigned long sp804_read_delay_timer_read(void)
{
- return sp804_read();
+ return ~readl_relaxed(delay_clkevt->value);
}
-static void sp804_register_delay_timer(int freq)
+static void sp804_register_delay_timer(struct sp804_clkevt *clk, int freq)
{
+ delay_clkevt = clk;
delay.freq = freq;
delay.read_current_timer = sp804_read_delay_timer_read;
register_current_timer_delay(&delay);
}
#else
-static inline void sp804_register_delay_timer(int freq) {}
+static inline void sp804_register_delay_timer(struct sp804_clkevt *clk, int freq) {}
#endif
static int __init sp804_clocksource_and_sched_clock_init(void __iomem *base,
@@ -135,8 +139,6 @@ static int __init sp804_clocksource_and_sched_clock_init(void __iomem *base,
if (rate < 0)
return -EINVAL;
- sp804_register_delay_timer(rate);
-
clkevt = sp804_clkevt_get(base);
writel(0, clkevt->ctrl);
@@ -152,6 +154,8 @@ static int __init sp804_clocksource_and_sched_clock_init(void __iomem *base,
clocksource_mmio_init(clkevt->value, name,
rate, 200, 32, clocksource_mmio_readl_down);
+ sp804_register_delay_timer(clkevt, rate);
+
if (use_sched_clock) {
sched_clkevt = clkevt;
sched_clock_register(sp804_read, 32, rate);
diff --git a/drivers/clocksource/timer-stm32.c b/drivers/clocksource/timer-stm32.c
index 0a4ea3288bfb..fee65914f99a 100644
--- a/drivers/clocksource/timer-stm32.c
+++ b/drivers/clocksource/timer-stm32.c
@@ -291,7 +291,7 @@ static int __init stm32_timer_init(struct device_node *node)
struct timer_of *to;
int ret;
- to = kzalloc(sizeof(*to), GFP_KERNEL);
+ to = kzalloc_obj(*to);
if (!to)
return -ENOMEM;
@@ -302,8 +302,7 @@ static int __init stm32_timer_init(struct device_node *node)
if (ret)
goto err;
- to->private_data = kzalloc(sizeof(struct stm32_timer_private),
- GFP_KERNEL);
+ to->private_data = kzalloc_obj(struct stm32_timer_private);
if (!to->private_data) {
ret = -ENOMEM;
goto deinit;
diff --git a/drivers/clocksource/timer-ti-dm-systimer.c b/drivers/clocksource/timer-ti-dm-systimer.c
index 985a6d08512b..eb0dfe4b9b7c 100644
--- a/drivers/clocksource/timer-ti-dm-systimer.c
+++ b/drivers/clocksource/timer-ti-dm-systimer.c
@@ -600,7 +600,7 @@ static int __init dmtimer_clockevent_