Skip to content

Commit 2b5b322

Browse files
committed
media: atomisp: split add from find subdev
There's only one place where a subdev can be added: when the sensor driver registers it. Trying to do it elsewhere will cause problems, as the detection code needs to access the I2C bus in order to probe some things. Tested-by: Andy Shevchenko <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
1 parent 1153cb4 commit 2b5b322

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,8 @@ int atomisp_register_i2c_module(struct v4l2_subdev *subdev,
202202
* gmin_subdev struct is already initialized for us.
203203
*/
204204
gs = find_gmin_subdev(subdev);
205+
if (!gs)
206+
return -ENODEV;
205207

206208
pdata.subdevs[i].type = type;
207209
pdata.subdevs[i].port = gs->csi_port;
@@ -713,7 +715,7 @@ static struct gmin_subdev *find_gmin_subdev(struct v4l2_subdev *subdev)
713715
for (i = 0; i < MAX_SUBDEVS; i++)
714716
if (gmin_subdevs[i].subdev == subdev)
715717
return &gmin_subdevs[i];
716-
return gmin_subdev_add(subdev);
718+
return NULL;
717719
}
718720

719721
static int axp_regulator_set(struct device *dev, struct gmin_subdev *gs,
@@ -1064,7 +1066,7 @@ struct camera_sensor_platform_data *gmin_camera_platform_data(
10641066
enum atomisp_input_format csi_format,
10651067
enum atomisp_bayer_order csi_bayer)
10661068
{
1067-
struct gmin_subdev *gs = find_gmin_subdev(subdev);
1069+
struct gmin_subdev *gs = gmin_subdev_add(subdev);
10681070

10691071
gs->csi_fmt = csi_format;
10701072
gs->csi_bayer = csi_bayer;

0 commit comments

Comments
 (0)