Skip to content

Commit

Permalink
oplus: Fix duplicate registration of /proc/ftm_tfa98xx
Browse files Browse the repository at this point in the history
Multiple tfa chips does exist on one device, we shouldn't create it
every time on drivers probe. Make it only run once to fix the kernel
warning.

[    1.457908] proc_dir_entry '/proc/ftm_tfa98xx' already registered
[    1.457933] WARNING: CPU: 1 PID: 1 at fs/proc/generic.c:360 proc_register+0x10c/0x180
[    1.457941] CPU: 1 PID: 1 Comm: swapper/0 Tainted: G S      W         4.19.157-Horizon-04171222 #6
[    1.457945] Hardware name: Qualcomm Technologies, Inc. kona MTP 19805 (DT)
[    1.457951] pstate: 60800005 (nZCv daif -PAN +UAO)
[    1.457956] pc : proc_register+0x10c/0x180
[    1.457961] lr : proc_register+0x104/0x180
[    1.457964] pc : ffffff968ed47da4
[    1.457968] lr : ffffff968ed47d9c
[    1.457972] sp : ffffff800805bae0
[    1.457975] x29: ffffff800805bae0 x28: 0000000000000000
[    1.457981] x27: 0000000000000000 x26: 0000000000000000
[    1.457986] x25: ffffff9692d53000 x24: ffffff9692d53000
[    1.457990] x23: 0000000000000000 x22: ffffffebf669ab18
[    1.457996] x21: ffffff9691a5cee0 x20: ffffff9691a5ce60
[    1.458001] x19: ffffffed58a84180 x18: ffffff969265b000
[    1.458005] x17: 00000000007d6990 x16: 00000000000000c4
[    1.458010] x15: ffffff9690643c7c x14: 6572657473696765
[    1.458015] x13: 0000000000000212 x12: 0000000000000000
[    1.458020] x11: 0000000000000000 x10: ffffffffffffffff
[    1.458025] x9 : d0a22079345ec400 x8 : d0a22079345ec400
[    1.458029] x7 : 393735342e312020 x6 : ffffffed599b3d50
[    1.458034] x5 : 0000000000000000 x4 : 0000000000000003
[    1.458039] x3 : 0000000000000045 x2 : 0000000000000001
[    1.458043] x1 : 0000000000000000 x0 : ffffff9692682710
[    1.458050] Call trace:
[    1.458055] proc_register+0x10c/0x180
[    1.458060] proc_create_data+0x88/0xc0
[    1.458067] tfa98xx_i2c_probe+0x6a8/0xa08
[    1.458075] i2c_device_probe+0x230/0x278
[    1.458081] really_probe+0x270/0x2f4
[    1.458085] driver_probe_device+0x60/0xf8
[    1.458090] __driver_attach+0xe8/0x124
[    1.458095] bus_for_each_dev+0x78/0xc0
[    1.458100] driver_attach+0x20/0x28
[    1.458104] bus_add_driver+0x128/0x20c
[    1.458108] driver_register+0x74/0x108
[    1.458114] i2c_register_driver+0x3c/0x9c
[    1.458120] tfa98xx_i2c_init+0x60/0x80
[    1.458125] do_one_initcall+0xd0/0x210
[    1.458130] do_initcall_level+0x13c/0x164
[    1.458134] do_basic_setup+0x48/0x94
[    1.458138] kernel_init_freeable+0xac/0x144
[    1.458147] kernel_init+0x14/0x2b0
[    1.458153] ret_from_fork+0x10/0x18

Signed-off-by: LibXZR <i@xzr.moe>
  • Loading branch information
libxzr authored and HELLBOY017 committed Jan 28, 2024
1 parent eb1f900 commit 77fcd0d
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions oplus/kernel_4.19/audio/codecs/tfa98xx-v6/tfa98xx_v6.c
Original file line number Diff line number Diff line change
Expand Up @@ -5260,19 +5260,6 @@ static int tfa98xx_i2c_probe(struct i2c_client *i2c,
if (no_start == 0)
tfa98xx_debug_init(tfa98xx, i2c);

#ifdef OPLUS_ARCH_EXTENDS
#ifdef CONFIG_DEBUG_FS
tfa98xx_debugfs = debugfs_create_file(TFA98XX_DEBUG_FS_NAME,
S_IFREG | S_IRUGO | S_IWUSR, NULL, (void *)TFA98XX_DEBUG_FS_NAME, &tfa98xx_debug_ops);
#else
proc_create_data(TFA98XX_DEBUG_FS_NAME,
S_IFREG | S_IRUGO | S_IWUSR, NULL, &tfa98xx_debug_ops, (void *)TFA98XX_DEBUG_FS_NAME);
#endif /*CONFIG_DEBUG_FS*/

tfa_ftm_mode = get_boot_mode();
pr_info("tfa_ftm_mode=%d\n", tfa_ftm_mode);
#endif /* OPLUS_ARCH_EXTENDS */

/* Register the sysfs files for climax backdoor access */
ret = device_create_bin_file(&i2c->dev, &dev_attr_rw);
if (ret)
Expand Down Expand Up @@ -5396,6 +5383,19 @@ static int __init tfa98xx_i2c_init(void)
ret = -ENOMEM;
}

#ifdef OPLUS_ARCH_EXTENDS
#ifdef CONFIG_DEBUG_FS
tfa98xx_debugfs = debugfs_create_file(TFA98XX_DEBUG_FS_NAME,
S_IFREG | S_IRUGO | S_IWUSR, NULL, (void *)TFA98XX_DEBUG_FS_NAME, &tfa98xx_debug_ops);
#else
proc_create_data(TFA98XX_DEBUG_FS_NAME,
S_IFREG | S_IRUGO | S_IWUSR, NULL, &tfa98xx_debug_ops, (void *)TFA98XX_DEBUG_FS_NAME);
#endif /*CONFIG_DEBUG_FS*/

tfa_ftm_mode = get_boot_mode();
pr_info("tfa_ftm_mode=%d\n", tfa_ftm_mode);
#endif /* OPLUS_ARCH_EXTENDS */

ret = i2c_add_driver(&tfa98xx_i2c_driver);

return ret;
Expand Down

0 comments on commit 77fcd0d

Please sign in to comment.