Skip to content

Commit 1e42bbc

Browse files
committed
drivers: i2c: andes: using subsys_initcall (torvalds#136) fix bug30592
Because the i2c bus driver needs to bring up other drivers, it should use subsys_initcall. The procedure declared as subsys_initcall is guaranteed to be executed before the procedure declared as module_init. http://e-andes.andestech.com/bugzilla5/show_bug.cgi?id=30592 Test on Bigorca with Ax27L2 bitmap Reviewed-on: https://gitea.andestech.com/RD-SW/linux/pulls/136 Reviewed-by: Tim Shih-Ting OuYang <[email protected]> Reviewed-by: CL Chin-Long Wang <[email protected]> Signed-off-by: Randolph <[email protected]>
1 parent b57a6d3 commit 1e42bbc

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

drivers/i2c/busses/i2c-atciic100.c

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -527,7 +527,19 @@ static struct platform_driver atciic_platform_driver = {
527527
.remove = atciic_remove,
528528
};
529529

530-
module_platform_driver(atciic_platform_driver);
530+
/* I2C may be needed to bring up other drivers */
531+
static int __init andes_i2c_init_driver(void)
532+
{
533+
return platform_driver_register(&atciic_platform_driver);
534+
}
535+
subsys_initcall(andes_i2c_init_driver);
536+
537+
static void __exit andes_i2c_exit_driver(void)
538+
{
539+
platform_driver_unregister(&atciic_platform_driver);
540+
}
541+
module_exit(andes_i2c_exit_driver);
542+
531543
MODULE_AUTHOR("Rick Chen");
532544
MODULE_AUTHOR("Dylan Jhong");
533545
MODULE_DESCRIPTION("I2C driver for Andes atciic100");

0 commit comments

Comments
 (0)