[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190518113643.53a42976@archlinux>
Date: Sat, 18 May 2019 11:36:43 +0100
From: Jonathan Cameron <jic23@...nel.org>
To: Chun-Hung Wu <chun-hung.wu@...iatek.com>
Cc: Hartmut Knaack <knaack.h@....de>,
Lars-Peter Clausen <lars@...afoo.de>,
Peter Meerwald-Stadler <pmeerw@...erw.net>,
Rob Herring <robh+dt@...nel.org>,
Mark Rutland <mark.rutland@....com>,
Matthias Brugger <matthias.bgg@...il.com>,
<linux-iio@...r.kernel.org>, <devicetree@...r.kernel.org>,
<linux-arm-kernel@...ts.infradead.org>,
<linux-mediatek@...ts.infradead.org>,
<linux-kernel@...r.kernel.org>, <wsd_upstream@...iatek.com>,
<peter.wang@...iatek.com>, <kuohong.wang@...iatek.com>,
<jg_poxu@...iatek.com>
Subject: Re: [PATCH 4/4] iio: auxadc: mediatek: change to subsys_initcall
On Thu, 16 May 2019 16:10:47 +0800
Chun-Hung Wu <chun-hung.wu@...iatek.com> wrote:
> Move auxadc platform_driver_register() from module_init
> to subsys_initcall because auxadc user drivers
> are all moudle drivers, need to gurantee
> auxadc driver ready before module_init.
>
Is it not possible to make them use deferred handling to come
back later if this isn't yet available?
subsys_initcall often ends up being a more fragile approach.
Thanks,
Jonathan
> Signed-off-by: Chun-Hung Wu <chun-hung.wu@...iatek.com>
> ---
> drivers/iio/adc/mt6577_auxadc.c | 14 +++++++++++++-
> 1 file changed, 13 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/iio/adc/mt6577_auxadc.c b/drivers/iio/adc/mt6577_auxadc.c
> index 58d7cb2..cb8e3dd 100644
> --- a/drivers/iio/adc/mt6577_auxadc.c
> +++ b/drivers/iio/adc/mt6577_auxadc.c
> @@ -350,7 +350,19 @@ static int mt6577_auxadc_remove(struct platform_device *pdev)
> .probe = mt6577_auxadc_probe,
> .remove = mt6577_auxadc_remove,
> };
> -module_platform_driver(mt6577_auxadc_driver);
> +
> +static int __init mt6577_auxadc_init(void)
> +{
> + return platform_driver_register(&mt6577_auxadc_driver);
> +}
> +
> +static void __exit mt6577_auxadc_exit(void)
> +{
> + platform_driver_unregister(&mt6577_auxadc_driver);
> +}
> +
> +subsys_initcall(mt6577_auxadc_init);
> +module_exit(mt6577_auxadc_exit);
>
> MODULE_AUTHOR("Zhiyong Tao <zhiyong.tao@...iatek.com>");
> MODULE_DESCRIPTION("MTK AUXADC Device Driver");
Powered by blists - more mailing lists