[PATCH v4 0/2] Fix clk_divider_bestdiv() to get max clk rate supported and add KUnit test suites

From: Prabhakar

Date: Mon Apr 27 2026 - 07:33:09 EST


From: Lad Prabhakar <prabhakar.mahadev-lad.rj@xxxxxxxxxxxxxx>

Hi all,

This patch series includes two patches. The first patch fixes the
clk_divider_bestdiv() function in clk-divider driver to return the
maximum clock rate supported by the divider when the requested rate
is larger than the parent clock rate. The second patch adds some
kunit test suites for clk-divider driver to verify the fix.

v3->v4:
- Dropped unregister_fixed_rate/unregister_divider/unregister_mux wrapper
- Added entry in .kunitconfig file
- Fixed reverse christmas tree order in
clk_divider_bestdiv_ulong_max_returns_max_rate
- Updated MODULE_DESCRIPTION() to be more specific

v2->v3:
- Added Rb tag
- Swapped the order of the patches
- Added the expected value in the fixup patch

v1->v2:
- Updated the patch#1 fixing review comments from Sashiko
- Added a new patch#2 to add some kunit test suites for clk-divider driver

Cheers,
Prabhakar

Lad Prabhakar (2):
clk: divider: Add KUnit tests for clk_divider_bestdiv() ULONG_MAX
handling
clk: divider: Fix clk_divider_bestdiv() returning min rate for large
rate requests

drivers/clk/.kunitconfig | 1 +
drivers/clk/Kconfig | 8 ++
drivers/clk/Makefile | 1 +
drivers/clk/clk-divider.c | 25 ++++--
drivers/clk/clk-divider_test.c | 152 +++++++++++++++++++++++++++++++++
5 files changed, 179 insertions(+), 8 deletions(-)
create mode 100644 drivers/clk/clk-divider_test.c

--
2.54.0