of/irq: Export of_irq_count()
Subsystems (2)
PATCH 1/1 of/irq: Export of_irq_count()
Some of the Qualcomm pinctrl drivers have started trying to use of_irq_count() in modular code but this fails to build as the symbol is not exported. Since there doesn't seem to be any reason not to export the symbol make it available to modules.
--- drivers/of/irq.c | 1 + 1 file changed, 1 insertion(+)
drivers/of/irq.c +1 -0
@@ -449,6 +449,7 @@ int of_irq_count(struct device_node *dev)return nr; } +EXPORT_SYMBOL_GPL (of_irq_count);/** * of_irq_to_resource_table - Fill in resource table with node's IRQ info
Signature · 6 lines
2.6.2 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Linus Walleij
Reviewed-byQuoted 6 lines · Mark Brown
Some of the Qualcomm pinctrl drivers have started trying to use
of_irq_count()in modular code but this fails to build as the symbol is not exported. Since there doesn't seem to be any reason not to export the symbol make it available to modules.Signed-off-by Mark Brown <[email protected]>
Thanks Mark.
Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 4 lines · Mark Brown
Some of the Qualcomm pinctrl drivers have started trying to use
of_irq_count()in modular code but this fails to build as the symbol is not exported. Since there doesn't seem to be any reason not to export the symbol make it available to modules.
The reason it has not been exported is because we want to stick with the platform_* APIs for IRQs. There's not really an equivalent function though. Perhaps we should make one? Usually it is just used for allocating some driver data. If that is the case, is it really enough data to not just allocate the max?
Rob
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 11 lines · Rob Herring
Quoted 4 lines · Mark Brown
Some of the Qualcomm pinctrl drivers have started trying to use
of_irq_count()in modular code but this fails to build as the symbol is not exported. Since there doesn't seem to be any reason not to export the symbol make it available to modules.The reason it has not been exported is because we want to stick with the platform_* APIs for IRQs. There's not really an equivalent function though. Perhaps we should make one? Usually it is just used for allocating some driver data. If that is the case, is it really enough data to not just allocate the max?
Hm that seems like a bigger solution. Should we try to mitigate the issue by making the Qualcomm drivers builtin for the time being?
Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 6 lines · Rob Herring
Quoted 4 lines · Mark Brown
Some of the Qualcomm pinctrl drivers have started trying to use
of_irq_count()in modular code but this fails to build as the symbol is not exported. Since there doesn't seem to be any reason not to export the symbol make it available to modules.
Quoted 6 lines
The reason it has not been exported is because we want to stick with the platform_* APIs for IRQs. There's not really an equivalent function though. Perhaps we should make one? Usually it is just used for allocating some driver data. If that is the case, is it really enough data to not just allocate the max?
It's mostly used for allocation but we also do some pin type discovery by reading registers and that would fail if we went past the actual number of pins there are.
So how about implementing platform_irq_count()? I'd like to keep these drivers as tristate if possible.
----8<----
drivers/base/platform.c +19 -0
@@ -118,6 +118,25 @@ int platform_get_irq(struct platform_device *dev, unsigned int num)EXPORT_SYMBOL_GPL (platform_get_irq);/** +* platform_irq_count - Count the number of IRQs a platform device uses +* @dev: platform device +* +* Return: Number of IRQs a platform device uses or EPROBE_DEFER +*/ +int platform_irq_count (struct platform_device *dev) +{ +int ret, nr =0 ; + +while ((ret =platform_get_irq (dev, nr)) ==0 ) + nr++; + +if (ret == -EPROBE_DEFER ) +return ret; + +return nr; +} + +/** * platform_get_resource_byname - get a resource for a device by name * @dev: platform device * @type: resource type
Signature · 6 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 14 lines · Stephen Boyd
Quoted 6 lines · Rob Herring
Quoted 4 lines · Mark Brown
Some of the Qualcomm pinctrl drivers have started trying to use
of_irq_count()in modular code but this fails to build as the symbol is not exported. Since there doesn't seem to be any reason not to export the symbol make it available to modules.Quoted 6 lines
The reason it has not been exported is because we want to stick with the platform_* APIs for IRQs. There's not really an equivalent function though. Perhaps we should make one? Usually it is just used for allocating some driver data. If that is the case, is it really enough data to not just allocate the max?
Quoted 6 lines
It's mostly used for allocation but we also do some pin type discovery by reading registers and that would fail if we went past the actual number of pins there are.
So how about implementing
platform_irq_count()? I'd like to keep these drivers as tristate if possible.
Ack.
Quoted 16 lines
----8<----
drivers/base/platform.c +7
-0@@ -118,6 +118,25 @@ int platform_get_irq(struct platform_device *dev, unsigned int num)EXPORT_SYMBOL_GPL (platform_get_irq);/** +* platform_irq_count - Count the number of IRQs a platform device uses +* @dev: platform device +* +* Return: Number of IRQs a platform device uses or EPROBE_DEFER +*/ +int platform_irq_count (struct platform_device *dev) +{
drivers/base/platform.c int platform_get_irq(struct platform_device *dev, unsigned int num) · line 137
Quoted 10 lines
drivers/base/platform.c +10
-0+int ret, nr =0 ; + +while ((ret =platform_get_irq (dev, nr)) ==0 ) + nr++; + +if (ret == -EPROBE_DEFER ) +return ret; + +return nr; +}
Don't forget the export here. :)
Rob
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html