aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/drivers/clk/clk-si5351.c
diff options
context:
space:
mode:
authorBiju Das <biju.das.jz@bp.renesas.com>2023-09-09 17:20:47 +0100
committerStephen Boyd <sboyd@kernel.org>2023-10-23 19:36:53 -0700
commitf234f028727f8634973f8a9ef2ec933eb0eade5b (patch)
treebdd6f70eeb772262f72034c0bf0923706b079fd5 /drivers/clk/clk-si5351.c
parentclk: rs9: Use i2c_get_match_data() instead of device_get_match_data() (diff)
downloadwireguard-linux-f234f028727f8634973f8a9ef2ec933eb0eade5b.tar.xz
wireguard-linux-f234f028727f8634973f8a9ef2ec933eb0eade5b.zip
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>
Diffstat (limited to 'drivers/clk/clk-si5351.c')
-rw-r--r--drivers/clk/clk-si5351.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/clk/clk-si5351.c b/drivers/clk/clk-si5351.c
index 00fb9b09e030..afe12d1a9ddc 100644
--- a/drivers/clk/clk-si5351.c
+++ b/drivers/clk/clk-si5351.c
@@ -1385,8 +1385,7 @@ MODULE_DEVICE_TABLE(i2c, si5351_i2c_ids);
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)id->driver_data;
+ enum si5351_variant variant;
struct si5351_platform_data *pdata;
struct si5351_driver_data *drvdata;
struct clk_init_data init;
@@ -1394,6 +1393,7 @@ static int si5351_i2c_probe(struct i2c_client *client)
u8 num_parents, num_clocks;
int ret, n;
+ variant = (enum si5351_variant)(uintptr_t)i2c_get_match_data(client);
ret = si5351_dt_parse(client, variant);
if (ret)
return ret;