* [PATCH v1] clk: clk-lmk04832: Simplify device abstraction
@ 2026-06-18 16:04 Uwe Kleine-König (The Capable Hub)
2026-06-18 16:49 ` Brian Masney
0 siblings, 1 reply; 2+ messages in thread
From: Uwe Kleine-König (The Capable Hub) @ 2026-06-18 16:04 UTC (permalink / raw)
To: Michael Turquette, Stephen Boyd; +Cc: Brian Masney, linux-clk, linux-kernel
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@baylibre.com>
---
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v1] clk: clk-lmk04832: Simplify device abstraction
2026-06-18 16:04 [PATCH v1] clk: clk-lmk04832: Simplify device abstraction Uwe Kleine-König (The Capable Hub)
@ 2026-06-18 16:49 ` Brian Masney
0 siblings, 0 replies; 2+ messages in thread
From: Brian Masney @ 2026-06-18 16:49 UTC (permalink / raw)
To: Uwe Kleine-König (The Capable Hub)
Cc: Michael Turquette, Stephen Boyd, linux-clk, linux-kernel
On Thu, Jun 18, 2026 at 06:04:55PM +0200, Uwe Kleine-König (The Capable Hub) wrote:
> 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@baylibre.com>
Reviewed-by: Brian Masney <bmasney@redhat.com>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-06-18 16:49 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-18 16:04 [PATCH v1] clk: clk-lmk04832: Simplify device abstraction Uwe Kleine-König (The Capable Hub)
2026-06-18 16:49 ` Brian Masney
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.