Skip to content

Commit

Permalink
oplus: Fix duplicate registration of /proc/oplus_ke
Browse files Browse the repository at this point in the history
Multiple PMICs does exist on one device, which means qpnp-power-on may
get probed multiple times. It doesn't make sense to register the
directory each time when any of the PMICs get probed. Make it only run
once to fix the kernel warning.

[    0.347206] proc_dir_entry '/proc/oplus_ke' already registered
[    0.347232] WARNING: CPU: 6 PID: 1 at fs/proc/generic.c:360 proc_register+0x10c/0x180
[    0.347239] CPU: 6 PID: 1 Comm: swapper/0 Tainted: G S                4.19.157-Horizon-04171222 #6
[    0.347243] Hardware name: Qualcomm Technologies, Inc. kona MTP 19805 (DT)
[    0.347249] pstate: 60800005 (nZCv daif -PAN +UAO)
[    0.347255] pc : proc_register+0x10c/0x180
[    0.347261] lr : proc_register+0x104/0x180
[    0.347264] pc : ffffff968ed47da4
[    0.347268] lr : ffffff968ed47d9c
[    0.347272] sp : ffffff800805ba90
[    0.347275] x29: ffffff800805ba90 x28: ffffff96911ad465
[    0.347281] x27: ffffff96915a9263 x26: ffffff969142e6e0
[    0.347286] x25: 0000000000000000 x24: ffffffed7fe37010
[    0.347291] x23: 0000000000000000 x22: ffffffed7fcd9d50
[    0.347296] x21: ffffff9691a5cee0 x20: ffffff9691a5ce60
[    0.347300] x19: ffffffebfa1d9b40 x18: ffffff969265b000
[    0.347305] x17: 00000000007f5618 x16: 00000000000000c4
[    0.347310] x15: ffffff9690643c7c x14: 0000000000003036
[    0.347314] x13: 00000000000000ae x12: 0000000000000000
[    0.347319] x11: 0000000000000000 x10: ffffffffffffffff
[    0.347323] x9 : d0a22079345ec400 x8 : d0a22079345ec400
[    0.347328] x7 : 65726c612027656b x6 : ffffff969265d7fe
[    0.347332] x5 : 0000000000000000 x4 : 000000000000000c
[    0.347337] x3 : 0000000000000042 x2 : 0000000000000001
[    0.347341] x1 : 0000000000000000 x0 : ffffff9692682710
[    0.347347] Call trace:
[    0.347353] proc_register+0x10c/0x180
[    0.347359] proc_mkdir+0x70/0xa8
[    0.347367] pmicwd_init+0x40/0x254
[    0.347373] qpnp_pon_probe+0x9b8/0x9d8
[    0.347381] platform_drv_probe+0x7c/0xb4
[    0.347386] really_probe+0x270/0x2f4
[    0.347391] driver_probe_device+0x60/0xf8
[    0.347396] __driver_attach+0xe8/0x124
[    0.347401] bus_for_each_dev+0x78/0xc0
[    0.347406] driver_attach+0x20/0x28
[    0.347410] bus_add_driver+0x128/0x20c
[    0.347415] driver_register+0x74/0x108
[    0.347421] __platform_driver_register+0x40/0x48
[    0.347429] qpnp_pon_init+0x18/0x20
[    0.347434] do_one_initcall+0xd0/0x210
[    0.347439] do_initcall_level+0x13c/0x164
[    0.347443] do_basic_setup+0x48/0x94
[    0.347447] kernel_init_freeable+0xac/0x144
[    0.347455] kernel_init+0x14/0x2b0
[    0.347462] ret_from_fork+0x10/0x18

Signed-off-by: LibXZR <[email protected]>
  • Loading branch information
libxzr authored and HELLBOY017 committed Jan 28, 2024
1 parent 084fe89 commit fd5d708
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions oplus/kernel/system/qcom_pmicwd/qcom_pmicwd.c
Original file line number Diff line number Diff line change
Expand Up @@ -473,13 +473,6 @@ void pmicwd_init(struct platform_device *pdev, struct qpnp_pon *pon, bool sys_re
u32 pon_rt_sts = 0;
int rc;

oplus_ke_proc_dir = proc_mkdir("oplus_ke", NULL);
if (oplus_ke_proc_dir == NULL) {
pr_info("oplus_ke proc_mkdir failed\n");
}

OPLUS_KE_PROC_ENTRY(force_shutdown, force_shutdown, 0600);

if (!pon){
return;
}
Expand Down Expand Up @@ -651,4 +644,16 @@ const struct dev_pm_ops qpnp_pm_ops = {
};
EXPORT_SYMBOL(qpnp_pm_ops);

static __init int pmicwd_init_once(void)
{
oplus_ke_proc_dir = proc_mkdir("oplus_ke", NULL);
if (oplus_ke_proc_dir == NULL) {
pr_info("oplus_ke proc_mkdir failed\n");
}
OPLUS_KE_PROC_ENTRY(force_shutdown, force_shutdown, 0600);

return 0;
}

module_init(pmicwd_init_once);
MODULE_LICENSE("GPL v2");

0 comments on commit fd5d708

Please sign in to comment.