Re: [PATCH 11/16] OMAP3: PM: Configurations for Smartreflex Class 2 and Smartreflex Class 3

Kevin Hilman
2010-03-05T19:20:28Z

"Gopinath, Thara" <thara@ti.com> writes:

[...]

>>>> /* PM Debug Fs enteries to enable disable smartreflex.*/
>>>> @@ -448,6 +551,7 @@ static int __devinit omap_smartreflex_probe(struct platform_device *pdev)
>>>> if (odev->hwmods[0]->mpu_irqs)
>>>> sr_info->irq = odev->hwmods[0]->mpu_irqs[0].irq;
>>>> sr_set_clk_length(sr_info);
>>>> + sr_set_regfields(sr_info);
>>>>
>>>> /* Create the debug fs enteries */
>>>> sprintf(name, "sr%d_autocomp", sr_info->srid);
>>>> @@ -456,8 +560,29 @@ static int __devinit omap_smartreflex_probe(struct platform_device *pdev)
>>>>
>>>> odev->hwmods[0]->dev_attr = sr_info;
>>>> list_add(&sr_info->node, &sr_list);
>>>> - pr_info("SmartReflex driver initialized\n");
>>>>
>>>> + /*
>>>> + * Register interrrupt handler if smartreflex class driver is already
>>>> + * registered and has requested for interrupts. This will be attempted
>>>> + * in the class driver register again if it does not happen here.
>>>> + */
>>>
>>>Why the duplicate attempts to request_irq()? Seems like it's only needed
>>>in the register_class hook above.
>
> Duplicate attempt is so that it does not matter whether the class driver gets registered before the smartreflex driver gets registered. So if smartreflex driver gets registered first the request_irq will happen only when class driver gets registered. On the other hand if class driver gets registered first then the request_irq will happen from here. The thing to notice is that there is only a duplicate attempt. Actual double registrations does not happen.

OK, thanks for the clarification.

Then, the two blocks of code that reqest_irq + init_enable should be
combined into a subroutine (with comment) called from both places.
This will help avoid the confusion I had and increase readability.

Kevin