media: mt9p031: Extend match support for OF tables
authorBiju Das <biju.das.jz@bp.renesas.com>
Sun, 10 Sep 2023 16:01:25 +0000 (17:01 +0100)
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Sat, 24 Aug 2024 22:42:02 +0000 (01:42 +0300)
commitc551551b677f213ef12d7ba213483f17304790a6
tree5dffcf23fcca15e8d0a31a3ff62060d0b9112cbb
parentb5dec48c2b85e6150b50fa22b181e6396c769c76
media: mt9p031: Extend match support for OF tables

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 MEDIA_BUS_FMT as match data for both these
tables and replace the ID lookup table for the match data by
i2c_get_match_data() and simplifly probe() and mt9p031_init_state().

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>
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Link: https://lore.kernel.org/r/20230910160126.70122-2-biju.das.jz@bp.renesas.com
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
drivers/media/i2c/mt9p031.c