Re: [PATCH 2/5] clocksource/drivers/spacemit: Add K1 timer support

From: Iker Pedrosa

Date: Wed Nov 04 2026 - 13:48:45 EST


Hi Troy,

El mar, 3 nov 2026 a las 11:02, Troy Mitchell
(<troy.mitchell@xxxxxxxxxxxxxxxxxx>) escribió:
>
> +static int spacemit_timer_probe(struct platform_device *pdev)
> [...]
> + irq = platform_get_irq(pdev, 0);
> + if (irq < 0)
> + return irq;

Consider using dev_err_probe() here for consistency with the rest of
the function.

> [...]
> + rate = clk_get_rate(func);
> + if (rate < 32768 || rate > U32_MAX)
> + return dev_err_probe(dev, -EINVAL, "Invalid timer rate: %lu\n", rate);

32768 looks like a magic number. I'd recommend you to add a comment
above explaining the clock rate bounds.

> [...]
> + timer->sync_us = DIV_ROUND_UP(3 * USEC_PER_SEC, rate);

3 also looks line a magic number that could have an explanation. I'd
suggest you to add a macro with a proper name to have it properly
documented.

> +static const struct of_device_id spacemit_timer_match[] = {
> + { .compatible = "spacemit,k1-timer" },
> + { }
> +};

The device tree bindings support both spacemit,k1-timer and
spacemit,k3-timer, but the driver's of_match_table only lists K1. You
should add K3 to the list.