* checking status semantics with compatible functions
@ 2011-03-30 8:07 Kumar Gala
[not found] ` <9BC4C90E-090F-4961-A242-10D769C08738-XVmvHMARGAS8U2dJNN8I7kB+6BGkLq7r@public.gmane.org>
0 siblings, 1 reply; 4+ messages in thread
From: Kumar Gala @ 2011-03-30 8:07 UTC (permalink / raw)
To: Grant Likely
Cc: devicetree-discuss, linuxppc-dev-50dRxjG7WBCY5r8RbUyfqNHuzzzSOjJt,
Prabhakar Kushwaha
Grant,
We have a few helper functions like:
drivers/of/base.c:EXPORT_SYMBOL(of_device_is_compatible);
drivers/of/base.c:EXPORT_SYMBOL(of_find_compatible_node);
That we use in places like arch/powerpc/platform/85xx/mpc85xx_ds.c:
for_each_node_by_type(np, "pci") {
if (of_device_is_compatible(np, "fsl,mpc8540-pci") ||
of_device_is_compatible(np, "fsl,mpc8548-pcie") ||
of_device_is_compatible(np, "fsl,p2020-pcie")) {
It seems like we should check 'status' in these cases with 'of_device_is_available'. I'm thinking that we should have versions of the helpers that also do the 'of_device_is_available' checking. Or should we just change the helpers to call of_device_is_available?
- k
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: checking status semantics with compatible functions
[not found] ` <9BC4C90E-090F-4961-A242-10D769C08738-XVmvHMARGAS8U2dJNN8I7kB+6BGkLq7r@public.gmane.org>
@ 2011-03-30 8:26 ` Kumar Gala
2011-03-30 14:31 ` Grant Likely
0 siblings, 1 reply; 4+ messages in thread
From: Kumar Gala @ 2011-03-30 8:26 UTC (permalink / raw)
To: Kumar Gala; +Cc: Linuxppc-dev list, devicetree-discuss, Prabhakar Kushwaha
[Adding proper lists on CC]
- k
On Mar 30, 2011, at 3:07 AM, Kumar Gala wrote:
> Grant,
>
> We have a few helper functions like:
>
> drivers/of/base.c:EXPORT_SYMBOL(of_device_is_compatible);
> drivers/of/base.c:EXPORT_SYMBOL(of_find_compatible_node);
>
> That we use in places like arch/powerpc/platform/85xx/mpc85xx_ds.c:
>
> for_each_node_by_type(np, "pci") {
> if (of_device_is_compatible(np, "fsl,mpc8540-pci") ||
> of_device_is_compatible(np, "fsl,mpc8548-pcie") ||
> of_device_is_compatible(np, "fsl,p2020-pcie")) {
>
> It seems like we should check 'status' in these cases with 'of_device_is_available'. I'm thinking that we should have versions of the helpers that also do the 'of_device_is_available' checking. Or should we just change the helpers to call of_device_is_available?
>
> - k
> _______________________________________________
> devicetree-discuss mailing list
> devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org
> https://lists.ozlabs.org/listinfo/devicetree-discuss
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: checking status semantics with compatible functions
2011-03-30 8:26 ` Kumar Gala
@ 2011-03-30 14:31 ` Grant Likely
[not found] ` <20110330143113.GA13685-e0URQFbLeQY2iJbIjFUEsiwD8/FfD2ys@public.gmane.org>
0 siblings, 1 reply; 4+ messages in thread
From: Grant Likely @ 2011-03-30 14:31 UTC (permalink / raw)
To: Kumar Gala; +Cc: Linuxppc-dev list, devicetree-discuss, Prabhakar Kushwaha
On Wed, Mar 30, 2011 at 03:26:29AM -0500, Kumar Gala wrote:
> [Adding proper lists on CC]
>
> - k
>
> On Mar 30, 2011, at 3:07 AM, Kumar Gala wrote:
>
> > Grant,
> >
> > We have a few helper functions like:
> >
> > drivers/of/base.c:EXPORT_SYMBOL(of_device_is_compatible);
> > drivers/of/base.c:EXPORT_SYMBOL(of_find_compatible_node);
> >
> > That we use in places like arch/powerpc/platform/85xx/mpc85xx_ds.c:
> >
> > for_each_node_by_type(np, "pci") {
> > if (of_device_is_compatible(np, "fsl,mpc8540-pci") ||
> > of_device_is_compatible(np, "fsl,mpc8548-pcie") ||
> > of_device_is_compatible(np, "fsl,p2020-pcie")) {
> >
> > It seems like we should check 'status' in these cases with
> > 'of_device_is_available'. I'm thinking that we should have
> > versions of the helpers that also do the 'of_device_is_available'
> > checking. Or should we just change the helpers to call
> > of_device_is_available?
Yes, of_device_is_available() should be checked, but it should not be
added directly to of_device_is_compatible(). I'm okay with adding
a helper variant that does the of_device_is_compatible() check.
In that particular case, I'd also suggest using for_each_matching_node().
g.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: checking status semantics with compatible functions
[not found] ` <20110330143113.GA13685-e0URQFbLeQY2iJbIjFUEsiwD8/FfD2ys@public.gmane.org>
@ 2011-04-05 11:59 ` Benjamin Herrenschmidt
0 siblings, 0 replies; 4+ messages in thread
From: Benjamin Herrenschmidt @ 2011-04-05 11:59 UTC (permalink / raw)
To: Grant Likely; +Cc: Linuxppc-dev list, devicetree-discuss, Prabhakar Kushwaha
On Wed, 2011-03-30 at 08:31 -0600, Grant Likely wrote:
> Yes, of_device_is_available() should be checked, but it should not be
> added directly to of_device_is_compatible(). I'm okay with adding
> a helper variant that does the of_device_is_compatible() check.
>
> In that particular case, I'd also suggest using
> for_each_matching_node().
Agreed. A device might be unavailable due to how FW configured the
machine, but made later on available by the kernel, that shouldn't
impact the interface compatibility test.
Cheers,
Ben.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2011-04-05 11:59 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-30 8:07 checking status semantics with compatible functions Kumar Gala
[not found] ` <9BC4C90E-090F-4961-A242-10D769C08738-XVmvHMARGAS8U2dJNN8I7kB+6BGkLq7r@public.gmane.org>
2011-03-30 8:26 ` Kumar Gala
2011-03-30 14:31 ` Grant Likely
[not found] ` <20110330143113.GA13685-e0URQFbLeQY2iJbIjFUEsiwD8/FfD2ys@public.gmane.org>
2011-04-05 11:59 ` Benjamin Herrenschmidt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).