linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* Re: checking status semantics with compatible functions
       [not found] <9BC4C90E-090F-4961-A242-10D769C08738@kernel.crashing.org>
@ 2011-03-30  8:26 ` Kumar Gala
  2011-03-30 14:31   ` Grant Likely
  0 siblings, 1 reply; 3+ 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,
>=20
> We have a few helper functions like:
>=20
> drivers/of/base.c:EXPORT_SYMBOL(of_device_is_compatible);
> drivers/of/base.c:EXPORT_SYMBOL(of_find_compatible_node);
>=20
> That we use in places like arch/powerpc/platform/85xx/mpc85xx_ds.c:
>=20
>        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")) {
>=20
> 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?
>=20
> - k
> _______________________________________________
> devicetree-discuss mailing list
> devicetree-discuss@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/devicetree-discuss

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

* Re: checking status semantics with compatible functions
  2011-03-30  8:26 ` checking status semantics with compatible functions Kumar Gala
@ 2011-03-30 14:31   ` Grant Likely
  2011-04-05 11:59     ` Benjamin Herrenschmidt
  0 siblings, 1 reply; 3+ 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] 3+ messages in thread

* Re: checking status semantics with compatible functions
  2011-03-30 14:31   ` Grant Likely
@ 2011-04-05 11:59     ` Benjamin Herrenschmidt
  0 siblings, 0 replies; 3+ 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] 3+ messages in thread

end of thread, other threads:[~2011-04-05 11:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <9BC4C90E-090F-4961-A242-10D769C08738@kernel.crashing.org>
2011-03-30  8:26 ` checking status semantics with compatible functions Kumar Gala
2011-03-30 14:31   ` Grant Likely
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).