Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

clk: si5351: Simplify probe

The driver has an OF match table, still, it uses an ID lookup table for
retrieving match data. Currently, the driver is working on the
assumption that an I2C device registered via OF will always match a
legacy I2C device ID. The correct approach is to have an OF device ID
table using i2c_get_match_data() if the devices are registered via OF/ID.

Simplify probe() by replacing ID lookup table for retrieving match data
with i2c_get_match_data().

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Link: https://lore.kernel.org/r/20230909162047.41845-1-biju.das.jz@bp.renesas.com
Signed-off-by: Stephen Boyd <sboyd@kernel.org>

authored by

Biju Das and committed by
Stephen Boyd
f234f028 38a929ab

+2 -2
+2 -2
drivers/clk/clk-si5351.c
··· 1385 1385 1386 1386 static int si5351_i2c_probe(struct i2c_client *client) 1387 1387 { 1388 - const struct i2c_device_id *id = i2c_match_id(si5351_i2c_ids, client); 1389 - enum si5351_variant variant = (enum si5351_variant)id->driver_data; 1388 + enum si5351_variant variant; 1390 1389 struct si5351_platform_data *pdata; 1391 1390 struct si5351_driver_data *drvdata; 1392 1391 struct clk_init_data init; ··· 1393 1394 u8 num_parents, num_clocks; 1394 1395 int ret, n; 1395 1396 1397 + variant = (enum si5351_variant)(uintptr_t)i2c_get_match_data(client); 1396 1398 ret = si5351_dt_parse(client, variant); 1397 1399 if (ret) 1398 1400 return ret;