diff mbox series

mfd: sec: initialize driver via module_platform_driver

Message ID 20200921203421.19456-1-krzk@kernel.org (mailing list archive)
State Not Applicable
Headers show
Series mfd: sec: initialize driver via module_platform_driver | expand

Commit Message

Krzysztof Kozlowski Sept. 21, 2020, 8:34 p.m. UTC
The driver was using subsys_initcall() because in old times deferred
probe was not supported everywhere and specific ordering was needed.
Since probe deferral works fine and specific ordering is discouraged
(hides dependencies between drivers and couples their boot order), the
driver can be converted to regular module_platform_driver.

Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
---
 drivers/mfd/sec-core.c | 14 +-------------
 1 file changed, 1 insertion(+), 13 deletions(-)

Comments

Marek Szyprowski Sept. 22, 2020, 8:04 a.m. UTC | #1
Hi Krzysztof,

On 21.09.2020 22:34, Krzysztof Kozlowski wrote:
> The driver was using subsys_initcall() because in old times deferred
> probe was not supported everywhere and specific ordering was needed.
> Since probe deferral works fine and specific ordering is discouraged
> (hides dependencies between drivers and couples their boot order), the
> driver can be converted to regular module_platform_driver.
>
> Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>
> ---
>   drivers/mfd/sec-core.c | 14 +-------------
>   1 file changed, 1 insertion(+), 13 deletions(-)
>
> diff --git a/drivers/mfd/sec-core.c b/drivers/mfd/sec-core.c
> index 95473ff9bb4b..8d55992da19e 100644
> --- a/drivers/mfd/sec-core.c
> +++ b/drivers/mfd/sec-core.c
> @@ -549,19 +549,7 @@ static struct i2c_driver sec_pmic_driver = {
>   	.shutdown = sec_pmic_shutdown,
>   	.id_table = sec_pmic_id,
>   };
> -
> -static int __init sec_pmic_init(void)
> -{
> -	return i2c_add_driver(&sec_pmic_driver);
> -}
> -
> -subsys_initcall(sec_pmic_init);
> -
> -static void __exit sec_pmic_exit(void)
> -{
> -	i2c_del_driver(&sec_pmic_driver);
> -}
> -module_exit(sec_pmic_exit);
> +module_i2c_driver(sec_pmic_driver);
>   
>   MODULE_AUTHOR("Sangbeom Kim <sbkim73@samsung.com>");
>   MODULE_DESCRIPTION("Core support for the S5M MFD");

Best regards
diff mbox series

Patch

diff --git a/drivers/mfd/sec-core.c b/drivers/mfd/sec-core.c
index 95473ff9bb4b..8d55992da19e 100644
--- a/drivers/mfd/sec-core.c
+++ b/drivers/mfd/sec-core.c
@@ -549,19 +549,7 @@  static struct i2c_driver sec_pmic_driver = {
 	.shutdown = sec_pmic_shutdown,
 	.id_table = sec_pmic_id,
 };
-
-static int __init sec_pmic_init(void)
-{
-	return i2c_add_driver(&sec_pmic_driver);
-}
-
-subsys_initcall(sec_pmic_init);
-
-static void __exit sec_pmic_exit(void)
-{
-	i2c_del_driver(&sec_pmic_driver);
-}
-module_exit(sec_pmic_exit);
+module_i2c_driver(sec_pmic_driver);
 
 MODULE_AUTHOR("Sangbeom Kim <sbkim73@samsung.com>");
 MODULE_DESCRIPTION("Core support for the S5M MFD");