clk: clk-si544: Simplify probe() and is_valid_frequency()
authorBiju Das <biju.das.jz@bp.renesas.com>
Sat, 9 Sep 2023 15:54:18 +0000 (16:54 +0100)
committerStephen Boyd <sboyd@kernel.org>
Tue, 24 Oct 2023 02:35:12 +0000 (19:35 -0700)
commitb28f95c61965fd31ca15556e7ac65dfc84a15fad
treeb3011cb160c2298416e1d536631475bea4eb358a
parentebcae17f87b34f71e8e55512226c4da35a9e3233
clk: clk-si544: Simplify probe() and is_valid_frequency()

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.

Unify the OF/ID table by using max_freq as match data instead of
enum si544_speed_grade and replace the ID lookup table for
the match data by i2c_get_match_data(). This allows to simplify both
probe() and is_valid_frequency().

Drop enum si544_speed_grade as there is no user.

While at it, remove the trailing comma in the terminator entry for the OF
table making code robust against (theoretical) misrebases or other similar
things where the new entry goes _after_ the termination without the
compiler noticing.

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