All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] of/irq: Export of_irq_count()
@ 2015-12-22 12:22 Mark Brown
       [not found] ` <1450786942-13292-1-git-send-email-broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
  0 siblings, 1 reply; 6+ messages in thread
From: Mark Brown @ 2015-12-22 12:22 UTC (permalink / raw)
  To: Rob Herring, Frank Rowand, Linus Walleij, Stephen Boyd
  Cc: devicetree-u79uwXL29TY76Z2rM5mHXA, 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 <broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
---
 drivers/of/irq.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/of/irq.c b/drivers/of/irq.c
index 4fa916dffc91..2cea06a0c751 100644
--- a/drivers/of/irq.c
+++ b/drivers/of/irq.c
@@ -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
-- 
2.6.2

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] of/irq: Export of_irq_count()
       [not found] ` <1450786942-13292-1-git-send-email-broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
@ 2015-12-22 12:56   ` Linus Walleij
  2015-12-22 17:12   ` Rob Herring
  1 sibling, 0 replies; 6+ messages in thread
From: Linus Walleij @ 2015-12-22 12:56 UTC (permalink / raw)
  To: Mark Brown
  Cc: Rob Herring, Frank Rowand, Stephen Boyd,
	devicetree-u79uwXL29TY76Z2rM5mHXA

On Tue, Dec 22, 2015 at 1:22 PM, Mark Brown <broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org> wrote:

> 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 <broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>

Thanks Mark.
Reviewed-by: Linus Walleij <linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] of/irq: Export of_irq_count()
       [not found] ` <1450786942-13292-1-git-send-email-broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
  2015-12-22 12:56   ` Linus Walleij
@ 2015-12-22 17:12   ` Rob Herring
       [not found]     ` <CAL_JsqJELQc316UkkpzLrbSsYMYh69uxX5Jw8p4TpWm6eqmfuA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  1 sibling, 1 reply; 6+ messages in thread
From: Rob Herring @ 2015-12-22 17:12 UTC (permalink / raw)
  To: Mark Brown
  Cc: Frank Rowand, Linus Walleij, Stephen Boyd,
	devicetree-u79uwXL29TY76Z2rM5mHXA

On Tue, Dec 22, 2015 at 6:22 AM, Mark Brown <broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org> wrote:
> 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 majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] of/irq: Export of_irq_count()
       [not found]     ` <CAL_JsqJELQc316UkkpzLrbSsYMYh69uxX5Jw8p4TpWm6eqmfuA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2015-12-22 23:55       ` Linus Walleij
  2016-01-05  0:04       ` Stephen Boyd
  1 sibling, 0 replies; 6+ messages in thread
From: Linus Walleij @ 2015-12-22 23:55 UTC (permalink / raw)
  To: Rob Herring
  Cc: Mark Brown, Frank Rowand, Stephen Boyd,
	devicetree-u79uwXL29TY76Z2rM5mHXA

On Tue, Dec 22, 2015 at 6:12 PM, Rob Herring <robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org> wrote:
> On Tue, Dec 22, 2015 at 6:22 AM, Mark Brown <broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org> wrote:
>> 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 majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] of/irq: Export of_irq_count()
       [not found]     ` <CAL_JsqJELQc316UkkpzLrbSsYMYh69uxX5Jw8p4TpWm6eqmfuA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  2015-12-22 23:55       ` Linus Walleij
@ 2016-01-05  0:04       ` Stephen Boyd
       [not found]         ` <20160105000454.GB22188-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
  1 sibling, 1 reply; 6+ messages in thread
From: Stephen Boyd @ 2016-01-05  0:04 UTC (permalink / raw)
  To: Rob Herring
  Cc: Mark Brown, Frank Rowand, Linus Walleij,
	devicetree-u79uwXL29TY76Z2rM5mHXA

On 12/22, Rob Herring wrote:
> On Tue, Dec 22, 2015 at 6:22 AM, Mark Brown <broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org> wrote:
> > 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?
> 

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<----
diff --git a/drivers/base/platform.c b/drivers/base/platform.c
index d77ed0c946dd..421c67f8fdef 100644
--- a/drivers/base/platform.c
+++ b/drivers/base/platform.c
@@ -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

-- 
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 majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] of/irq: Export of_irq_count()
       [not found]         ` <20160105000454.GB22188-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
@ 2016-01-05 14:26           ` Rob Herring
  0 siblings, 0 replies; 6+ messages in thread
From: Rob Herring @ 2016-01-05 14:26 UTC (permalink / raw)
  To: Stephen Boyd
  Cc: Mark Brown, Frank Rowand, Linus Walleij,
	devicetree-u79uwXL29TY76Z2rM5mHXA

On Mon, Jan 4, 2016 at 6:04 PM, Stephen Boyd <sboyd-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org> wrote:
> On 12/22, Rob Herring wrote:
>> On Tue, Dec 22, 2015 at 6:22 AM, Mark Brown <broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org> wrote:
>> > 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?
>>
>
> 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.

> ----8<----
> diff --git a/drivers/base/platform.c b/drivers/base/platform.c
> index d77ed0c946dd..421c67f8fdef 100644
> --- a/drivers/base/platform.c
> +++ b/drivers/base/platform.c
> @@ -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;
> +}

Don't forget the export here. :)

Rob
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-01-05 14:26 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-22 12:22 [PATCH] of/irq: Export of_irq_count() Mark Brown
     [not found] ` <1450786942-13292-1-git-send-email-broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2015-12-22 12:56   ` Linus Walleij
2015-12-22 17:12   ` Rob Herring
     [not found]     ` <CAL_JsqJELQc316UkkpzLrbSsYMYh69uxX5Jw8p4TpWm6eqmfuA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-12-22 23:55       ` Linus Walleij
2016-01-05  0:04       ` Stephen Boyd
     [not found]         ` <20160105000454.GB22188-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2016-01-05 14:26           ` Rob Herring

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.