Skip to content

Commit fbb5298

Browse files
lkundrakhverkuil
authored andcommitted
media: mmp: Bring back registration of the device
In commit 4af6514 ("media: marvell: cafe: Register V4L2 device earlier"), a call to v4l2_device_register() was moved away from mccic_register() into its caller, marvell/cafe's cafe_pci_probe(). This is not the only caller though -- there's also marvell/mmp. Add v4l2_device_register() into mmpcam_probe() to unbreak the MMP camera driver, in a fashion analogous to what's been done to the Cafe driver. Same for the teardown path. Fixes: 4af6514 ("media: marvell: cafe: Register V4L2 device earlier") Signed-off-by: Lubomir Rintel <[email protected]> Cc: [email protected] # v6.6+ Signed-off-by: Hans Verkuil <[email protected]>
1 parent d76bf52 commit fbb5298

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

drivers/media/platform/marvell/mmp-driver.c

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -231,13 +231,23 @@ static int mmpcam_probe(struct platform_device *pdev)
231231

232232
mcam_init_clk(mcam);
233233

234+
/*
235+
* Register with V4L.
236+
*/
237+
238+
ret = v4l2_device_register(mcam->dev, &mcam->v4l2_dev);
239+
if (ret)
240+
return ret;
241+
234242
/*
235243
* Create a match of the sensor against its OF node.
236244
*/
237245
ep = fwnode_graph_get_next_endpoint(of_fwnode_handle(pdev->dev.of_node),
238246
NULL);
239-
if (!ep)
240-
return -ENODEV;
247+
if (!ep) {
248+
ret = -ENODEV;
249+
goto out_v4l2_device_unregister;
250+
}
241251

242252
v4l2_async_nf_init(&mcam->notifier, &mcam->v4l2_dev);
243253

@@ -246,15 +256,15 @@ static int mmpcam_probe(struct platform_device *pdev)
246256
fwnode_handle_put(ep);
247257
if (IS_ERR(asd)) {
248258
ret = PTR_ERR(asd);
249-
goto out;
259+
goto out_v4l2_device_unregister;
250260
}
251261

252262
/*
253263
* Register the device with the core.
254264
*/
255265
ret = mccic_register(mcam);
256266
if (ret)
257-
goto out;
267+
goto out_v4l2_device_unregister;
258268

259269
/*
260270
* Add OF clock provider.
@@ -283,6 +293,8 @@ static int mmpcam_probe(struct platform_device *pdev)
283293
return 0;
284294
out:
285295
mccic_shutdown(mcam);
296+
out_v4l2_device_unregister:
297+
v4l2_device_unregister(&mcam->v4l2_dev);
286298

287299
return ret;
288300
}
@@ -293,6 +305,7 @@ static void mmpcam_remove(struct platform_device *pdev)
293305
struct mcam_camera *mcam = &cam->mcam;
294306

295307
mccic_shutdown(mcam);
308+
v4l2_device_unregister(&mcam->v4l2_dev);
296309
pm_runtime_force_suspend(mcam->dev);
297310
}
298311

0 commit comments

Comments
 (0)