[PATCH v1] clk: clk-lmk04832: Simplify device abstraction

From: Uwe Kleine-König (The Capable Hub)

Date: Thu Jun 18 2026 - 12:06:01 EST


The driver was introduced in 2021 and since then only supports a single
chip variant. Simplify the driver by hard-coding the device properties
instead of using the id_table's abstraction for a single chip type.

While touching the id table, use a single space in the table terminator
to match the most used style.

Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@xxxxxxxxxxxx>
---
Hello,

my motivation here is to get rid of the assignment to .driver_data using
a list initializer. I want to move .driver_data into an anonymous union
which requires the member to be initialized by name (or not being
assigned a value).

Best regards
Uwe

drivers/clk/clk-lmk04832.c | 27 ++++++++++-----------------
1 file changed, 10 insertions(+), 17 deletions(-)

diff --git a/drivers/clk/clk-lmk04832.c b/drivers/clk/clk-lmk04832.c
index 9bf86caad829..c644d31b223e 100644
--- a/drivers/clk/clk-lmk04832.c
+++ b/drivers/clk/clk-lmk04832.c
@@ -175,10 +175,6 @@
#define LMK04832_REG_RB_HOLDOVER 0x188
#define LMK04832_REG_SPI_LOCK 0x555

-enum lmk04832_device_types {
- LMK04832,
-};
-
/**
* struct lmk04832_device_info - Holds static device information that is
* specific to the chip revision
@@ -197,14 +193,12 @@ struct lmk04832_device_info {
unsigned int vco1_range[2];
};

-static const struct lmk04832_device_info lmk04832_device_info[] = {
- [LMK04832] = {
- .pid = 0x63d1, /* WARNING PROD_ID is inverted in the datasheet */
- .maskrev = 0x70,
- .num_channels = 14,
- .vco0_range = { 2440, 2580 },
- .vco1_range = { 2945, 3255 },
- },
+static const struct lmk04832_device_info lmk04832_device_info = {
+ .pid = 0x63d1, /* WARNING PROD_ID is inverted in the datasheet */
+ .maskrev = 0x70,
+ .num_channels = 14,
+ .vco0_range = { 2440, 2580 },
+ .vco1_range = { 2945, 3255 },
};

enum lmk04832_rdbk_type {
@@ -422,11 +416,10 @@ static unsigned long lmk04832_vco_recalc_rate(struct clk_hw *hw,
*/
static int lmk04832_check_vco_ranges(struct lmk04832 *lmk, unsigned long rate)
{
- struct spi_device *spi = to_spi_device(lmk->dev);
const struct lmk04832_device_info *info;
unsigned long mhz = rate / 1000000;

- info = &lmk04832_device_info[spi_get_device_id(spi)->driver_data];
+ info = &lmk04832_device_info;

if (mhz >= info->vco0_range[0] && mhz <= info->vco0_range[1])
return LMK04832_VAL_VCO_MUX_VCO0;
@@ -1405,7 +1398,7 @@ static int lmk04832_probe(struct spi_device *spi)
int ret;
int i;

- info = &lmk04832_device_info[spi_get_device_id(spi)->driver_data];
+ info = &lmk04832_device_info;

lmk = devm_kzalloc(&spi->dev, sizeof(struct lmk04832), GFP_KERNEL);
if (!lmk)
@@ -1553,8 +1546,8 @@ static int lmk04832_probe(struct spi_device *spi)
}

static const struct spi_device_id lmk04832_id[] = {
- { "lmk04832", LMK04832 },
- {}
+ { .name = "lmk04832" },
+ { }
};
MODULE_DEVICE_TABLE(spi, lmk04832_id);


base-commit: e2cae00c05d196491c318196792297f2dfbaa02c
--
2.47.3