To distinguish ov9281 & ov9282 the name has to be explicitly set. Provide a fixed string using platform data. Signed-off-by: Alexander Stein <alexander.stein@xxxxxxxxxxxxxxx> --- Changes in v4: * Replaced v4l2_i2c_subdev_set_name with device_get_match_data and added platform data containing the sensor name drivers/media/i2c/ov9282.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/media/i2c/ov9282.c b/drivers/media/i2c/ov9282.c index 352dbe21a902..f79bdfa821e8 100644 --- a/drivers/media/i2c/ov9282.c +++ b/drivers/media/i2c/ov9282.c @@ -1037,6 +1037,7 @@ static int ov9282_get_regulators(struct ov9282 *ov9282) static int ov9282_probe(struct i2c_client *client) { struct ov9282 *ov9282; + const char *sensor_name; int ret; ov9282 = devm_kzalloc(&client->dev, sizeof(*ov9282), GFP_KERNEL); @@ -1047,6 +1048,12 @@ static int ov9282_probe(struct i2c_client *client) /* Initialize subdev */ v4l2_i2c_subdev_init(&ov9282->sd, client, &ov9282_subdev_ops); + sensor_name = device_get_match_data(ov9282->dev); + if (!sensor_name) { + dev_err(ov9282->dev, "Sensor name is missing"); + return ret; + } + v4l2_i2c_subdev_set_name(&ov9282->sd, client, sensor_name, NULL); ret = ov9282_parse_hw_config(ov9282); if (ret) { @@ -1152,8 +1159,8 @@ static const struct dev_pm_ops ov9282_pm_ops = { }; static const struct of_device_id ov9282_of_match[] = { - { .compatible = "ovti,ov9281" }, - { .compatible = "ovti,ov9282" }, + { .compatible = "ovti,ov9281", .data = "ov9281" }, + { .compatible = "ovti,ov9282", .data = "ov9282" }, { } }; -- 2.25.1