1
0
Fork 0

media: platform: mxc: capture: ov5640: Disable regulators in ov5640_remove()

The below commit introduced in v5.0 would warn us when putting
a regulator with non-zero enable_count.  So, we should disable
regulators in ov5640_remove() in cases where regulators are
still enabled when the module is removed.  This patch can suppress
the below warnings when the module is removed:

[  456.156524] WARNING: CPU: 3 PID: 11175 at drivers/regulator/core.c:2042 _regulator_put.part.4+0x1a4/0x1c8
[  456.166261] Modules linked in: mxc_v4l2_capture ipu_bg_overlay_sdc ipu_still ipu_prp_enc ipu_csi_enc ipu_fg_overlay_sdc ov5640_camera_mipi_v2 ov5640_camera_int(-) imx_vdoa ov5640_camera_mipi_int v4l2_int_device galcore(O) [last unloaded: ipu_bg_overlay_sdc]
[  456.189199] CPU: 3 PID: 11175 Comm: modprobe Tainted: G        W  O      5.4.0-rc3-5.3-warrior-next+gfb33033 #1
[  456.199312] Hardware name: Freescale i.MX6 Quad/DualLite (Device Tree)
[  456.205881] [<c0112e70>] (unwind_backtrace) from [<c010cd80>] (show_stack+0x10/0x14)
[  456.213654] [<c010cd80>] (show_stack) from [<c0c98ba0>] (dump_stack+0xd8/0x110)
[  456.220992] [<c0c98ba0>] (dump_stack) from [<c0136da0>] (__warn+0xc0/0x10c)
[  456.227978] [<c0136da0>] (__warn) from [<c0137168>] (warn_slowpath_fmt+0x58/0xb8)
[  456.235490] [<c0137168>] (warn_slowpath_fmt) from [<c05f143c>] (_regulator_put.part.4+0x1a4/0x1c8)
[  456.244477] [<c05f143c>] (_regulator_put.part.4) from [<c05f148c>] (regulator_put+0x2c/0x3c)
[  456.252942] [<c05f148c>] (regulator_put) from [<c0685f08>] (release_nodes+0x1ac/0x1f8)
[  456.260890] [<c0685f08>] (release_nodes) from [<c0682168>] (device_release_driver_internal+0xf8/0x1b8)
[  456.270222] [<c0682168>] (device_release_driver_internal) from [<c0682284>] (driver_detach+0x44/0x80)
[  456.279464] [<c0682284>] (driver_detach) from [<c0680e40>] (bus_remove_driver+0x4c/0xa4)
[  456.287584] [<c0680e40>] (bus_remove_driver) from [<c01e4c64>] (sys_delete_module+0x164/0x1d8)
[  456.296222] [<c01e4c64>] (sys_delete_module) from [<c0101000>] (ret_fast_syscall+0x0/0x28)
[  456.304505] Exception stack(0xe7657fa8 to 0xe7657ff0)
[  456.309577] 7fa0:                   01d284b8 01d284f4 01d284f4 00000800 00000070 00000000
[  456.317776] 7fc0: 01d284b8 01d284f4 00000000 00000081 00000001 01d27150 01d284b8 be935b40
[  456.325973] 7fe0: b6ef8340 be93479c 0001fd24 b6ef834c
[  456.331155] irq event stamp: 4303
[  456.334505] hardirqs last  enabled at (4311): [<c019d73c>] console_unlock+0x420/0x5dc
[  456.342449] hardirqs last disabled at (4328): [<c019d3c4>] console_unlock+0xa8/0x5dc
[  456.350328] softirqs last  enabled at (4344): [<c01024e4>] __do_softirq+0x2c4/0x518
[  456.358104] softirqs last disabled at (4355): [<c013e9d4>] irq_exit+0x100/0x18c
[  456.365516] ---[ end trace 67f399ebac279467 ]---

commit 5451781dad ("regulator: core: Only count load for enabled consumers")

Signed-off-by: Liu Ying <victor.liu@nxp.com>
5.4-rM2-2.2.x-imx-squashed
Liu Ying 2019-10-21 16:20:33 +08:00 committed by Dong Aisheng
parent 3b78d52323
commit 54f171f06f
1 changed files with 1 additions and 0 deletions

View File

@ -1951,6 +1951,7 @@ static int ov5640_probe(struct i2c_client *client,
static int ov5640_remove(struct i2c_client *client)
{
v4l2_int_device_unregister(&ov5640_int_device);
ov5640_regulator_disable();
return 0;
}