diff mbox

[v2,2/2] PM / AVS: SmartReflex/class3: Fix order of initialization of SR class and SR driver

Message ID 1370339913-16135-3-git-send-email-andrii.tseglytskyi@ti.com (mailing list archive)
State New, archived
Headers show

Commit Message

Andrii Tseglytskyi June 4, 2013, 9:58 a.m. UTC
SmartReflex consists of three entities: SR device, SR class and
SR driver. SmartReflex driver depends on SmartReflex class, but
order of their initialization is not clear. They both use
late_initcall(), and order depends on Makefile calls.
Patch moves initialization of SR class to device_initcall(),
and removes redundant call of sr_late_init().

This provides predictable order of SmartReflex initcalls:
1. device_initcall() -> SmartReflex class init
2. late_initcall() -> SmartReflex driver init

Signed-off-by: Andrii Tseglytskyi <andrii.tseglytskyi@ti.com>
---
 arch/arm/mach-omap2/smartreflex-class3.c |    2 +-
 drivers/power/avs/smartreflex.c          |    9 ---------
 2 files changed, 1 insertion(+), 10 deletions(-)

Comments

Kevin Hilman June 10, 2013, 5:52 p.m. UTC | #1
Andrii Tseglytskyi <andrii.tseglytskyi@ti.com> writes:

> SmartReflex consists of three entities: SR device, SR class and
> SR driver. SmartReflex driver depends on SmartReflex class, but
> order of their initialization is not clear. They both use
> late_initcall(), and order depends on Makefile calls.
> Patch moves initialization of SR class to device_initcall(),
> and removes redundant call of sr_late_init().
>
> This provides predictable order of SmartReflex initcalls:
> 1. device_initcall() -> SmartReflex class init
> 2. late_initcall() -> SmartReflex driver init
>
> Signed-off-by: Andrii Tseglytskyi <andrii.tseglytskyi@ti.com>

Tony will have to decide on whether he's OK with the initcall changes.

I can queue this with the rest of the AVS changes with Tony's ack.

Kevin

> ---
>  arch/arm/mach-omap2/smartreflex-class3.c |    2 +-
>  drivers/power/avs/smartreflex.c          |    9 ---------
>  2 files changed, 1 insertion(+), 10 deletions(-)
>
> diff --git a/arch/arm/mach-omap2/smartreflex-class3.c b/arch/arm/mach-omap2/smartreflex-class3.c
> index aee3c89..50523b8 100644
> --- a/arch/arm/mach-omap2/smartreflex-class3.c
> +++ b/arch/arm/mach-omap2/smartreflex-class3.c
> @@ -59,4 +59,4 @@ static int __init sr_class3_init(void)
>  	pr_info("SmartReflex Class3 initialized\n");
>  	return sr_register_class(&class3_data);
>  }
> -omap_late_initcall(sr_class3_init);
> +omap_device_initcall(sr_class3_init);
> diff --git a/drivers/power/avs/smartreflex.c b/drivers/power/avs/smartreflex.c
> index fd71d5a..42eed34 100644
> --- a/drivers/power/avs/smartreflex.c
> +++ b/drivers/power/avs/smartreflex.c
> @@ -650,8 +650,6 @@ void sr_disable(struct voltagedomain *voltdm)
>   */
>  int sr_register_class(struct omap_sr_class_data *class_data)
>  {
> -	struct omap_sr *sr_info;
> -
>  	if (!class_data) {
>  		pr_warning("%s:, Smartreflex class data passed is NULL\n",
>  			__func__);
> @@ -666,13 +664,6 @@ int sr_register_class(struct omap_sr_class_data *class_data)
>  
>  	sr_class = class_data;
>  
> -	/*
> -	 * Call into late init to do intializations that require
> -	 * both sr driver and sr class driver to be initiallized.
> -	 */
> -	list_for_each_entry(sr_info, &sr_list, node)
> -		sr_late_init(sr_info);
> -
>  	return 0;
>  }
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Tony Lindgren June 12, 2013, 1:32 p.m. UTC | #2
* Kevin Hilman <khilman@linaro.org> [130610 10:58]:
> Andrii Tseglytskyi <andrii.tseglytskyi@ti.com> writes:
> 
> > SmartReflex consists of three entities: SR device, SR class and
> > SR driver. SmartReflex driver depends on SmartReflex class, but
> > order of their initialization is not clear. They both use
> > late_initcall(), and order depends on Makefile calls.
> > Patch moves initialization of SR class to device_initcall(),
> > and removes redundant call of sr_late_init().
> >
> > This provides predictable order of SmartReflex initcalls:
> > 1. device_initcall() -> SmartReflex class init
> > 2. late_initcall() -> SmartReflex driver init
> >
> > Signed-off-by: Andrii Tseglytskyi <andrii.tseglytskyi@ti.com>
> 
> Tony will have to decide on whether he's OK with the initcall changes.
> 
> I can queue this with the rest of the AVS changes with Tony's ack.

I'd rather not make anything earlier, relying on the Makefile is just
fine here. These pieces are always compiled in too. The reason why
we should only minimal things initialized earlier than module_init
is that this way we have a proper console initialized and see real
error messages without having to have DEBUG_LL + earlyprintk enabled.

If anything else is needed, you have have just one late_initcall
that checks the return values of the various SR related init functions
to make sure all the dependencies are met.

Regards,

Tony
 
> >  arch/arm/mach-omap2/smartreflex-class3.c |    2 +-
> >  drivers/power/avs/smartreflex.c          |    9 ---------
> >  2 files changed, 1 insertion(+), 10 deletions(-)
> >
> > diff --git a/arch/arm/mach-omap2/smartreflex-class3.c b/arch/arm/mach-omap2/smartreflex-class3.c
> > index aee3c89..50523b8 100644
> > --- a/arch/arm/mach-omap2/smartreflex-class3.c
> > +++ b/arch/arm/mach-omap2/smartreflex-class3.c
> > @@ -59,4 +59,4 @@ static int __init sr_class3_init(void)
> >  	pr_info("SmartReflex Class3 initialized\n");
> >  	return sr_register_class(&class3_data);
> >  }
> > -omap_late_initcall(sr_class3_init);
> > +omap_device_initcall(sr_class3_init);
> > diff --git a/drivers/power/avs/smartreflex.c b/drivers/power/avs/smartreflex.c
> > index fd71d5a..42eed34 100644
> > --- a/drivers/power/avs/smartreflex.c
> > +++ b/drivers/power/avs/smartreflex.c
> > @@ -650,8 +650,6 @@ void sr_disable(struct voltagedomain *voltdm)
> >   */
> >  int sr_register_class(struct omap_sr_class_data *class_data)
> >  {
> > -	struct omap_sr *sr_info;
> > -
> >  	if (!class_data) {
> >  		pr_warning("%s:, Smartreflex class data passed is NULL\n",
> >  			__func__);
> > @@ -666,13 +664,6 @@ int sr_register_class(struct omap_sr_class_data *class_data)
> >  
> >  	sr_class = class_data;
> >  
> > -	/*
> > -	 * Call into late init to do intializations that require
> > -	 * both sr driver and sr class driver to be initiallized.
> > -	 */
> > -	list_for_each_entry(sr_info, &sr_list, node)
> > -		sr_late_init(sr_info);
> > -
> >  	return 0;
> >  }
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Andrii Tseglytskyi June 12, 2013, 3:33 p.m. UTC | #3
On 06/12/2013 04:32 PM, Tony Lindgren wrote:
> * Kevin Hilman <khilman@linaro.org> [130610 10:58]:
>> Andrii Tseglytskyi <andrii.tseglytskyi@ti.com> writes:
>>
>>> SmartReflex consists of three entities: SR device, SR class and
>>> SR driver. SmartReflex driver depends on SmartReflex class, but
>>> order of their initialization is not clear. They both use
>>> late_initcall(), and order depends on Makefile calls.
>>> Patch moves initialization of SR class to device_initcall(),
>>> and removes redundant call of sr_late_init().
>>>
>>> This provides predictable order of SmartReflex initcalls:
>>> 1. device_initcall() -> SmartReflex class init
>>> 2. late_initcall() -> SmartReflex driver init
>>>
>>> Signed-off-by: Andrii Tseglytskyi <andrii.tseglytskyi@ti.com>
>> Tony will have to decide on whether he's OK with the initcall changes.
>>
>> I can queue this with the rest of the AVS changes with Tony's ack.
> I'd rather not make anything earlier, relying on the Makefile is just
> fine here. These pieces are always compiled in too. The reason why
> we should only minimal things initialized earlier than module_init
> is that this way we have a proper console initialized and see real
> error messages without having to have DEBUG_LL + earlyprintk enabled.
>
> If anything else is needed, you have have just one late_initcall
> that checks the return values of the various SR related init functions
> to make sure all the dependencies are met.
>
> Regards,
>
> Tony
>   
>
Hi Tony,

Thank you for your comment - it sounds reasonable.
Patch can be dropped from this patch series.

Regards,
Andrii


--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/arch/arm/mach-omap2/smartreflex-class3.c b/arch/arm/mach-omap2/smartreflex-class3.c
index aee3c89..50523b8 100644
--- a/arch/arm/mach-omap2/smartreflex-class3.c
+++ b/arch/arm/mach-omap2/smartreflex-class3.c
@@ -59,4 +59,4 @@  static int __init sr_class3_init(void)
 	pr_info("SmartReflex Class3 initialized\n");
 	return sr_register_class(&class3_data);
 }
-omap_late_initcall(sr_class3_init);
+omap_device_initcall(sr_class3_init);
diff --git a/drivers/power/avs/smartreflex.c b/drivers/power/avs/smartreflex.c
index fd71d5a..42eed34 100644
--- a/drivers/power/avs/smartreflex.c
+++ b/drivers/power/avs/smartreflex.c
@@ -650,8 +650,6 @@  void sr_disable(struct voltagedomain *voltdm)
  */
 int sr_register_class(struct omap_sr_class_data *class_data)
 {
-	struct omap_sr *sr_info;
-
 	if (!class_data) {
 		pr_warning("%s:, Smartreflex class data passed is NULL\n",
 			__func__);
@@ -666,13 +664,6 @@  int sr_register_class(struct omap_sr_class_data *class_data)
 
 	sr_class = class_data;
 
-	/*
-	 * Call into late init to do intializations that require
-	 * both sr driver and sr class driver to be initiallized.
-	 */
-	list_for_each_entry(sr_info, &sr_list, node)
-		sr_late_init(sr_info);
-
 	return 0;
 }