Commit f234f028 authored by Biju Das's avatar Biju Das Committed by Stephen Boyd

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: default avatarBiju Das <biju.das.jz@bp.renesas.com>
Link: https://lore.kernel.org/r/20230909162047.41845-1-biju.das.jz@bp.renesas.comSigned-off-by: default avatarStephen Boyd <sboyd@kernel.org>
parent 38a929ab
...@@ -1385,8 +1385,7 @@ MODULE_DEVICE_TABLE(i2c, si5351_i2c_ids); ...@@ -1385,8 +1385,7 @@ MODULE_DEVICE_TABLE(i2c, si5351_i2c_ids);
static int si5351_i2c_probe(struct i2c_client *client) static int si5351_i2c_probe(struct i2c_client *client)
{ {
const struct i2c_device_id *id = i2c_match_id(si5351_i2c_ids, client); enum si5351_variant variant;
enum si5351_variant variant = (enum si5351_variant)id->driver_data;
struct si5351_platform_data *pdata; struct si5351_platform_data *pdata;
struct si5351_driver_data *drvdata; struct si5351_driver_data *drvdata;
struct clk_init_data init; struct clk_init_data init;
...@@ -1394,6 +1393,7 @@ static int si5351_i2c_probe(struct i2c_client *client) ...@@ -1394,6 +1393,7 @@ static int si5351_i2c_probe(struct i2c_client *client)
u8 num_parents, num_clocks; u8 num_parents, num_clocks;
int ret, n; int ret, n;
variant = (enum si5351_variant)(uintptr_t)i2c_get_match_data(client);
ret = si5351_dt_parse(client, variant); ret = si5351_dt_parse(client, variant);
if (ret) if (ret)
return ret; return ret;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment